[vtkusers] Problem in loading big images using vtkimagereader

Leo van Ruijven LvRuijven at gmx.com
Thu Aug 12 05:21:17 EDT 2010


As Mike said, you do not have to change the API to correct the issue. Just use 64 bit precision calculations inside the methods (for vtkImageReader2 the method SeekFile() must also be corrected).

However, on my computer (Windows XP and Visual Studio 8) that did not yet solve the problem. In windows the file positioning functions are still not fully 64 bit. So in vtkImageReader::SeekFile() the line: 

 this->File->seekg(streamStart, ios::beg);

did not work if streamStart is too large. But the following workaround does work on my system:

 this->File->seekg(0, ios::beg);
 while (streamStart > 0x2000000) {
 this->File->Seek(0x2000000, ios::cur);
 streamStart -= 0x2000000;
 }
 if (streamStart > 0) this->File->seekg(streamStart, ios::cur);


I don't know how to change the vtk source code. otherwise I would have corrected the bug myself. But If somebody is interested in my version of vtkImageReader2, just let me know.

Leo.



there _is_ but the actual code in the vtkImageReader2 class uses the 
"long" and not the "vtkIdType" which would help solve the problem. An 
example is the following that was posted to the ParaView mailing list:

In the void vtkImageData::AllocateScalars(); method the following
should be used:

 vtkIdType extent[6] ={ this->Extent[0], this->Extent[1], this- 
 >Extent[2],
 this->Extent[3], this->Extent[4], this- 
 >Extent[5]};

instead of
 const int* extent = this->Extent;

In the case of vtkImageReader2 it is probably "long" instead of int. 
Either way on Windows, both are a 32 bit integer no matter how you 
compile it.

___________________________________________________________
Mike Jackson www.bluequartz.net www.bluequartz.net 
Principal Software Engineer  mike.jackson at bluequartz.net 
BlueQuartz Software Dayton, Ohio



On Aug 11, 2010, at 9:35 AM, John Drescher wrote:

>> http://public.kitware.com/pipermail/paraview/2008-March/007422.html http://public.kitware.com/pipermail/paraview/2008-March/007422.html 
>>
>> Is when I came across the issue. I did not keep track of what the 
>> eventual
>> "fixes" were but somewhere (probably a private email) I think it 
>> was said
>> that a fix was difficult because the API for a lot of filters would 
>> need to
>> be changed.
>> In the most draconian fix the use of "long" should just be 
>> banned, but
>> this would cause all sorts of backwards compatibility issues.
>>
>
> Isn't there an option when building VTK to use 64 bit ids? I have
> never used that so I am not sure how much of the code supports this.
>
> John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100812/fa639a47/attachment.htm>


More information about the vtkusers mailing list