Module disappearing after restarting

Howdy~

I have run into an issue where when I add these lines of code:

loadedVolumeNode = slicer.util.loadVolume(‘Z:/Something/LumbarCT’, {}, returnNode=True)
vol=slicer.util.getNode(‘Lumbar*’)
vol.GetImageData().GetDimensions()

then my module stops updating and then when I restart it gives me the following error:
Traceback (most recent call last):
File “Z:/Slicer 4.10.2/bin/…/lib/Slicer-4.10/qt-scripted-modules/ExtensionWizard.py”, line 273, in selectExtension
xd = SlicerWizard.ExtensionDescription(sourcedir=path)
File “Z:\Slicer 4.10.2\bin\Python\SlicerWizard\ExtensionDescription.py”, line 136, in init
self._setProjectAttribute(“homepage”, p, required=True)
File “Z:\Slicer 4.10.2\bin\Python\SlicerWizard\ExtensionDescription.py”, line 183, in setProjectAttribute
v = project.getValue("EXTENSION
" + name.upper(), default, substitute)
File “Z:\Slicer 4.10.2\bin\Python\SlicerWizard\ExtensionProject.py”, line 280, in getValue
raise KeyError(“script does not set %r” % name)
KeyError: “script does not set ‘EXTENSION_HOMEPAGE’”

My ultimate goal is to import a DICOM from a file on my PC, segment it automatically, then export it onto a file on my PC. This is the importing part of this ultimate goal.

Thank you advance! Always a pleasure to learn more~

You only need to use the ExtensionWizard once, to create your module. Once your module is created, you can update it by clicking on “Reload” button in Reload&Test section of the module GUI.

If your module does not show up in the module list then add its path to additional module paths in menu: Edit / Application settings / Modules.

I have been doing that as well. When I comment out the lines of code I outlined above for importing, the module reappears.

When I uncomment it, then I get the following error and module disappears on restart
Traceback (most recent call last):
File “Z:\Slicer 4.10.2\bin\Python\slicer\ScriptedLoadableModule.py”, line 195, in onReload
slicer.util.reloadScriptedModule(self.moduleName)
File “Z:\Slicer 4.10.2\bin\Python\slicer\util.py”, line 623, in reloadScriptedModule
moduleName, fp, filePath, (’.py’, ‘r’, imp.PY_SOURCE))
File “Z:/LoadSegMod/DicomTesting/SegmentDicom/SegmentDicom.py”, line 158
vol = slicer.util.getNode(‘Lumbar*’)
^
IndentationError: unindent does not match any outer indentation level

Python failed to parse your file due to an indentation error. You need to pay very close attention to correct indentation when developing in Python - you must not mix spaces and tabs for indentation, and all lines in the same block must have the same number of leading spaces or tabs.

1 Like