X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDocument.cxx;h=70e868c1236a99d51c53ce6f8be0518858f2d71c;hb=957dcd905e535fcfe37185ca5ea08a801e3078d3;hp=17a7cdfee552a9fcaab071edc4a9cad1b1285169;hpb=088100ec11c9814549610307c848af8c14e81ba6;p=gdcm.git diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 17a7cdfe..70e868c1 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2005/06/10 14:05:38 $ - Version: $Revision: 1.245 $ + Date: $Date: 2005/06/23 09:20:23 $ + Version: $Revision: 1.250 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -169,8 +169,12 @@ bool Document::Load( std::string const &fileName ) std::string PhotometricInterpretation = GetEntryValue(0x0028,0x0004); if( PhotometricInterpretation == "PALETTE COLOR " ) { - LoadEntryBinArea(0x0028,0x1200); // gray LUT - /// FIXME FIXME FIXME + // FIXME + // Probabely this line should be outside the 'if' + // Try to find an image sample holding a 'gray LUT' + LoadEntryBinArea(0x0028,0x1200); // gray LUT + + /// FIXME /// The tags refered by the three following lines used to be CORRECTLY /// defined as having an US Value Representation in the public /// dictionary. BUT the semantics implied by the three following @@ -195,9 +199,25 @@ bool Document::Load( std::string const &fileName ) LoadEntryBinArea(0x0028,0x1222); // Segmented Blue Palette Color LUT Data LoadEntryBinArea(0x0028,0x1223); - } + } + //FIXME later : how to use it? - LoadEntryBinArea(0x0028,0x3006); //LUT Data (CTX dependent) + SeqEntry *modLutSeq = GetSeqEntry(0x0028,0x3000); + if ( modLutSeq !=0 ) + { + SQItem *sqi= modLutSeq->GetFirstSQItem(); + if ( sqi != 0 ) + { + BinEntry *b = sqi->GetBinEntry(0x0028,0x3006); + if ( b != 0 ) + { + if ( b->GetLength() != 0 ) + { + LoadEntryBinArea(b); //LUT Data (CTX dependent) + } + } + } + } CloseFile(); @@ -1247,7 +1267,7 @@ void Document::LoadDocEntry(DocEntry *entry) { newValue = Util::DicomString(str, length+1); gdcmWarningMacro("Warning: bad length: " << length << - " ,For string :" << newValue.c_str()); + " For string :" << newValue.c_str()); // Since we change the length of string update it length //entry->SetReadLength(length+1); } @@ -1261,7 +1281,12 @@ void Document::LoadDocEntry(DocEntry *entry) { if ( Fp->fail() || Fp->eof()) { - gdcmWarningMacro("Unread element value"); + if ( Fp->fail() ) + gdcmWarningMacro("--> fail"); + + gdcmWarningMacro("Unread element value " << valEntry->GetKey() + << " lgt : " << valEntry->GetReadLength() + << " at " << std::hex << valEntry->GetOffset()); valEntry->SetValue(GDCM_UNREAD); return; } @@ -1278,7 +1303,9 @@ void Document::LoadDocEntry(DocEntry *entry) } else { - gdcmErrorMacro( "Should have a ValEntry, here !"); + gdcmWarningMacro("Should have a ValEntry, here ! " << valEntry->GetKey() + << " lgt : " << valEntry->GetReadLength() + << " at " << std::hex << valEntry->GetOffset()); } } @@ -1954,7 +1981,8 @@ bool Document::CheckSwap() */ void Document::SwitchByteSwapCode() { - gdcmWarningMacro( "Switching Byte Swap code from "<< SwapCode); + gdcmWarningMacro( "Switching Byte Swap code from "<< SwapCode + << " at :" <tellg() ); if ( SwapCode == 1234 ) { SwapCode = 4321;