]> Creatis software - gdcm.git/commitdiff
* python/demo/*.py load.py extracted from test.py. Added explore.py
authorfrog <frog>
Wed, 27 Nov 2002 22:28:43 +0000 (22:28 +0000)
committerfrog <frog>
Wed, 27 Nov 2002 22:28:43 +0000 (22:28 +0000)
        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. --- Frog

ChangeLog
src/gdcm.h
src/gdcmHeader.cxx

index 36525709bb5bf44557453a3c67c0fc8280f0b839..89c9142db5f3c7c818e47bee5292f7019669fdcf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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
index 22f3eb9e7044877b912090b28ae43bf0a16f9217..c5ae0c6f0534fdc0b27439404ed331607990b238 100644 (file)
@@ -186,7 +186,7 @@ typedef map<TagKey, ElValue*> TagElValueHT;
 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:
index a2bece5180e74a3a48decff566b0f06c739246c6..7922a455b760a535138bf0956e8b4ebf637df87a 100644 (file)
@@ -226,7 +226,8 @@ void gdcmHeader::CheckSwap()
 }
 
 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;
@@ -283,6 +284,9 @@ void gdcmHeader::SwitchSwapToBigEndian(void) {
  */
 
 void gdcmHeader::FindVR( ElValue *ElVal) {
+       if (filetype != ExplicitVR)
+               return;
+
        char VR[3];
        string vr;
        int lgrLue;
@@ -296,9 +300,6 @@ void gdcmHeader::FindVR( ElValue *ElVal) {
        // 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);
@@ -321,8 +322,26 @@ void gdcmHeader::FindVR( ElValue *ElVal) {
                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; 
        }