# MIPs using reslice.SetSlabModeToMax()

**URL:** <https://discourse.slicer.org/t/mips-using-reslice-setslabmodetomax/12104>\
**Category:** Development\
**Created:** [June 18, 2020, 10:10pm UTC](https://discourse.slicer.org/t/mips-using-reslice-setslabmodetomax/12104 "2020-06-18T22:10:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohan\_n](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rohan_n/32/78474_2.png) [@rohan\_n](https://discourse.slicer.org/u/rohan_n)\
**Post date:** [June 18, 2020, 10:10pm UTC](https://discourse.slicer.org/t/mips-using-reslice-setslabmodetomax/12104/1 "2020-06-18T22:10:30Z")

</div>

Can someone please explain how the SetSlabNumberOfSlices feature works for displaying MIPs as shown here:  
[https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Thick\_slab\_reconstruction\_and\_maximum.2Fminimum\_intensity\_volume\_projections](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Thick_slab_reconstruction_and_maximum.2Fminimum_intensity_volume_projections)

I tried doing this to have the MIP cover just enough slices for the entire volume:

```
inputVolume = self.inputSelector.currentNode()
img = inputVolume.GetImageData()
rows,cols,slices = img.GetDimensions()
sliceNodeRed = slicer.mrmlScene.GetNodeByID('vtkMRMLSliceNodeRed')
appLogic = slicer.app.applicationLogic()
sliceLogicRed = appLogic.GetSliceLogic(sliceNodeRed)
sliceLayerLogicRed = sliceLogicRed.GetBackgroundLayer()
resliceRed = sliceLayerLogicRed.GetReslice()
resliceRed.SetSlabModeToMax()
resliceRed.SetSlabNumberOfSlices(slices) 
sliceNodeRed.Modified()

```

But that doesn’t appear to work as intended and I end up having to use a very large value for slab # of slices, like 600.  
If I’m doing something similar for the yellow slice because I want to display sagittal MIPs, how would I set slab # of slices so that there is one sagittal MIP for the left half of the volume and another sagittal MIP for the right half?

Thanks,  
Rohan Nadkarni

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [June 20, 2020, 4:43am UTC](https://discourse.slicer.org/t/mips-using-reslice-setslabmodetomax/12104/2 "2020-06-20T04:43:59Z")

</div>

> [@rohan\_n](#):
>
> But that doesn’t appear to work as intended and I end up having to use a very large value for slab # of slices, like 600.

For a MIP covering an entire volume 600 slices sounds reasonable. If you want to generate MIP in real-time, I would recommend to use Volume Rendering module with Display / Rendering → `GPU Ray Casting`; and Advanced / Techniques / Technique → `Maximum Intensity Projection`.
