I have list of img/hdr file. Suppose that length of list is 50 and size of img is 60*60*60. I would like to convert it to Nifti1image whose size is (60*60*60*50).
import nibabel
import nipy
img_list=[]
for file in os.listdir(path):
if file.endswith(".img"):
temp=nibabel.load(os.path.join(path,file)
img_list.append(temp)
by above program, I get the list I would like to convert to Nifti1image.Then I try
nipy.save(nipy.list_to_image(img_list),'sample.nii')
But i did not work. Could someone tell me how to do this in python?