Package loci.plugins.util
Class ROIHandler
java.lang.Object
loci.plugins.util.ROIHandler
Utility class for managing regions of interest within ImageJ.
Capable of constructing ROIs within ImageJ's ROI manager matching
those specified in an OME metadata store, and vice versa.
- Author:
- Melissa Linkert melissa at glencoesoftware.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidLook for ROIs in the given OMEXMLMetadata; if any are present, apply them to the given images and display them in the ROI manager.static voidOpens the rois and converts them into ImageJ Rois.static voidOpens the rois and converts them into ImageJ Rois.private static int[][]parsePoints(String points) Parse (x, y) coordinates from a String returned by MetadataRetrieve.getPolygonpoints(...) or MetadataRetrieve.getPolylinepoints(...)static ij.gui.Roi[]Returns rois if any from the overlay.static ij.gui.Roi[]Returns the rois if any stored in the ROI manager.static voidsaveROIs(MetadataStore store) Save ROIs in the ROI manager to the given MetadataStore.private static voidstoreLine(ij.gui.Line roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Line ROI into the specified metadata store.private static voidstoreOval(ij.gui.OvalRoi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Oval ROI into the specified metadata store.private static voidstorePoint(ij.gui.PointRoi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Point ROI into the specified metadata store.private static voidstorePolygon(ij.gui.PolygonRoi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Polygon ROI into the specified metadata store.private static voidstoreRectangle(ij.gui.Roi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Rectangle ROI into the specified metadata store.private static voidstoreText(ij.gui.TextRoi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the text ROI into the metadata stored.private static ome.xml.model.primitives.ColortoOMExmlColor(Color color) Converts the Java Color into an OME-XML Color.private static ome.xml.model.primitives.NonNegativeIntegerunwrap(int r) Wraps the specified integer into a Non negative integer.
-
Constructor Details
-
ROIHandler
public ROIHandler()
-
-
Method Details
-
openROIs
Look for ROIs in the given OMEXMLMetadata; if any are present, apply them to the given images and display them in the ROI manager. -
openROIs
Opens the rois and converts them into ImageJ Rois.- Parameters:
retrieve- The OMEXML store.images- The imageJ object.isOMERO-trueif data stored in OMERO,falseotherwise.
-
openROIs
public static void openROIs(IMetadata retrieve, ij.ImagePlus[] images, boolean isOMERO, String roisMode) Opens the rois and converts them into ImageJ Rois.- Parameters:
retrieve- The OMEXML store.images- The imageJ object.isOMERO-trueif data stored in OMERO,falseotherwise.roisMode- Determines whether to import Rois to overlay or RoiManager
-
readFromRoiManager
public static ij.gui.Roi[] readFromRoiManager()Returns the rois if any stored in the ROI manager.- Returns:
- See above.
-
readFromOverlays
public static ij.gui.Roi[] readFromOverlays()Returns rois if any from the overlay.- Returns:
- See above
-
saveROIs
Save ROIs in the ROI manager to the given MetadataStore.- Parameters:
store- Where to store the rois.
-
unwrap
private static ome.xml.model.primitives.NonNegativeInteger unwrap(int r) Wraps the specified integer into a Non negative integer.- Parameters:
r- The value to wrap.- Returns:
- See above.
-
storeText
private static void storeText(ij.gui.TextRoi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the text ROI into the metadata stored.- Parameters:
roi- The roi to convert.store- The store to handle.roiNum- The roi numbershape- The index of the shape.c- The selected channel.z- The selected slice.t- The selected timepoint.
-
storePoint
private static void storePoint(ij.gui.PointRoi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Point ROI into the specified metadata store.- Parameters:
roi- The roi to convert.store- The store to handle.roiNum- The roi numbershape- The index of the shape.c- The selected channel.z- The selected slice.t- The selected timepoint.
-
storeLine
private static void storeLine(ij.gui.Line roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Line ROI into the specified metadata store.- Parameters:
roi- The roi to convert.store- The store to handle.roiNum- The roi numbershape- The index of the shape.c- The selected channel.z- The selected slice.t- The selected timepoint.
-
storeRectangle
private static void storeRectangle(ij.gui.Roi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Rectangle ROI into the specified metadata store.- Parameters:
roi- The roi to convert.store- The store to handle.roiNum- The roi numbershape- The index of the shape.c- The selected channel.z- The selected slice.t- The selected timepoint.
-
storePolygon
private static void storePolygon(ij.gui.PolygonRoi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Polygon ROI into the specified metadata store.- Parameters:
roi- The roi to convert.store- The store to handle.roiNum- The roi numbershape- The index of the shape.c- The selected channel.z- The selected slice.t- The selected timepoint.
-
storeOval
private static void storeOval(ij.gui.OvalRoi roi, MetadataStore store, int roiNum, int shape, int c, int z, int t) Stores the Oval ROI into the specified metadata store.- Parameters:
roi- The roi to convert.store- The store to handle.roiNum- The roi numbershape- The index of the shape.c- The selected channel.z- The selected slice.t- The selected timepoint.
-
parsePoints
Parse (x, y) coordinates from a String returned by MetadataRetrieve.getPolygonpoints(...) or MetadataRetrieve.getPolylinepoints(...) -
toOMExmlColor
Converts the Java Color into an OME-XML Color.- Parameters:
color- The color to convert- Returns:
- See above
-