Skip to content
Snippets Groups Projects
Commit 4c4fa8e7 authored by Johannes Stelzer's avatar Johannes Stelzer
Browse files

4D fix

parent 051810a7
No related branches found
No related tags found
No related merge requests found
......@@ -184,7 +184,7 @@ def load_vista(fp_input):
img3D = np.transpose(np.reshape(img1D, (zdim,ydim,xdim)), (2,1,0))
data = img3D
dim = "4D"
dim = "3D"
else:
list_images = []
for i in range(len(idx_images)):
......@@ -202,11 +202,13 @@ def load_vista(fp_input):
img1D[i*xdim*ydim*tdim:(i+1)*xdim*ydim*tdim] = list_images[i]
img4D = np.transpose(np.reshape(img1D, (zdim,tdim,ydim,xdim)), (3,2,0,1))
data = img4D
dim = "3D"
dim = "4D"
#%% re-parse the header to get the complete header information
mm = get_property_str(header_img, "voxel", "list")
if dim == "4D":
mm.append(tdim)
#get s-form code
sform_code = get_property_str(header, "sform_code", "int")
......@@ -240,6 +242,7 @@ def load_vista(fp_input):
#%% convert to nii object... fill in data and header
nii_loaded = nib.Nifti1Image(data, affine=np.eye(4))
# import pdb; pdb.set_trace()
nii_loaded.header.set_zooms(mm)
nii_loaded.header['pixdim'][4] = tr
nii_loaded.set_sform(sform2D)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment