[Insight-developers] [Insight-users] Image offset is giving bad pointer for large datasets (7Gb)
Luis Ibanez
luis.ibanez at kitware.com
Fri Jul 10 18:33:28 EDT 2009
On recent realization:
"size_t" is unsigned :-/
and we need the OffsetValueType to be signed,
since we use it to compute differences...
It seems that what we need is the type
"ptrdiff_t"
which is supposed to represent the differences
between two pointers, and therefore should be
capable of measuring distances between any
two locations in memory.
I'm now rerunning the Experimental with
"ptrdiff_t" instead of "size_t".
Luis
------------------------------------------------------------------------------------------------------
On Fri, Jul 10, 2009 at 12:30 PM, Luis Ibanez <luis.ibanez at kitware.com>wrote:
> Hi Kana,
>
> Thanks a lot for looking into this and sharing your findings.
>
> I just confirmed that in Windows 64bits, the "long" type is
> only 4 bytes.
>
> Here is the program I used:
>
> #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;
> }
>
>
> with this CMakeLists.txt file
>
>
> CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
> IF(COMMAND CMAKE_POLICY)
> CMAKE_POLICY(SET CMP0003 NEW)
> ENDIF(COMMAND CMAKE_POLICY)
>
>
> PROJECT(64bitsTest)
>
> FIND_PACKAGE(ITK REQUIRED)
> INCLUDE(${ITK_USE_FILE})
>
> ADD_EXECUTABLE(typesTest typesTest.cxx )
>
> TARGET_LINK_LIBRARIES(typesTest ITKCommon)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090710/756fb34a/attachment.htm>
More information about the Insight-developers
mailing list