3D View interactive ROI Cropping

@lassoan

OK, this function seems to be working. I found a way to expose and use moveAllPoints…

newPresetPosition = self.ui.RenderShiftSlider.value * self.scalarRange[1] # scalar Range set in showVolumeRendering() function

volumePropertyNodeWidget.moveAllPoints(newPresetPosition - self.OldPresetPosition, 0, False)    
self.OldPresetPosition = newPresetPosition

However, my slider values range from 0 to 1.0. MoveAllPoint takes delta value of a range much greater than 0 to 1. Therefore, I’m using the slider value as a scale factor for a bigger range. Here, I am using the scalar range of the volume as the max. That’s much too big in most cases (CT range from -3500 to 3500).

How can I find exactly what value to multiply by my scalar?

Thanks

In the volume rendering module, we only use offset to map the transfer functions to a particular volume, and we don’t use scaling. I’m not exactly why this is the case, but most likely because scaling is just not necessary, as you choose a preset based on the scalar range of the image (255 → ultrasound; several hundred → MRI; few thousand → CT) and you adjust the offset to accommodate for small acquisition or patient specific differences. Maybe @pieper or @finetjul remembers why exactly this decision was made.

It could be an interesting study to evaluate the usefulness of applying scaling to the transfer functions - for example, to have “universal” transfer functions that can be applied to multiple modalities. But maybe evaluating and tuning existing presets (and maybe implementing logic for automatically recommending the best preset) for your clinical use cases would make a bigger practical impact.

The Volume Rendering module has evolved over the years based mostly on trial and error, where people have ideas about what might work or inspiration from other programs and try to make something useful. There are lots of ways it could be improved but no particular formula to indicate which changes will be better for a wide range of images.

1 Like

@pieper @lassoan

I’m just trying to duplicate exactly how your shift function works in Slicer. But, I can’t determine what exactly VolumePropertyWidget->moveAllPoints does underneath the hood. Sounds like I’m doing something wrong here. Using your method of searching for code, am I correct by using moveAllPoints to shift?

FYI: My slider is defined exactly like PresetOffsetSlider

Thanks

The offset slider in Volume Rendering module just adds/subtract a value from the x coordinate of thr control points (does not multiply the coordinate with a value).