public class TrackOutline extends Object
The algorithm uses IJ tools for tracking and filling (deleting) objects It goes through all points of the image and for every visited point it checks whether the value is different than defined background. If it is, the Wand tool is used to select object given by the pixel value inside it. The ROI (outline) is then stored in this object and served as reference The ROI is then used to delete selected object from image (using background value). Next, the algorithm moves to next pixel (of the same image the object has been deleted from, so it is not possible to detect the same object twice).
It assigns also frame number to outline
Creating object runs also outline detection and tracking. Detected outlines are stored in object
and can be accessed by reference directly from outlines array or as copies from
getCopyofShapes().
SegmentedShapeRoi
Modifier and Type | Field and Description |
---|---|
protected int |
background
The background color.
|
ArrayList<Color> |
colors
List of colors of objects that were used to produce SegmentedShapeRoi.
|
protected ij.process.ImageProcessor |
imp
Original image.
|
ArrayList<SegmentedShapeRoi> |
outlines
List of found outlines as ROIs.
|
Constructor and Description |
---|
TrackOutline(ij.ImagePlus im,
int background)
Default constructor.
|
TrackOutline(ij.process.ImageProcessor imp,
int background)
Constructor from ImageProcessor for single images.
|
TrackOutline(ij.process.ImageProcessor imp,
int background,
int frame)
Constructor from ImageProcessor.
|
Modifier and Type | Method and Description |
---|---|
ArrayList<Color> |
getColors()
Get colors of pixels that outlines were produced from.
|
List<SegmentedShapeRoi> |
getCopyofShapes()
Return deep copy of Shapes.
|
List<List<Point2d>> |
getOutlineasRawPoints()
Convert found outlines to List without any interpolation.
|
List<Outline> |
getOutlines(double step,
boolean smooth)
Convert found outlines to Outline.
|
List<List<Point2d>> |
getOutlinesasPoints(double step,
boolean smooth)
Convert found outlines to List.
|
Pair<List<Outline>,List<Color>> |
getOutlinesColors(double step,
boolean smooth)
Convert found outlines to Outline.
|
List<Pair<Outline,Color>> |
getPairs(double step,
boolean smooth)
Reformat collected outlines and Colors to list of pairs.
|
List<SegmentedShapeRoi> |
getShapes()
Return shallow copy of Shapes.
|
ij.process.ImageProcessor |
prepare()
Filter input image to remove single pixels.
|
void |
setColors()
Set
Roi.setStrokeColor(Color) of each found Roi to color of pixels it was produced
from. |
String |
toString() |
protected ij.process.ImageProcessor imp
public ArrayList<SegmentedShapeRoi> outlines
public ArrayList<Color> colors
This list is related to outlines
. Colors are encoded as rgb
Color.Color(int)
protected int background
public TrackOutline(ij.process.ImageProcessor imp, int background, int frame)
imp
- Image to process (not modified)background
- Color value for backgroundframe
- Frame of stack that \a imp belongs toIllegalArgumentException
- when wrong image format is providedpublic TrackOutline(ij.process.ImageProcessor imp, int background)
imp
- Image to process (not modified)background
- Color value for backgroundIllegalArgumentException
- when wrong image format is providedpublic TrackOutline(ij.ImagePlus im, int background)
im
- Image to process (not modified), 8-bit, one slicebackground
- Background colorpublic ij.process.ImageProcessor prepare()
Implement closing followed by opening.
TODO If input image is grayscale this method may not work as expected, e.g. small pixels with one color sticked to larger objects with another color will not be removed
public List<Outline> getOutlines(double step, boolean smooth)
step
- resolution stepsmooth
- true to use IJ polygon smoothing (running average).SegmentedShapeRoi.getOutlineasPoints()
,
getOutlinesasPoints(double, boolean)
,
getOutlinesColors(double, boolean)
public Pair<List<Outline>,List<Color>> getOutlinesColors(double step, boolean smooth)
step
- resolution stepsmooth
- true to use IJ polygon smoothing (running average).Color.Color(int)
SegmentedShapeRoi.getOutlineasPoints()
,
getOutlinesasPoints(double, boolean)
public List<Pair<Outline,Color>> getPairs(double step, boolean smooth)
step
- resolution stepsmooth
- true to use IJ polygon smoothing (running average).public List<List<Point2d>> getOutlinesasPoints(double step, boolean smooth)
step
- step - step during conversion outline to points. For 1 every point from outline
is included in output listsmooth
- true for using running average during interpolationSegmentedShapeRoi.getOutlineasPoints()
public List<List<Point2d>> getOutlineasRawPoints()
SegmentedShapeRoi.getOutlineasPoints()
public List<SegmentedShapeRoi> getCopyofShapes()
public List<SegmentedShapeRoi> getShapes()
getColors()
public ArrayList<Color> getColors()
Size of this array and order of elements correspond to getShapes()
and all
get methods in this class.
Color.Color(int)
. Integer can be retrieved by
summing up three RGB components.getShapes()
public void setColors()
Roi.setStrokeColor(Color)
of each found Roi to color of pixels it was produced
from.
Modified are SegmentedShapeRoi
stored in outlines
Copyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.