public class ROIListData extends ArrayList<Roi> implements JIPipeData
Roi
modCount
Constructor and Description |
---|
ROIListData()
Creates an empty set of ROI
|
ROIListData(List<Roi> other)
Creates a deep copy
|
ROIListData(ij.plugin.frame.RoiManager roiManager)
Initializes from a RoiManager
|
Modifier and Type | Method and Description |
---|---|
void |
addToRoiManager(ij.plugin.frame.RoiManager roiManager)
Adds the ROI to an existing ROI manager instance
|
static Roi |
calculateMinimumBoundingRectangle(Roi roi)
Method based on fitMinRectangle
|
boolean |
containsOnlyRoisOfType(int type)
Returns if this ROI list only contains ROI of given type
|
int |
countRoisOfType(int type)
Counts all ROIs of given type
|
ij.ImagePlus |
createBlankCanvas(String title,
BitDepth bitDepth) |
ij.ImagePlus |
createBlankCanvas(String title,
int bitDepth) |
ij.ImagePlus |
createDummyImage()
Creates a 2D 8-bit image that covers the region of all ROI
|
static ij.ImagePlus |
createDummyImageFor(Collection<ROIListData> rois)
Creates a 2D 8-bit black image that covers the region of all provided ROI
|
JIPipeThumbnailData |
createThumbnail(int width,
int height,
JIPipeProgressInfo progressInfo)
This function generates a thumbnail for this data
Can return null
|
void |
crop(boolean cropXY,
boolean cropZ,
boolean cropC,
boolean cropT)
Moves the ROI, so the bounding rectangle is at 0,0
|
void |
display(String displayName,
JIPipeWorkbench workbench,
JIPipeDataSource source)
This function should display the data in the GUI.
|
void |
draw(ij.ImagePlus rgbImage,
boolean ignoreZ,
boolean ignoreC,
boolean ignoreT,
ROIElementDrawingMode drawOutline,
ROIElementDrawingMode fillOutline,
int defaultLineThickness,
Color defaultFillColor,
Color defaultLineColor)
Draw on top of an RGB image
|
void |
draw(ij.process.ImageProcessor processor,
ImageSliceIndex currentIndex,
boolean ignoreZ,
boolean ignoreC,
boolean ignoreT,
boolean drawOutline,
boolean fillOutline,
boolean drawLabel,
int defaultLineThickness,
Color defaultFillColor,
Color defaultLineColor,
Collection<Roi> highlighted)
Draw on top of an RGB processor with specified coordinates.
|
void |
drawMask(boolean drawOutline,
boolean drawFilledOutline,
int lineThickness,
ij.ImagePlus result)
Draws the ROI over an existing mask image
|
void |
drawMaskForSliceIndex(boolean drawOutline,
boolean drawFilledOutline,
int lineThickness,
ij.ImagePlus result,
ImageSliceIndex sliceIndex)
Draws the ROI over an existing mask image
|
JIPipeData |
duplicate(JIPipeProgressInfo progressInfo)
Duplicates the data
|
void |
exportData(JIPipeWriteDataStorage storage,
String name,
boolean forceName,
JIPipeProgressInfo progressInfo)
Saves the data to a folder
|
void |
flatten()
Makes all ROI visible on all stacks
|
Rectangle |
getBounds()
Returns the bounds of area described by the
Roi |
static Point |
getCentroid(Roi roi)
Gets the centroid of a ROI
|
static Point2D |
getCentroidDouble(Roi roi)
Gets the centroid of a ROI
|
int |
getChannelPosition()
The overall channel position of the ROIs.
|
int |
getFramePosition()
The overall frame position of the ROIs.
|
ij.ImagePlus |
getMaskForSlice(int width,
int height,
boolean drawOutline,
boolean drawFilledOutline,
int lineThickness,
ImageSliceIndex sliceIndex)
Generates a mask image from pure ROI data.
|
int |
getStackPosition()
The overall stack position of the ROIs.
|
Map<ImageSliceIndex,List<Roi>> |
groupByPosition(boolean perSlice,
boolean perChannel,
boolean perFrame)
Groups the ROI by their image positions
|
Map<Optional<ij.ImagePlus>,ROIListData> |
groupByReferenceImage()
Groups the ROI by their reference image
|
static ROIListData |
importData(JIPipeReadDataStorage storage,
JIPipeProgressInfo progressInfo)
Loads
Roi from a path that contains a zip/roi file |
static boolean |
isVisibleIn(Roi roi,
ImageSliceIndex location,
boolean ignoreZ,
boolean ignoreC,
boolean ignoreT)
Returns true if the ROI is visible at given slice index
|
static ROIListData |
loadRoiListFromFile(Path fileName)
Loads a set of ROI from a zip file
|
void |
logicalAnd()
Applies a logical AND operation to all
Roi in this list. |
void |
logicalOr()
Applies a logical OR operation to all
Roi in this list. |
void |
logicalXor()
Applies a logical XOR operation on the list of
Roi . |
ResultsTableData |
measure(ij.ImagePlus imp,
ImageStatisticsSetParameter measurements,
boolean addNameToTable,
boolean measurePhysicalSizes)
Generates ROI statistics
|
void |
mergeWith(ROIListData other)
Merges the ROI from another data into this one.
|
void |
outline(RoiOutline outline)
Outlines all
Roi in this list by the specified algorithm. |
Component |
preview(int width,
int height)
This function generates a preview component for usage within the GUI
Can return null
|
ROIListData |
rotate(double angle,
Point2D center)
Rotates the ROI around the center
Does not change the ROIs in this list
|
Path |
save(Path path)
Saves the ROI list into the selected path
|
static void |
saveSingleRoi(Roi roi,
Path outputFile)
Saves a single ROI to a file
|
Path |
saveToRoiOrZip(Path outputFile)
Saves all ROIs in this list as *.roi or *.zip file depending on how many ROIs are stored in the list
If the extension of the output file is .zip and there is one ROI in the list, the output will still be saved as zip!
|
void |
saveToZip(Path outputFile)
Saves all ROIs in this list as ZIP file
|
ROIListData |
scale(double scaleX,
double scaleY,
boolean centered)
Scales the ROI in this list and returns a new list containing the scaled instances
Does not change the ROIs in this list
|
ROIListData |
shallowClone()
Creates a shallow copy of this list
|
void |
splitAll()
Splits all
ShapeRoi that consist of multiple sub-Roi into their individual sub-Roi. |
ij.ImagePlus |
toMask(boolean drawFilledOutline,
boolean drawOutline,
int lineThickness,
int width,
int height,
int numSlices,
int numChannels,
int numFrames)
Converts this ROI list into a mask that has the same size as the reference image
|
ij.ImagePlus |
toMask(ij.ImagePlus reference,
boolean drawFilledOutline,
boolean drawOutline,
int lineThickness)
Converts this ROI list into a mask that has the same size as the reference image
|
ij.ImagePlus |
toMask(int width,
int height,
boolean drawOutline,
boolean drawFilledOutline,
int lineThickness)
Generates a mask image from pure ROI data.
|
ij.ImagePlus |
toMask(Margin imageArea,
boolean drawOutline,
boolean drawFilledOutline,
int lineThickness)
Generates a mask image from pure ROI data.
|
ij.ImagePlus |
toRGBImage(Margin imageArea,
ROIElementDrawingMode drawOutline,
ROIElementDrawingMode drawFilledOutline,
int defaultLineThickness,
Color defaultFillColor,
Color defaultLineColor)
Generates an RGB image from pure ROI data.
|
String |
toString() |
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
equals, hashCode
containsAll
finalize, getClass, notify, notifyAll, wait, wait, wait
close, exportThumbnails, getDescriptionOf, getMenuPathOf, getNameOf, getSortedList, getStorageDocumentation, getStorageSchema, groupByMenuPath, isCommon, isHeavy, isHidden, toDetailedString
containsAll, equals, hashCode
parallelStream, stream
public ROIListData()
public ROIListData(List<Roi> other)
other
- the originalpublic ROIListData(ij.plugin.frame.RoiManager roiManager)
roiManager
- the ROI managerpublic static ij.ImagePlus createDummyImageFor(Collection<ROIListData> rois)
rois
- the roispublic static ROIListData importData(JIPipeReadDataStorage storage, JIPipeProgressInfo progressInfo)
Roi
from a path that contains a zip/roi filestorage
- path that contains a zip/roi filepublic static ROIListData loadRoiListFromFile(Path fileName)
fileName
- the zip filepublic static Point getCentroid(Roi roi)
roi
- the roipublic static Point2D getCentroidDouble(Roi roi)
roi
- the roipublic static boolean isVisibleIn(Roi roi, ImageSliceIndex location, boolean ignoreZ, boolean ignoreC, boolean ignoreT)
roi
- the roilocation
- slice index, zero-basedignoreZ
- ignore Z constraintignoreC
- ignore C constraintignoreT
- ignore T constraintpublic static void saveSingleRoi(Roi roi, Path outputFile)
roi
- the ROIoutputFile
- the filepublic static Roi calculateMinimumBoundingRectangle(Roi roi)
roi
- the roipublic ROIListData shallowClone()
public Map<ImageSliceIndex,List<Roi>> groupByPosition(boolean perSlice, boolean perChannel, boolean perFrame)
perSlice
- group per sliceperChannel
- group per channelperFrame
- group per framepublic Path save(Path path)
path
- the pathpublic void saveToZip(Path outputFile)
outputFile
- the output filepublic Path saveToRoiOrZip(Path outputFile)
outputFile
- the output file. without extension.public void exportData(JIPipeWriteDataStorage storage, String name, boolean forceName, JIPipeProgressInfo progressInfo)
JIPipeData
exportData
in interface JIPipeData
storage
- The storage where the data should be writtenname
- A name reference that can be used to generate filename(s)forceName
- If enabled, the data is saved potentially destructively. Generated files must always contain the name parameter. This is used to collect results for humans or other algorithms.progressInfo
- the progresspublic String toString()
toString
in class AbstractCollection<Roi>
public JIPipeData duplicate(JIPipeProgressInfo progressInfo)
JIPipeData
duplicate
in interface JIPipeData
progressInfo
- the progress of duplicating the datapublic Component preview(int width, int height)
JIPipeData
preview
in interface JIPipeData
width
- the target widthheight
- the target heightpublic JIPipeThumbnailData createThumbnail(int width, int height, JIPipeProgressInfo progressInfo)
JIPipeData
createThumbnail
in interface JIPipeData
width
- the widthheight
- the heightprogressInfo
- the progress infopublic void display(String displayName, JIPipeWorkbench workbench, JIPipeDataSource source)
JIPipeData
JIPipeDataDisplayOperation
that can be registered separately.
This item will always be shown as "Default" in the list of operations.display
in interface JIPipeData
displayName
- a name that can be usedworkbench
- the workbenchsource
- optional source of the data. Can be null or any kind of data type (e.g. JIPipeDataSlot
)public Map<Optional<ij.ImagePlus>,ROIListData> groupByReferenceImage()
public ROIListData scale(double scaleX, double scaleY, boolean centered)
scaleX
- the x-scalescaleY
- the y-scalecentered
- if the scaling expands from the ROI centerpublic ROIListData rotate(double angle, Point2D center)
angle
- the anglecenter
- the center pointpublic void crop(boolean cropXY, boolean cropZ, boolean cropC, boolean cropT)
public void flatten()
public ij.ImagePlus createDummyImage()
public ij.ImagePlus toMask(Margin imageArea, boolean drawOutline, boolean drawFilledOutline, int lineThickness)
imageArea
- modifications for the image areadrawOutline
- whether to draw an outlinedrawFilledOutline
- whether to fill the arealineThickness
- line thickness for drawingpublic ij.ImagePlus toRGBImage(Margin imageArea, ROIElementDrawingMode drawOutline, ROIElementDrawingMode drawFilledOutline, int defaultLineThickness, Color defaultFillColor, Color defaultLineColor)
imageArea
- modifications for the image areadrawOutline
- whether to draw an outlinedrawFilledOutline
- whether to fill the areadefaultLineThickness
- line thickness for drawingdefaultFillColor
- the default fill colordefaultLineColor
- the default line colorpublic ij.ImagePlus toMask(int width, int height, boolean drawOutline, boolean drawFilledOutline, int lineThickness)
width
- the image widthheight
- the image heightdrawOutline
- whether to draw an outlinedrawFilledOutline
- whether to fill the arealineThickness
- line thickness for drawingpublic ij.ImagePlus toMask(ij.ImagePlus reference, boolean drawFilledOutline, boolean drawOutline, int lineThickness)
reference
- the reference imagedrawFilledOutline
- fill the ROIdrawOutline
- draw the ROI outlineslineThickness
- the ROI line thicknesspublic ij.ImagePlus toMask(boolean drawFilledOutline, boolean drawOutline, int lineThickness, int width, int height, int numSlices, int numChannels, int numFrames)
drawFilledOutline
- fill the ROIdrawOutline
- draw the ROI outlineslineThickness
- the ROI line thicknesswidth
- output image widthheight
- output image heightnumSlices
- output image Z slicesnumChannels
- output image channel slicesnumFrames
- output image frame slicespublic ij.ImagePlus getMaskForSlice(int width, int height, boolean drawOutline, boolean drawFilledOutline, int lineThickness, ImageSliceIndex sliceIndex)
width
- the image widthheight
- the image heightdrawOutline
- whether to draw an outlinedrawFilledOutline
- whether to fill the arealineThickness
- line thickness for drawingsliceIndex
- zero-based slice indexpublic void draw(ij.ImagePlus rgbImage, boolean ignoreZ, boolean ignoreC, boolean ignoreT, ROIElementDrawingMode drawOutline, ROIElementDrawingMode fillOutline, int defaultLineThickness, Color defaultFillColor, Color defaultLineColor)
rgbImage
- the target imagedrawOutline
- draw an outlinefillOutline
- fill the outlineignoreZ
- do not constrain ZignoreC
- do not constrain channelignoreT
- do not constrain framedefaultLineThickness
- default line thicknessdefaultFillColor
- default fill colordefaultLineColor
- default line colorpublic void draw(ij.process.ImageProcessor processor, ImageSliceIndex currentIndex, boolean ignoreZ, boolean ignoreC, boolean ignoreT, boolean drawOutline, boolean fillOutline, boolean drawLabel, int defaultLineThickness, Color defaultFillColor, Color defaultLineColor, Collection<Roi> highlighted)
processor
- the target processorcurrentIndex
- current index in the stackignoreZ
- do not constrain ZignoreC
- do not constrain channelignoreT
- do not constrain framedrawOutline
- draw an outlinefillOutline
- fill the outlinedrawLabel
- draw labelsdefaultLineThickness
- default line thicknessdefaultFillColor
- default fill colordefaultLineColor
- default line colorhighlighted
- highlighted rois (other ones are drawn darker)public void drawMaskForSliceIndex(boolean drawOutline, boolean drawFilledOutline, int lineThickness, ij.ImagePlus result, ImageSliceIndex sliceIndex)
drawOutline
- whether to draw an outlinedrawFilledOutline
- whether to fill the arealineThickness
- line thickness for drawingresult
- the target imagesliceIndex
- zero-based slice indexpublic void drawMask(boolean drawOutline, boolean drawFilledOutline, int lineThickness, ij.ImagePlus result)
drawOutline
- whether to draw an outlinedrawFilledOutline
- whether to fill the arealineThickness
- line thickness for drawingresult
- the target imagepublic void addToRoiManager(ij.plugin.frame.RoiManager roiManager)
roiManager
- the ROI managerpublic void mergeWith(ROIListData other)
Roi
other
- the other data. The entries are copied.public void outline(RoiOutline outline)
outline
- the methodpublic void splitAll()
public Rectangle getBounds()
Roi
Roi
are present, a Rectangle with zero size is returnedpublic void logicalOr()
public void logicalAnd()
public void logicalXor()
Roi
.public boolean containsOnlyRoisOfType(int type)
type
- the ROI type. Can be RECTANGLE=0, OVAL=1, POLYGON=2, FREEROI=3, TRACED_ROI=4, LINE=5, POLYLINE=6, FREELINE=7, ANGLE=8, COMPOSITE=9, or POINT=10public int countRoisOfType(int type)
type
- the ROI type. Can be RECTANGLE=0, OVAL=1, POLYGON=2, FREEROI=3, TRACED_ROI=4, LINE=5, POLYLINE=6, FREELINE=7, ANGLE=8, COMPOSITE=9, or POINT=10public ResultsTableData measure(ij.ImagePlus imp, ImageStatisticsSetParameter measurements, boolean addNameToTable, boolean measurePhysicalSizes)
imp
- the reference image. Can be null to measure on a black image. Warning: If you provide an existing image that should not be changed, make a duplicate!measurements
- which measurements to extractaddNameToTable
- if true, add the ROI's name to the tablemeasurePhysicalSizes
- if true, physical sizes will be measured if availablepublic int getChannelPosition()
public int getStackPosition()
public int getFramePosition()
public ij.ImagePlus createBlankCanvas(String title, int bitDepth)
Copyright © 2020–2024 Leibniz Institute for Natural Product Research and Infection Biology - Hans Knöll Institute (HKI). All rights reserved.