Class ROIWrapper


  • public class ROIWrapper
    extends GenericObjectWrapper<ROIData>
    Class containing a ROIData object.

    Wraps function calls to the ROIData contained.

    • Field Detail

      • IJ_PROPERTY

        public static final java.lang.String IJ_PROPERTY
        Default IJ property to store ROI local labels / indices.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ROIWrapper

        public ROIWrapper()
        Constructor of the ROIWrapper class.
      • ROIWrapper

        public ROIWrapper​(java.lang.Iterable<? extends GenericShapeWrapper<?>> shapes)
        Constructor of the ROIWrapper class.
        Parameters:
        shapes - List of shapes to add to the ROIData.
      • ROIWrapper

        public ROIWrapper​(ROIData data)
        Constructor of the ROIWrapper class.
        Parameters:
        data - ROIData to be contained.
    • Method Detail

      • checkProperty

        public static java.lang.String checkProperty​(java.lang.String property)
        Checks the provided property.
        Parameters:
        property - The property where the 4D ROI local index/label is stored.
        Returns:
        The property, or the default value IJ_PROPERTY (= "ROI") if it is null or empty.
      • ijIDProperty

        public static java.lang.String ijIDProperty​(java.lang.String property)
        Returns the ID property corresponding to the input local index/label property (appends "_ID" to said property).
        Parameters:
        property - The property where the 4D ROI local index/label is stored. Defaults to "ROI" if null or empty.
        Returns:
        See above.
      • fromImageJ

        public static java.util.List<ROIWrapper> fromImageJ​(java.util.List<? extends Roi> ijRois)
        Converts an ImageJ list of ROIs to a list of OMERO ROIs
        Parameters:
        ijRois - A list of ImageJ ROIs.
        Returns:
        The converted list of OMERO ROIs.
      • fromImageJ

        public static java.util.List<ROIWrapper> fromImageJ​(java.util.List<? extends Roi> ijRois,
                                                            java.lang.String property)
        Converts an ImageJ list of ROIs to a list of OMERO ROIs
        Parameters:
        ijRois - A list of ImageJ ROIs.
        property - The property used to store the 4D ROI local index/label. Defaults to "ROI" if null or empty.
        Returns:
        The converted list of OMERO ROIs.
      • toImageJ

        public static java.util.List<Roi> toImageJ​(java.util.List<? extends ROIWrapper> rois)
        Converts an OMERO list of ROIs to a list of ImageJ ROIs
        Parameters:
        rois - A list of OMERO ROIs.
        Returns:
        The converted list of ImageJ ROIs.
      • toImageJ

        public static java.util.List<Roi> toImageJ​(java.util.List<? extends ROIWrapper> rois,
                                                   java.lang.String property)
        Converts an OMERO list of ROIs to a list of ImageJ ROIs
        Parameters:
        rois - A list of OMERO ROIs.
        property - The property used to store the 4D ROI local index/label. Defaults to "ROI" if null or empty.
        Returns:
        The converted list of ImageJ ROIs.
      • toImageJ

        public static java.util.List<Roi> toImageJ​(java.util.Collection<? extends ROIWrapper> rois,
                                                   java.lang.String property,
                                                   boolean groupRois)
        Converts an OMERO list of ROIs to a list of ImageJ ROIs
        Parameters:
        rois - A list of OMERO ROIs.
        property - The property used to store the 4D ROI local labels/IDs. Defaults to "ROI" if null or empty.
        groupRois - Whether ImageJ Rois belonging to the same OMERO ROI should be grouped or not.
        Returns:
        The converted list of ImageJ ROIs.
      • getName

        public java.lang.String getName()
        Gets the ROI name.
        Returns:
        The ROI name (can be null).
      • setName

        public void setName​(java.lang.String name)
        Sets the ROI name.
        Parameters:
        name - The ROI name.
      • setData

        @Deprecated
        public void setData​(ROIData data)
        Deprecated.
        Changes the wrapped data.
        Parameters:
        data - The ROI data.
      • addShapes

        public void addShapes​(java.util.List<? extends GenericShapeWrapper<?>> shapes)
        Adds ShapeData objects from a list of GenericShapeWrapper to the ROIData
        Parameters:
        shapes - List of GenericShapeWrapper.
      • addShape

        public void addShape​(GenericShapeWrapper<?> shape)
        Adds a ShapeData from a GenericShapeWrapper to the ROIData
        Parameters:
        shape - GenericShapeWrapper to add.
      • getShapes

        public ShapeList getShapes()
        Returns the list of shapes contained in the ROIData.
        Returns:
        list of shape contained in the ROIData.
      • setImage

        public void setImage​(ImageWrapper image)
        Sets the image linked to the ROI.
        Parameters:
        image - Image linked to the ROIData.
      • deleteShape

        public void deleteShape​(ShapeData shape)
        Deletes a ShapeData from the ROIData.
        Parameters:
        shape - ShapeData to delete.
      • deleteShape

        public void deleteShape​(int pos)
        Deletes a ShapeData from the ROIData.
        Parameters:
        pos - Position of the ShapeData in the ShapeData list from the ROIData.
        Throws:
        java.lang.IndexOutOfBoundsException - If pos is out of the ShapeData list bounds.
      • getBounds

        public PixelsWrapper.Bounds getBounds()
        Returns the 5D bounds containing the ROI.
        Returns:
        The 5D bounds.
      • toImageJ

        public java.util.List<Roi> toImageJ()
        Convert ROI to ImageJ list of ROIs.
        Returns:
        A list of ROIs.
      • toImageJ

        public java.util.List<Roi> toImageJ​(java.lang.String property)
        Convert ROI to ImageJ list of ROIs.
        Parameters:
        property - The property where the 4D ROI local index will be stored.
        Returns:
        A list of ROIs.