[Insight-developers] question regarding nifti IO
Hans Johnson
hans-johnson at uiowa.edu
Wed Apr 29 09:37:13 EDT 2009
Nick,
The reason is that the image dimensions are stored in ³short integers²
Insight/Utilities/nifti/niftilib/nifti1.h:157
short dim[8]; /*!< Data array dimensions.*/ /* short dim[8];
*/
echo "2^15-1"|bc -l
32767
Hans
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
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged. If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited. Please reply to the sender that you have received the message in error, then delete it. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090429/8aaab231/attachment.htm>
More information about the Insight-developers
mailing list