[ITK] problem (and fix?) for Nifti IO with very large number of elements in file
Matt McCormick
matt.mccormick at kitware.com
Sun Aug 17 17:25:55 EDT 2014
Hi Kris,
Thank you for the report and patch.
Please review [1] these patches [2] [3].
For future reference, it is not necessary to file a bug report to
submit a patch. Essentially,
./Utilities/SetupForDevelopment.sh
git gerrit-push
will submit the patch. More details can be found here [4].
Thanks,
Matt
[1] https://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySoftwareProcess/PerformAGerritReview/index.html
[2] http://review.source.kitware.com/#/c/16729/
[3] http://review.source.kitware.com/#/c/16728/
[4] https://insightsoftwareconsortium.github.io/ITKBarCamp-doc/CommunitySoftwareProcess/SubmitAPatchToGerrit/index.html
On Sun, Aug 17, 2014 at 9:42 AM, Kris Thielemans
<kris.f.thielemans at gmail.com> wrote:
> Dear all
>
> My Nifti file is very large (448x512x176 x141). After a lot of pain, I
> discovered that it doesn't get read completely by the ITK Nifti IO image
> reader. The reason is that the number of elements is computed as an integer,
> which is 32bit on my system (Ubuntu 12.04, gcc 4.6.3). Below is an easy
> patch that seems to solve the problem. (It also fixes a compilation error in
> the file when __USE_VERY_VERBOSE_NIFTI_DEBUGGING__ is on, as then it refers
> to a nonexisting variable tobuffer, so I've just commented that line out).
>
> I'm afraid I don't have the resources to put in a bug report (in fact, I
> couldn't register as https://issues.itk.org/jira/secure/Signup.jspa seems to
> ask for a captcha, but I can't see any in my firefox window), nor for adding
> a test case etc, so I'm hoping somebody else will take this further.
>
> Please also reply to my email address as I might miss anything sent to the
> list.
>
>
> Kris Thielemans
> Senior Lecturer at University College London
> Institute for Nuclear Medicine, UCL Hospital
>
>
>
> diff --git a/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx
> b/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx
> index 25d85d3..491bcd1 100644
> --- a/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx
> +++ b/Modules/IO/NIFTI/src/itkNiftiImageIO.cxx
> @@ -409,7 +409,7 @@ void RescaleFunction(TBuffer *buffer,
> double intercept,
> size_t size)
> {
> - for ( unsigned int i = 0; i < size; i++ )
> + for ( size_t i = 0; i < size; i++ )
> {
> double tmp = static_cast< double >( buffer[i] ) * slope;
> tmp += intercept;
> @@ -437,7 +437,7 @@ void NiftiImageIO::Read(void *buffer)
> ImageIORegion::SizeType size = regionToRead.GetSize();
> ImageIORegion::IndexType start = regionToRead.GetIndex();
>
> - int numElts = 1;
> + size_t numElts = 1;
> int _origin[7];
> int _size[7];
> unsigned int i;
> @@ -1933,7 +1933,7 @@ NiftiImageIO
> }
> delete[] vecOrder;
> dumpdata(buffer);
> - dumpdata(tobuffer);
> + //dumpdata(tobuffer);
> //Need a const cast here so that we don't have to copy the memory for
> //writing.
> this->m_NiftiImage->data = (void *)nifti_buf;
>
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community
More information about the Community
mailing list