Operating system: Ubuntu 16.04.3 LTS
Slicer version: 4.8.1
Hi everyone!
I’m trying to create a scripted python module and I need to perform bias correction over an MRI volume as the first step in the processing pipeline. For this purpose, I intended to call the n4itkbiascorrection CLI module from within the python script. After looking the tutorials in the slicer web page, I understand I should be using ‘slicer.module’ to import the n4itkbiasfieldcorrection module.
I am able to do so from the Python Interactor console via the following code line:
from slicer.modules import n4itkbiasfieldcorrection
However, when using the same code line in the script, the module won’t load and Slicer throws the following error in the python console:
Traceback (most recent call last):
_ File “”, line 1, in _
_ File “/home/miguel/Documentos/Extensiones_3DSlicer/SPAL/SPAL/SPAL.py”, line 12, in _
_ from slicer.modules import n4itkbiasfieldcorrection_
ImportError: cannot import name n4itkbiasfieldcorrection
I tried checking the importable modules via the command:
print(dir(slicer.modules))
When I call this line from the console, the n4itkbiasfieldcorrection module appears in the list printed but it does not appear (along with other many modules) when calling the line from the script.
I am quite new in developing slicer extensions so I am probably missing something here. Any clues on solving this issue??
Thanks in advance for the help!
Miguel