I am using slicer module in my own module to get bias corrected volume. The following function is working correctly.
def biascorrection(volumeNode1):
parameters = {}
parameters["inputImageName"] = volumeNode1.GetID()
outModel = slicer.vtkMRMLScalarVolumeNode()
slicer.mrmlScene.AddNode(outModel)
parameters["outputImageName"] = outModel.GetID()
biascorrect = slicer.modules.n4itkbiasfieldcorrection
return (slicer.cli.run(biascorrect, None, parameters))
Vol1_biasCorrect = biascorrection(nodet1)
Output node is (vtkCommonCorePython.vtkMRMLCommandLineModuleNode)0x7fc11452a808. To get numpy array of this vtk node, I have been used the following code:
Vol1_biasCorrectNode = slicer.util.getNode('Volume')
Vol1_biasCorrect_array = slicer.util.array(Vol1_biasCorrectNode.GetID())
The following error appears:
File "/home/siddique/Slicer-4.6.2-linux-amd64/bin/Python/slicer/util.py", line 583, in array
shape = list(n.GetImageData().GetDimensions())
AttributeError: 'NoneType' object has no attribute 'GetDimensions'
As output volume is created as vtkMRMLScalarVolumeNode()
, I think this volume should be converted to numpy array. Please help me to get the numpy array of bias corrected volume.