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

**URL:** <https://discourse.slicer.org/t/2d-mip-maximum-intensity-projection-not-works-in-slicer-5-6-1/36272>\
**Category:** Support\
**Created:** [May 20, 2024, 6:55am UTC](https://discourse.slicer.org/t/2d-mip-maximum-intensity-projection-not-works-in-slicer-5-6-1/36272 "2024-05-20T06:55:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![park](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/park/32/5717_2.png) [@park](https://discourse.slicer.org/u/park)\
**Post date:** [May 20, 2024, 6:55am UTC](https://discourse.slicer.org/t/2d-mip-maximum-intensity-projection-not-works-in-slicer-5-6-1/36272/1 "2024-05-20T06:55:36Z")

</div>

Hi all,

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

```auto
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 ?

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 20, 2024, 2:49pm UTC](https://discourse.slicer.org/t/2d-mip-maximum-intensity-projection-not-works-in-slicer-5-6-1/36272/2 "2024-05-20T14:49:30Z")

</div>

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.

> <https://github.com/Slicer/Slicer/commit/530b8fcdca4987533a03cfc9361585007883808b>
>
> This commit updates the Slice Controller widget adding controls for
> enabling th…e Thick Slab Reconstruction (TSR), selecting the reconstruction
> type (max, min, mean, sum) as well as adjusting the slab thickness.
> 
> It also updates the DataProbe/SlicerViewAnnotations to allow displaying
> the slab type and thickness.
> 
> It updates the Slice node adding the following properties:
> \* SlabReconstructionEnabled
> \* SlabReconstructionType
> \* SlabReconstructionThickness
> \* SlabReconstructionOversamplingFactor
> 
> Finally, it also updates vtkMRMLSliceNodeTest adding the following tests:
> \* SlabReconstructionEnabledTest
> \* SlabReconstructionTypeTest
> \* SlabReconstructionThicknessTest
> 
> Co-authored-by: Jean-Christophe Fillion-Robin \<jchris.fillionr@kitware.com\>

---

<div class="post-metadata">

**Author:** ![park](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/park/32/5717_2.png) [@park](https://discourse.slicer.org/u/park)\
**Post date:** [May 28, 2024, 8:02am UTC](https://discourse.slicer.org/t/2d-mip-maximum-intensity-projection-not-works-in-slicer-5-6-1/36272/3 "2024-05-28T08:02:32Z")

</div>

I got a solution about this

```auto

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

```

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [May 28, 2024, 6:47pm UTC](https://discourse.slicer.org/t/2d-mip-maximum-intensity-projection-not-works-in-slicer-5-6-1/36272/4 "2024-05-28T18:47:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Antmaker](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/antmaker/32/81424_2.png) [@Antmaker](https://discourse.slicer.org/u/Antmaker)\
**Post date:** [April 15, 2026, 3:20am UTC](https://discourse.slicer.org/t/2d-mip-maximum-intensity-projection-not-works-in-slicer-5-6-1/36272/5 "2026-04-15T03:20:29Z")

</div>

I have created [PR #9113](https://github.com/Slicer/Slicer/pull/9113) for this. However, I have a question on how to update the script and thus have started a review in the PR.

Thank you @park for the code.
