2D MIP (maximum intensity projection) not works in Slicer 5.6.1

Hi all,

I would like to make maximum intensity projection (MIP) in 2D view
Thus, I tried the code below from the ‘script repository’

sliceNode = slicer.mrmlScene.GetNodeByID("vtkMRMLSliceNodeRed")
appLogic = slicer.app.applicationLogic()
sliceLogic = appLogic.GetSliceLogic(sliceNode)
sliceLayerLogic = sliceLogic.GetBackgroundLayer()
reslice = sliceLayerLogic.GetReslice()
reslice.SetSlabModeToMax()
reslice.SetSlabNumberOfSlices(600) # use a large number of slices (600) to cover the entire volume
reslice.SetSlabSliceSpacingFraction(0.5) # spacing between slices are 0.5 pixel (supersampling is useful to reduce interpolation artifacts)
sliceNode.Modified()

This codes work in Slicer 5.0.3 but not works in 5.6.1, 5.6.2
Could I get a solution about this ?

Slab reconstruction has moved to the core, so operating on the vtkImageResllice directly is no longer the right way.

You should be able to migrate using the info here. It would be great if you could make a PR to the script repository updating to the new approach.

I got a solution about this


sliceNode = slicer.mrmlScene.GetNodeByID("vtkMRMLSliceNodeSlice7")
sliceNode.SetSlabReconstructionEnabled(True)
sliceNode.SetSlabReconstructionOversamplingFactor(VolumeSpacing)
sliceNode.SetSlabReconstructionThickness(thickness)
sliceNode.SetSlabReconstructionType(2) # Mean projection
sliceNode.Modified()
1 Like

Nice! It would be cool if you could update the script repository with your solution.