MantisBT - ITK
View Issue Details
0009260ITKpublic2009-07-11 12:032010-11-07 01:18
Luis Ibanez 
Luis Ibanez 
urgentminorhave not tried
assignedopen 
 
 
0009260: Integer types inconsistency in 64 bits platforms
Windows 64 bits platforms define "long" as a 32-bits integer. As a consequence, the Index, Size, and Offset types are unable to manage images larger than 2Gb.
Thread in the users mailing list:
http://www.itk.org/pipermail/insight-users/2009-July/031463.html [^]
No tags attached.
related to 0008371assigned Bradley Lowekamp large MetaImage files and 32-bit produces erroneous results 
patch MetaImage64BitsWarnings.patch (47,426) 2009-11-21 13:47
https://public.kitware.com/Bug/file/2683/MetaImage64BitsWarnings.patch
Issue History
2009-07-11 12:03Luis IbanezNew Issue
2009-07-11 12:05Luis IbanezNote Added: 0016848
2009-07-11 12:05Luis IbanezStatusnew => confirmed
2009-07-11 12:05Luis IbanezStatusconfirmed => assigned
2009-07-11 12:05Luis IbanezAssigned To => Luis Ibanez
2009-07-11 12:05Luis IbanezPrioritynormal => urgent
2009-07-11 13:33Luis IbanezNote Added: 0016849
2009-07-12 06:56Luis IbanezNote Added: 0016850
2009-11-21 13:46Luis IbanezNote Added: 0018499
2009-11-21 13:47Luis IbanezFile Added: MetaImage64BitsWarnings.patch
2009-11-21 14:34Luis IbanezNote Added: 0018506
2009-11-22 10:01Bradley LowekampRelationship addedrelated to 0008371
2010-11-07 01:18Luis IbanezNote Added: 0022985

Notes
(0016848)
Luis Ibanez   
2009-07-11 12:05   
verified in the following way:

http://www.itk.org/pipermail/insight-users/2009-July/031442.html [^]

#include <iostream>
#include "itkOffset.h"
#include "itkNumericTraits.h"

int main()
{
  unsigned long tt;
  std::cout << "size = " << sizeof(tt) << std::endl;
  tt = -1;
  std::cout << "tt = " << tt << std::endl;

  typedef itk::Offset<3> OffsetType;
  typedef OffsetType::OffsetValueType OffsetValueType;

  OffsetValueType offsetValue;

  std::cout << "sizeof(offsetValue) = " << sizeof( offsetValue ) <<
std::endl;

  offsetValue = itk::NumericTraits< OffsetValueType >::max();

  std::cout << "OffsetValueType max() = " << offsetValue << std::endl;

  return EXIT_SUCCESS;
}
(0016849)
Luis Ibanez   
2009-07-11 13:33   
In order to be consistent across platforms and across architectures we suggest that the types should be:

ptrdiff_t for OffsetValueType (this is signed)
size_t for SizeValueType (this is unsigned)
ptrdiff_t for IndexValueType (this is signed)

and that the use of "int" and "long" should be discouraged when loading values into these variables. Instead developers should use the Traits from the ImageType as


ImageType::OffsetValueType
ImageType::SizeValueType
ImageType::IndexValueType


More details in the discussion at:

http://www.itk.org/pipermail/insight-users/2009-July/031466.html [^]
(0016850)
Luis Ibanez   
2009-07-12 06:56   
First pass of changes committed:

Introducing Traits for IndexValueType, SizeValueType and OffsetType.

Replacing explicit use of "long" in the Tests, when refering to this concepts.

Also expanded use of SpacingValueType and PointValueType.

In general,
all these types should have always been obtained as Traits of the Image...
(0018499)
Luis Ibanez   
2009-11-21 13:46   
Adding patch for the MetaImage library.

Most of the changes are related to

METAIO_STL::streampos
METAIO_STL::streamoff
METAIO_STL::streamsize
(0018506)
Luis Ibanez   
2009-11-21 14:34   
Julien committed the patch.
Thanks !
(0022985)
Luis Ibanez   
2010-11-07 01:18   
This is still an issue, and requires a toolkit-wide review for correcting it.