# MIP - Max Intensity Projection with Bones

**URL:** <https://discourse.vtk.org/t/mip-max-intensity-projection-with-bones/10220>\
**Category:** Development\
**Tags:** python\
**Created:** [December 16, 2022, 7:07am UTC](https://discourse.vtk.org/t/mip-max-intensity-projection-with-bones/10220 "2022-12-16T07:07:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tigerhu7](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tigerhu7/32/7613_2.png) [@tigerhu7](https://discourse.vtk.org/u/tigerhu7)\
**Post date:** [December 16, 2022, 7:07am UTC](https://discourse.vtk.org/t/mip-max-intensity-projection-with-bones/10220/1 "2022-12-16T07:07:31Z")

</div>

Dear All, I am working on a project on visualizating MIP of carotid-cerebral arteries of two types, namely with bone shown and without. The results are like these.  
 ![QQ截图20221216145034](https://discourse.vtk.org/uploads/default/original/2X/4/4814bbc363eff720dd6e6d0b320951ae0853d31b.png)  
 ![QQ截图20221216145046](https://discourse.vtk.org/uploads/default/original/2X/8/8f3a990dba6ba6651c9bd7dfa6499e3ce7be068a.png)

Here, I succeeded in vislualization top image ( removing bones by a high intensity threshold and mip )

> Class vtkFixedPointVolumeRayCastMapper

code are as the following

> volumeMapper = vtk.vtkFixedPointVolumeRayCastMapper()  
> volumeMapper.SetInputConnection( vtkImage.GetOutputPort())  
> volumeMapper.SetBlendModeToMaximumIntensity()

But in order to get the second one, I used the same class on image (with bones), and only to get a bright silouette. Then I realized it is the intensity of bones that is shown in this mip image.  
Later, I think I could achieve if by generating a No-Bones MIP, and on top of it, laying one slice of bone image (like image blending).  
However, after searching quite a while, I could not make it.  
Please help me if you know how to finish this blending process in VTK.  
Any hint and suggestion is appreciated.  
Thanks in Advance!!

---

<div class="post-metadata">

**Author:** ![tigerhu7](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tigerhu7/32/7613_2.png) [@tigerhu7](https://discourse.vtk.org/u/tigerhu7)\
**Post date:** [December 16, 2022, 10:01am UTC](https://discourse.vtk.org/t/mip-max-intensity-projection-with-bones/10220/2 "2022-12-16T10:01:26Z")

</div>

Reply to myself,  
I found that to get carotid-cerebral mip, it is not possible to get max intensity through whole image.  
A thickness needed to choose before conducting mip.

---

<div class="post-metadata">

**Author:** ![sankhesh](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sankhesh/32/73_2.png) [@sankhesh](https://discourse.vtk.org/u/sankhesh)\
**Post date:** [December 16, 2022, 3:44pm UTC](https://discourse.vtk.org/t/mip-max-intensity-projection-with-bones/10220/3 "2022-12-16T15:44:25Z")

</div>

Do you have two different datasets - with and without bones?

I recommend using `vtkGPUVolumeRayCastMapper` instead of the `vtkFixedPointVolumeRayCastMapper`. The mapper can also do an average intensity projection which might give you better results in the first case.

---

<div class="post-metadata">

**Author:** ![tigerhu7](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tigerhu7/32/7613_2.png) [@tigerhu7](https://discourse.vtk.org/u/tigerhu7)\
**Post date:** [December 19, 2022, 1:53am UTC](https://discourse.vtk.org/t/mip-max-intensity-projection-with-bones/10220/4 "2022-12-19T01:53:11Z")

</div>

Dear Sankhesh,  
Thank you for your reply.  
I have one dataset (initially with bones)  
Unfortunately, I dot not have GPU, I am afraid I cant use vtkGPUVolumeRayCastMapper.  
I find that

> vtkImageSlabReslice

might be the right function to do this job, and I found one example written in C++. Code will be like

> vtkNew reslice;  
> reslice-\>SetInputConnection(reader-\>GetOutputPort());  
> reslice-\>SetOutputDimensionality(2);  
> reslice-\>SetResliceAxes(resliceAxes);  
> reslice-\>SetInterpolationModeToLinear();  
> reslice-\>SetSlabThickness(20);  
> reslice-\>SetBlendModeToMax();  
> reslice-\>Update();

I will try to convert it into python.  
Thanks for your suggestion anyway.

---

<div class="post-metadata">

**Author:** ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)\
**Post date:** [December 19, 2022, 11:47am UTC](https://discourse.vtk.org/t/mip-max-intensity-projection-with-bones/10220/5 "2022-12-19T11:47:57Z")

</div>

Slab rendering can also be done with [vtkImageResliceMapper](https://vtk.org/doc/nightly/html/classvtkImageResliceMapper.html). For an example of how to use, see [TestResliceMapperSlab.cxx](https://gitlab.kitware.com/vtk/vtk/-/blob/master/Rendering/Image/Testing/Cxx/TestImageResliceMapperSlab.cxx).

```cpp
    vtkNew<vtkImageResliceMapper> imageMapper;
    imageMapper->SetInputConnection(reader->GetOutputPort());
    imageMapper->SetSlabTypeToMax();
    imageMapper->SetSlabThickness(20);
    imageMapper->SliceFacesCameraOn();

    vtkNew<vtkImageSlice> image;
    image->SetMapper(imageMapper);
    image->GetProperty()->SetInterpolationTypeToLinear();
    image->GetProperty()->SetColorWindow(2000);
    image->GetProperty()->SetColorLevel(1000);

    renderer->AddViewProp(image);

```

---

<div class="post-metadata">

**Author:** ![tigerhu7](https://discourse.vtk.org/user_avatar/discourse.vtk.org/tigerhu7/32/7613_2.png) [@tigerhu7](https://discourse.vtk.org/u/tigerhu7)\
**Post date:** [January 28, 2023, 2:19am UTC](https://discourse.vtk.org/t/mip-max-intensity-projection-with-bones/10220/6 "2023-01-28T02:19:21Z")

</div>

Dear David,  
Thank you so much for your suggestion.  
I will give it a try!!
