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

Brad King brad.king at kitware.com
Thu Jul 14 17:04:16 EDT 2005

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, 
             // dicom_stream::cout << "32 bit byte swap needed!" << 

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:


You can assign it to me if you wish.


More information about the vtk-developers mailing list