Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2006/02/16 20:06:14 $
- Version: $Revision: 1.342 $
+ Date: $Date: 2006/03/01 10:15:12 $
+ Version: $Revision: 1.343 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
<< " at offset " << std::hex << "0x(" << offset << ")" );
while (true)
{
- // if ( !delim_mode && ((long)(Fp->tellg())-offset) >= l_max) // Once per DocEntry
+ ///\todo FIXME : On 64 bits processors, tellg gives unexpected results after a while ?
+ /// Probabely a bug in gdcm code somwhere (some memory erased ?)
+
+// Uncomment to track the bug
+/*
+ if( Debug::GetDebugFlag() )
+ std::cout << std::dec <<"(long)(Fp->tellg()) " << (long)(Fp->tellg())
+ << std::hex << " 0x(" <<(long)(Fp->tellg()) << ")" << std::endl;
+*/
+
+ // if ( !delim_mode && ((long)(Fp->tellg())-offset) >= l_max) // Once per DocEntry
if ( !delim_mode ) // 'and then' doesn't exist in C++ :-(
if ( ((long)(Fp->tellg())-offset) >= l_max) // Once per DocEntry, when no delim mode
{
// Well ... group 0002 is always coded in 'Explicit VR Litle Endian'
// even if Transfer Syntax is 'Implicit VR ...'
// --> Except for 'Implicit VR Big Endian Transfer Syntax GE Private'
-
+ // where Group 0x0002 is *also* encoded in Implicit VR !
+
FixDocEntryFoundLength( entry, ReadInt32() );
return;
}
* the parser went Jabberwocky) one can hope improving things by
* applying some heuristics.
* @param entry entry to check
- * @param foundLength first assumption about length
+ * @param foundLength first assumption about length (before bug fix, or set to zero if =0xffffffff)
*/
void Document::FixDocEntryFoundLength(DocEntry *entry,
uint32_t foundLength)
{
entry->SetReadLength( foundLength );// will be updated only if a bug is found
+
if ( foundLength == 0xffffffff)
{
- foundLength = 0;
+ //foundLength = 0;
+ //entry->SetLength(foundLength);
+ entry->SetLength(0);
+ return; // return ASAP; don't waist time on useless tests
}
-
+
uint16_t gr = entry->GetGroup();
uint16_t elem = entry->GetElement();
// Occurence of such images is quite low (unless one leaves close to a
// 'Leonardo' source. Hence, one might consider commenting out the
// following fix on efficiency reasons.
- else if ( gr == 0x0009 && ( elem == 0x1113 || elem == 0x1114 ) )
+ else if ( gr == 0x0009 && ( elem == 0x1113 || elem == 0x1114 ) )
{
foundLength = 4;
entry->SetReadLength(4); // a bug is to be fixed !
// According to the norm, fffe|0000 shouldn't exist. BUT the Philips
// image gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm happens to
// causes extra troubles...
- if ( entry->GetElement() != 0x0000 )
+ if ( elem != 0x0000 )
{
foundLength = 0;
}
Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2006/02/16 20:06:14 $
- Version: $Revision: 1.315 $
+ Date: $Date: 2006/03/01 10:15:12 $
+ Version: $Revision: 1.316 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/**
* \brief This function is intended to user who doesn't want
* to have to manage a LUT and expects to get an RBG Pixel image
- * (or a monochrome one ...)
+ * (or a monochrome one, if no LUT found ...)
* \warning to be used with GetImagePixels()
* @return 1 if Gray level, 3 if Color (RGB, YBR, *or PALETTE COLOR*)
*/