[Insight-users] Image offset is giving bad pointer for large datasets (7Gb)

Luis Ibanez luis.ibanez at kitware.com
Wed Jul 8 10:09:41 EDT 2009



Hi Arunachalam,


          Thanks for your detailed post.


          Let's discuss first ITK by itself,


(before we go into the integration with VTK and VTKEdge)



As you pointed out, the type

               OffsetValueType

is currently defined as "long" in ITK.



However, your assumptiong that "long" types in 64 bits
platforms, are storing values up to 2^32 is incorrect.


An unsigned long type in a 64bits platforms will have
8 bytes, and therefore can store values up to 2^64.
which is:

             18446744073709551615 L


You can verify this with the following code:


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


The output of this program, in a 64bits machine will be:


          size = 8
          tt = 18446744073709551615


The same code, when compiled in a 32-bits machine
will produce as output:


          size = 4
          tt = 4294967295


Therefore, if your OffsetValueType is getting saturated,
it is likely that you are *not* compiling for 64 bits.


Are you sure that when you configured ITK with CMake,
you selected the "64 bits" version of your Visual Studio
compiler.


A simple way to double-check is to compile the code
above and run it.



    Please do so, and let us konw what you find.


       Thanks



          Luis



----------------------------------
Arunachalam Kana wrote:
> Hi,
> 
>  
> 
> Machine details: Windows XP, visual studio 2008,  64 bit platform, 64Gb Ram
> 
> Image size: 1442 x 1566 x 1657 ( approx 7Gb )
> 
> Other libraries: Along with ITK, VTK and VTK Edge is also used. VTK Edge 
> is used for changing vtk image to itk image and vice versa.
> 
>  
> 
> Problem:
> 
> In ITK the OffsetValueType is long. Range of long datatype: 
> –2,147,483,648 to 2,147,483,647
> 
> But the image m_OffsetTable values of type OffsetValueType are : 1; 
> 1442; 2258172;  3,741,791,004
> 
> In the above, it is clearly seen that the image offset value exceeds the 
> OffsetValueType range.
> 
>  
> 
> Correction attempts:
> 
> 1.       I changed the OffsetValueType to unsigned long to increase the 
> range. Unsigned long range : 0 to 4,294,967,295. But
> 
> this gives problems on conversion back to vtk. The vtkdataarray created 
> has a variable maxID which is of VtkIDType.
> 
> VtkIDType is of long long. The maxID contains the value = -553,176,292.
> 
>  
> 
> Correlation between  3,741,791,004 and -553,176,292.
> 
> Decimal                                               Hexa
> 
> 3,741,791,003                                    DF07331B
> 
> -553,176,292                  FFFFFFFF DF07331B           
> 
>  
> 
> So, the program crashes due to bad pointer when it used vtkdata array 
> details to draw histogram.
> 
> I think the probelm here is assigning of unsigned long to long long. I 
> don’t want to change the
> 
> Vtk data type to unsigned long, so in next attempt i change the itk 
> OffsetValueType to long long.
> 
>  
> 
> 2.       I changed the itk OffsetValueType to long long, but this leads 
> to change of lot of several other
> 
> variable type in different file. Specially some of the basic image 
> container variables like TElementIdentifier, TElement have to be changed.
> 
> For now I only can give these 2 variable, but i am afraid more variable 
> data types have to be changed in the future.
> 
>  
> 
> I would be glad to have some help to solve this problem.
> 
>  
> 
> Regards,
> 
> Kana
> 
> 
> ------------------------------------------------------------------------
> 
> _____________________________________
> 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-users


More information about the Insight-users mailing list