Hi all, I am working with medical volume data, and I want to initially reorient the volume so it is always in the axial view. As far as I can see there are two ways I could do this. Either using vtkImageReslice, which I already use to account for gantry tilt. The second would be setting a transform on the vtkVolume with setUserTransform.
What is the recommended way? Are there any obvious disadvantages with one method? Personally I would prefer using vtkImageReslice, but of course it has a small performance overhead.
vtkImageReslice reorients the actual dataset and gives you a new oriented data object. The SetUserTransform applies the transform right before rendering but doesn’t affect the data object directly. So, if you have downstream filters/pipeline that needs oriented image data, use vtkImageReslice. If you just need to reorient for rendering, use transforms. Hth
I would just add that gantry tilt is not the only irregularity that you need to prepare your reader for. For example, slice spacing may be varying, or slices of a series may not be all parallel (they may rotate around an axis). Slices can actually be artbitrarily positioned and rotated across the series. You also need to be able to group the slices of a series according to various DICOM tags (timestamps, cardiac phase, repetition time, instance number, trigger time, echo time, flip angle, B-value, etc.) before forming volumes from them.
So, whether to use vtkImageReslice or you can manage with a single linear transform is the least of your worries. As @sankhesh described, if all you need to apply is a simple linear transform and you don’t need to run any processing then you can use the SetUserTransform for rendering. You need to be careful because for example the CPU and GPU volume raycast mapper uses the UserTransform slightly differently: one uses it for rescaling the resampling distance, while the other doesn’t. In less trivial cases you must use vtkImageReslice. If slices intersect then you cannot even use vtkImageReslice, but you need to paste each slice into the volume.
In 3D Slicer we use all three methods: vtkUserTransform if under linear transform, vtkImageReslice with a grid transform for gantry tilt and variable spacing, and IGSIO library’s volume reconstructor if slices intersect.