Class IJProperties
Note that these use ImagePlus.setProp(String, String) rather than the tempting
ImagePlus.setProperty(String, Object), as this seems necessary to be able to access the properties
later from a macro.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringProperty value for IMAGE_BACKGROUND when an image is known to have a dark background.static final StringProperty value for IMAGE_BACKGROUND when an image is known to have a light background.static final StringProperty to store the name for aRoi.static final StringKey for anImagePlusproperty storing either"light"or"darkdepending upon whether an image is known to be brightfield of fluorescence respectively.static final StringKey for aImagePlusproperties to store the bounding box of a QuPathImageRegion.static final StringKey for anImagePlusproperty to store a json representation of aRegionRequestused to request the image.static final StringKey for anImagePlusproperty to store a string representing a QuPathImageData.ImageType.static final StringSet property forPathObject.getClassification()()}static final StringSet property forPathObject.getID()()}static final StringBase for property names that store measurements to be added toPathObject.getMeasurements().static final StringSet property forPathObject.getName()static final StringSet property that stores the type of an object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAllMeasurements(Roi roi) Get all QuPath object measurements found in the properties of a Roi.static StringgetClassification(Roi roi) Get a QuPath classification, as stored in a roi's properties.static StringgetDefaultRoiName(Roi roi) Get the value of the DEFAULT_ROI_NAME property.static StringGet the image background property valuestatic ImageRegiongetImageRegion(ImagePlus imp) Get the IMAGE_REGION_ROOT property, if set.static DoublegetMeasurement(Roi roi, String name) Get a measurement stored as a property.static Optional<Function<ROI, PathObject>> getObjectCreator(Roi roi) Get a function to create a new object based upon the stored object type property, if available.static Optional<Function<ROI, PathObject>> getObjectCreator(String typeString) Get a function to create a new object based upon a property value of OBJECT_TYPE.static UUIDgetObjectId(Roi roi) Get a QuPath object ID from the Roi properties.static StringgetObjectName(Roi roi) Get a QuPath object name, as stored in a roi's properties.static StringgetObjectType(Roi roi) Get the value of a Roi's OBJECT_TYPE property.static RegionRequestGet a RegionRequest by reading the json representation stored as a property in the image.static booleanhasDefaultRoiName(Roi roi) Check whether the name of a Roi matches any (non-null) value of DEFAULT_ROI_NAME.static voidputMeasurement(Roi roi, String name, double value) Set a property storing a QuPath object measurement within a specified Roi.static StringsetClassification(Roi roi, String classification) Set a property storing a QuPath object classification within a specified Roi.static StringsetClassification(Roi roi, PathObject pathObject) Set a property storing a QuPath object classification within a specified Roi.static StringsetDefaultRoiName(Roi roi, String name) Set the value of the DEFAULT_ROI_NAME property.static StringsetImageBackground(ImagePlus imp, ImageData.ImageType imageType) Set theIMAGE_BACKGROUNDproperty as"dark"for fluorescence images or"light"for brightield images; otherwise, do nothing.static StringsetImageRegion(ImagePlus imp, ImageRegion region) Set the IMAGE_REGION_ROOT property as a string representation of the region's bounding box.static StringsetImageType(ImagePlus imp, ImageData.ImageType imageType) Set theIMAGE_TYPEproperty based on the name of QuPath's image type, if available.static StringsetObjectId(Roi roi, UUID id) Set a property storing a QuPath object ID within a specified Roi.static StringsetObjectId(Roi roi, PathObject pathObject) Set a property storing a QuPath object ID within a specified Roi.static StringsetObjectName(Roi roi, String name) Set a property storing a QuPath object name within a specified Roi.static StringsetObjectName(Roi roi, PathObject pathObject) Set a property storing a QuPath object name within a specified Roi.static StringsetObjectType(Roi roi, PathObject pathObject) Set a property storing the type of an object (e.g.static StringSet the object type property of a Roi to indicate it should be an annotation in QuPath.static StringsetObjectTypeCell(Roi roi) Set the object type property of a Roi to indicate it should be a cell in QuPath.static StringSet the object type property of a Roi to indicate it should be a cell nucleus in QuPath.static StringSet the object type property of a Roi to indicate it should be an detection in QuPath.static StringsetObjectTypeTile(Roi roi) Set the object type property of a Roi to indicate it should be a tile in QuPath.static StringsetRegionRequest(ImagePlus imp, RegionRequest request) Store a json representation of a RegionRequest as a property in an image.
-
Field Details
-
IMAGE_TYPE
Key for anImagePlusproperty to store a string representing a QuPathImageData.ImageType.- See Also:
-
IMAGE_BACKGROUND
-
BACKGROUND_DARK
Property value for IMAGE_BACKGROUND when an image is known to have a dark background.- See Also:
-
BACKGROUND_LIGHT
Property value for IMAGE_BACKGROUND when an image is known to have a light background.- See Also:
-
IMAGE_REGION_ROOT
Key for aImagePlusproperties to store the bounding box of a QuPathImageRegion. Each value (x, y, width, height) is stored as a separate entry.- See Also:
-
IMAGE_REQUEST
Key for anImagePlusproperty to store a json representation of aRegionRequestused to request the image.- See Also:
-
OBJECT_CLASSIFICATION
Set property forPathObject.getClassification()()}- See Also:
-
OBJECT_NAME
-
OBJECT_TYPE
-
OBJECT_ID
-
OBJECT_MEASUREMENT_ROOT
Base for property names that store measurements to be added toPathObject.getMeasurements(). The measurement name should be in the formatOBJECT_MEASUREMENT_ROOT + namewherenamemust not contain any spaces or newlines.- See Also:
-
DEFAULT_ROI_NAME
Property to store the name for aRoi. The purpose of this is to allow QuPath to set the name of aRoifor processing within ImageJ, but then identify whether that name has been changed within ImageJ or not.It addresses the problem of figuring out when the name of a
Roishould be used to update a QuPath object (because the name was intentionally set elsewhere), and when it should not.- See Also:
-
-
Constructor Details
-
IJProperties
public IJProperties()
-
-
Method Details
-
setImageRegion
Set the IMAGE_REGION_ROOT property as a string representation of the region's bounding box.This also stores additional properties under
"qupath.image.region.x","qupath.image.region.y","qupath.image.region.width"and"qupath.image.region.height"to encode the values separately, in addition to"qupath.image.region.downsample"if available.- Parameters:
imp-region-- Returns:
- the value that was set for the property, or null if the region was null
-
getImageRegion
Get the IMAGE_REGION_ROOT property, if set.- Parameters:
imp-- Returns:
- the image region stored in the image properties, or null if a valid region could not be found
-
setRegionRequest
Store a json representation of a RegionRequest as a property in an image.- Parameters:
imp- the imagerequest- the request that corresponds to the image- Returns:
- the json representation that is stored
- See Also:
-
getRegionRequest
Get a RegionRequest by reading the json representation stored as a property in the image.- Parameters:
imp- the image- Returns:
- the RegionRequest, or null if none is found
- See Also:
-
setImageType
Set theIMAGE_TYPEproperty based on the name of QuPath's image type, if available.- Parameters:
imp-imageType-- Returns:
- the value that was set for the property, or null if it was not set
-
setImageBackground
Set theIMAGE_BACKGROUNDproperty as"dark"for fluorescence images or"light"for brightield images; otherwise, do nothing.- Parameters:
imp-imageType-- Returns:
- the value that was set for the property, or null if it was not set
-
getImageBackground
-
setClassification
Set a property storing a QuPath object classification within a specified Roi.- Parameters:
roi- the roi with the property to setpathObject- the object whose classification should be stored- See Also:
-
setClassification
-
getClassification
-
setObjectName
Set a property storing a QuPath object name within a specified Roi.- Parameters:
roi- the roi with the property to setpathObject- the object whose name should be stored- See Also:
-
setObjectName
-
getObjectName
-
setDefaultRoiName
-
getDefaultRoiName
-
hasDefaultRoiName
Check whether the name of a Roi matches any (non-null) value of DEFAULT_ROI_NAME.- Parameters:
roi- the roi to query- Returns:
- true if the default Roi name is not null, and matches the name of the Roi
-
setObjectId
Set a property storing a QuPath object ID within a specified Roi.- Parameters:
roi- the roi with the property to setpathObject- the object whose ID should be stored- Returns:
- a string representation of the object id
- See Also:
-
setObjectId
-
getObjectId
-
setObjectType
Set a property storing the type of an object (e.g. annotation, detection, cell), optionally appending an additional string.- Parameters:
roi- the roi with the property to setpathObject- the object whose type should be set- Returns:
- a string representation of the object type
- See Also:
-
setObjectTypeAnnotation
-
setObjectTypeDetection
-
setObjectTypeTile
-
setObjectTypeCell
-
setObjectTypeCellNucleus
Set the object type property of a Roi to indicate it should be a cell nucleus in QuPath.Note that this may be useful for ImageJ, but it is not possible to create a QuPath cell object from a single nucleus ROI.
- Parameters:
roi- the ImageJ roi- Returns:
- the string representing the object type
-
getObjectType
-
getObjectCreator
Get a function to create a new object based upon the stored object type property, if available.Note that not all object types can be created in this way (e.g., it isn't possible to create a root object or TMA core object; it also isn't possible to create a cell containing a nucleus only, but rather only a detection).
- Parameters:
roi- the Roi that may contain an object type property- Returns:
- an optional that contains an object creator, if known
-
getObjectCreator
Get a function to create a new object based upon a property value of OBJECT_TYPE.Note that not all object types can be created in this way (e.g., it isn't possible to create a root object or TMA core object; it also isn't possible to create a cell containing a nucleus only, but rather only a detection).
- Parameters:
typeString- the type string, as would be set bysetObjectType(Roi, PathObject)- Returns:
- an optional that contains an object creator, if known
-
putMeasurement
-
getMeasurement
Get a measurement stored as a property. The property name will begin withOBJECT_MEASUREMENT_ROOTbut the name supplied here need only be the measurement name appended to this.- Parameters:
roi- the roi that may contain the measurement as a propertyname- the measurement name- Returns:
- the measurement if it is found, or null otherwise
- See Also:
-
getAllMeasurements
Get all QuPath object measurements found in the properties of a Roi. These are properties with names that start withOBJECT_MEASUREMENT_ROOTand contain a numeric value that can be parsed.- Parameters:
roi- the Roi to query- Returns:
- a map of all measurements that could be found, or an empty map if none are found
- See Also:
-