ENH: Use the latest vtkImageReslice filter instead of vtkImageResliceMask
Features:
- Performance optimization: about 2x speed increase in slice rendering speed when the volume is linearly transformed (e.g., transformed MRHead refresh rate 25fps -> 50fps)
- Thick slices, MIP, DRR, etc. display modes are available (no GUI yet, but already can be enabled using Python), see the code samples below
Implementation:
- Convert composite transform to simple linear filter before setting it in the reslice filter (because vtkImageResliceMask can do some additional optimizations if it gets a simple linear transform)
- Use the latest vtkImageReslice filter instead of vtkImageResliceMask: ** mask output of vtkImageReslice is a stencil, therefore slice processing pipeline is simplified: vtkImageCast filter is not needed anymore and the more efficient vtkImageStencil is used instead of vtkImageMathematics ** custom vtkImageResliceMask class is removed: no need to maintain it any longer, etc.
Thick slice:
sliceNode = slicer.mrmlScene.GetNodeByID('vtkMRMLSliceNodeRed') appLogic = slicer.app.applicationLogic() sliceLogic = appLogic.GetSliceLogic(sliceNode) sliceLayerLogic = sliceLogic.GetBackgroundLayer() reslice = sliceLayerLogic.GetReslice() reslice.SetSlabModeToMean() reslice.SetSlabNumberOfSlices(10) reslice.SetSlabSliceSpacingFraction(0.3) sliceNode.Modified()
Maximum intensity projection (MIP):
sliceNode = slicer.mrmlScene.GetNodeByID('vtkMRMLSliceNodeRed') appLogic = slicer.app.applicationLogic() sliceLogic = appLogic.GetSliceLogic(sliceNode) sliceLayerLogic = sliceLogic.GetBackgroundLayer() reslice = sliceLayerLogic.GetReslice() reslice.SetSlabModeToMax() reslice.SetSlabNumberOfSlices(600) reslice.SetSlabSliceSpacingFraction(0.5) sliceNode.Modified()