]> Creatis software - gdcm.git/commitdiff
ENH: Still remove some sprintf and rework internals
authormalaterre <malaterre>
Sat, 9 Oct 2004 03:21:55 +0000 (03:21 +0000)
committermalaterre <malaterre>
Sat, 9 Oct 2004 03:21:55 +0000 (03:21 +0000)
src/gdcmDicomDir.cxx
src/gdcmDicomDir.h
src/gdcmDicomDirElement.cxx
src/gdcmDicomDirElement.h
src/gdcmDicomDirObject.cxx

index 3a57a57a4d4d42805550e0ea50c08ca562805e35..d9f71b67e87674bc768b0146f74039a2e3f0440f 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/27 08:39:05 $
-  Version:   $Revision: 1.70 $
+  Date:      $Date: 2004/10/09 03:21:55 $
+  Version:   $Revision: 1.71 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
   
 =========================================================================*/
 
-#include <string>
-#include <algorithm>
-#include <sys/types.h>
-
-#ifdef _MSC_VER 
-   #include <direct.h>
-#else
-   #include <unistd.h>
-#endif
-
 #include "gdcmDicomDir.h"
 #include "gdcmDicomDirStudy.h"
 #include "gdcmDicomDirSerie.h"
 #include "gdcmSQItem.h"
 #include "gdcmValEntry.h"
 
+#include <string>
+#include <algorithm>
+#include <sys/types.h>
+
+#ifdef _MSC_VER 
+   #include <direct.h>
+#else
+   #include <unistd.h>
+#endif
+
 //-----------------------------------------------------------------------------
 //  For full DICOMDIR description, see:
 //  PS 3.3-2003, pages 731-750
