# How to create MIP images from the command line?

**URL:** <https://discourse.slicer.org/t/how-to-create-mip-images-from-the-command-line/13435>\
**Category:** Support\
**Created:** [September 11, 2020, 8:22am UTC](https://discourse.slicer.org/t/how-to-create-mip-images-from-the-command-line/13435 "2020-09-11T08:22:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [September 11, 2020, 8:22am UTC](https://discourse.slicer.org/t/how-to-create-mip-images-from-the-command-line/13435/1 "2020-09-11T08:22:01Z")

</div>

Hello Dear Developers and Users

Can the **MIP viewer** module be run from the command line?  
In other words, how can I generate axial MIP images from _the command line_ by setting **Slice Size MIP** in any way possible?

Please guide me.  
Thanks a lot.  
Shahrokh.

---

<div class="post-metadata">

**Author:** ![Andinet\_Enquobahrie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/andinet_enquobahrie/32/75_2.png) [@Andinet\_Enquobahrie](https://discourse.slicer.org/u/Andinet_Enquobahrie)\
**Post date:** [September 11, 2020, 1:37pm UTC](https://discourse.slicer.org/t/how-to-create-mip-images-from-the-command-line/13435/2 "2020-09-11T13:37:20Z")

</div>

Hello @shahrokh

One option is to write a python script to generate the MIP and write out the resliced image output to a file.

[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)

You can then run your python script using --python-script command line option in Slicer.

-Andinet

---

<div class="post-metadata">

**Author:** ![shahrokh](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/shahrokh/32/1499_2.png) [@shahrokh](https://discourse.slicer.org/u/shahrokh)\
**Post date:** [September 13, 2020, 12:58pm UTC](https://discourse.slicer.org/t/how-to-create-mip-images-from-the-command-line/13435/3 "2020-09-13T12:58:46Z")

</div>

Hello Andinet

Thank you very much for your guidance. I have some questions about the concept of **MIP** that I hope you will guide me, perhaps I should not ask my question in here.

Thanks a lot for your help. To create the MIP images, I used the Python code provided on github:  
Title: GitHub - ljpadam/maximum\_intensity\_projection: Maximum intensity projection for medical image  
Address: [GitHub - ljpadam/maximum\_intensity\_projection: Maximum intensity projection for medical image](https://github.com/ljpadam/maximum_intensity_projection)

I think that the **slices\_num** parameter in the _maximum\_intensity\_projection.py_ code (in the above link) is similar to the **Slice size MIP** in the module of **MIP Viewer**. Is it true?

As you can see in the following image, if I increase **slices\_num** in the code of _maximum\_intensity\_projection.py_ or **Slice Size MIP** in 3DSlicer, more arteries will be projected in the axial slice.

 ![new](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/4/94213b37a164b0d2740496aa1a712334eba5d483.png)

This destroys the vascular view in the coronal slice as you can see in the following image:

 ![new2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/5/b5b6bb38270f6b2b55227f4b1e6ca63e0c2994a2.png)

Is this situation unavoidable in a MIP view?

How can I have good quality of MIPs in the three directions (AP, IS and LR)?

Please guide me.  
Thanks a lot.  
Shahrokh.

---

<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:** [September 13, 2020, 1:44pm UTC](https://discourse.slicer.org/t/how-to-create-mip-images-from-the-command-line/13435/4 "2020-09-13T13:44:40Z")

</div>

> [@shahrokh](#):
>
> To create the MIP images, I used the Python code provided on github:  
> Title: GitHub - ljpadam/maximum\_intensity\_projection: Maximum intensity projection for medical image  
> Address: [GitHub - ljpadam/maximum\_intensity\_projection: Maximum intensity projection for medical image](https://github.com/ljpadam/maximum_intensity_projection)

This code, as is, does not make a lot of sense, as it does thick slice reformat for every slice of a volume. However, you could easily change it to compute the maximum intensity for all slices and along any of the 3 images axes.

If you need arbitrarily oriented views then I would recommend to use the script that @Andinet_Enquobahrie linked above. If you need perspective projection (to simulate fluoroscopy images) or you need fast MIP generation (50-100 images per second) and 8 bit precision is enough then you can use the volume renderer.
