MIPs using reslice.SetSlabModeToMax()

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

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

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.