superxuang / caffe_3d_faster_rcnn

Caffe for 3D organ localization in CT image
Other
46 stars 19 forks source link

How to convert the .nii format to .mhd format? #13

Open Joey0538 opened 4 years ago

Joey0538 commented 4 years ago

Your help would be appreciated as I'm trying to implement this. One way I know is to rename the extension from .nii to .mhd but I think that's a wrong way to do it, so please help me on how to convert this.

Joey0538 commented 4 years ago

import os import SimpleITK as sitk

FileNames = [ #location of dataset ] for file in FileNames: path,name = os.path.split(file) name = name.split('.') image = sitk.ReadImage(file) sitk.WriteImage(image,name[0] + '.mhd')

Is this the right way to do it?

superxuang commented 4 years ago

Yes. I think it's right.