-
Notifications
You must be signed in to change notification settings - Fork 1
Segmentation Automation Ideas
slicer.util.loadLavelVolume(filename) -> loads into scene
current test
Cant properly call slicer --python-script , so Im just testing using built in python with slicer currently
slicer.util.loadColorTable('/home/kknoernschild/Documents/BrainLabelMapandNrrd/BAWHDAdultAtlas_FreeSurferConventionColorLUT_20160524_ModifiedForSlicer.txt')
slicer.util.loadLabelVolume('/home/kknoernschild/Documents/BrainLabelMapandNrrd/TRIO_TRIO_MR2_dense_seg.nii.gz')
singlenode = slicer.util.getNode("TRIO_TRIO_MR2_dense_seg")
displaynode = singlenode.GetDisplayNodeID() you can get the colornodeID , which is the lookuptable, by calling displaynode.GetColorNodeID()
displaynode.SetAndObserveColorNodeID("vtkMRMLColorTableNode1")
Node1 refers to the lookuptable being loaded in as the 1st non vtk standard node.
standard Lookuptable:

Custom lookuptable:

After applying the custom lookup table, both the label strings and their pixel colors change accordingly.
From this point, I should be able to create a segmentation node, and apply the lookuptable to the node, creating a segmentation image
tried using the regular module , but I think the python script has to be located in the same spot as the Slicer.exe . Downloaded the nightly build, and put my script for creating the segmentation of the human brain, and it runs properly.

Run-time for creating segmentation is 17.954 seconds.
Naming conventions:
In order to call the script, I have to call the Slicer.exe within the module path, so the command call is currently:
/nfsscratch/opt/iiai/Slicer3D/4.10.1/Slicer --no-main-window --python-script /home/kknoernschild/Documents/BrainLabelMapandNrrd/testpythonscriptoutputs/TestScript.py
--no-main-window just prevents slicer opening the visual portion
FINAL STEPS:: ARGPARSE IMPLEMENTATION - only need to introduce an argparse that will pass 2 string s to the program. Input Labelmap, and Input LUT