@@ -54,7 +54,7 @@ gdcmDicomDir::gdcmDicomDir()
 { 
    Initialize();  // sets all private fields to NULL
    std::string pathBidon = "Bidon"; // Sorry, NULL not allowed ...   
-   metaElems = NewMeta();
+   MetaElems = NewMeta();
 }
 
 /**
@@ -87,15 +87,14 @@ gdcmDicomDir::gdcmDicomDir(std::string const & fileName, bool parseDir ):
       {
          // user passed '.' as Name
          // we get current directory name
-         char* dummy = new char[1000];
+         char dummy[1000];
          getcwd(dummy, (size_t)1000);
          SetFileName( dummy ); // will be converted into a string
-         delete[] dummy;       // no longer needed   
       }
 
       if ( parseDir ) // user asked for a recursive parsing of a root directory
       {
-         metaElems = NewMeta();
+         MetaElems = NewMeta();
 
          dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : Parse directory"
                         " and create the DicomDir");
@@ -131,15 +130,15 @@ gdcmDicomDir::~gdcmDicomDir()
    SetStartMethod(NULL);
    SetProgressMethod(NULL);
    SetEndMethod(NULL);
-   for(ListDicomDirPatient::iterator cc = patients.begin();
-                                     cc!= patients.end();
+   for(ListDicomDirPatient::iterator cc = Patients.begin();
+                                     cc!= Patients.end();
                                    ++cc)
    {
       delete *cc;
    }
-   if ( metaElems )
+   if ( MetaElems )
    {
-      delete metaElems;
+      delete MetaElems;
    }
 }
 
@@ -150,13 +149,13 @@ gdcmDicomDir::~gdcmDicomDir()
  */
 void gdcmDicomDir::Print(std::ostream &os)
 {
-   if(metaElems)
+   if( MetaElems )
    {
-      metaElems->SetPrintLevel(PrintLevel);
-      metaElems->Print(os);   
+      MetaElems->SetPrintLevel(PrintLevel);
+      MetaElems->Print(os);   
    }   
-   for(ListDicomDirPatient::iterator cc  = patients.begin();
-                                     cc != patients.end();
+   for(ListDicomDirPatient::iterator cc  = Patients.begin();
+                                     cc != Patients.end();
                                    ++cc)
    {
      (*cc)->SetPrintLevel( PrintLevel );
@@ -180,11 +179,11 @@ bool gdcmDicomDir::IsReadable()
    {
       return false;
    }
-   if( !metaElems )
+   if( !MetaElems )
    {
       return false;
    }
-   if( patients.size() <= 0 )
+   if( Patients.size() <= 0 )
    {
       return false;
    }
@@ -198,20 +197,20 @@ bool gdcmDicomDir::IsReadable()
 
 void gdcmDicomDir::Initialize()
 {
-   startMethod             = NULL;
-   progressMethod          = NULL;
-   endMethod               = NULL;
-   startMethodArgDelete    = NULL;
-   progressMethodArgDelete = NULL;
-   endMethodArgDelete      = NULL;
-   startArg                = NULL;
-   progressArg             = NULL;
-   endArg                  = NULL;
-
-   progress = 0.0;
-   abort = false;
-
-   metaElems = 0;   
+   StartMethod             = NULL;
+   ProgressMethod          = NULL;
+   EndMethod               = NULL;
+   StartMethodArgDelete    = NULL;
+   ProgressMethodArgDelete = NULL;
+   EndMethodArgDelete      = NULL;
+   StartArg                = NULL;
+   ProgressArg             = NULL;
+   EndArg                  = NULL;
+
+   Progress = 0.0;
+   Abort = false;
+
+   MetaElems = 0;   
 }
 
 
@@ -236,14 +235,14 @@ void gdcmDicomDir::ParseDirectory()
 void gdcmDicomDir::SetStartMethod(gdcmMethod* method, void* arg, 
                                   gdcmMethod* argDelete )
 {
-   if( startArg && startMethodArgDelete )
+   if( StartArg && StartMethodArgDelete )
    {
-      startMethodArgDelete( startArg );
+      StartMethodArgDelete( StartArg );
    }
 
-   startMethod          = method;
-   startArg             = arg;
-   startMethodArgDelete = argDelete;
+   StartMethod          = method;
+   StartArg             = arg;
+   StartMethodArgDelete = argDelete;
 }
 
 /**
@@ -255,7 +254,7 @@ void gdcmDicomDir::SetStartMethod(gdcmMethod* method, void* arg,
  */
 void gdcmDicomDir::SetStartMethodArgDelete(gdcmMethod* method) 
 {
-   startMethodArgDelete = method;
+   StartMethodArgDelete = method;
 }
 
 /**
@@ -269,14 +268,14 @@ void gdcmDicomDir::SetStartMethodArgDelete(gdcmMethod* method)
 void gdcmDicomDir::SetProgressMethod(gdcmMethod* method, void* arg, 
                                      gdcmMethod* argDelete )
 {
-   if( progressArg && progressMethodArgDelete )
+   if( ProgressArg && ProgressMethodArgDelete )
    {
-      progressMethodArgDelete( progressArg );
+      ProgressMethodArgDelete( ProgressArg );
    }
 
-   progressMethod          = method;
-   progressArg             = arg;
-   progressMethodArgDelete = argDelete;
+   ProgressMethod          = method;
+   ProgressArg             = arg;
+   ProgressMethodArgDelete = argDelete;
 }
 
 /**
@@ -288,7 +287,7 @@ void gdcmDicomDir::SetProgressMethod(gdcmMethod* method, void* arg,
  */
 void gdcmDicomDir::SetProgressMethodArgDelete(gdcmMethod* method)
 {
-   progressMethodArgDelete = method;
+   ProgressMethodArgDelete = method;
 }
 
 /**
@@ -302,14 +301,14 @@ void gdcmDicomDir::SetProgressMethodArgDelete(gdcmMethod* method)
 void gdcmDicomDir::SetEndMethod(gdcmMethod* method, void* arg, 
                                 gdcmMethod* argDelete )
 {
-   if( endArg && endMethodArgDelete )
+   if( EndArg && EndMethodArgDelete )
    {
-      endMethodArgDelete( endArg );
+      EndMethodArgDelete( EndArg );
    }
 
-   endMethod          = method;
-   endArg             = arg;
-   endMethodArgDelete = argDelete;
+   EndMethod          = method;
+   EndArg             = arg;
+   EndMethodArgDelete = argDelete;
 }
 
 /**
@@ -321,7 +320,7 @@ void gdcmDicomDir::SetEndMethod(gdcmMethod* method, void* arg,
  */
 void gdcmDicomDir::SetEndMethodArgDelete(gdcmMethod* method)
 {
-   endMethodArgDelete = method;
+   EndMethodArgDelete = method;
 }
 
 /**
@@ -348,11 +347,10 @@ bool gdcmDicomDir::WriteDicomDir(std::string const& fileName)
       return false;
    }
 
-   uint8_t* filePreamble = new  uint8_t[128];
+   uint8_t filePreamble[128];
    memset(filePreamble, 0, 128);
    fwrite(filePreamble,128,1,fp);
    fwrite("DICM",4,1,fp);
-   delete[] filePreamble;
  
    gdcmDicomDirMeta *ptrMeta = GetDicomDirMeta();
    ptrMeta->Write(fp, gdcmExplicitVR);
@@ -360,7 +358,9 @@ bool gdcmDicomDir::WriteDicomDir(std::string const& fileName)
    // force writing 0004|1220 [SQ ], that CANNOT exist within gdcmDicomDirMeta
    fwrite(&sq[0],8,1,fp);  // 0004 1220 ffff ffff
         
-   for(ListDicomDirPatient::iterator cc = patients.begin();cc!=patients.end();++cc)
+   for(ListDicomDirPatient::iterator cc  = Patients.begin();
+                                     cc != Patients.end();
+                                   ++cc )
    {
       (*cc)->Write( fp, gdcmExplicitVR );
    }
@@ -389,15 +389,15 @@ void gdcmDicomDir::CreateDicomDirChainedList(std::string const & path)
    gdcmHeader *header;
 
    TagHT.clear();
-   patients.clear();
+   Patients.clear();
 
    for( gdcmDirList::iterator it  = fileList.begin();
                               it != fileList.end();
                               ++it )
    {
-      progress = (float)(count+1)/(float)fileList.size();
+      Progress = (float)(count+1)/(float)fileList.size();
       CallProgressMethod();
-      if( abort )
+      if( Abort )
       {
          break;
       }
@@ -484,12 +484,12 @@ gdcmDicomDirPatient * gdcmDicomDir::NewPatient()
    // for all the DicomDirPatient Elements      
    for( it = elemList.begin(); it != elemList.end(); ++it ) 
    {
-      tmpGr     = it->group;
-      tmpEl     = it->elem;
+      tmpGr     = it->Group;
+      tmpEl     = it->Elem;
       dictEntry = GetPubDict()->GetDictEntryByNumber(tmpGr, tmpEl);
       entry     = new gdcmValEntry( dictEntry );
       entry->SetOffset(0); // just to avoid further missprinting
-      entry->SetValue( it->value );
+      entry->SetValue( it->Value );
 
       // dealing with value length ...
       
@@ -517,7 +517,7 @@ gdcmDicomDirPatient * gdcmDicomDir::NewPatient()
    }
 
    gdcmDicomDirPatient *p = new gdcmDicomDirPatient(s, &TagHT);
-   patients.push_front( p );
+   Patients.push_front( p );
 
    return p;   
 }
@@ -577,8 +577,8 @@ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,
 
    for( it = elemList.begin(); it != elemList.end(); ++it)
    {
-      tmpGr     = it->group;
-      tmpEl     = it->elem;
+      tmpGr     = it->Group;
+      tmpEl     = it->Elem;
       dictEntry = GetPubDict()->GetDictEntryByNumber(tmpGr, tmpEl);
 
       entry     = new gdcmValEntry( dictEntry ); // Be sure it's never a BinEntry !
@@ -586,11 +586,16 @@ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,
       entry->SetOffset(0); // just to avoid further missprinting
       entry->SetLength(0); // just to avoid further missprinting
 
-      if( header ) // NULL when we Build Up (ex nihilo) a DICOMDIR
-                   //   or when we add the META elems
+      if( header )
+      {
+         // NULL when we Build Up (ex nihilo) a DICOMDIR
+         //   or when we add the META elems
          val = header->GetEntryByNumber(tmpGr, tmpEl);
+      }
       else
+      {
          val = GDCM_UNFOUND;
+      }
 
       if( val == GDCM_UNFOUND) 
       {
@@ -608,15 +613,19 @@ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,
                val = header->GetFileName();
             }
             else
+            {
                val = &(header->GetFileName().c_str()[path.length()]);
+            }
          }
          else
-            val = it->value;
+         {
+            val = it->Value;
+         }
       }
       else
       {
          if ( header->GetEntryLengthByNumber(tmpGr,tmpEl) == 0 )
-            val = it->value;
+            val = it->Value;
       }
 
      // GDCM_UNFOUND or not !
@@ -685,11 +694,11 @@ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,
  */
 void gdcmDicomDir::CallStartMethod()
 {
-   progress = 0.0f;
-   abort    = false;
-   if( startMethod )
+   Progress = 0.0f;
+   Abort    = false;
+   if( StartMethod )
    {
-      startMethod( startArg );
+      StartMethod( StartArg );
    }
 }
 
@@ -699,9 +708,9 @@ void gdcmDicomDir::CallStartMethod()
  */
 void gdcmDicomDir::CallProgressMethod()
 {
-   if( progressMethod )
+   if( ProgressMethod )
    {
-      progressMethod( progressArg );
+      ProgressMethod( ProgressArg );
    }
 }
 
@@ -711,10 +720,10 @@ void gdcmDicomDir::CallProgressMethod()
  */
 void gdcmDicomDir::CallEndMethod()
 {
-   progress = 1.0f;
-   if( endMethod )
+   Progress = 1.0f;
+   if( EndMethod )
    {
-      endMethod( endArg );
+      EndMethod( EndArg );
    }
 }
 
@@ -753,7 +762,7 @@ void gdcmDicomDir::CreateDicomDir()
    }
 
    gdcmDicomDirType type = gdcmDicomDir::GDCM_DICOMDIR_META;
-   metaElems = NewMeta();
+   MetaElems = NewMeta();
 
    ListSQItem listItems = s->GetSQItems();
    
@@ -808,11 +817,11 @@ void gdcmDicomDir::CreateDicomDir()
  */
 void gdcmDicomDir::AddDicomDirMeta()
 {
-   if( metaElems )
+   if( MetaElems )
    {
-      delete metaElems;
+      delete MetaElems;
    }
-   metaElems = new gdcmDicomDirMeta( &TagHT );
+   MetaElems = new gdcmDicomDirMeta( &TagHT );
 }
 
 /**
@@ -822,7 +831,7 @@ void gdcmDicomDir::AddDicomDirMeta()
  */
 void gdcmDicomDir::AddDicomDirPatientToEnd(gdcmSQItem *s)
 {
-   patients.push_back(new gdcmDicomDirPatient(s, &TagHT));
+   Patients.push_back(new gdcmDicomDirPatient(s, &TagHT));
 }
 
 /**
@@ -832,9 +841,9 @@ void gdcmDicomDir::AddDicomDirPatientToEnd(gdcmSQItem *s)
  */
  void gdcmDicomDir::AddDicomDirStudyToEnd(gdcmSQItem *s)
 {
-   if( patients.size() > 0 )
+   if( Patients.size() > 0 )
    {
-      ListDicomDirPatient::iterator itp = patients.end();
+      ListDicomDirPatient::iterator itp = Patients.end();
       itp--;
       (*itp)->AddDicomDirStudy(new gdcmDicomDirStudy(s, &TagHT));
    }
@@ -847,9 +856,9 @@ void gdcmDicomDir::AddDicomDirPatientToEnd(gdcmSQItem *s)
  */
 void gdcmDicomDir::AddDicomDirSerieToEnd(gdcmSQItem *s)
 {
-   if( patients.size() > 0 )
+   if( Patients.size() > 0 )
    {
-      ListDicomDirPatient::iterator itp = patients.end();
+      ListDicomDirPatient::iterator itp = Patients.end();
       itp--;
 
       if( (*itp)->GetDicomDirStudies().size() > 0 )
@@ -868,9 +877,9 @@ void gdcmDicomDir::AddDicomDirSerieToEnd(gdcmSQItem *s)
  */
  void gdcmDicomDir::AddDicomDirImageToEnd(gdcmSQItem *s)
 {
-   if( patients.size() > 0 )
+   if( Patients.size() > 0 )
    {
-      ListDicomDirPatient::iterator itp = patients.end();
+      ListDicomDirPatient::iterator itp = Patients.end();
       itp--;
 
       if( (*itp)->GetDicomDirStudies().size() > 0 )
index df5d9f64abaa2e5473041a9587751712c92f83c7..40772ca8ddcd3aee59abca3d2a8cc614d92a497d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDir.h,v $
   Language:  C++
-  Date:      $Date: 2004/09/27 08:39:06 $
-  Version:   $Revision: 1.32 $
+  Date:      $Date: 2004/10/09 03:21:55 $
+  Version:   $Revision: 1.33 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -52,16 +52,16 @@ public:
    /// \sa    SetPrintLevel
    virtual void Print(std::ostream &os = std::cout);
 
-// Informations contained in the parser
+   /// Informations contained in the parser
    virtual bool IsReadable();
 
    /// Returns a pointer to the gdcmDicomDirMeta for this DICOMDIR. 
-   gdcmDicomDirMeta* GetDicomDirMeta() { return metaElems; };
+   gdcmDicomDirMeta* GetDicomDirMeta() { return MetaElems; };
 
    /// Returns the PATIENT chained List for this DICOMDIR.    
-   ListDicomDirPatient &GetDicomDirPatients() { return patients; };
+   ListDicomDirPatient &GetDicomDirPatients() { return Patients; };
 
-// Parsing
+   /// Parsing
    void ParseDirectory();
    
    void SetStartMethod(gdcmMethod*, void* = NULL, gdcmMethod* = NULL);
@@ -72,19 +72,19 @@ public:
    void SetEndMethodArgDelete(gdcmMethod*);
 
    /// GetProgress GetProgress
-   float GetProgress()  { return progress; };
+   float GetProgress()  { return Progress; };
 
    /// AbortProgress AbortProgress
-   void  AbortProgress() { abort = true; };
+   void  AbortProgress() { Abort = true; };
 
    /// IsAborted IsAborted
-   bool  IsAborted() { return abort; };
+   bool  IsAborted() { return Abort; };
    
-// Adding
+   /// Adding
    gdcmDicomDirMeta*    NewMeta();
    gdcmDicomDirPatient* NewPatient();
 
-// Write  
+   /// Write  
    bool WriteDicomDir(std::string const & fileName);
 
    /// Types of the gdcmDicomDirObject within the gdcmDicomDir
@@ -122,33 +122,33 @@ private:
 // Variables
 
    /// Pointer on *the* gdcmDicomDirObject 'DicomDirMeta Elements'
-   gdcmDicomDirMeta* metaElems;
+   gdcmDicomDirMeta* MetaElems;
 
    /// Chained list of DicomDirPatient (to be exploited recursively) 
-   ListDicomDirPatient patients;
-
-/// pointer to the initialisation method for any progress bar   
-   gdcmMethod* startMethod;
-/// pointer to the incrementation method for any progress bar
-    gdcmMethod* progressMethod;
-/// pointer to the termination method for any progress bar
-   gdcmMethod* endMethod;
-/// pointer to the ??? method for any progress bar   
-   gdcmMethod* startMethodArgDelete;
-/// pointer to the ??? method for any progress bar
-   gdcmMethod* progressMethodArgDelete;
-/// pointer to the ??? method for any progress bar
-   gdcmMethod* endMethodArgDelete;
-/// pointer to the ??? for any progress bar   
-   void* startArg;
-/// pointer to the ??? for any progress bar
-   void* progressArg;
-/// pointer to the ??? for any progress bar   
-   void* endArg;
-/// value of the ??? for any progress bar
-   float progress;
-/// value of the ??? for any progress bar   
-   bool abort;
+   ListDicomDirPatient Patients;
+
+   /// pointer to the initialisation method for any progress bar   
+   gdcmMethod* StartMethod;
+   /// pointer to the incrementation method for any progress bar
+   gdcmMethod* ProgressMethod;
+   /// pointer to the termination method for any progress bar
+   gdcmMethod* EndMethod;
+   /// pointer to the ??? method for any progress bar   
+   gdcmMethod* StartMethodArgDelete;
+   /// pointer to the ??? method for any progress bar
+   gdcmMethod* ProgressMethodArgDelete;
+   /// pointer to the ??? method for any progress bar
+   gdcmMethod* EndMethodArgDelete;
+   /// pointer to the ??? for any progress bar   
+   void* StartArg;
+   /// pointer to the ??? for any progress bar
+   void* ProgressArg;
+   /// pointer to the ??? for any progress bar   
+   void* EndArg;
+   /// value of the ??? for any progress bar
+   float Progress;
+   /// value of the ??? for any progress bar   
+   bool Abort;
 };
 
 //-----------------------------------------------------------------------------
index 88df039aa62ba30bd3e78863d11b9bfb1b89d48c..a645bc814c4cc285387c80bd574db384a1c03acd 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirElement.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/10/08 04:43:37 $
-  Version:   $Revision: 1.17 $
+  Date:      $Date: 2004/10/09 03:21:55 $
+  Version:   $Revision: 1.18 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -22,7 +22,6 @@
 #include "gdcmDictSet.h"
 
 #include <fstream>
-#include <stdio.h>    // For sprintf
 #include <iostream>
 
 //-----------------------------------------------------------------------------
@@ -45,7 +44,7 @@ gdcmDicomDirElement::gdcmDicomDirElement()
 
    while (!from.eof())
    {
-      from >> std::ws;  // used to be eatwhite(from);
+      from >> std::ws;
       from.getline(buff, 1024, ' ');
       type = buff;
 
@@ -53,13 +52,13 @@ gdcmDicomDirElement::gdcmDicomDirElement()
           (type=="studyElem") || (type=="serieElem")   || 
           (type=="imageElem") )
       {
-         from >> std::hex >> elem.group >> elem.elem;
+         from >> std::hex >> elem.Group >> elem.Elem;
 
-         from >> std::ws; // used to be eatwhite(from);
+         from >> std::ws;
          from.getline(buff, 1024, '"');
-         from >> std::ws; // Used to be eatwhite(from);
+         from >> std::ws;
          from.getline(buff, 1024, '"');
-         elem.value = buff;
+         elem.Value = buff;
 
          if( type == "metaElem" )
          {
@@ -112,41 +111,42 @@ void gdcmDicomDirElement::Print(std::ostream &os)
 {
    std::ostringstream s;
    std::list<gdcmElement>::iterator it;
-   char greltag[10];  //group element tag
+   //char greltag[10];  //group element tag
+   std::string greltag;
 
    s << "Meta Elements :"<<std::endl;
    for (it = DicomDirMetaList.begin(); it != DicomDirMetaList.end(); ++it)
    {
-      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
-      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+      greltag = Format("%04x|%04x ",it->Group,it->Elem);
+      s << "   (" << greltag << ") = " << it->Value << std::endl;
    }
 
    s << "Patient Elements :"<<std::endl;
    for (it = DicomDirPatientList.begin(); it != DicomDirPatientList.end(); ++it)
    {
-      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
-      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+      greltag = Format("%04x|%04x ",it->Group,it->Elem);
+      s << "   (" << greltag << ") = " << it->Value << std::endl;
    }
 
    s << "Study Elements :"<<std::endl;
    for (it = DicomDirStudyList.begin(); it != DicomDirStudyList.end(); ++it)
    {
-      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
-      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+      greltag = Format("%04x|%04x ", it->Group, it->Elem);
+      s << "   (" << greltag << ") = " << it->Value << std::endl;
    }
 
    s << "Serie Elements :"<<std::endl;
    for (it = DicomDirSerieList.begin(); it != DicomDirSerieList.end(); ++it)
    {
-      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
-      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+      greltag = Format("%04x|%04x ", it->Group, it->Elem);
+      s << "   (" << greltag << ") = " << it->Value << std::endl;
    }
 
    s << "Image Elements :"<<std::endl;
    for (it = DicomDirImageList.begin(); it != DicomDirImageList.end(); ++it)
    {
-      sprintf(greltag,"%04x|%04x ",it->group,it->elem);
-      s << "   ("<<greltag<<") = "<< it->value<<std::endl;
+      greltag = Format("%04x|%04x ", it->Group, it->Elem);
+      s << "   (" << greltag << ") = " << it->Value << std::endl;
    }
 
    os << s.str();
index 1f063a089c0f2637909c6f8b628609aef3fbce33..6ab62e9dff482cbb450c41baff798dfbe187bd4b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirElement.h,v $
   Language:  C++
-  Date:      $Date: 2004/09/27 08:39:06 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2004/10/09 03:21:55 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 typedef struct
 {
    /// DicomGroup number
-   unsigned short int group;
+   unsigned short int Group;
    /// DicomElement number
-   unsigned short int elem;
+   unsigned short int Elem;
    /// value (coded as a std::string) of the Element
-   std::string value;
+   std::string Value;
 } gdcmElement;
 
 typedef std::list<gdcmElement> ListDicomDirMetaElem;
@@ -55,41 +55,46 @@ public:
   /**
     * \brief   canonical Printer 
     * \sa    SetPrintLevel
-  */ 
+    */ 
    void Print(std::ostream &os);
-/**
- * \ingroup gdcmDicomDirElement
- * \brief   returns a reference to the chained List 
- *          related to the META Elements of a DICOMDIR.
- */
+
+   /**
+    * \ingroup gdcmDicomDirElement
+    * \brief   returns a reference to the chained List 
+    *          related to the META Elements of a DICOMDIR.
+    */
    ListDicomDirMetaElem    &GetDicomDirMetaElements()
       { return DicomDirMetaList; };
-/**
- * \ingroup gdcmDicomDirElement
- * \brief   returns a reference to the chained List 
- *          related to the PATIENT Elements of a DICOMDIR.
- */      
+
+   /**
+    * \ingroup gdcmDicomDirElement
+    * \brief   returns a reference to the chained List 
+    *          related to the PATIENT Elements of a DICOMDIR.
+    */      
    ListDicomDirPatientElem &GetDicomDirPatientElements()
       { return DicomDirPatientList; };
-/**
- * \ingroup gdcmDicomDirElement
- * \brief   returns a reference to the chained List 
- *          related to the STUDY Elements of a DICOMDIR.
- */      
+
+   /**
+    * \ingroup gdcmDicomDirElement
+    * \brief   returns a reference to the chained List 
+    *          related to the STUDY Elements of a DICOMDIR.
+    */      
    ListDicomDirStudyElem   &GetDicomDirStudyElements()
       { return DicomDirStudyList; };
-/**
- * \ingroup gdcmDicomDirElement
- * \brief   returns a reference to the chained List 
- *          related to the SERIE Elements of a DICOMDIR.
- */
+
+   /**
+    * \ingroup gdcmDicomDirElement
+    * \brief   returns a reference to the chained List 
+    *          related to the SERIE Elements of a DICOMDIR.
+    */
    ListDicomDirSerieElem   &GetDicomDirSerieElements()
       { return DicomDirSerieList; };
-/**
- * \ingroup gdcmDicomDirElement
- * \brief   returns a reference to the chained List 
- *          related to the IMAGE Elements of a DICOMDIR.
- */
+
+   /**
+    * \ingroup gdcmDicomDirElement
+    * \brief   returns a reference to the chained List 
+    *          related to the IMAGE Elements of a DICOMDIR.
+    */
    ListDicomDirImageElem   &GetDicomDirImageElements()
       { return DicomDirImageList; };
 
index ae5ca855f9ce83c48280eb5c5df958485ec58c2f..5bbdbc024f9275f6ba2ac5464e141181c8c365d3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirObject.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/09/27 08:39:06 $
-  Version:   $Revision: 1.2 $
+  Date:      $Date: 2004/10/09 03:21:55 $
+  Version:   $Revision: 1.3 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -89,12 +89,12 @@ void gdcmDicomDirObject::FillObject(std::list<gdcmElement> elemList)
    // for all the Elements found in they own part of the DicomDir dict.     
    for(it = elemList.begin(); it != elemList.end(); ++it)
    {
-      tmpGr = it->group;
-      tmpEl = it->elem;
+      tmpGr = it->Group;
+      tmpEl = it->Elem;
       dictEntry = gdcmGlobal::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
       entry = new gdcmValEntry(dictEntry);
       entry->SetOffset(0); // just to avoid further missprinting
-      entry->SetValue(it->value);
+      entry->SetValue(it->Value);
 
       // dealing with value length ...