vnt

Class FindEdges_Segment

Implemented Interfaces:
PlugInFilter

public class FindEdges_Segment
extends VascularNetworkToolkit
implements PlugInFilter

Plug-in for ImageJ that attempts to automatically perform specific segmentation designed for vascular cells grown on a Matrigel assay by Dr. Robert Baer.

The plugin operates based off the following series of ImageJ steps:

  1. Find Edges
  2. Variance... (about 2-4 pixels)
  3. Median... (2-4 pixels)
  4. Subtract...(approximately the standard deviation)
  5. Multiply by 255 (white out any non-black, max the contrast)
Version:
1.0
Author:
Michael Miller - Truman State University
Since:
1.0

Field Summary

private int
meshWasNotEnclosed
A variable that specifies whether a 4-connected area touched the boundary of the image.

Method Summary

private boolean
fillGrayMeshWithColor(ImageProcessor bp, int startX, int startY, int theColor)
Fills a 4-connected GRAY mesh starting at the given coordinates with the given color.
boolean
fillSegmentedSmallHoles(ImageProcessor bp)
Takes a segmented image and fills any 'small' holes: 1) All holes are filled with gray.
ImageProcessor
generateSegmented(ImageProcessor bp)
Segments the image via the following process: 1) Find Edges - a standard call is performed This creates a lot of noise in the background and within the vasculature.
private int
getEnclosedMeshArea(ImageProcessor bp, int startX, int startY)
Calculates the area of a 4-connected enclosed mesh.
void
run(ImageProcessor bp)
Performs specific segmentation designed for vascular cells grown on a Matrigel assay.
int
setup(String arg, ImagePlus ip)
Specifies the preconditions for the plug-in.

Field Details

meshWasNotEnclosed

private int meshWasNotEnclosed
A variable that specifies whether a 4-connected area touched the boundary of the image. If it touched the boundary, it was not enclosed and this value is returned for the area instead of the actual area.

Method Details

fillGrayMeshWithColor

private boolean fillGrayMeshWithColor(ImageProcessor bp,
                                      int startX,
                                      int startY,
                                      int theColor)
Fills a 4-connected GRAY mesh starting at the given coordinates with the given color. Reads and modifies the pixel[] memory.

Pre: The image must have been loaded, preferably using the VascularNetworkToolkit.LoadImage() method.
Post: On success, the pixel[] array data has been modified. The memory which represented the gray mesh should be painted the desired color.

Parameters:
startX - The starting x-coordinate.
startY - The starting y-coordinate.
theColor - The 8-bit color with which to replace the 4-connected GRAY mesh.
Returns:
Returns true on success.

fillSegmentedSmallHoles

public boolean fillSegmentedSmallHoles(ImageProcessor bp)
Takes a segmented image and fills any 'small' holes: 1) All holes are filled with gray. Their areas are calculated. 2) Any areas that are below the minimum allowed are painted black, and all other holes are returned to white. Note: This algorithm has the added benefit of computing meshes.

Pre: The image must have been converted to binary.
Post: On success, a new image with the "filled" segmented information is created and displayed. On failure (if a given ImageProcessor is null), no changes are made, and false is returned.

Returns:
Returns true on success, false otherwise.

generateSegmented

public ImageProcessor generateSegmented(ImageProcessor bp)
Segments the image via the following process: 1) Find Edges - a standard call is performed This creates a lot of noise in the background and within the vasculature. 2) Variance... (about 2-4 pixels) This eliminates the majority of the background noise created by Find Edges. Noise remains from within the vasculature. 3) Median... (2-4 pixels) This eliminates some of the noise within the vasculature. I'm having trouble with this step as I want to "close" off solid vessels but it's difficult without destroying image information. 4) Subtract...(approximately the standard deviation) Remove whatever artifact remain of the background. The majority of the vasculature is 255 or very close. I'd like to use a max filter but it widens too much (very similar to a blur, only far worse in my oppinion, a tremendous information loss). 5) Multiply by 255 (white out) Since the previous step bottomed out all the noise (at least hopefully), multiplying by 255 thresholds the image into pure black (0) and pure white (255).

Pre: The image must have been grayscaled.
Post: On success, a new image with the segmented information is created and displayed. Also, the local member pixel is filled with non-BLACK values. On failure (if a given ImageProcessor is null), no changes are made, and false is returned.

Returns:
Returns true on success, false otherwise.

getEnclosedMeshArea

private int getEnclosedMeshArea(ImageProcessor bp,
                                int startX,
                                int startY)
Calculates the area of a 4-connected enclosed mesh. Reads and modifies the pixel[] memory.

Pre: The image must have been loaded, preferably using the VascularNetworkToolkit.LoadImage() method.
Post: On success, the pixel[] array data has been modified. The memory which represented the white mesh should be painted gray color.

Parameters:
startX - The starting X coordinate.
startY - The starting Y coordinate.
Returns:
Returns the area of the enclosed mesh. If the mesh is not enclosed (it touches the boundary of the image), it will return the value meshWasNotEnclosed.

run

public void run(ImageProcessor bp)
Performs specific segmentation designed for vascular cells grown on a Matrigel assay.

Pre: The image was cleared to run by the setup() method.
Post: The image is processed by the segmentation routines. A new segmented binary image is drawn.

Parameters:
bp - Required by the interface. The access information to the original image.

setup

public int setup(String arg,
                 ImagePlus ip)
Specifies the preconditions for the plug-in. If this method succeeds then run() is called.

Pre: ImageJ is running and an 8-bit grayscale image is open. The plug-in was just activated.
Post: Either an argument was processed, the image was not saved to a local folder, or the plug-in is cleared to run on the image.

Parameters:
arg - Required by the interface. The argument list passed to the plug-in.
Returns:
If DONE is returned, ImageJ quits without run()'ing the plug-in. Otherwise, the plug-in signals to ImageJ that this plugin only handles 8-bit (256 grayscale) and will not change the original image.