-
Notifications
You must be signed in to change notification settings - Fork 337
Nested detections render poorly when filled #2112
Copy link
Copy link
Open
Description
Bug report
Describe the bug
When detections are nested in the object hierarchy, their opacity is adjusted too eagerly - with the result that the appearance can be very odd.
This was (I think) introduced so that subcellular detections could be seen more easily, but it isn't good general behavior.
To Reproduce
Steps to reproduce the behavior:
- Open an image and create a selected rectangle annotation
- Run the following script
var pathObject = getSelectedObject()
var roi = pathObject?.getROI()
if (roi == null || !roi.isArea())
throw new RuntimeException("I need an area ROI!")
pathObject.clearChildObjects()
for (int i = 0; i < 3; i++) {
double diam = Math.min(roi.getBoundsWidth(), roi.getBoundsHeight())
roi = RoiTools.buffer(roi, -diam / 4.0)
var newObject = PathObjects.createDetectionObject(roi, getPathClass("Class " + i))
pathObject.addChildObject(newObject)
pathObject = newObject
}- Check how it appears in the viewer - including with 'Fill detections' toggled on.
Expected behavior
Two things should improve:
- The default behavior should (at most) adjust the opacity in a more reserved way that is more general. Making no opacity changes with nested objects is probably undesirable, since there is a risk of masking child objects entirely.
- Metadata values for
fillOpacityshould be respected.
The second refers to a trick that QuPath can use to smuggle in object-specific rendering hints.
Adding the following line to the script can change the default opacity of the objects
newObject.metadata['fillOpacity'] = '1'but this doesn't have any influence upon how the opacity is adjusted when the objects are nested. I think that probably setting the metadata should enable the opacity to be locked, irrespective of nesting.
Screenshots
Desktop (please complete the following information):
- OS: macOS (but all)
- QuPath Version: v0.7.0 (and earlier)
Reactions are currently unavailable