fusion_node = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLVectorVolumeNode", "bone_blended")
params['outputVolume']=fusion_node.GetID()
# ID is C:/Users/xxx/AppData/Local/Temp/Slicer/CEGJC_vtkMRMLVectorVolumeNodeB.nrrd when running
cliNode=slicer.cli.run(slicer.modules.ctacli,None, parameters=params,wait_for_completion=True)
fusion_image= slicer.util.arrayFromVolume(fusion_node)
It runs without error when calling ctacli.py, but the file doesn’t exists.
output error is as below:
…
ctacli completed without errors
vtkMRMLStorageNode::ReadData: Failed to read node
vtkMRMLStorageNode::ReadData: Failed to read node (vtkMRMLVectorVolumeNode1) from filename=‘C:/Users/xxx/AppData/Local/Temp/Slicer/CEGJC_vtkMRMLVectorVolumeNodeB.nrrd’
What I meant by suggesting you look at the SSCCE guidance is that it’s difficult for others on this forum to help when you post fragments of code rather than a complete example. I can look at what you posted and maybe guess what’s going on but it’s also possible that your issue lies with some other code. The process of making the smallest possible example that replicates the issue you are asking about often leads you to solve the problem yourself, so it helps everyone.
@pieper
very grateful for your help and i will try later.
About this question, it is very urgent for me to do a simple example. i am sorry for that.
for output vtkMRMLVecotrVolumeNode in this script. i try to convert from numpy array [1000,1000,3] , then it fails. At last , i expanded the numpy dimension and it works. itk or simple itk api both fulfill the requirement
just add ‘fusion_image = np.expand_dims(fusion_image, axis=0)’ before outpu t *.nrrd file