openigtlink / SlicerOpenIGTLink

OpenIGTLinkIF module as an Slicer Extension
Other
16 stars 28 forks source link

Volume information not updated when new volume content is received #47

Open ungi opened 6 years ago

ungi commented 6 years ago

When an image is received for the first time, mrml node is created and volume information is computed (min max scalar value). The brightness/contrast of volume display is limited by min and max scalar values. When an image message is received with the same name, the min max scalar values are not updated. So e.g. when the updated image has brighter scalars, those are always white and grayscales cannot be visualized in that range.

How computationally expensive would it be to update the min max scalar values, to reset the thresholds on the brightness/contrast (window/level) sliders in the Volumes module every time the image content is updated by OpenIGTLink?

Sunderlandkyl commented 6 years ago

Interesting... I did some digging and it looks like this happens in the old version of OpenIGTLinkIF (in 4.8.1) as well.

I don't think that updating the scalar range and window/level would be that expensive, but is that necessarily always the desired behaviour (specifically with updating the window/level)?

@lassoan @leochan2009 Thoughts?

lassoan commented 6 years ago

Updating the scalar range is considerable amount of time for volumes, but quick for single slices. Also, scalar range is only computed on request (for example, when auto WW/WL needs it or manually changing WW/WL) and cached in vtkImageData (so only recomputed when image data changes).

So, we don't need to worry about introducing performance problems by properly calling Modified() events when needed. Something like this should work: https://github.com/Slicer/Slicer/blob/3090483f8cec1e068e4a23d0e7ca3fe627a9cd54/Base/Python/slicer/util.py#L760-L769

ungi commented 6 years ago

@Sunderlandkyl you are right this was an issue in 4.8 too, we have tested that too. We were just lucky that usually ultrasound images have a bright line at the transducer rubber, so we got a full range of scalars when we started the connection. This is still a serious issue, because TGC set low on the top of the image, or cropping may result in a totally black initial image.

leochan2009 commented 6 years ago

Hi Tamas,

I think updating the scalar range is not always an desired behavior in OpenIGTLinkIF module, and as it is mentioned by Andras, it will be considerable amount of time for volume data. In the case of Ultrasound images, probably you could write an python script to observe the VolumeNode Modify() event and get the Min/max range of the volume.

lassoan commented 6 years ago

Scalar range is normally NOT computed. It may be computed if auto ww/wl is enabled (but then histogram is computed for as well and that takes much longer than scalar range min/max compute; so scalar range computation should not be an issue) and during manual ww/wl adjustment (you don't normally keep adjusting the ww/wl, so it should not be an issue).