[vtk-developers] dicom reader and 64 bit problem?

Clinton Stimpson clinton at elemtech.com
Fri Jul 15 18:29:20 EDT 2005


I found the problem.

The DICOMFile::ReturnAs* functions did not implement the endian parameter.
I added a check for big endianess, and swap accordingly, and now it can 
read the dicom file.
I'll open a bug and attach a patch file for you Brad.

Thanks,
Clint


Brad King wrote:

> Clinton Stimpson wrote:
>
>>
>>
>> The iris.elemtech dashboard has been failing the TestSobel2D-image 
>> test for a
>> long time.  This is a 64 bit build of VTK.  And the DICOM file isn't 
>> being
>> read.
>>
>> See the results from the 11th (last night's failed to build):
>> http://www.vtk.org/Testing/Sites/iris.elemtech/IRIX64-CC64-7.4/20050711-0300-Nightly/Results/__Imaging_Testing_Tcl_TestSobel2D-image.html 
>>
>>
>> If I build a 32 bit version, and run the test, it works fine.  But 
>> not with a
>> 64 bit build.  Is any other dashboard doing a 64 bit build?  I 
>> debugged it
>> for a bit, and it looks like the problem is somewhere in
>> Utilities/DICOMParser code.
>>
>> Perhaps this is a 64 bit issue?
>
>
> I just tried it on a 64-bit Linux box and the test passes (with either 
> 32- or 64-bit vtkIdType).  The difference from a 64-bit SGI build 
> would be the byte ordering.  I bet the problem is in DICOMParser.cxx:
>
>       if (this->DataFile->GetPlatformIsBigEndian() == true)
>         {
>         switch (callbackType)
>           {
> ...
>           case DICOMParser::VR_SL:
>           case DICOMParser::VR_UL:
>             DICOMFile::swapLongs((ulong*) tempdata, (ulong*) tempdata, 
> length/sizeof(ulong));
>             // dicom_stream::cout << "32 bit byte swap needed!" << 
> dicom_stream::endl;
>             break;
> ...
>           }
>         }
>
> It looks like it is trying to use "long" to do a 32-bit byte swap.  On 
> a 64-bit machine "long" may be 64-bit, so only every other 32-bit 
> block will be swapped!
>
> Glancing through the code it looks like there may be other places that 
> assume long is 32-bits.  I won't be able to look into this for a 
> while.  Clinton, please try changing that swap to use an int and see 
> if it helps.
>
> Meanwhile please create a bug report for the issue:
>
> http://www.vtk.org/Bug
>
> You can assign it to me if you wish.
>
> Thanks,
> -Brad





More information about the vtk-developers mailing list