X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmFile.cxx;h=1c0db8127a5b61e298c83688d6385a9a2338cda7;hb=97945d8b11b86924800fe1d78dcbf8a54be75927;hp=4dc3506b20aff1173b7b9c4ef8472e2f7083d969;hpb=8c7ca53952f8a597259d7f27240c8eb42b9d39aa;p=gdcm.git diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 4dc3506b..1c0db812 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.cxx,v $ Language: C++ - Date: $Date: 2005/10/06 18:54:49 $ - Version: $Revision: 1.272 $ + Date: $Date: 2005/10/10 22:25:05 $ + Version: $Revision: 1.274 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -894,6 +894,7 @@ int File::GetPixelSize() // (in order no to be messed up by old ACR-NEMA RGB images) // if (File::GetEntryValue(0x0028,0x0100) == "24") // return 3; + assert( !(GetEntryValue(0x0028,0x0100) == "24") ); std::string pixelType = GetPixelType(); if ( pixelType == "8U" || pixelType == "8S" ) @@ -1667,15 +1668,22 @@ void File::ComputeJPEGFragmentInfo() { // Since we have read the basic offset table, let's check the value were correct // or else produce a warning: + // A.4 Transfer syntaxes for encapsulation of encoded pixel data: + // When the Item Value is present, the Basic Offset Table Item Value shall contain + // concatenated 32-bit unsigned integer values that are byte offsets to the first + // byte of the Item Tag of the first fragment for each frame in the Sequence of + // Items. These offsets are measured from the first byte of the first Item Tag + // following the Basic Offset Table item (See Table A.4-2). + if ( BasicOffsetTableItemValue ) { // If a BasicOffsetTableItemValue was read uint32_t individualLength = BasicOffsetTableItemValue[i]; - std::cerr << individualLength << " == " << sum << std::endl; - assert( individualLength == sum ); // REMOVE that if this is a problem + //assert( individualLength == sum ); // Seems like 00191113.dcm is off by one ?? if( individualLength != sum ) { - gdcmWarningMacro( "BasicOffsetTableItemValue differs from the fragment lenght" ); + gdcmWarningMacro( "BasicOffsetTableItemValue differs from the fragment lenght:" << + individualLength << " != " << sum ); } sum += fragmentLength + 8; i++; @@ -1806,6 +1814,12 @@ void File::ReadEncapsulatedBasicOffsetTable() for (unsigned int i=0; i < nbEntries; i++ ) { BasicOffsetTableItemValue[i] = *((uint32_t*)(&charBasicOffsetTableItemValue[4*i])); +#if defined(GDCM_WORDS_BIGENDIAN) || defined(GDCM_FORCE_BIGENDIAN_EMULATION) + uint32_t val = BasicOffsetTableItemValue[i]; + BasicOffsetTableItemValue[i] + = ( (val<<24) | ((val<<8) & 0x00ff0000) | + ((val>>8) & 0x0000ff00) | (val>>24) ); +#endif gdcmWarningMacro( "Read one length for: " << std::hex << BasicOffsetTableItemValue[i] ); }