# Run a 3D Slicer module multiple times on different scans

**URL:** <https://discourse.slicer.org/t/run-a-3d-slicer-module-multiple-times-on-different-scans/28726>\
**Category:** Support\
**Created:** [April 3, 2023, 11:29am UTC](https://discourse.slicer.org/t/run-a-3d-slicer-module-multiple-times-on-different-scans/28726 "2023-04-03T11:29:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahulhere](https://avatars.discourse-cdn.com/v4/letter/r/5f8ce5/32.png) [@rahulhere](https://discourse.slicer.org/u/rahulhere)\
**Post date:** [April 3, 2023, 11:29am UTC](https://discourse.slicer.org/t/run-a-3d-slicer-module-multiple-times-on-different-scans/28726/1 "2023-04-03T11:29:49Z")

</div>

Hi Team,

I need to use the N4ITK MRI Bias correction module of 3D slicer. I have multiple scans on which I want to use the Module. Is there a way to automate running the module on multiple scans (looping basically) and also saving the results back to the system ?

Thanks a lot in Advance.

---

<div class="post-metadata">

**Author:** ![rbumm](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/rbumm/32/9404_2.png) [@rbumm](https://discourse.slicer.org/u/rbumm)\
**Post date:** [April 3, 2023, 12:12pm UTC](https://discourse.slicer.org/t/run-a-3d-slicer-module-multiple-times-on-different-scans/28726/2 "2023-04-03T12:12:41Z")

</div>

Absolutely, but there is a Python script required to establish this. It needs to be run from the 3D Slicer Python Console.  
See [how we did](https://github.com/rbumm/SlicerLungCTAnalyzer/blob/66dfec4b810f38a2b4fd1a6e6af53815b398d874/LungCTAnalyzer/LungCTAnalyzer.py#L735) it for the Lung CT Analyzer extension. You recursively scan your input directory for input files, process them, and save results to the output folder.

---

<div class="post-metadata">

**Author:** ![marwanabb](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/marwanabb/32/65584_2.png) [@marwanabb](https://discourse.slicer.org/u/marwanabb)\
**Post date:** [April 11, 2023, 2:38pm UTC](https://discourse.slicer.org/t/run-a-3d-slicer-module-multiple-times-on-different-scans/28726/3 "2023-04-11T14:38:10Z")

</div>

This link might be useful also : [How to segment multiple volumes at once?](https://discourse.slicer.org/t/how-to-segment-multiple-volumes-at-once/10280)
