I want to implement an image plugin that generates and displays image on the fly with a parameter derived from the position of a slider. Is it possible to make use of the slider control above the viewport and override the default behavior that sets the slicing position along a certain vector?
For example, if I am to implement a straightened CPR image plugin that takes the abscissa on the centerline as the parameter, and generates an sliced image on the fly, I want to override the slider control to make its minimal value 0mm and maximal value the arclen of the centerline, and the behavior of moving that slider would be a callback to a function that generates a new image and replaces current viewport by the position of the slider.
Another example, if I am to implement a non-volumetric dicom image stack plugin that takes the index of the image in the stack as the parameter, I want to make the slider control take minimal value of 0 and maximal value of len(stack), and the behavior of moving that slider would be replacing current viewport with some .
P.S: Non-volumentric dicom image stacks are common here in clinical practice relating to intervertebral discs. The technician scans along the axis of each intervertebral disc for, like 3 slices, and stacks the images from all intervertebral discs into one series. So this series as whole would not be compatible with volumetric image, but splitting them into groups of 3 images would be also too overwhelming for viewing purpose.
Actually, Slicer reconstructs a volume from these arbitrarily spaced and oriented slices on-the-fly! So, you can browse the sparse volume using parallel slices. (If the slices intersect then Volume reconstruction module of IGSIO extension can be used to create a meaningful 3D volume, but this is probably not worth the trouble.)
However, if you don’t want to do this then you can load the image slices as a sequence. It may not be the default interpretation of the series, so you may need to use the “Advanced” option in the DICOM module to load them as a sequence. You can add a custom DICOM reader plugin that recognizes your very special kind of acquisition type and make it loaded as a sequence by default.
You can browser the slices using the slider on the sequence toolbar. You can also put a sequence browser widget on your module’s GUI. If you want the sequence browser appear in the slice view controller then you need to hack a little (hide the slice offset slider and add a slicer.qMRMLSequenceBrowserSeekWidget or a Qt slider there).
Once the frames are loaded as a sequence, you can use VolumeResliceDriver module to make a slice view move along with the slice position/orientation.
All these could be nicely implemented in a Python scripted module. If you accept the challenge of implementing this then you could create a new “CurvedPlanarReformat” extension, move the “Curved Planar Reformat” module into that extension, and add these improved browsing features to that module. You could also add the custom DICOM importer plugin to that extension (that recognizes your kind of MR series and load them as a sequence by default).