Program: gdcm
Module: $RCSfile: gdcmDocument.cxx,v $
Language: C++
- Date: $Date: 2004/06/22 13:47:33 $
- Version: $Revision: 1.22 $
+ Date: $Date: 2004/06/23 09:30:22 $
+ Version: $Revision: 1.26 $
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 !
+
+ Write(fp,filetype); // the gdcmElementSet one !
/// WriteEntries(fp,type); // old stuff
return true;
guint16 Elem)
{
gdcmDocEntry* a;
- gdcmBinEntry* b;
+ gdcmBinEntry* b;
a = GetDocEntryByNumber( Group, Elem);
if (a == NULL) {
a =NewBinEntryByNumber(Group, Elem);
if (a == NULL)
return NULL;
- b = new gdcmBinEntry(a);
+ b = new gdcmBinEntry(a);
AddEntry(b);
}
SetEntryByNumber(voidArea, lgth, Group, Elem);
TagKey key = gdcmDictEntry::TranslateToKey(group, element);
if ( ! tagHT.count(key))
return false;
-
+
/* Hope Binray field length is never wrong
if(lgth%2) // Non even length are padded with a space (020H).
{
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)
{
long offset, long l_max, bool delim_mode)
{
int SQItemNumber = 0;
-
+
gdcmDocEntry *NewDocEntry = (gdcmDocEntry *)0;
gdcmSQItem *itemSQ;
bool dlm_mod;
lgr=ParseDES(itemSQ, NewDocEntry->GetOffset(), l, dlm_mod);
- set->AddEntry(itemSQ,SQItemNumber);
+ set->AddEntry(itemSQ,SQItemNumber);
SQItemNumber ++;
if (!delim_mode && (ftell(fp)-offset) >= l_max) {
break;
// (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