[Insight-developers] question regarding nifti IO

Nicholas Tustison ntustison at gmail.com
Tue Apr 28 21:03:27 EDT 2009


Developers,

My colleague, Brian Avants, asked that I post the following question  
to the Insight Developers' list.  Essentially, as he points out below,  
and I've reproduced using my own code, it seems as though 1-D images  
can't be created in nifti format where the size exceeds ~30,000 pixels  
but can be created using the mhd format.  Is this behavior known and  
is there a particular reason for it?

Thanks,
Nick Tustison

Begin forwarded message:

> From: brian avants <stnava at gmail.com>
> Date: April 28, 2009 1:48:58 PM EDT
> To: Nicholas Tustison <ntustison at gmail.com>
> Subject: bug nifti writer?
>
>
> is this a known/unknown bug?
>
> only appears to happen if #voxels exceeds about 30,000.
> suggesting datatype problem.
>
> see below:
>
> # first, just print the mhd header
> $ PrintHeader zero2.mhd
>  Spacing [1, 1]
>  Origin [0, 0]
>  Direction
> 1 0
> 0 1
>  Size
> [1, 65536]
>
> # convert to nifti
> $ MultiplyImages 2 zero2.mhd 1 zero2.nii
>
> # print nifti header
> $ PrintHeader zero2.nii
>  Spacing [1, 1]
>  Origin [0, 0]
>  Direction
> 1 0
> 0 1
>
>  Size
> [1, 1]
>
> # size is wrong in terms of the header info
> # but not in terms of the raw data ...
> $ ls -l zero2.nii
> -rw-r--r--  1 user  user  262496 Apr 28 13:37 zero2.nii
> $ ls -l zero2.raw
> -rw-r--r--  1 user  user  262144 Mar 25  2008 zero2.raw
>
> # if i convert zero2.nii to mhd the size is wrong
> ls -l zero3.raw
> -rw-r--r--  1   user  user  4 Apr 28 13:42 zero3.raw
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090428/6c55df14/attachment.htm>


More information about the Insight-developers mailing list