|  |  | Methods defined here: 
 __del__(self)# The destructor:
 __init__(self, *args, **kwargs)Initialize self.  See help(type(self)) for accurate signature.
 apply_color_filter_hsv(self)
 apply_color_filter_hsv_to_named_image_file(self, filename, show_intermediate_results=True)
 apply_color_filter_rgb(self)
 apply_otsu_threshold_to_hue(self, polarity=1, area_threshold=0, min_brightness_level=100)Applies the optimum Otsu threshold to hue in order to separate the image into foreground and background.  Regarding the argument 'polarity', if it is '-1', all pixels whose hue is below the
 optimum Otsu threshold are accepted.  On the other hand, if the polarity is '1', all pixels whole
 hue is higher than the calculated threshold are accepted.  The 'area_threshold' parameter is
 passed to the method "connected_components_for_binary_array()" for rejecting blobs that are
 smaller than the value supplied through 'area_threshold'.
 compute_LoG_image(self)This method computes the Laplacian-of-Gaussian (LoG) of an image. The LoG is calculated as the difference of two Gaussian-smoothed versions of the input
 image at two slightly difference scales.  The LoG itself is NOT used in
 watershed calculations.
 compute_Z_level_sets_for_gradient_image(self)For any value of n between 0 and 255, both ends inclusive, a pixel is in theset Z_n if the gradient value at that pixel is less than or equal to n.  Note
 that the gradient values are normalized to be between 0 and 255.
 compute_gradient_image(self)The Watershed algorithm is applied to the gradient of the input image.  Thismethod computes the gradient image.  The gradient calculation is carried out
 after the image is smoothed with a Gaussian kernel whose sigma is set in the
 constructor.
 compute_influence_zones_for_marks(self)Calculates the influence zones in a binary blob with respect to the marksplaced inside the blob.  The method also identifies the pixels at the
 geodesic skeleton formed by the influence zones.
 connected_components(self, data_or_marks)This method is the basic connected components algorithm in the Watershedmodule.  Just for programming convenience related to the I/O from this
 method, I have made a distinction between carrying out a connected-components
 labeling of a binary image and doing the same for a binary pattern that
 contains all of the marks made by the user.
 connected_components_of_filtered_output(self, argimage, min_brightness_level, min_area_threshold, max_area_threshold, expected_number_of_blobs, blob_shape, show_intermediate_results=True)
 dilate(self, structuring_element_rad, structuring_ele_shape)This is to just demonstrate the basic idea of dilation of a binary pattern bya disk structuring element whose radius is supplied as the first
 argument. The precise shape of the structuring element, which can be either
 "square" or "circular", is supplied through the second argument. This method
 itself is NOT used in the watershed calculations.  For large binary patterns,
 it would be more efficient to carry out the dilations only at the border
 pixels.
 dilate_mark_in_its_blob(self, mark_index)This method illustrates distance mapping of a blob in a binary image withrespect to a mark created by clicking at a point within the blob.
 displayImage(self, argimage, title='')Displays the argument image.  The display stays on for the number of secondsthat is the first argument in the call to tk.after() divided by 1000.
 displayImage2(self, argimage, title='')Displays the argument image.  The display stays on until the user closes thewindow.  If you want a display that automatically shuts off after a certain
 number of seconds, use the previous method displayImage().
 displayImage3(self, argimage, title='')Displays the argument image (which must be of type Image) in its actual size.  The display stays on until the user closes the window.  If you want a display that
 automatically shuts off after a certain number of seconds, use the method
 displayImage().
 displayImage4(self, argimage, title='')Displays the argument image (which must be of type Image) in its actual size without imposing the constraint that the larger dimension of the image be at most half the
 corresponding screen dimension.
 displayImage5(self, argimage, title='')This does the same thing as displayImage4() except that it also provides for"save" and "exit" buttons.  This method displays the argument image with more
 liberal sizing constraints than the previous methods.  This method is
 recommended for showing a composite of all the segmented objects, with each
 object displayed separately.  Note that 'argimage' must be of type Image.
 displayImage6(self, argimage, title='')This does the same thing as displayImage3() except that it also provides for"save" and "exit" buttons. Note that 'argimage' must be of type Image.
 display_all_segmented_blobs(self)
 display_data_image(self)This is just a convenience method for displaying the image that you want tosubject to watershed segmentation.
 display_watershed(self)Displays the watershed segmentation of the image in the grayscale mode.  Thatis, the image shown is what the computations are carried out on --- a
 grayscale version of the input image (assuming it was a color image).
 display_watershed_contours_in_color(self)Shows the watershed contours as extracted by the extract_watershed_contours()method.
 
 To write the result image as a jpeg file to the disk, click on the "save"
 and "exit" buttons at the bottom of the window --- as opposed to just closing
 the window.  You can subsequently display the image from the disk file by
 using, say, the 'display' function from the ImageMagick library.  You can
 create a hardcopy version of the result by sending the jpeg image to a
 printer.
 display_watershed_in_color(self)Displays the watershed segmentation on top of the original color image(assuming that the input image was a color image to begin with.)
 
 To write this result image as a jpeg file to the disk, click on the "save"
 and "exit" buttons at the bottom of the window --- as opposed to just closing
 the window.  You can subsequently display the image from the disk file by
 using, say, the 'display' function from the ImageMagick library.  You can
 create a hardcopy version of the result by sending the jpeg image to a
 printer.
 erode(self, argimage, structuring_element_rad, structuring_ele_shape)This is to just demonstrate the basic idea of erosion of a binary pattern bya disk structuring element whose radius is supplied as the first argument.
 The precise shape of the structuring element, which can be either "square" or
 "circular", is supplied through the second argument. This method itself is
 NOT used in the watershed calculations.
 extract_data_pixels(self)Gets the binary, grayscale, and color images ready for watershed processing.If the images are too large, they are reduced to the size set by the
 constructor.  Color images are converted into grayscale images.
 extract_image_region_interactively_by_dragging_mouse(self)This is one method you can use to apply watershed segmentation to just a portion of your image.This method extract the portion you want.  You click at the upper left corner of the rectangular
 portion of the image you are interested in and you then drag the mouse pointer to the lower
 right corner.  Make sure that you click on "save" and "exit" after you have delineated the area.
 extract_image_region_interactively_through_mouse_clicks(self)This method allows a user to use a sequence of mouse clicks in order to specify a region of the input image that should be subject to watershed segmentation.  The mouse clicks taken together
 define a polygon. The method encloses the polygonal region by a minimum bounding rectangle,
 which then becomes the new input image for the rest of processing.
 extract_rectangular_masked_segment_of_image(self, horiz_start, horiz_end, vert_start, vert_end)Keep in mind the following convention used in the PIL's Image class: the firstcoordinate in the args supplied to the getpixel() and putpixel() methods is for
 the horizontal axis (the x-axis, if you will) and the second coordinate for the
 vertical axis (the y-axis).  On the other hand, in the args supplied to the
 array and matrix processing functions, the first coordinate is for the row
 index (meaning the vertical) and the second coordinate for the column index
 (meaning the horizontal).  In what follows, I use the index 'i' with its
 positive direction going down for the vertical coordinate and the index 'j'
 with its positive direction going to the right as the horizontal coordinate.
 The origin is at the upper left corner of the image.
 extract_segmented_blobs_using_contours(self, min_contour_length=50)This method uses the inside/outside logic at a point (based on the number of times aline through the point intersects the contour) in order to decide whether the point is
 inside a closed contour or outside it.
 extract_segmented_blobs_using_region_growing(self, num_of_segments, min_area=50)This method uses region growing to extract segmented blobs.  We start at a pixeland grow from there by incorporating other neighboring pixels recursive until we
 hit a watershed ridge.
 extract_watershed_contours_separated(self)This method uses the border following algorithm to extract the watershedcontours from the final propagation of influences by the propagate_influences
 method.
 extract_watershed_contours_with_random_sampling(self, num_of_contours, min_length=20)This method uses the border following algorithm to extract the watershedcontours from the final propagation of influences by the propagate_influences
 method.
 histogram_equalize(self)Carries out contrast enhancement in an image.  If an image is generally too dark or generally toobright, you may wish to histogram equalize it before subjecting it to watershed segmentation.
 is_blob_circular(self, list_of_pixel_coords)Tests the circularity predicate by taking the ratio of the area of the blob, as measured bythe number of pixels in the blob, to \pi*r^2 where r is its average radius.  This is
 obviously much too simple a predicate at this time.  However, you can add to its power
 by incorporating additional logic here.
 mark_blobs(self, purpose)For demonstrations of distance mapping of a binary blob with respect to amarker blob, this method allows a user to both select one or more blobs in a
 binary image for the purpose of distance mapping and to also place marks on
 the blobs.
 mark_blobs_no_image_scale_change(self)For demonstrations of distance mapping of a binary blob with respect to amarker blob, this method allows a user to both select one or more blobs in a
 binary image for the purpose of distance mapping and to also place marks on
 the blobs.
 mark_image_regions_for_gradient_mods(self)For watershed segmentation that incorporates user-supplied modifications tothe image gradients, this method allows a user to demarcate through mouse
 clicks polygonal regions where the gradient can be explicitly set to 0.  For
 each region thus demarcated, the mouse clicks must be supplied in a clockwise
 fashion.
 modify_gradients_with_marker_minima(self)After a user has demarcated the regions in which the image gradients can bemodified, this method carries out the gradient modifications.
 propagate_influence_zones_from_bottom_to_top_of_Z_levels(self)Basic to watershed computation is the calculation of influence zones of theconnected components for one Z level in the connected components in the next
 Z level.  Note that we stop at one level below the max level at which Z sets
 are known.  That is because the last IZ calculation consists of finding the
 influence zones of the Z sets at the 'self.max_grad_level-1' level in the Z
 sets at the 'self.max_grad_level' level.
 Static methods defined here:
 
 gendata(feature, imagesize, position, orientation_or_radius, output_image_name)This method is useful for generating simple binary patterns for checking thevalidity of the logic used for dilation, erosion, IZ calculation, geodesic
 skeleton calculation, etc.  Note that the permissible values for the
 'feature' parameter are: 'line', 'triangle', 'rectangle', 'broken_rectangle',
 'disk' and 'twin_rect'.  The parameter 'imagesize' is supposed to be a tuple
 (m,n) for the size of the output image desired.  The parameter 'position' is
 supposed to be a tuple (x,y) of pixel coordinates for specifying the position
 of the binary pattern in your image.  The parameter 'orientation_or_radius' is an
 integer value specifying the number of degrees of rotation that should be
 applied to the pattern for a given 'feature' for the case of 'line', 'triangle',
 'rectangle' and 'broken_rectangle'.  The same parameter for the case of 'circle'
 means the radius of the disk.  Note that the x coordinate is along the horizontal
 direction pointing  to the right and the y coordinate is along vertical direction
 pointing downwards.  The origin is at the upper left corner.
 make_binary_pic_art_nouveau(under_what_name)Can be used to make "fun" binary images for demonstrating distance mapping ofbinary blobs, calculation of influence zones, etc.  This method is taken from
 Chapter 13 of my book "Scripting with Objects".
 Data descriptors defined here:
 
 __dict__dictionary for instance variables (if defined)
 __weakref__list of weak references to the object (if defined)
 Data and other attributes defined here:
 
 canvas = None
 drawEnable = 0
 region_mark_coords = {}
 startX = 0
 startY = 0
 |