[Insight-developers] question regarding nifti IO

Bill Lorensen bill.lorensen at gmail.com
Wed Apr 29 15:52:28 EDT 2009


I think it's a bug if the imageio does not throw an exception for
execeeding the size.

On Wed, Apr 29, 2009 at 2:43 PM, kent williams
<norman-k-williams at uiowa.edu> wrote:
> You’re absolutely correct — if you happen to look in the NIfTI header (in
> ITK, it’s Insight/Utilities/nifti/niftilib/nifti1.h)  you will see that the
> image dimensions are stored as an array of shorts.
>
>                                  /* NIFTI-1 usage         */              /*
> ANALYZE 7.5 field(s) */
>  short dim[8];        /*!< Data array dimensions.*/  /* short dim[8];
>        */
>
> This is not a bug in ITK, this is a basic limitation of the file format.  So
> the maximum of any dimension is going to be 32767.
>
> In other words, if you really want to have an image with any dimension >
> 32767, you will have to use a different image format.  Which rather begs the
> question of why you would need to save such a data object to a standard
> image format at all, but I’m sure you have your reasons.
>
>
> On 4/28/09 8:03 PM, "Nicholas Tustison" <ntustison at gmail.com> wrote:
>
> 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
>
>
>
>
>
> ________________________________
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
>
>


More information about the Insight-developers mailing list