I tried to process MHD image files using python and python-vtk. File uploaded to Google Drive: mhd .
I want to convert it to a numpy array and then split them according to the given value of "500, for example." then calculate the summary information. I followed the instructions of this
[post] How to convert a 3D vtkDataSet file to a numpy array?
but this does not work for my case.
import vtk
imageReader = vtk.vtkMetaImageReader()
imageReader.SetFileName(testfile1)
imageReader.Update()
image = imageReader.GetOutput()
print image.GetDimensions()
pixelspace = imageReader.GetPixelSpacing()
here comes the error:
AttributeError: GetPixelSpacing
How can I achieve conversion?
When I finish splitting the data, how can I save it back to mhd (or will the original data be better?)