smistad / FAST

A framework for high-performance medical image processing, neural network inference and visualization
https://fast.eriksmistad.no
BSD 2-Clause "Simplified" License
433 stars 101 forks source link

Bug: Fixed setColor(s) for SegmentationLabelRenderer #149

Closed andreped closed 2 years ago

andreped commented 2 years ago

I believe this used to work before SegmentationRenderer and SegmentationPyramidRenderer were merged. Perhaps it is due to the introduction (?) of SegmentationLabelRenderer, which I was not aware of.

Anyways, AFAIK, the correct way of setting colors such that they can be properly updated later on, is to use setModified(true). I believe you have told me that having a "local" m_colorsModified is not ideal, as one should use the setModified method, which is used for all other POs, instead.

However, for the createColorUniformBufferObject I wasn't sure if it was correct to simply remove that if-statement. Maybe this function will be run redundantly in other classes? Currently it is only being used in the BoundingBoxRenderer and the SegmentationRenderer.

Anyway, I tested this fix on FastPathology (Windows) and it seems to work well, both for low-res and high-res. But would be nice to know if I should do something else regarding the createColorUniformBufferObject method.

EDIT: I just tested for bounding boxes as well, and that works!

andreped commented 2 years ago

As discussed, having the m_colorsModified was important. I therefore reverted the changes. In the end, the only edits I did were to use setModified(true) and updating the flag m_colorsModified=true when setColor.

Tested again in FP for Windows, and works well for low-res, high-res and bounding box.