I currently have been using ITK to generate automated segmentations using command line inputs that include seed point regions of interest, to create a more efficient version of outdated matlab code that my lab is using.
I have also been messing around with the slicer execution models and ITK, and realized that I could create an all encompassing package for this segmentation script. But, I am stuck on how (or if it is possible) to get markup fiducials as variables to my scripts.
I have experience with SEM and basic usage using filters and image processing pipelines using ITK, but getting the information out of slicer for these markups is something I have zero experience with.
Any help or suggestions would be greatly appreciated.
I did a little bit of searching around and I found some vtk python examples that somewhat resemble what I would like to do in c++.
I am currently building vtk and will see if I can get it to work as a c++ executable through slicer. From what I saw, as long as I know the name of the fiducials (which the user can edit before running the script), I should be able to pull those from slicer when hitting ‘run’ using vtk in some way.
Ill post an update If I find something that works well.
If you have a look at the Execution Model Tour module you can try multiple seeds. You need to select two volumes and then make a fiducial list with multiple points and the clicking apply creates this command line.
Thank you, Ill take a look at that. Unfortunately something happened to my machine so that I cannot build my projects properly, but I will look into this when It that build issue solved.
I took a look at ways to implement using the built in python package with slicer, and found the ways to get the markup node physical positioning information and the volume file information from a loaded node. With the nodes and that file name I can just create a sitk implementation of my script to run directly through the slicer python interpreter. The only adjustment that I need to make is converting the RAS coordinates to LPS for itk.
The added benefit of doing this through python is that other lab members already have access to slicer and would not need to go through a slow process of getting our technology services to install cmake and other tools I use. slicer already has access or can install the packages needed without administrator rights.
Just for reference this is the start to the python script after figuring a bit out about the python interpreter in slicer. Its a little rough and making assumptions on use case.
#####################################
## Get Markup Physical Coordinates ##
#####################################
NoduleNode=slicer.util.getNode("Nod_Seeds")
BackgroundNode=slicer.util.getNode("BG_Seeds")
NoduleSeedLocations=slicer.util.arrayFromMarkupsControlPoints(NoduleNode)
BackgroundSeedLocations=slicer.util.arrayFromMarkupsControlPoints(BackgroundNode)
## Example output of NoduleSeedLocations with 4 randomly placed markup points in RAS physical space
## [ [ 10.1329359 24.94261144 0. ]
## [-53.78250591 9.35347929 0. ]
## [ 30.39880769 1.55891321 0. ]
## [ 89.30380263 0.703125 -55.56418023]]
## The same can be done with the background points of interest.
## Can now use these arrays of physical points later with sITK, but need to transform to LPS space
#####################################
## Get Filename from volume node ##
#####################################
VolumeNodes = slicer.util.getNodesByClass("vtkMRMLModelVolumeNode")
ImageNode= VolumeNodes[0]
StorageNode= ImageNode.GetStorageNode()
ImageFilename = StorageNode.GetFileName()
print(ImageFilename)
# ImageFilename is pathtofile/TestImage.nii.gz
# I now have the image filename to load the image for processing in sitk, and the corresponding markup points of interest to input to an algorithm.