diff --git a/nii2dcm/nii.py b/nii2dcm/nii.py index 7aa11ca..4ab899c 100644 --- a/nii2dcm/nii.py +++ b/nii2dcm/nii.py @@ -31,8 +31,13 @@ def fnT1N(A, N): nX, nY, nZ, nF = nib_nii.header['dim'][1], nib_nii.header['dim'][2], nib_nii.header['dim'][3], 1 dimX, dimY, dimZ = nib_nii.header['pixdim'][1], nib_nii.header['pixdim'][2], nib_nii.header['pixdim'][3] - elif nib_nii.header['dim'][4] > 1: - print("Warning: Nifti is not 3-dimensional.") + elif nib_nii.header['dim'][0] == 3 and all([x > 1 for x in nib_nii.header['dim'][1:4]]): + nX, nY, nZ, nF = (nib_nii.header['dim'][1:4].tolist() + [1]) + dimX, dimY, dimZ = nib_nii.header['pixdim'][1:4].tolist() + + else: + print("Error: NIfTI is not 3-dimensional.") + exit(1) # Instances & Slice Spacing nInstances = nZ*nF