Re: Image has an invalid orientation (code ...)

725 views
Skip to first unread message

Dorian P.

unread,
Nov 5, 2014, 3:56:23 PM11/5/14
to itksna...@googlegroups.com
The following command fixed the problem:
c3d input.nii -orient RAI -o output.nii

Thank you.

On Wed, Nov 5, 2014 at 2:15 PM, Dorian P. <alb...@gmail.com> wrote:
Hi Snappers,

I have a lesion mask for a subject that cannot be opened with ITKsnap. I receive the error: "Image has an invalid orientation (code ...)"

Inline image 1

The image is regular nii.gz as many others, and I can open the same image in MRIcron. Note, ANTs  also failed to process this image correctly when doing some image math.

Any solutions how to fix this?
P.s. I can send you the location on CFN cluster if you need to have a look.

################# IMAGE HEADER ############### 
dpustina@chead:dpustina$ PrintHeader MR0047_M.nii
 Spacing [0.976562, 0.992063, 1]
 Origin [0, 0, 0]
 Direction 
1 0 0
0 -1 0
0 0 -1

 Size : 192 252  160

  Image Dimensions   : [192, 252, 160]
  Bounding Box       : {[0 0 0], [187.5 250 160]}
  Voxel Spacing      : [0.976562, 0.992063, 1]
  Intensity Range    : [0, 1]
  Mean Intensity     : 0.0171989
  Direction Cos Mtx. : 
1 0 0
0 -1 0
0 0 -1

  Voxel->RAS x-form  : 
  Image Metadata: 
    ITK_FileNotes = nifti 3D file produced by VoxBo
    bitpix = 8
    cal_max = 0
    cal_min = 0
    datatype = 2
    descrip = nifti 3D file produced by VoxBo
    dim[0] = 3
    dim[1] = 192
    dim[2] = 252
    dim[3] = 160
    dim[4] = 1
    dim[5] = 1
    dim[6] = 1
    dim[7] = 1
    intent_code = 0
    intent_p1 = 0
    intent_p2 = 0
    intent_p3 = 0
    pixdim[0] = 0
    pixdim[1] = 0.976562
    pixdim[2] = 0.992063
    pixdim[3] = 1
    pixdim[4] = 1
    pixdim[5] = 1
    pixdim[6] = 1
    pixdim[7] = 1
    qform_code = 8192
    qoffset_x = 0
    qoffset_y = 0
    qoffset_z = 0
    quatern_b = 9.80909e-45
    quatern_c = -1.01451e+34
    quatern_d = -nan
    scl_inter = 0
    scl_slope = 0
    sform_code = -2060
    slice_duration = 0
    slice_end = 0
    slice_start = 0
    srow_x = -1.01003e+34 -1.01451e+34 -9.90397e+33 1.4013e-45
    srow_y = 0 0 1.12104e-44 1.56945e-43
    srow_z = -1.01442e+34 -1.00702e+34 -1.01246e+34 0
    toffset = 0
    vox_offset = 352


Dorian P.

unread,
Nov 5, 2014, 3:57:54 PM11/5/14
to itksna...@googlegroups.com
Also note, in Matlab:
volgood=spm_vol('MR0044_M.nii')
volbad=spm_vol('MR0047_M.nii')


>> volgood.private.mat0

ans =

   -0.9800         0         0   94.5700
         0    0.9956         0 -125.9378
         0         0    1.0000  -80.5000
         0         0         0    1.0000

volbad.private.mat0

ans =

   NaN   NaN   NaN   NaN
   NaN   NaN   NaN   NaN
   NaN   NaN   NaN   NaN
   NaN   NaN   NaN   NaN


Any solution?

Dorian

Philip A Cook

unread,
Nov 5, 2014, 5:35:09 PM11/5/14
to itksna...@googlegroups.com
Something has wrecked the original header - the qform and sform are both nonsense. I suspect there was a bug involving wrong endianness when the header was written. Be careful that the image orientation after imposing RAI is correct.

On Nov 5, 2014, at 2:26 PM, Dorian P. <alb...@gmail.com> wrote:

> Also note, in Matlab:
> volgood=spm_vol('MR0044_M.nii')
> volbad=spm_vol('MR0047_M.nii')
>
>
> >> volgood.private.mat0
>
> ans =
>
> -0.9800 0 0 94.5700
> 0 0.9956 0 -125.9378
> 0 0 1.0000 -80.5000
> 0 0 0 1.0000
>
> volbad.private.mat0
>
> ans =
>
> NaN NaN NaN NaN
> NaN NaN NaN NaN
> NaN NaN NaN NaN
> NaN NaN NaN NaN
>
>
> Any solution?
>
> Dorian
>
>
> On Wed, Nov 5, 2014 at 2:15 PM, Dorian P. <alb...@gmail.com> wrote:
> Hi Snappers,
>
> I have a lesion mask for a subject that cannot be opened with ITKsnap. I receive the error: "Image has an invalid orientation (code ...)"
>
> <image.png>
> --
> You received this message because you are subscribed to the Google Groups "itksnap-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to itksnap-user...@googlegroups.com.
> To post to this group, send email to itksna...@googlegroups.com.
> Visit this group at http://groups.google.com/group/itksnap-users.
> For more options, visit https://groups.google.com/d/optout.

Dorian P.

unread,
Nov 6, 2014, 12:44:21 PM11/6/14
to itksna...@googlegroups.com
Hi Snappers,

I have a lesion mask for a subject that cannot be opened with ITKsnap. I receive the error: "Image has an invalid orientation (code ...)"

Inline image 1

Reply all
Reply to author
Forward
0 new messages