]> Creatis software - gdcm.git/commitdiff
Rectification menage intempestif dans les print.
authorjpr <jpr>
Thu, 10 Apr 2003 09:49:02 +0000 (09:49 +0000)
committerjpr <jpr>
Thu, 10 Apr 2003 09:49:02 +0000 (09:49 +0000)
(un sprintf etait passe' à la trappe)

Testing/TestHash.cxx
src/gdcmElValSet.cxx

index 56cbdfcdfe16d6281bc92e157db99d6cc2188406..4e278e5b956312a939d0067e0b0506f5f06a6a27 100644 (file)
@@ -1,6 +1,7 @@
 #include <map>
 #include <string>
 #include <iostream>
+#include <stdio.h>
 
 int main()
 {
@@ -21,4 +22,15 @@ int main()
        cout << "Find request on key 00380010" << endl;
        im = tb1.find("00380010");
        cout << "   \"" << im->first << "\" = " << im->second << endl;
+       
+       int i = 0x0010;
+       std::cout.setf(std::ios::hex);
+       std::cout << i << endl;
+       std::cout.setf(std::ios::dec);
+       std::cout << i << endl; 
+       
+       // Voir :
+       //http://www.developer.com/net/cplus/article.php/10919_2119781_3
+       //
+       // domage que ca ne marche pas ...
 }
index beb99fd364d5dc826c64b7b4c0ccfe39d9a88276..b6dfbfb9ad3b3c72b5bd23db97058bb0b06079ee 100644 (file)
@@ -4,8 +4,6 @@
 #include "gdcmUtil.h"
 #include "gdcmElValSet.h"
 
-#define DEBUG 0
-
 
 TagElValueHT & gdcmElValSet::GetTagHt(void) {
        return tagHt;
@@ -143,7 +141,7 @@ void gdcmElValSet::UpdateGroupLength(bool SkipSequence, FileType type) {
                  
       sprintf(trash, "%04x", gr);
       key = trash;
-            
+                  
       if (SkipSequence && vr == "SQ") continue;
          // pas SEQUENCE en ACR-NEMA
          // WARNING : pb CERTAIN
@@ -168,15 +166,23 @@ void gdcmElValSet::UpdateGroupLength(bool SkipSequence, FileType type) {
       } 
    }
   
+     if(0)
+     for (GroupHT::iterator g = groupHt.begin();
+        g != groupHt.end();
+        ++g){        
+        printf("groupKey %s : %d\n",g->first.c_str(),g->second);
+     }
+       
+  
    unsigned short int gr_bid;
   
    for (GroupHT::iterator g = groupHt.begin();
         g != groupHt.end();
         ++g){ 
   
-      tk = g->first + "|0000";
       sscanf(g->first.c_str(),"%x",&gr_bid);
-               
+      tk = g->first + "|0000";
+                     
       if ( tagHt.count(tk) == 0) { 
          gdcmDictEntry * tagZ = new gdcmDictEntry(gr_bid, 0x0000, "UL");       
          elemZ = new gdcmElValue(tagZ);
@@ -184,7 +190,8 @@ void gdcmElValSet::UpdateGroupLength(bool SkipSequence, FileType type) {
          Add(elemZ);
       } else {
          elemZ=GetElementByNumber(gr_bid, 0x0000);
-      }
+      }     
+      sprintf(trash ,"%d",g->second);
       str_trash=trash;
       elemZ->SetValue(str_trash);
    }   
@@ -217,7 +224,6 @@ void gdcmElValSet::WriteElements(FileType type, FILE * _fp) {
       lgr = tag2->second->GetLength();
       val = tag2->second->GetValue().c_str();
       vr =  tag2->second->GetVR();
-      if(DEBUG)printf ("%04x %04x [%s] : [%s]\n",gr, el, vr.c_str(), val);
 
       if ( type == ACR ) { 
          if (gr < 0x0008) continue;
@@ -280,12 +286,13 @@ int gdcmElValSet::Write(FILE * _fp, FileType type) {
       
       //FIXME Refer to standards on page 21, chapter 6.2 "Value representation":
       //      values with a VR of UI shall be padded with a single trailing null
-      //      Dans le cas suivant on doit pader manuellement avec un 0.
+      //      Dans le cas suivant on doit pader manuellement avec un 0
+      
       SetElValueLengthByNumber(18, 0x0002, 0x0010);
    }
    
        // Question :
-       // Comment pourrait-on si le DcmHeader vient d'un fichoer DicomV3 ou non ,
+       // Comment pourrait-on savoir si le DcmHeader vient d'un fichier DicomV3 ou non ,
        // (FileType est un champ de gdcmHeader ...)
        // WARNING : Si on veut ecrire du DICOM V3 a partir d'un DcmHeader ACR-NEMA
        // no way