Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/06/22 14:07:05 $
- Version: $Revision: 1.23 $
+ Date: $Date: 2004/06/23 15:01:57 $
+ Version: $Revision: 1.29 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
long l=ParseDES( this, beg, lgt, false); // le Load sera fait a la volee
(void)l; //is l used anywhere ?
+
+ rewind(fp);
+
+ // Load 'non string' values
+
+ std::string PhotometricInterpretation = GetEntryByNumber(0x0028,0x0004);
+ if( PhotometricInterpretation == "PALETTE COLOR " ) {
+ LoadEntryVoidArea(0x0028,0x1200); // gray LUT
+ LoadEntryVoidArea(0x0028,0x1201); // R LUT
+ LoadEntryVoidArea(0x0028,0x1202); // G LUT
+ LoadEntryVoidArea(0x0028,0x1203); // B LUT
+
+ LoadEntryVoidArea(0x0028,0x1221); // Segmented Red Palette Color LUT Data
+ LoadEntryVoidArea(0x0028,0x1222); // Segmented Green Palette Color LUT Data
+ LoadEntryVoidArea(0x0028,0x1223); // Segmented Blue Palette Color LUT Data
+ }
+ //FIXME later : how to use it?
+ LoadEntryVoidArea(0x0028,0x3006); //LUT Data (CTX dependent)
+
CloseFile();
// --------------------------------------------------------------
* @return True when RLE Lossless found. False in all
* other cases.
*/
+
bool gdcmDocument::IsJPEGLossless(void)
{
return ( IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_55)
|| IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_57)
- || IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_90) );
+ || IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_70) ); // was 90
}
/**
* if ( filetype == ACR)
* UpdateGroupLength(true,ACR);
*/
-
- Write(fp,filetype); // the gdcmElementSet one !
+
+ gdcmElementSet::Write(fp,filetype);
/// WriteEntries(fp,type); // old stuff
return true;
NewValEntry->SetDepthLevel(depth);
set->AddEntry(NewValEntry);
LoadDocEntry(NewValEntry);
- if (/*!delim_mode && */NewValEntry->isItemDelimitor())
+ if (NewValEntry->isItemDelimitor())
break;
if ( !delim_mode && ftell(fp)-offset >= l_max)
{
NewDocEntry->GetElement() == 0x0010 )
{
if (NewDocEntry->GetLength()==0xffffffff)
+ {
// Broken US.3405.1.dcm
Parse7FE0(); // to skip the pixels
// (multipart JPEG/RLE are trouble makers)
+ }
+ else
+ {
+ SkipToNextDocEntry(NewDocEntry);
+ l = NewDocEntry->GetFullLength();
+ }
}
else
{
while (true) {
NewDocEntry = ReadNextDocEntry();
+ if (!NewDocEntry)
+ break;
if(delim_mode) {
if (NewDocEntry->isSequenceDelimitor()) {
set->SetSequenceDelimitationItem(NewDocEntry);
// (fffe e0dd) tells us the current SeQuence just ended
if( group == 0xfffe ) {
// NO more value field for SQ !
- //Entry->SetValue("gdcm::Skipped");
- // appel recursif de Load Value
- // (meme pb que pour le parsing)
return;
}
// The elements whose length is bigger than the specified upper bound
// are not loaded. Instead we leave a short notice of the offset of
// the element content and it's length.
+
if (length > MaxSizeLoadEntry) {
+ if (gdcmBinEntry* BinEntryPtr = dynamic_cast< gdcmBinEntry* >(Entry) )
+ {
+ std::ostringstream s;
+ s << "gdcm::NotLoaded (BinEntry)";
+ s << " Address:" << (long)Entry->GetOffset();
+ s << " Length:" << Entry->GetLength();
+ s << " x(" << std::hex << Entry->GetLength() << ")";
+ BinEntryPtr->SetValue(s.str());
+ }
+ // to be sure we are at the end of the value ...
+ fseek(fp,(long)Entry->GetOffset()+(long)Entry->GetLength(),SEEK_SET);
+ return;
+ // Be carefull : a BinEntry IS_A ValEntry ...
if (gdcmValEntry* ValEntryPtr = dynamic_cast< gdcmValEntry* >(Entry) )
{
std::ostringstream s;
- s << "gdcm::NotLoaded.";
+ s << "gdcm::NotLoaded. (ValEntry)";
s << " Address:" << (long)Entry->GetOffset();
s << " Length:" << Entry->GetLength();
s << " x(" << std::hex << Entry->GetLength() << ")";
ValEntryPtr->SetValue(s.str());
- }
+ }
// to be sure we are at the end of the value ...
- fseek(fp,(long)Entry->GetOffset()+(long)Entry->GetLength(),SEEK_SET);
-
+ fseek(fp,(long)Entry->GetOffset()+(long)Entry->GetLength(),SEEK_SET);
return;
}
+
+ // When we find a BinEntry not very much can be done :
+ if (gdcmBinEntry* BinEntryPtr = dynamic_cast< gdcmBinEntry* >(Entry) ) {
+ LoadEntryVoidArea (BinEntryPtr->GetGroup(),BinEntryPtr->GetElement());
+ return;
+ }
+
// Any compacter code suggested (?)
if ( IsDocEntryAnInteger(Entry) ) {
(void)fseek(fp, (long)(entry->GetReadLength()), SEEK_CUR);
}
-/**
- * \brief Loads the value for a a given VLEntry
- * \warning NOT end user intended method !
- * @param entry
- */
-void gdcmDocument::LoadVLEntry(gdcmDocEntry *entry)
-{
- //SkipBytes(entry->GetLength());
- LoadDocEntry(entry);
-}
/**
* \brief When the length of an element value is obviously wrong (because
* the parser went Jabberwocky) one can hope improving things by