+2002-11-27 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+ * python/demo/*.py load.py extracted from test.py. Added explore.py
+ that only displays required tags and testAll.py that parses all
+ the files of the testsuite without using unittest.
+ * python/testSuite.py other additional test on new files added.
+ * Data/* new test files added accordingly to the testSuite.
+ * src/gdcmHeader.cxx avoid overwriting of the dictionary when
+ the vr in the file differs from the one of the dictionary.
+
2002-11-20 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
* src/gdcm.h and gdcmHeader.cxx gdcm no longer loads all the elements
values, but limits itself to values which are below a user specified
typedef map<string, ElValue*> TagElValueNameHT;
// Container for a set of succefully parsed ElValues.
class GDCM_EXPORT ElValSet {
- // We need both accesses with a TagKey and the Dicentry.Name
+ // We need both accesses with a TagKey and the Dictentry.Name
TagElValueHT tagHt;
TagElValueNameHT NameHt;
public:
}
void gdcmHeader::SwitchSwapToBigEndian(void) {
- dbg.Verbose(1, "gdcmHeader::FindLength", "Switching to BigEndian mode.");
+ dbg.Verbose(1, "gdcmHeader::SwitchSwapToBigEndian",
+ "Switching to BigEndian mode.");
if ( sw == 0 ) {
sw = 4321;
return;
*/
void gdcmHeader::FindVR( ElValue *ElVal) {
+ if (filetype != ExplicitVR)
+ return;
+
char VR[3];
string vr;
int lgrLue;
// the case.
bool RealExplicit = true;
- if (filetype != ExplicitVR)
- return;
-
lgrLue=fread (&VR, (size_t)2,(size_t)1, fp);
VR[2]=0;
vr = string(VR);
RealExplicit = false;
if ( RealExplicit ) {
- if ( ElVal->IsVrUnknown() )
+ if ( ElVal->IsVrUnknown() ) {
+ // When not a dictionary entry, we can safely overwrite the vr.
ElVal->SetVR(vr);
+ return;
+ }
+ if ( ElVal->GetVR() == vr ) {
+ // The vr we just read and the dictionary agree. Nothing to do.
+ return;
+ }
+ // The vr present in the file and the dictionary disagree. We assume
+ // the file writer knew best and use the vr of the file. Since it would
+ // be unwise to overwrite the vr of a dictionary (since it would
+ // compromise it's next user), we need to clone the actual DictEntry
+ // and change the vr for the read one.
+ gdcmDictEntry* NewTag = new gdcmDictEntry(ElVal->GetGroup(),
+ ElVal->GetElement(),
+ vr,
+ "FIXME",
+ ElVal->GetName());
+ ElVal->SetDictEntry(NewTag);
return;
}