# Scripted CLI Module simplest set-up

**URL:** <https://discourse.slicer.org/t/scripted-cli-module-simplest-set-up/12186>\
**Category:** Support\
**Created:** [June 23, 2020, 9:34pm UTC](https://discourse.slicer.org/t/scripted-cli-module-simplest-set-up/12186 "2020-06-23T21:34:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Queen\_Rei](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/queen_rei/32/6348_2.png) [@Queen\_Rei](https://discourse.slicer.org/u/Queen_Rei)\
**Post date:** [June 23, 2020, 9:34pm UTC](https://discourse.slicer.org/t/scripted-cli-module-simplest-set-up/12186/1 "2020-06-23T21:34:24Z")

</div>

Hi there, I have a python script that converts a directory of .dcm’s into a .obj.  
In its simplest form the script looks like this:

```
inputFilePath = "My Input File Path"
(Create .obj from .dcm directory)
outputFilePath = "My Output File Path"

```

I was thinking of having the input and output file paths be parameters for a subprocess, so the module can be run multiple times for multiple folder directories of .dcm’s. I am currently running off of the template Andros provided to get a decent understanding. I’ve been looking through other posts, script repos, and the nightly documentation, but I don’t seem to have the clearest view of what I would need to do so I have some questions.

1. Is a .xml file required? I wouldn’t need a GUI for what I want to do. If it is required, then I can just do the basic requirements on the nightly docs, so it still executes?
2. Would making it run in the command line look like so:  
[I’m on Windows and would also like to know for Linux]  
python DICOM2OBJ.py inputPath outputPath  
OR  
“slicer path” --python-code “DICOM2OBJ(inputPath, outputPath”)
3. Considering Slicer is open already, would I need to run another line before the module execution or would the one line be enough?

Happy to clarify anything that needs it~ I am learning about scripted modules only recently, so I want to make sure I get the most updated information. Thank you and stay safe \<3

---

<div class="post-metadata">

**Author:** ![Queen\_Rei](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/queen_rei/32/6348_2.png) [@Queen\_Rei](https://discourse.slicer.org/u/Queen_Rei)\
**Post date:** [June 24, 2020, 1:58pm UTC](https://discourse.slicer.org/t/scripted-cli-module-simplest-set-up/12186/2 "2020-06-24T13:58:31Z")

</div>

I am still stuck on these questions. Any helps goes a long way \<3

---

<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:** [June 24, 2020, 2:21pm UTC](https://discourse.slicer.org/t/scripted-cli-module-simplest-set-up/12186/3 "2020-06-24T14:21:20Z")

</div>

The command line example in the post below should give you an idea. Yes, you can run it as a subprocess launched from Slicer. HTH.

> [@How can I convert DICOM series to NRRD files in batch mode?](https://discourse.slicer.org/t/how-can-i-convert-dicom-series-to-nrrd-files-in-batch-mode/3421/2):
>
> Here is how you can do the conversion in batch mode. First, install mpReview extension. This will add two new modules: mpReview and mpReviewPreprocessor. mpReviewPreprocessor can be used to volume-reconstruct any collection of DICOM files in batch mode using Slicer DICOM plugins. It can be accessed from the Slicer GUI, but you can also run the script as from the command line follows (you will need to update the path to the preprocessor to the on your system after installing the script, or you …

---

<div class="post-metadata">

**Author:** ![BigBrotherHui](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/bigbrotherhui/32/13630_2.png) [@BigBrotherHui](https://discourse.slicer.org/u/BigBrotherHui)\
**Post date:** [December 24, 2021, 8:12am UTC](https://discourse.slicer.org/t/scripted-cli-module-simplest-set-up/12186/4 "2021-12-24T08:12:54Z")

</div>

could you please help me sovle a problem about the bug:“AttributeError: module ‘slicer’ has no attribute ‘dicomDatabaseDirectorySettingsKey’”? i’m not understand the reply they told you in the past post

---

<div class="post-metadata">

**Author:** ![BigBrotherHui](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/bigbrotherhui/32/13630_2.png) [@BigBrotherHui](https://discourse.slicer.org/u/BigBrotherHui)\
**Post date:** [December 24, 2021, 8:14am UTC](https://discourse.slicer.org/t/scripted-cli-module-simplest-set-up/12186/5 "2021-12-24T08:14:02Z")

</div>

> [@Queen\_Rei](#):
>
> Any helps goes a long way \<3

any helps goes a long way for me too

---

<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:** [December 28, 2021, 4:45pm UTC](https://discourse.slicer.org/t/scripted-cli-module-simplest-set-up/12186/6 "2021-12-28T16:45:42Z")

</div>

Do you need a GUI for your module or you just want to run a Python script in Slicer?
