Package sc.fiji.snt.analysis
Class RoiConverter
java.lang.Object
sc.fiji.snt.analysis.RoiConverter
Converts SNT
Paths into (IJ1) ROIs.- Author:
- Tiago Ferreira
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRoiConverter(Collection<Path> paths, ij.ImagePlus imp) Instantiates a new Converter.RoiConverter(Path path, ij.ImagePlus imp) Instantiates a new Converter.RoiConverter(Tree tree) Instantiates a new Converter.RoiConverter(Tree tree, ij.ImagePlus imp) Instantiates a new Converter. -
Method Summary
Modifier and TypeMethodDescriptionstatic ij.gui.Roicombine(List<ij.gui.Roi> rois) static ij.gui.Roiconvert(Collection<Path> paths, ij.ImagePlus imp) voidconvertBranches(ij.gui.Overlay overlay) voidConverts all the branch points associated with the parsed paths intoPointRois, adding them to the overlay of the image specified in the constructor.voidconvertBranchPoints(ij.gui.Overlay overlay) Converts all the branch points associated with the parsed paths intoPointRoisvoidconvertInnerBranches(ij.gui.Overlay overlay) voidConverts paths into 2D polyline ROIs (segment paths), adding them to the overlay of the image specified in the constructor.convertPaths(ij.gui.Overlay overlay) Converts paths into 2D polyline ROIs.convertPaths(ij.gui.Overlay overlay, Collection<Path> paths) Converts an ad-hoc collection of paths into 2D polyline ROIs.voidconvertPrimaryBranches(ij.gui.Overlay overlay) voidConverts the starting nodes of primary paths in the parsed pool intoPointRoisvoidconvertRoots(ij.gui.Overlay overlay) Converts the starting nodes of primary paths in the parsed pool intoPointRoisvoidconvertTerminalBranches(ij.gui.Overlay overlay) voidConverts all the tips associated with the parsed paths intoPointRois, adding them to the overlay of the image specified in the constructor.voidconvertTips(ij.gui.Overlay overlay) Converts all the tips associated with the parsed paths intoPointRoisstatic ij.gui.Roienlarge(ij.gui.Roi roi, int pixels) static ij.gui.Roiget2DBoundingBox(Collection<Path> paths, int exportPlane) static double[]get2dCentroid(ij.gui.Roi roi) static doublegetFittedRadius(ij.ImagePlus imp, ij.gui.Roi areaRoi) Retrieves the radius of a circle with the same area of the specified area ROI.static List<ij.gui.Roi> getROIs(ij.gui.Overlay overlay, int channel, int zSlice, int tFrame) Extracts ROIs associated with a specified CZT position.Gets ROI representations of the specified path.getZplaneROIs(int zSlice) Extracts all the ROIs converted so far associated with the specified Z-plane.static List<ij.gui.Roi> getZplaneROIs(ij.gui.Overlay overlay, int zSlice) Extracts ROIs associated with a specified Z position.static List<ij.gui.Roi> loadRoisFromZip(File zipFile) static booleansaveRoisToZip(List<ij.gui.Roi> rois, File file) voidsetStrokeWidth(int width) Sets the line width of converted segment paths.voidsetView(int view) Sets the exporting view for segment paths (XY by default).static ij.gui.PointRoitoPointRoi(List<PeripathDetector.Detection> detections, ij.ImagePlus imp, String name, Color color) Creates a groupedPointRoifrom a list ofPeripathDetector.Detections.voiduseSWCcolors(boolean useSWCcolors) Specifies coloring of ROIs by SWC type.
-
Field Details
-
XY_PLANE
public static final int XY_PLANESNT's XY view (the default export plane)- See Also:
-
ZY_PLANE
public static final int ZY_PLANESNT's ZY view- See Also:
-
XZ_PLANE
public static final int XZ_PLANESNT's XZ view- See Also:
-
-
Constructor Details
-
RoiConverter
Instantiates a new Converter. Since an image has not been specified, C,Z,T positions may not be properly for converted nodes.- Parameters:
tree- the Tree to be converted
-
RoiConverter
Instantiates a new Converter.- Parameters:
path- the Path to be convertedimp- the image associated with the Tree, used to properly assign C,T positions of converted nodes
-
RoiConverter
Instantiates a new Converter.- Parameters:
paths- the collection of Paths to be convertedimp- the image associated with the collection, used to properly assign C,T positions of converted nodes
-
RoiConverter
Instantiates a new Converter.- Parameters:
tree- the Tree to be convertedimp- the image associated with the Tree, used to properly assign C,T positions of converted nodes
-
-
Method Details
-
convertPaths
Converts paths into 2D polyline ROIs.- Parameters:
overlay- the target overlay to hold converted paths- Returns:
- a reference to the overlay holding paths
-
convertPaths
Converts an ad-hoc collection of paths into 2D polyline ROIs.- Parameters:
overlay- the target overlay to hold converted pathspaths- the collection of paths to be converted (e.g., a list of branches produced byStrahlerAnalyzer- Returns:
- a reference to the overlay holding paths
-
getROIs
Gets ROI representations of the specified path.Converts the path to a list of PolygonRoi objects using the path's name as the ROI name. The conversion respects the current view setting.
- Parameters:
path- the path to convert- Returns:
- a list of PolygonRoi objects representing the path
-
convertTips
Converts all the tips associated with the parsed paths intoPointRois- Parameters:
overlay- the target overlay to hold converted point- See Also:
-
convertRoots
Converts the starting nodes of primary paths in the parsed pool intoPointRois- Parameters:
overlay- the target overlay to hold converted point
-
convertPaths
Converts paths into 2D polyline ROIs (segment paths), adding them to the overlay of the image specified in the constructor.- Throws:
IllegalArgumentException- if this RoiConverter instance is not aware of any image- See Also:
-
convertBranches
-
convertInnerBranches
-
convertPrimaryBranches
-
convertTerminalBranches
-
convertTips
Converts all the tips associated with the parsed paths intoPointRois, adding them to the overlay of the image specified in the constructor.- Throws:
IllegalArgumentException- if this RoiConverter instance is not aware of any image- See Also:
-
convertBranchPoints
Converts all the branch points associated with the parsed paths intoPointRois, adding them to the overlay of the image specified in the constructor.- Throws:
IllegalArgumentException- if this RoiConverter instance is not aware of any image- See Also:
-
convertRoots
Converts the starting nodes of primary paths in the parsed pool intoPointRois- Throws:
IllegalArgumentException- if this RoiConverter instance is not aware of any image- See Also:
-
getZplaneROIs
Extracts all the ROIs converted so far associated with the specified Z-plane. It is assumed that ROIs are stored in the overlay of the image specified in the constructor.- Throws:
IllegalArgumentException- if this RoiConverter instance is not aware of any image
-
convertBranchPoints
Converts all the branch points associated with the parsed paths intoPointRois- Parameters:
overlay- the target overlay to hold converted point- See Also:
-
setView
public void setView(int view) Sets the exporting view for segment paths (XY by default). -
useSWCcolors
public void useSWCcolors(boolean useSWCcolors) Specifies coloring of ROIs by SWC type.- Parameters:
useSWCcolors- if true converted ROIs are colored according to their SWC type integer flag
-
setStrokeWidth
public void setStrokeWidth(int width) Sets the line width of converted segment paths. Set it to -1 to have ROIs plotted using the average diameter of the path- Parameters:
width- the new stroke width- See Also:
-
getZplaneROIs
Extracts ROIs associated with a specified Z position.- Parameters:
overlay- the overlay holding ROIszSlice- the z-plane (1-based index)- Returns:
- the sub-list of ROIs associated with the specified Z position. Note that ROIs with a ZPosition of 0 are considered to be associated with all Z-slices of a stack
-
getROIs
Extracts ROIs associated with a specified CZT position. Only ROIS with known hyperstackPosition are considered.- Parameters:
overlay- the overlay holding ROIschannel- the channel (1-based index)zSlice- the z-plane (1-based index)tFrame- the t-frame (1-based index)- Returns:
- the sub-list of ROIs associated with the specified CZT position
- See Also:
-
enlarge
-
combine
-
convert
-
toPointRoi
public static ij.gui.PointRoi toPointRoi(List<PeripathDetector.Detection> detections, ij.ImagePlus imp, String name, Color color) Creates a groupedPointRoifrom a list ofPeripathDetector.Detections. Each detection's pixel coordinates and stack position are computed viaPeripathDetector.Detection.xyzct().- Parameters:
detections- the detections to convertimp- the image used to resolve stack positions (channel, Z, frame)name- the ROI name, ornullfor no namecolor- the stroke color, ornullfor default- Returns:
- a PointRoi containing all detection points with per-point Z positions
- Throws:
IllegalArgumentException- if detections or imp is null
-
get2DBoundingBox
-
getFittedRadius
Retrieves the radius of a circle with the same area of the specified area ROI.- Parameters:
imp- The image associated with the ROIareaRoi- The input area ROI- Returns:
- the radius (in calibrated units) of a circle with the same area of
areaRoi
-
get2dCentroid
-
saveRoisToZip
-
loadRoisFromZip
-