[ITK] [ITK-users] [ITK-dev] Problem reading a big nifti volume.

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Dec 2 11:34:17 EST 2014


Hello,

Unfortunately, I don't see the logic with it working with Slicer, but not working in native ITK as it uses the same code.

I have perused the NIFT1 C library that ITK has in the ThirdParty group, which appears up to date with the latest released version: 2.0.0.

There a quite a number of places where the calculation of the size of the image is not done at size_t/64-bits safe fashion, along with other 64-bit safe operations. I am concluding that the nifit file format doesn't readily support image > 4GB. Even if we then through the extensive effort of updating our version of the third party library the resulting images are very likely not going to work with other toosl that work with nifti images.

Brad

On Dec 2, 2014, at 11:14 AM, Fotis Drakopoulos <fdrakopo at gmail.com> wrote:

> The image contains a single non-zero voxel on each axial slice. 
> 
> When I load the image on Slicer the non-zero voxels are preserved as you traverse the image using the window slider.  
> When I read the image using a simple main program a big portion of the the non-zero voxels do not exist.
> 
> I had the same issue when the file was .nii (not compressed).
> 
> Fotis
>   
> 
> On Tue, Dec 2, 2014 at 10:58 AM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
> So if you wrote and read with ITK ( via Slicer ), how do you know that the file is correct as you expect?
> 
> I see the file has a ".nii.gz" extension, meaning that it's compressed. Does the same issue occur when it's not compressed?
> 
> Brad
> 
> 
> 
> On Dec 2, 2014, at 10:49 AM, Fotis Drakopoulos <fdrakopo at gmail.com> wrote:
> 
>> Hi,
>> 
>> I created and wrote the image on the disk using ITK 4.6.0. 
>> I visualized the image using Slicer 4.4.0.
>> 
>> The properties are:
>> Size : [1001, 1001, 8345]  
>> Spacing : [1,1,1]
>> Origin : [0, 0, 0]
>> Direction : 
>> 1 0 0
>> 0 1 0
>> 0 0 1
>> 
>> Fotis
>> 
>> On Tue, Dec 2, 2014 at 10:27 AM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
>> Hello,
>> 
>> What software did you use to create and validate that this image is correct?
>> 
>> Thanks,
>> Brad
>> 
>> On Dec 1, 2014, at 11:56 AM, Fotis Drakopoulos <fdrakopo at gmail.com> wrote:
>> 
>>> Hi all,
>>> 
>>> I added a big test image to ITK/Public/ITK/Modules/IO/NIFTI/test/Input. The image cannot loaded correctly when I use the itk::ImageFileReader.
>>> The test image contains non-zero values only at indexes (350,350,i)  where i=0 to 8300.
>>> The pixelType is short.
>>>  
>>> Thanks
>>> Fotis  
>>> 
>>> On Wed, Nov 26, 2014 at 8:41 PM, Matt McCormick <matt.mccormick at kitware.com> wrote:
>>> Thanks! Added.
>>> 
>>> On Wed, Nov 26, 2014 at 9:21 AM, Fotis Drakopoulos <fdrakopo at gmail.com> wrote:
>>> > Hi,
>>> > I signed up for the ITK community on midas.
>>> >
>>> > Thanks,
>>> > Fotis Drakopoulos
>>> >
>>> > On Tue, Nov 25, 2014 at 10:44 PM, Matt McCormick
>>> > <matt.mccormick at kitware.com> wrote:
>>> >>
>>> >> Hi Fotis,
>>> >>
>>> >> Thanks for helping to improve large nifti file support.
>>> >>
>>> >> The file can be uploaded on midas3.kitware.com.  Sign up for the ITK
>>> >> community [1], let the list know the name of your account, and myself
>>> >> or one of the other administrators will add upload priviledges to the
>>> >> account.
>>> >>
>>> >> The file could then be added to
>>> >> ITK/Public/ITK/Modules/IO/NIFTI/test/Input.
>>> >>
>>> >> Thanks,
>>> >> Matt
>>> >>
>>> >> [1] http://midas3.kitware.com/midas/community/12
>>> >>
>>> >> On Tue, Nov 25, 2014 at 3:14 PM, Fotis Drakopoulos <fdrakopo at gmail.com>
>>> >> wrote:
>>> >> > Hi all,
>>> >> >
>>> >> > I created a test nifti image that reproduces the problem I mentioned
>>> >> > before.
>>> >> > How can I share this image with the ITK community?
>>> >> >
>>> >> > Best,
>>> >> > Fotis Drakopoulos
>>> >> >
>>> >> >
>>> >> > On Mon, Nov 24, 2014 at 10:13 AM, Bradley Lowekamp
>>> >> > <blowekamp at mail.nih.gov>
>>> >> > wrote:
>>> >> >>
>>> >> >> Shareable test data greatly helps determine the cause and fix these
>>> >> >> types
>>> >> >> of issues.
>>> >> >>
>>> >> >> Got data?
>>> >> >>
>>> >> >> Brad
>>> >> >> On Nov 23, 2014, at 5:40 PM, Gib Bogle <g.bogle at auckland.ac.nz> wrote:
>>> >> >>
>>> >> >> This is reminiscent of the previous problem with big TIFF images, now
>>> >> >> fixed.
>>> >> >>
>>> >> >> Gib
>>> >> >> ________________________________
>>> >> >> From: Insight-users [insight-users-bounces at itk.org] on behalf of Fotis
>>> >> >> Drakopoulos [fdrakopo at gmail.com]
>>> >> >> Sent: Monday, 24 November 2014 10:51 a.m.
>>> >> >> To: insight-users at itk.org; insight-developers at itk.org
>>> >> >> Subject: [ITK-users] Problem reading a big nifti volume.
>>> >> >>
>>> >> >> Hi all,
>>> >> >>
>>> >> >> For the last couple of days I have been trying reading (unsuccessfully)
>>> >> >> a
>>> >> >> big nifti volume labeled image from my disk.
>>> >> >>
>>> >> >> The pixel type is unsigned char and the rest specs of the image are:
>>> >> >> Size : [1001, 1001, 8345]  (in voxels)
>>> >> >> Spacing : [0.012, 0.012, 0.012]  (in mm)
>>> >> >> Origin : [0, 0, 0]
>>> >> >> Direction :
>>> >> >> 1 0 0
>>> >> >> 0 1 0
>>> >> >> 0 0 1
>>> >> >>
>>> >> >> First I loaded the volume on Slicer-4.4.0 (64 bit-linux) to get an idea
>>> >> >> how it looks like. Indeed the object in the volume looks as it was
>>> >> >> expected.
>>> >> >> So far no problems. The specs of the image on Slicer are the same as
>>> >> >> above
>>> >> >> (except the direction which has flipped signs for the first two
>>> >> >> diagonal
>>> >> >> entries, as we know ).
>>> >> >>
>>> >> >> Then I tried to load the image in the memory using the
>>> >> >> itk::ImageFileReader  from ITK4.6.0 (64 bit-linux) version. After
>>> >> >> loading
>>> >> >> the image I noticed that there are pixels with zero values instead of
>>> >> >> non-zero by comparing the same indexes with the loaded image on Slicer.
>>> >> >>
>>> >> >> Then I decided to write the loaded image on the disk using the
>>> >> >> itk::ImageFileWriter.
>>> >> >>
>>> >> >> After opening the (written from ITK) image on Slicer I checked the
>>> >> >> specks
>>> >> >> and were the same with the original image as above. However I noticed
>>> >> >> that a
>>> >> >> big portion of the image is completely empty (black)!
>>> >> >>
>>> >> >> My workstation has enough memory to load the image (768 GB 1600MHz
>>> >> >> DDR3L)
>>> >> >> and is using Red Hat Enterprise Linux Server 6.5.
>>> >> >> The size of the original nifti volume is :
>>> >> >>
>>> >> >> 25.7 MB (.nii.gz)
>>> >> >> 8.36 GB (.nii)
>>> >> >>
>>> >> >> Has anybody experienced similar difficulties trying to load so big
>>> >> >> volume
>>> >> >> data?
>>> >> >>
>>> >> >> Best,
>>> >> >> Fotis Drakopoulos
>>> >> >> CRTC
>>> >> >>
>>> >> >> _____________________________________
>>> >> >> Powered by www.kitware.com
>>> >> >>
>>> >> >> Visit other Kitware open-source projects at
>>> >> >> http://www.kitware.com/opensource/opensource.html
>>> >> >>
>>> >> >> Kitware offers ITK Training Courses, for more information visit:
>>> >> >> http://www.kitware.com/products/protraining.php
>>> >> >>
>>> >> >> 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://public.kitware.com/mailman/listinfo/insight-users
>>> >> >>
>>> >> >>
>>> >> >> ________________________________
>>> >> >>
>>> >> >> Spam
>>> >> >> Not spam
>>> >> >> Forget previous vote
>>> >> >
>>> >> >
>>> >> >
>>> >> > _______________________________________________
>>> >> > Powered by www.kitware.com
>>> >> >
>>> >> > Visit other Kitware open-source projects at
>>> >> > http://www.kitware.com/opensource/opensource.html
>>> >> >
>>> >> > Kitware offers ITK Training Courses, for more information visit:
>>> >> > http://kitware.com/products/protraining.php
>>> >> >
>>> >> > 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://public.kitware.com/mailman/listinfo/insight-developers
>>> >> >
>>> >>
>>> >>
>>> >> --
>>> >>
>>> >
>>> 
>>> 
>>> --
>>> BEGIN-ANTISPAM-VOTING-LINKS
>>> ------------------------------------------------------
>>> 
>>> Teach CanIt if this mail (ID 03NkpHcqT) is spam:
>>> Spam:        about:blank
>>> Not spam:    about:blank
>>> Forget vote: about:blank
>>> ------------------------------------------------------
>>> END-ANTISPAM-VOTING-LINKS
>>> 
>>> 
>> 
>> 
>> Spam
>> Not spam
>> Forget previous vote
>> 
> 
> 
> Spam
> Not spam
> Forget previous vote
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20141202/8189a553/attachment-0003.html>
-------------- next part --------------
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

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://public.kitware.com/mailman/listinfo/insight-users


More information about the Community mailing list