@lassoan, apologies for not reading the API doc carefully. I now modified as:
_, InputVolumeNode = slicer.util.loadVolume(one_patient_path, returnNode=True)
dim = InputVolumeNode.GetImageData().GetDimensions()
spacing = InputVolumeNode.GetSpacing()
and following this thread, I created the Output Node with:
def createEmptyVolume(imageSize, imageSpacing, nodeName):
voxelType=vtk.VTK_FLOAT
# Create an empty image volume
imageData=vtk.vtkImageData()
imageData.SetDimensions(imageSize)
imageData.AllocateScalars(voxelType, 1)
thresholder=vtk.vtkImageThreshold()
thresholder.SetInputData(imageData)
thresholder.SetInValue(0)
thresholder.SetOutValue(0)
thresholder.Update()
# Create volume node
volumeNode=slicer.mrmlScene.AddNewNodeByClass("vtkMRMLScalarVolumeNode", nodeName)
volumeNode.SetSpacing(imageSpacing)
volumeNode.SetAndObserveImageData(thresholder.GetOutput())
volumeNode.CreateDefaultDisplayNodes()
volumeNode.CreateDefaultStorageNode()
return volumeNode
# creat output node with same dim and spacing of InputNode
OutputNode = createEmptyVolume(dim, spacing, 'VesselnessFiltered') # invoke function
Now, if I try to apply the VesselNessFiltering from the GUI with these two volumes (and with the manual seed point), the āVesselnessFilteredā volume is created correctly.
However, when I run in Jupyter:
vfl = VesselnessFiltering.VesselnessFilteringLogic()
vfl.computeVesselnessVolume(InputVolumeNode, OutputVolume, minimumDiameterMm=0, maximumDiameterMm=25, alpha=0.3, beta=0.3, contrastMeasure=150)
I get the following log in Slicer (from Help/Report a bug):
[DEBUG][Python] 19.09.2019 10:04:22 [Python] (/home/newuser/.config/NA-MIC/Extensions-27931
SlicerVMTK/lib/Slicer-4.10/qt-scripted-modules/VesselnessFiltering.py:465) - Vesselness filtering
started: diameter min=0, max=25, alpha=0.3, beta=0.3, contrastMeasure=150
[CRITICAL][Stream] 19.09.2019 10:04:23 [] (unknown:0) - ERROR: during execute_request
[CRITICAL][Stream] 19.09.2019 10:04:23 [] (unknown:0) - /work/Stable/Slicer-4101-
build/ITK/Modules/Filtering/Smoothing/include/itkRecursiveGaussianImageFilter.hxx:344:
[CRITICAL][Stream] 19.09.2019 10:04:23 [] (unknown:0) - itk::ERROR:
RecursiveGaussianImageFilter(0xb7ded90): Sigma must be greater than zero.
The [DEBUG] tells us that the VesselnessFiltering started, but then the itkRecursiveGaussianImageFilter
raises the CRITICAL error about the Sigma. What I donāt understand is where, inside computeVesselnessVolume
, this itk function is invoked.
Pardon me if the question is trivial, but how could I find this out? Or, in other words, how can I debug in cases like this to understand what calls itkRecursiveGaussianImageFilter
?
Thanks again for your time!