Scripted CLI Module simplest set-up

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

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

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.

1 Like

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

any helps goes a long way for me too

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