So, what I understand about python based CLI is:
there is an xml file which will produce GUI for application and the same xml is used by the .py file to parse elements.
the execute function is in the xml file that will be run by slicer and the name of the script .py file is within this function.
How to run and test newly created cli modules?
and how do you get the GUI for newly created CLI module?
I am new in this and I want to create a python based CLI module. The module will take input image send it to external python file for execution (as python 3 external libraries are required) and return the resultant image.
Please help me as I could not understand how to do this?
As it says at the top of the page you linked that older style was only supported in Slicer 3.x. There is a new style for Slicer 4.x that you can follow like in this repository.
The description of the parameters goes in the .xml file, and the script to run is the .py file.
I added the folder ānewfuzzypythonā containing the example .py and .xml. Like below in the screen shot.
Is it correct? How can I see this in slicer. I dont see any new module added to module section.
Sorry, if i am asking general questions. I am new to this environment. Trying to understand.
Sorry I was away. the issue to load the cli module is resolved. will come back again if I have problems.
Please would you tell me one thing. if I made changes in cli module I have to restart slicer to see those changes. is it the only way to test the new module again and again.
There is no need to restart Slicer to test changes. You can reload your module by clicking āReloadā button at the top of your scripted module user interface. Make sure you use a module template generated by a recent version of Extension Wizard module, and enable āDeveloper modeā in application settings.
Dear Andras,
when I create scripted python module I do find restore and the changes reflect but when I am working with cli based python module I could not see a reload button. the template produces this as below:
For Python CLIs you donāt even need to click Reload, as when you click Apply then always the current version of the code is used.
If you update the GUI (the XML description) then you need to restart Slicer to see the changes, but since it is just a descriptive text, it should not require frequent modifications or debugging.
I was able to follow the instructions above and it worked fine for the moment. I just had a quick question:
Iām using a script to automate extraction of radiomics features after histogram matching. Iām using the radiomics CLI module for this. However, Iām not sure how to import a params.yaml file into slicer so I can use it for radiomics extraction. Should I directly import it using a python function or is there a slicer function I can use e.g. the āloadNodeFromFileā function
However, now I have a new problem. I have attached my code below. Iām trying to extract radiomics features from a node called āPref_histā using a segmentation node but the parameter file is not considered during the extraction of raiomics features. I manually extracted radiomics using the interative module and compared the values and it turns out that the parameter set supplied in the āparamā argument is not considered (or is being ignored). I have also attached a copy of the params file as a jpg here.
You can have a look at the application log to see the command-line arguments that are generated from your parameters_rad variable. Compare it to the command-line arguments that are generated when you run the interactive module.
hi Lassoan!
3D slicer is very convinnent in analysis medical images, specially show 3D models.
recently, I want to combine my deep learning code python with 3D slicer.
it is the algorithm for segmenting the liver in CT images on pytorch.
but I donāt know how to do this work. can you give me instructions, specific documents, linksā¦ for it.
thankyou!!!