From 95e6a4bdf85e20cc52a9a21490c1ebcb94b10312 Mon Sep 17 00:00:00 2001 From: jpr Date: Thu, 10 Apr 2003 09:49:02 +0000 Subject: [PATCH] =?utf8?q?Rectification=20menage=20intempestif=20dans=20le?= =?utf8?q?s=20print.=20(un=20sprintf=20etait=20passe'=20=E0=20la=20trappe)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Testing/TestHash.cxx | 12 ++++++++++++ src/gdcmElValSet.cxx | 25 ++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Testing/TestHash.cxx b/Testing/TestHash.cxx index 56cbdfcd..4e278e5b 100644 --- a/Testing/TestHash.cxx +++ b/Testing/TestHash.cxx @@ -1,6 +1,7 @@ #include #include #include +#include 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 ... } diff --git a/src/gdcmElValSet.cxx b/src/gdcmElValSet.cxx index beb99fd3..b6dfbfb9 100644 --- a/src/gdcmElValSet.cxx +++ b/src/gdcmElValSet.cxx @@ -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 -- 2.45.1