-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.112 2003/11/10 09:21:40 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.cxx,v 1.117 2003/11/13 18:08:34 jpr Exp $
#include "gdcmHeader.h"
* @param InFilename
* @param exception_on_error
*/
-gdcmHeader::gdcmHeader(const char *InFilename, bool exception_on_error) {
+gdcmHeader::gdcmHeader(const char *InFilename,
+ bool exception_on_error,
+ bool enable_sequences ) {
+ if (enable_sequences)
+ enableSequences = 1;
+ else
+ enableSequences = 0;
+
SetMaxSizeLoadElementValue(_MaxSizeLoadElementValue_);
filename = InFilename;
Initialise();
* applying this heuristic.
*/
void gdcmHeader::FixFoundLength(gdcmElValue * ElVal, guint32 FoundLength) {
- if ( FoundLength == 0xffffffff)
+
+ ElVal->SetReadLength(FoundLength); // will be updated only if a bug is found
+
+ if ( FoundLength == 0xffffffff) {
FoundLength = 0;
+ }
// Sorry for the patch!
// XMedCom did the trick to read some nasty GE images ...
else if (FoundLength == 13) {
// The following 'if' will be removed when there is no more
// images on Creatis HDs with a 13 length for Manufacturer...
- if ( (ElVal->GetGroup() != 0x0008) || (ElVal->GetElement() != 0x0070)) {
+ if ( (ElVal->GetGroup() != 0x0008) &&
+ ( (ElVal->GetElement() != 0x0070) || (ElVal->GetElement() != 0x0080) ) ) {
// end of remove area
FoundLength =10;
+ ElVal->SetReadLength(10); // a bug is to be fixed
}
}
// to fix some garbage 'Leonardo' Siemens images
else if ( (ElVal->GetGroup() == 0x0009)
&&
( (ElVal->GetElement() == 0x1113) || (ElVal->GetElement() == 0x1114) ) ){
- FoundLength =4;
+ FoundLength =4;
+ ElVal->SetReadLength(4); // a bug is to be fixed
}
// end of fix
- // to try to 'go inside' SeQuences (with length), and not to ship them
+ // to try to 'go inside' SeQuences (with length), and not to skip them
else if ( ElVal->GetVR() == "SQ") {
+ if (enableSequences) // only if the user does want to !
FoundLength =0;
}
FoundLength =0;
}
- ElVal->SetLength(FoundLength);
+ ElVal->SetUsableLength(FoundLength);
}
/**
return;
}
FixFoundLength(ElVal, length32);
-
return;
}
// appear when we find the first group with big endian encoding. This
// is easy to detect since the length of a "Group Length" tag (the
// ones with zero as element number) has to be of 4 (0x0004). When we
- // encouter 1024 (0x0400) chances are the encoding changed and we
+ // encounter 1024 (0x0400) chances are the encoding changed and we
// found a group with big endian encoding.
// We shall use this second strategy. In order to make sure that we
// can interpret the presence of an apparently big endian encoded
// not coexist in a Data Set and Data Sets nested within it".]
// Length is on 4 bytes.
FixFoundLength(ElVal, ReadInt32());
+ return;
}
/**
s << NewInt;
}
}
- }
+ }
+ s << '\0'; // to avoid oddities on Solaris
ElVal->SetValue(s.str());
return;
}
NewElVal = NewElValueByNumber(g, n);
FindVR(NewElVal);
FindLength(NewElVal);
+
if (errno == 1) {
// Call it quits
return (gdcmElValue *)0;
rewind(fp);
// We don't use any longer the HashTable, since a lot a stuff is missing
- // we SeQuences were encountered
+ // when SeQuences were encountered
//
//TagElValueHT ht = PubElValSet.GetTagHt();
//for (TagElValueHT::iterator tag = ht.begin(); tag != ht.end(); ++tag) {
// LoadElementValue(tag->second);
//}
- for (std::list<gdcmElValue*>::iterator i = GetListElem().begin();
+ for (ListTag::iterator i = GetListElem().begin();
i != GetListElem().end();
++i){
LoadElementValue(*i);
* @return Lookup Table RGBA
*/
-void * gdcmHeader::GetLUTRGBA(void) {
+unsigned char * gdcmHeader::GetLUTRGBA(void) {
// Not so easy : see
// http://www.barre.nom.fr/medical/dicom2/limitations.html#Color%20Lookup%20Tables
// and OT-PAL-8-face.dcm
if (gdcmHeader::GetPubElValByNumber(0x0028,0x0004) != "PALETTE COLOR ") {
return NULL;
}
-
- void * LutR,*LutG,*LutB;
- int l;
+
int lengthR, debR, nbitsR;
int lengthG, debG, nbitsG;
int lengthB, debB, nbitsB;