Closed amortazi closed 7 years ago
Does your code work if you save the image as NIfTI (.nii.gz)? Could you please post a minimal working example?
And skimage is an image processing library primarily targeted for 2D images that often does not work on 3D data. Please consider using scipy and numpy functions rather than skimage, although the resize function seems to work on 3D images, too.
Closed due to possibly MedPy-unrelated error causes.
Hello, I have installed all modules to read and save mhd files. (medpy, itkwrapper, itkbridgenmpy and vtk). For installing ITK wrapper I have followed instructions in this webpage in ubuntu14: http://pythonhosted.org/MedPy/installation/itkwrapper4.7.html: I just did it for itkwrapper4.10. Now, I can read mhd file and convert it to numpy, but when I wanna save numpy array as mhd I got following error: "medpy.io.save(image_orig,directory+str(n+1).zfill(3)+"/image_resize.mhd",hdr=image_header_orig) File "build/bdist.linux-x86_64/egg/medpy/io/save.py", line 192, in save medpy.core.exceptions.ImageSavingError: Failed to save image /home/user/Downloads/Datasets/LA-challenge2013/train-mri/a001/image_resize.mhd as type Itk/Vtk MetaImage (.mhd, .mha/.raw). Reason signaled by third-party module: Cannot get an instance of NumPy array."
Also, this is piece of code to read and save mhd: image_orig, image_header_orig = medpy.io.load(lstFiles_orig[n]) image_seg, image_header_seg = medpy.io.load(lstFiles_gt[n]) image_orig=transform.resize(image_orig, (320,320,110), order=3, mode='constant', cval=0)
I highly appreciate if anybody can help me regarding this issue. Thanks.