use of qupath.lib.objects.classes.PathClass in project qupath by qupath.
the class ColorToolsFX method getDisplayedColorARGB.
/**
* Get the color with which an object should be displayed, as a packaged ARGB integer.
*
* This could be stored internally, or obtained from its PathClass.
*
* If neither of these produces a result, a default color will be returned based on PathPrefs
* for the specific (Java) class of the PathObject.
*
* Assuming PathPrefs does not contain any nulls, this will therefore not return nulls either.
*
* @param pathObject
* @return
*/
public static Integer getDisplayedColorARGB(final PathObject pathObject) {
// Check if any color has been set - if so, return it
Integer color = pathObject.getColorRGB();
if (color != null)
return color;
// Check if any class has been set, if so then use its color
PathClass pathClass = pathObject.getPathClass();
if (pathClass != null)
color = pathClass.getColor();
if (color != null)
return color;
if (pathObject instanceof PathTileObject)
return PathPrefs.colorTileProperty().getValue();
if (pathObject instanceof TMACoreObject) {
if (((TMACoreObject) pathObject).isMissing())
return PathPrefs.colorTMAMissingProperty().getValue();
else
return PathPrefs.colorTMAProperty().getValue();
}
return PathPrefs.colorDefaultObjectsProperty().getValue();
}
Aggregations