:class:`~.ImageUtils` ============================================================================================================================================= .. py:class:: astropathdb.shared.utils.image.ImageUtils :single-line-parameter-list: basic image utilities class. :class:`~.astropathdb.shared.utils.image.ImageUtils` *Methods* --------------------------------------------------------------------------------------------------------------------------------------------- .. autoapisummary:: :signatures: none astropathdb.shared.utils.image.ImageUtils.imsize_filter astropathdb.shared.utils.image.ImageUtils.structuring_element astropathdb.shared.utils.image.ImageUtils.get_ellipse_kernel astropathdb.shared.utils.image.ImageUtils.imdilate astropathdb.shared.utils.image.ImageUtils.imerode astropathdb.shared.utils.image.ImageUtils.imopen astropathdb.shared.utils.image.ImageUtils.imclose astropathdb.shared.utils.image.ImageUtils.im_grouped_noise_reduction astropathdb.shared.utils.image.ImageUtils.imthreshold_max astropathdb.shared.utils.image.ImageUtils.imthreshold_median astropathdb.shared.utils.image.ImageUtils.imthreshold_image astropathdb.shared.utils.image.ImageUtils.immask astropathdb.shared.utils.image.ImageUtils.threshold_mask :class:`~.astropathdb.shared.utils.image.ImageUtils` *References* --------------------------------------------------------------------------------------------------------------------------------------------- .. py:currentmodule:: astropathdb.shared.utils.image.ImageUtils *Method Reference* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. py:method:: imsize_filter(im, size = 500) :single-line-parameter-list: :staticmethod: Perform a size filter on an image. https://www.geeksforgeeks.org/python-opencv-connected-component-labeling-and-analysis/. :param im: the image :param size: the minimum size of objects allowed .. py:method:: structuring_element(element_size_1 = 9, element_size_2 = None) :single-line-parameter-list: :staticmethod: Get a cv structuring ellipse element. :param element_size_1: the first dimension for the kernel :param element_size_2: the second dimension for the kernel .. py:method:: get_ellipse_kernel(kernel = None, element_size_1 = None, element_size_2 = None) :single-line-parameter-list: Get an ellipse kernel, useful for optionally providing a kernel to other functions. :param kernel: if provided returns the kernel :param element_size_1: the first dimension for the kernel :param element_size_2: the second dimension for the kernel .. py:method:: imdilate(image, kernel = None, element_size_1 = None, element_size_2 = None) :single-line-parameter-list: Performs a dilate operation on an image. :param image: the image to dilate :param kernel: if provided dilates using the kernel :param element_size_1: the first dimension for the kernel :param element_size_2: the second dimension for the kernel .. py:method:: imerode(image, kernel = None, element_size_1 = None, element_size_2 = None) :single-line-parameter-list: Performs an erode operation on an image. :param image: the image to erode :param kernel: if provided dilates using the kernel :param element_size_1: the first dimension for the kernel :param element_size_2: the second dimension for the kernel .. py:method:: imopen(image, kernel = None, element_size_1 = None, element_size_2 = None) :single-line-parameter-list: Performs an open operation on an image, an erosion followed by a dilation. :param image: the image to open :param kernel: if provided dilates using the kernel :param element_size_1: the first dimension for the kernel :param element_size_2: the second dimension for the kernel .. py:method:: imclose(image, kernel = None, element_size_1 = None, element_size_2 = None) :single-line-parameter-list: Performs a close operation on an image, a dilation followed by an erosion. :param image: the image to open :param kernel: if provided dilates using the kernel :param element_size_1: the first dimension for the kernel :param element_size_2: the second dimension for the kernel .. py:method:: im_grouped_noise_reduction(mask, params = ImageOperationParams, **_) :single-line-parameter-list: Performing some basic image noise reduction techniques. Use a value of None to skip an operation, the operation order is dilate (9), erode (9), open (None), close (None) -- defaults in parens. :param mask: an image mask to turn into an annotation :param params: an ImageOperationParams set .. py:method:: imthreshold_max(image, threshold) :single-line-parameter-list: :staticmethod: Return an image thresholded by a value of 0 to 1 relative to the max. :param image: the image :param threshold: the threshold to use of 0 to 1 (relative to the max) .. py:method:: imthreshold_median(image, threshold) :single-line-parameter-list: :staticmethod: Return an image thresholded by a value relative to the median. :param image: the image :param threshold: the threshold to use .. py:method:: imthreshold_image(image, threshold) :single-line-parameter-list: :staticmethod: Return an image thresholded by a value relative to the image itself. :param image: the image :param threshold: the threshold to use .. py:method:: immask(image) :single-line-parameter-list: :staticmethod: Convert an image to a mask, where image is > 0. :param image: the image .. py:method:: threshold_mask(image, threshold = 0.2, threshold_method = 'max', **_) :single-line-parameter-list: Build a threholded mask from an image. :param image: the image to threshold :param threshold: the threshold to use :param threshold_method: should the threshold be relative to the 'max', 'median', or the 'image'