I’ m trying to obtain the array of this volume, but i obtain some errors. Can you help me?
labeledImage = self.LabeledVolumeSelector.currentNode().GetImageData()
selectedImage = self.SelectedVolumeSelector.currentNode().GetImageData()
I tried to use slicer.util.arrayFromVolume
but i obtain this error: TypeError: object of type 'vtkCommonDataModelPython.vtkImageData' has no len()
This is the code written in 3DSlicer 3.6, it may be helpful:
labeledImage = self.LabeledVolumeSelector.GetSelected().GetImageData()
selectedImage = self.SelectedVolumeSelector.GetSelected().GetImageData()
labeledArray = labeledImage.ToArray()
selectedArray = selectedImage.ToArray()
labeledSlice = vol[ijk[2],…]
selectedSlice = voll[ijk[2],…]