public class RoiManagerAdapter extends Object
This class is implemented as singleton. To access its functionality, use the getAdapter() function to get the singleton instance and call its methods.
Modifier and Type | Class and Description |
---|---|
private static class |
RoiManagerAdapter.RoiReader
Class for parsing ImageJ roi files and zip archives.
|
Modifier and Type | Field and Description |
---|---|
private static Object |
classLock
Lock variable to make singleton thread-safe.
|
private static RoiManagerAdapter |
roiAdapt
The object instance.
|
private ij.plugin.frame.RoiManager |
roiManager
Reference to the current ImageJ roi manager.
|
Modifier | Constructor and Description |
---|---|
private |
RoiManagerAdapter()
Hidden constructor, never called from outside.
|
Modifier and Type | Method and Description |
---|---|
void |
addBordersToRoiManager(MTBBorder2DSet borders)
Adds a set of 2D borders to the ROI manager.
|
void |
addContoursToRoiManager(MTBContour2DSet conts)
Adds a set of 2D contours to the ROI manager.
|
void |
addPolygonsToRoiManager(MTBPolygon2DSet polys)
Adds a set of polygons to the ROI manager.
|
void |
addPolygonToRoiManager(MTBPolygon2D poly)
Adds the given polygon to the ROI manager.
|
void |
addRegionsToRoiManager(MTBRegion2DSet regs)
Adds a set of 2D regions to the ROI manager.
|
boolean |
areRegionsInManagerAvailable()
Returns true if there are regions available in ROI manager.
|
private boolean |
checkSelectionConsistency()
Checks if a proper set of regions is selected in ImageJ ROI manager.
|
private boolean |
checkSelectionConsistencyForLineSegments()
Checks if a proper set of ROIs convertible to line segments is
selected in ImageJ ROI manager.
|
MTBBorder2DSet |
getBorderSetFromRoiManager()
Reads a ROI manager selection into a set of borders.
|
MTBContour2DSet |
getContourSetFromRoiManager()
Reads a ROI manager selection into a set of contours.
|
static RoiManagerAdapter |
getInstance()
Single access point for singleton functionality.
|
MTBLineSegment2DSet |
getLineSegmentSetFromRoiManager()
Reads ROI manager selections into a set of line segments.
|
MTBPolygon2DSet |
getPolygonSetFromRoiFile(String file,
boolean asSnakes)
Reads an ImageJ roi file into a set of polygons/snakes.
|
MTBPolygon2DSet |
getPolygonSetFromRoiManager()
Reads ROI manager selections into a set of polygons/snakes.
|
MTBRegion2DSet |
getRegionSetFromRoiFile(String file)
Reads an ImageJ roi file into a set of regions.
|
MTBRegion2DSet |
getRegionSetFromRoiFile(String file,
double xMin,
double yMin,
double xMax,
double yMax)
Reads an ImageJ roi file into a set of regions.
|
MTBRegion2DSet |
getRegionSetFromRoiManager()
Reads a ROI manager selection into a set of regions.
|
private void |
openRoiManager()
Gets an instance of the current ROI manager of ImageJ.
|
private static RoiManagerAdapter roiAdapt
private static Object classLock
private ij.plugin.frame.RoiManager roiManager
private RoiManagerAdapter()
public static RoiManagerAdapter getInstance()
public void addPolygonToRoiManager(MTBPolygon2D poly)
poly
- Polygon to be added to ROI manager.public void addPolygonsToRoiManager(MTBPolygon2DSet polys)
Note that the set is destroyed by this operation, i.e. it cannot be recovered lateron from the ROI manager as it does not support to group several polygons into a logic entity.
polys
- Set of polygons to be added to ROI manager.public void addRegionsToRoiManager(MTBRegion2DSet regs)
regs
- Set of regions to be added to ROI manager.public void addContoursToRoiManager(MTBContour2DSet conts)
conts
- Set of contours to be added to ROI manager.public void addBordersToRoiManager(MTBBorder2DSet borders)
borders
- Set of borders to be added to ROI manager.public MTBRegion2DSet getRegionSetFromRoiFile(String file) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
file
- Input file.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Thrown in case of failure.public MTBRegion2DSet getRegionSetFromRoiFile(String file, double xMin, double yMin, double xMax, double yMax) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
file
- Input file.xMin
- Minimal x value of user-specified domain.yMin
- Minimal y value of user-specified domain.xMax
- Maximal x value of user-specified domain.yMax
- Maximal y value of user-specified domain.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Thrown in case of failure.public MTBPolygon2DSet getPolygonSetFromRoiFile(String file, boolean asSnakes) throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
file
- Input file.asSnakes
- If true, function returns snakes, otherwise polygons.de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Thrown in case of failure.public MTBLineSegment2DSet getLineSegmentSetFromRoiManager()
Note that polylines are not automatically closed, i.e. the first and last point are not identical even if ImageJ shows a closed polygon.
public MTBPolygon2DSet getPolygonSetFromRoiManager()
public MTBRegion2DSet getRegionSetFromRoiManager()
public MTBContour2DSet getContourSetFromRoiManager()
public MTBBorder2DSet getBorderSetFromRoiManager()
public boolean areRegionsInManagerAvailable()
private boolean checkSelectionConsistency()
private boolean checkSelectionConsistencyForLineSegments()
private void openRoiManager()
If there is already a roi manager open, get a reference to that one, otherwise open a new one.
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.