]> Creatis software - gdcm.git/commitdiff
ENH: Minor patch, cosmetic -again-. Remove all this->. I might have discover the...
authormalaterre <malaterre>
Sun, 1 Aug 2004 00:59:21 +0000 (00:59 +0000)
committermalaterre <malaterre>
Sun, 1 Aug 2004 00:59:21 +0000 (00:59 +0000)
17 files changed:
src/gdcmBinEntry.cxx
src/gdcmDicomDirPatient.cxx
src/gdcmDicomDirSerie.cxx
src/gdcmDicomDirStudy.cxx
src/gdcmDictSet.cxx
src/gdcmDictSet.h
src/gdcmDirList.cxx
src/gdcmDocEntry.cxx
src/gdcmDocEntry.h
src/gdcmDocument.cxx
src/gdcmHeaderHelper.cxx
src/gdcmObject.cxx
src/gdcmObject.h
src/gdcmSQItem.cxx
src/gdcmSQItem.h
src/gdcmValEntry.cxx
src/gdcmValEntry.h

index 81230ef96d837ce82a2ddd55ef3de33013908b7c..03a93ba24af4486b0e04fbafa99d31d955c0e31a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/25 12:58:24 $
-  Version:   $Revision: 1.19 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.20 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -28,7 +28,7 @@
  */
 gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e)
 {
-   this->voidArea = NULL;
+   voidArea = NULL;
 }
 
 /**
@@ -37,22 +37,26 @@ gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e)
  */
 gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
 {
-   this->UsableLength = e->GetLength();
-   this->ReadLength   = e->GetReadLength();
-   this->ImplicitVR   = e->IsImplicitVR();
-   this->Offset       = e->GetOffset();
-   this->printLevel   = e->GetPrintLevel();
-   this->SQDepthLevel = e->GetDepthLevel();
+   UsableLength = e->GetLength();
+   ReadLength   = e->GetReadLength();
+   ImplicitVR   = e->IsImplicitVR();
+   Offset       = e->GetOffset();
+   printLevel   = e->GetPrintLevel();
+   SQDepthLevel = e->GetDepthLevel();
 
-   this->voidArea = NULL; // let's be carefull !
+   voidArea = NULL; // let's be carefull !
 }
 
 /**
  * \brief   Canonical destructor.
  */
-gdcmBinEntry::~gdcmBinEntry(){
+gdcmBinEntry::~gdcmBinEntry()
+{
    if (voidArea)
+   {
       free (voidArea);
+      voidArea = NULL; // let's be carefull !
+   }
 }
 
 
@@ -67,7 +71,7 @@ void gdcmBinEntry::Print(std::ostream &os)
    gdcmDocEntry::Print(os);
    std::ostringstream s;
    void *voidArea = GetVoidArea();
-   if (voidArea != NULL)
+   if (voidArea)
    {
       s << " [gdcm::Binary data loaded with length is "
         << GetLength() << "]";
@@ -75,7 +79,9 @@ void gdcmBinEntry::Print(std::ostream &os)
    else
    {
       if ( GetLength() == 0 )
+      {
          s << " []";
+      }
       else 
       {
          s << " [gdcm::Binary data NOT loaded]";
@@ -88,15 +94,16 @@ void gdcmBinEntry::Print(std::ostream &os)
 /*
  * \brief   canonical Writer
  */
-void gdcmBinEntry::Write(FILE *fp, FileType filetype) {
+void gdcmBinEntry::Write(FILE *fp, FileType filetype)
+{
    gdcmDocEntry::Write(fp, filetype);
    void *voidArea = GetVoidArea();
-   int lgr=GetLength();
-   if (voidArea != NULL) 
-   { // there is a 'non string' LUT, overlay, etc
+   int lgr = GetLength();
+   if (voidArea)
+   {
+      // there is a 'non string' LUT, overlay, etc
       fwrite ( voidArea,(size_t)lgr ,(size_t)1 ,fp); // Elem value
-      return;            
-   } 
+   }
 }
 //-----------------------------------------------------------------------------
 // Public
index e4c646d0275001f138edeefc362c6885add8a43a..85fa49b5d28176ea8db1009b904584d8cc5921f2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirPatient.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/20 18:08:47 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -65,12 +65,13 @@ gdcmDicomDirPatient::~gdcmDicomDirPatient()
  */ 
 void gdcmDicomDirPatient::Print(std::ostream &os)
 {
-   os<<"PATIENT"<<std::endl;
+   os << "PATIENT" << std::endl;
    gdcmObject::Print(os);
 
-   for(ListDicomDirStudy::iterator cc = studies.begin();cc!=studies.end();++cc)
+   for(ListDicomDirStudy::iterator cc = studies.begin();
+                                   cc != studies.end(); ++cc)
    {
-      (*cc)->SetPrintLevel(printLevel);
+      (*cc)->SetPrintLevel(PrintLevel);
       (*cc)->Print(os);
    }
 }
@@ -83,17 +84,16 @@ void gdcmDicomDirPatient::Print(std::ostream &os)
  * \brief   adds a new Patient at the begining of the PatientList
  *          of a partially created DICOMDIR
  */
-gdcmDicomDirStudy * gdcmDicomDirPatient::NewStudy(void) {
-   std::list<gdcmElement> elemList;   
-   elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
+gdcmDicomDirStudy * gdcmDicomDirPatient::NewStudy()
+{
+   std::list<gdcmElement> elemList = 
+      gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
       
-   gdcmDicomDirStudy *st = new gdcmDicomDirStudy( ptagHT);
+   gdcmDicomDirStudy *st = new gdcmDicomDirStudy( PtagHT );
    st->FillObject(elemList);
 
    studies.push_front(st);
    return st; 
-
-  
 }   
 
 //-----------------------------------------------------------------------------
index 0b62c553ac2e0b3adc0bb2fecc9e3be63b3afd4a..146d1c06ee771e0454d45450c2ac5823073fec1a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirSerie.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/21 14:02:10 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.12 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -48,7 +48,9 @@ gdcmDicomDirSerie::gdcmDicomDirSerie(TagDocEntryHT *ptagHT):
  */
 gdcmDicomDirSerie::~gdcmDicomDirSerie() 
 {
-   for(ListDicomDirImage::iterator cc = images.begin();cc != images.end();++cc)
+   for(ListDicomDirImage::iterator cc = images.begin();
+                                   cc != images.end();
+                                   ++cc)
    {
       delete *cc;
    }
@@ -62,12 +64,14 @@ gdcmDicomDirSerie::~gdcmDicomDirSerie()
  */ 
 void gdcmDicomDirSerie::Print(std::ostream &os)
 {
-   os<<"SERIE"<<std::endl;
+   os << "SERIE" << std::endl;
    gdcmObject::Print(os);
 
-   for(ListDicomDirImage::iterator cc = images.begin();cc != images.end();++cc)
+   for(ListDicomDirImage::iterator cc = images.begin();
+                                   cc != images.end();
+                                   ++cc)
    {
-      (*cc)->SetPrintLevel(printLevel);
+      (*cc)->SetPrintLevel(PrintLevel);
       (*cc)->Print(os);
    }
 }
@@ -77,13 +81,15 @@ void gdcmDicomDirSerie::Print(std::ostream &os)
 /**
  * \brief   adds a new Image (with the basic elements) to a partially created DICOMDIR
  */
-gdcmDicomDirImage * gdcmDicomDirSerie::NewImage(void) {
-   std::list<gdcmElement> elemList;   
-   elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
-      
-   gdcmDicomDirImage *st = new gdcmDicomDirImage(ptagHT);
+gdcmDicomDirImage * gdcmDicomDirSerie::NewImage()
+{
+   std::list<gdcmElement> elemList = 
+      gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
+
+   gdcmDicomDirImage *st = new gdcmDicomDirImage(PtagHT);
    FillObject(elemList);
    images.push_front(st);
+
    return st;   
 } 
 //-----------------------------------------------------------------------------
index 3dffdb3a6e1d2e437eee769db7bf8eb9120a7ca1..ca551f164b9b6a5b59b8837d6e6b43c261ce059d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDirStudy.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/20 18:08:47 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -68,9 +68,11 @@ void gdcmDicomDirStudy::Print(std::ostream &os)
    os<<"STUDY"<<std::endl;
    gdcmObject::Print(os);
 
-   for(ListDicomDirSerie::iterator cc = series.begin();cc != series.end();++cc)
+   for(ListDicomDirSerie::iterator cc = series.begin();
+                                   cc != series.end();
+                                   ++cc)
    {
-      (*cc)->SetPrintLevel(printLevel);
+      (*cc)->SetPrintLevel(PrintLevel);
       (*cc)->Print(os);
    }
 }
@@ -83,14 +85,15 @@ void gdcmDicomDirStudy::Print(std::ostream &os)
  * \brief   adds a new Serie at the begining of the SerieList
  *          of a partially created DICOMDIR
  */
-gdcmDicomDirSerie * gdcmDicomDirStudy::NewSerie(void) {
-  
-   std::list<gdcmElement> elemList;
-   elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirSerieElements();   
+gdcmDicomDirSerie * gdcmDicomDirStudy::NewSerie()
+{
+   std::list<gdcmElement> elemList = 
+      gdcmGlobal::GetDicomDirElements()->GetDicomDirSerieElements();   
 
-   gdcmDicomDirSerie *st = new gdcmDicomDirSerie(ptagHT);
+   gdcmDicomDirSerie *st = new gdcmDicomDirSerie(PtagHT);
    FillObject(elemList);
    series.push_front(st);
+
    return st;  
 }   
 //-----------------------------------------------------------------------------
index c26768c0861ad86e8f7cd9edd2a3499f8fb9a490..6d8e10b01b63bf971be906e66e5de46adc39e7f9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/02 13:55:27 $
-  Version:   $Revision: 1.32 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  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
@@ -28,7 +28,7 @@
  * \brief   The Dictionnary Set obtained with this constructor simply
  *          contains the Default Public dictionnary.
  */
-gdcmDictSet::gdcmDictSet(void
+gdcmDictSet::gdcmDictSet() 
 {
    DictPath = BuildDictPath();
    std::string PubDictFile(DictPath);
index b9d57a9d0caf5f5586fff9e6fa6eabd7ba126c0c..960296d6ac9ca0ee34ca8bb50cbef3e0149f1ff6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDictSet.h,v $
   Language:  C++
-  Date:      $Date: 2004/07/02 13:55:27 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.22 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -35,7 +35,8 @@ typedef std::map<DictKey, gdcmDict*> DictSetHT;
  * \par    having many in memory representations of the same dictionary
  *        (saving memory).
  */
-class GDCM_EXPORT gdcmDictSet {
+class GDCM_EXPORT gdcmDictSet
+{
 public:
    // TODO Swig int LoadDictFromFile(std::string filename);
    // QUESTION: the following function might not be thread safe !? Maybe
@@ -44,26 +45,26 @@ public:
    // TODO Swig int LoadDictFromName(std::string filename);
    // TODO Swig int LoadAllDictFromDirectory(std::string DirectoryName);
    // TODO Swig std::string* GetAllDictNames();
-   gdcmDictSet(void);
-   ~gdcmDictSet(void);
+   gdcmDictSet();
+   ~gdcmDictSet();
 
    void Print(std::ostream& os);
 
-   std::list<std::string> *GetPubDictEntryNames(void);
+   std::list<std::string> *GetPubDictEntryNames();
    std::map<std::string, std::list<std::string> > *
-       GetPubDictEntryNamesByCategory(void);
+       GetPubDictEntryNamesByCategory();
 
    gdcmDict *LoadDictFromFile(std::string FileName, DictKey Name);
 
    gdcmDict *GetDict(DictKey DictName);
-   gdcmDict *GetDefaultPubDict(void);
+   gdcmDict *GetDefaultPubDict();
 
    gdcmDictEntry *NewVirtualDictEntry(uint16_t group, uint16_t element,
                                       std::string vr     = "Unknown",
                                       std::string fourth = "Unknown",
                                       std::string name   = "Unknown");
 
-   static std::string BuildDictPath(void);
+   static std::string BuildDictPath();
 
 protected:
    bool AppendDict(gdcmDict *NewDict,DictKey Name);
index 71c09f24a242d0f742ded301c2180a0ede5351e2..d76015df920331e0e149bf18033e6241d7ab4c0a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDirList.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/26 19:36:56 $
-  Version:   $Revision: 1.18 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.19 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -107,7 +107,7 @@ int gdcmDirList::Explore(std::string dirName, bool recursive)
       }
       else
       {
-         this->push_back(dirName+fileName);
+         push_back(dirName+fileName);
          numberOfFiles++;
       }
 
@@ -137,7 +137,7 @@ int gdcmDirList::Explore(std::string dirName, bool recursive)
       stat(fileName.c_str(), &buf); //really discard output ?
       if( S_ISREG(buf.st_mode) ) //is it a regular file?
       {
-         this->push_back( fileName );
+         push_back( fileName );
          numberOfFiles++;
       }
       else if( S_ISDIR(buf.st_mode) ) //directory?
index 5b1a9f3bc530d230a319e6d6645b58f300d57e3b..cd53a4b0e99c94d82eee6c43981cdbf8105e78e7 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/02 13:55:27 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -33,7 +33,8 @@
  * \brief   Constructor from a given gdcmDictEntry
  * @param   in Pointer to existing dictionary entry
  */
-gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in) {
+gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in)
+{
    ImplicitVR = false;
    entry = in;
 }
@@ -45,8 +46,8 @@ gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in) {
  * \brief   Prints the common part of gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
  * @param   os ostream we want to print in
  */
-void gdcmDocEntry::Print(std::ostream & os) {
-
+void gdcmDocEntry::Print(std::ostream & os)
+{
    printLevel=2; // FIXME
    
    size_t o;
@@ -65,17 +66,21 @@ void gdcmDocEntry::Print(std::ostream & os) {
    sprintf(greltag,"%04x|%04x ",g,e);           
    s << greltag ;
        
-   if (printLevel>=2) { 
+   if (printLevel>=2)
+   {
       s << "lg : ";
       lgth = GetReadLength(); // ReadLength, as opposed to UsableLength
-      if (lgth == 0xffffffff) {
+      if (lgth == 0xffffffff)
+      {
          sprintf(st,"x(ffff)");  // I said : "x(ffff)" !
          s.setf(std::ios::left);
          s << std::setw(10-strlen(st)) << " ";  
          s << st << " ";
          s.setf(std::ios::left);
          s << std::setw(8) << "-1";      
-      } else {
+      }
+      else
+      {
          sprintf(st,"x(%x)",lgth);
          s.setf(std::ios::left);
          s << std::setw(10-strlen(st)) << " ";  
@@ -92,7 +97,8 @@ void gdcmDocEntry::Print(std::ostream & os) {
 
    s << "[" << vr  << "] ";
 
-   if (printLevel>=1) {      
+   if (printLevel >= 1)
+   {
       s.setf(std::ios::left);
       s << std::setw(66-GetName().length()) << " ";
    }
@@ -105,19 +111,21 @@ void gdcmDocEntry::Print(std::ostream & os) {
  * \ingroup gdcmDocEntry
  * \brief   Writes the common part of any gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
  */
-void gdcmDocEntry::Write(FILE *fp, FileType filetype) {
-
+void gdcmDocEntry::Write(FILE *fp, FileType filetype)
+{
    uint32_t FFFF  = 0xffffffff;
    uint16_t group = GetGroup();
    gdcmVRKey vr   = GetVR();
    uint16_t el    = GetElement();
    uint32_t lgr   = GetReadLength();
 
-   if ( (group == 0xfffe) && (el == 0x0000) ) 
+   if ( (group == 0xfffe) && (el == 0x0000) )
+   {
      // Fix in order to make some MR PHILIPS images e-film readable
      // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm:
      // we just *always* ignore spurious fffe|0000 tag !   
-      return; 
+      return;
+   }
 
 //
 // ----------- Writes the common part
@@ -125,10 +133,11 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype) {
    fwrite ( &group,(size_t)2 ,(size_t)1 ,fp);  //group
    fwrite ( &el,   (size_t)2 ,(size_t)1 ,fp);  //element
       
-   if ( filetype == gdcmExplicitVR ) {
-
+   if ( filetype == gdcmExplicitVR )
+   {
       // Special case of delimiters:
-      if (group == 0xfffe) {
+      if (group == 0xfffe)
+      {
          // Delimiters have NO Value Representation
          // Hence we skip writing the VR.
          // In order to avoid further troubles, we choose to write them
@@ -139,44 +148,56 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype) {
 
        // TODO : verify if the Sequence Delimitor Item was forced during Parsing 
 
-         int ff=0xffffffff;
+         int ff = 0xffffffff;
          fwrite (&ff,(size_t)4 ,(size_t)1 ,fp);
          return;
       }
 
-      uint16_t z=0;
+      uint16_t z = 0;
       uint16_t shortLgr = lgr;
 
-      if (vr == "unkn") {     // Unknown was 'written'
+      if (vr == "unkn")
+      {
+         // Unknown was 'written'
          // deal with Little Endian            
          fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,fp);
          fwrite ( &z,  (size_t)2 ,(size_t)1 ,fp);
-      } else {
+      }
+      else
+      {
          fwrite (vr.c_str(),(size_t)2 ,(size_t)1 ,fp); 
                   
          if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") || (vr == "UN") )
          {
             fwrite ( &z,  (size_t)2 ,(size_t)1 ,fp);
-            if (vr == "SQ") {
-            // we set SQ length to ffffffff
-            // and  we shall write a Sequence Delimitor Item 
-            // at the end of the Sequence! 
+            if (vr == "SQ")
+            {
+               // we set SQ length to ffffffff
+               // and  we shall write a Sequence Delimitor Item 
+               // at the end of the Sequence! 
                fwrite ( &FFFF,(size_t)4 ,(size_t)1 ,fp);
-            } else {
+            }
+            else
+            {
                fwrite ( &lgr,(size_t)4 ,(size_t)1 ,fp);
             }
-         } else {
+         }
+         else
+         {
             fwrite ( &shortLgr,(size_t)2 ,(size_t)1 ,fp);
          }
       }
    } 
    else // IMPLICIT VR 
    { 
-      if (vr == "SQ") {
-          fwrite ( &FFFF,(size_t)4 ,(size_t)1 ,fp);
-       } else {
-          fwrite ( &lgr,(size_t)4 ,(size_t)1 ,fp);
-       }
+      if (vr == "SQ")
+      {
+         fwrite ( &FFFF,(size_t)4 ,(size_t)1 ,fp);
+      }
+      else
+      {
+         fwrite ( &lgr,(size_t)4 ,(size_t)1 ,fp);
+      }
    }
 }
 
@@ -187,30 +208,39 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype) {
  * \ingroup gdcmDocEntry
  * \brief   Gets the full length of the elementary DocEntry (not only value length)
  */
-uint32_t gdcmDocEntry::GetFullLength(void) {
-   uint32_t l;
-   l = GetReadLength();
-   if ( IsImplicitVR() ) 
+uint32_t gdcmDocEntry::GetFullLength()
+{
+   uint32_t l = GetReadLength();
+   if ( IsImplicitVR() )
+   {
       l = l + 8;  // 2 (gr) + 2 (el) + 4 (lgth) 
-   else    
+   }
+   else
+   {
       if ( GetVR()=="OB" || GetVR()=="OW" || GetVR()=="SQ" )
+      {
          l = l + 12; // 2 (gr) + 2 (el) + 2 (vr) + 2 (unused) + 4 (lgth)
+      }
       else
+      {
          l = l + 8;  // 2 (gr) + 2 (el) + 2 (vr) + 2 (lgth)
-   return(l);
+      }
+   }
+   return l;
 }
 
 /**
  * \ingroup gdcmDocEntry
  * \brief   Copies all the attributes from an other DocEntry 
  */
-void gdcmDocEntry::Copy (gdcmDocEntry* e) {
-   this->entry        = e->entry;
-   this->UsableLength = e->UsableLength;
-   this->ReadLength   = e->ReadLength;
-   this->ImplicitVR   = e->ImplicitVR;
-   this->Offset       = e->Offset;
-   this->printLevel   = e->printLevel;
+void gdcmDocEntry::Copy (gdcmDocEntry* e)
+{
+   entry        = e->entry;
+   UsableLength = e->UsableLength;
+   ReadLength   = e->ReadLength;
+   ImplicitVR   = e->ImplicitVR;
+   Offset       = e->Offset;
+   printLevel   = e->printLevel;
    // TODO : remove gdcmDocEntry SQDepth
 }
 
@@ -219,22 +249,18 @@ void gdcmDocEntry::Copy (gdcmDocEntry* e) {
  * \brief   tells us if entry is the last one of a 'no length' SequenceItem 
  *          (fffe,e00d) 
  */
-bool gdcmDocEntry::isItemDelimitor() {
-   if ( (GetGroup() == 0xfffe) && (GetElement() == 0xe00d) )
-      return true;
-   else
-      return false;      
+bool gdcmDocEntry::isItemDelimitor()
+{
+   return (GetGroup() == 0xfffe && GetElement() == 0xe00d);
 }
 /**
  * \ingroup gdcmDocEntry
  * \brief   tells us if entry is the last one of a 'no length' Sequence 
  *          (fffe,e0dd) 
  */
-bool gdcmDocEntry::isSequenceDelimitor() {
-   if (GetGroup() == 0xfffe && GetElement() == 0xe0dd)
-      return true;
-   else
-      return false; 
+bool gdcmDocEntry::isSequenceDelimitor()
+{
+   return (GetGroup() == 0xfffe && GetElement() == 0xe0dd);
 }
 
 //-----------------------------------------------------------------------------
index 5792c6417cf920e4e6c112075c0babe768499e38..9f7a59a65c4b8a91f38e3b1aa2f9360aec16e032 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.h,v $
   Language:  C++
-  Date:      $Date: 2004/07/31 18:43:43 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.15 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -39,7 +39,7 @@ class GDCM_EXPORT gdcmDocEntry
 {
 public:
    gdcmDocEntry(gdcmDictEntry*);
-     
+
    /// Returns the Dicom Group number of the current Dicom Header Entry
    uint16_t      GetGroup()     { return entry->GetGroup();  };
 
@@ -120,7 +120,7 @@ public:
    void SetPrintLevel(int level) { printLevel = level; };
 
    /// \brief Gets the print level for the Dicom Header Elements
-   int GetPrintLevel() { return(printLevel); };
+   int GetPrintLevel() { return printLevel; };
    
    virtual void Print (std::ostream & os = std::cout); 
    virtual void Write(FILE *fp, FileType filetype);
index af9d840d54a538d5fa2e4ac774e421ceac4f1427..499accac5410d45dee99ccb863dedd6eaa0adfab 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/31 23:30:04 $
-  Version:   $Revision: 1.61 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.62 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -2763,7 +2763,7 @@ void gdcmDocument::Parse7FE0 ()
 bool gdcmDocument::operator<(gdcmDocument &document)
 {
    // Patient Name
-   std::string s1 = this->GetEntryByNumber(0x0010,0x0010);
+   std::string s1 = GetEntryByNumber(0x0010,0x0010);
    std::string s2 = document.GetEntryByNumber(0x0010,0x0010);
    if(s1 < s2)
    {
@@ -2776,7 +2776,7 @@ bool gdcmDocument::operator<(gdcmDocument &document)
    else
    {
       // Patient ID
-      s1 = this->GetEntryByNumber(0x0010,0x0020);
+      s1 = GetEntryByNumber(0x0010,0x0020);
       s2 = document.GetEntryByNumber(0x0010,0x0020);
       if ( s1 < s2 )
       {
@@ -2789,7 +2789,7 @@ bool gdcmDocument::operator<(gdcmDocument &document)
       else
       {
          // Study Instance UID
-         s1 = this->GetEntryByNumber(0x0020,0x000d);
+         s1 = GetEntryByNumber(0x0020,0x000d);
          s2 = document.GetEntryByNumber(0x0020,0x000d);
          if ( s1 < s2 )
          {
@@ -2802,7 +2802,7 @@ bool gdcmDocument::operator<(gdcmDocument &document)
          else
          {
             // Serie Instance UID
-            s1 = this->GetEntryByNumber(0x0020,0x000e);
+            s1 = GetEntryByNumber(0x0020,0x000e);
             s2 = document.GetEntryByNumber(0x0020,0x000e);
             if ( s1 < s2 )
             {
index 164254ef0f4c194a50efab943e7e39b90af25c4d..c8d6c43eb074cca3343f20caa0e62834699bcdc3 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmHeaderHelper.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/25 20:48:25 $
-  Version:   $Revision: 1.40 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.41 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -55,7 +55,7 @@ gdcmSerieHeader::~gdcmSerieHeader()
 void gdcmSerieHeader::AddFileName(std::string const & filename)
 {
    gdcmHeader *header = new gdcmHeader( filename );
-   this->CoherentGdcmFileList.push_back( header );
+   CoherentGdcmFileList.push_back( header );
 }
 
 /**
@@ -64,7 +64,7 @@ void gdcmSerieHeader::AddFileName(std::string const & filename)
  */
 void gdcmSerieHeader::AddGdcmFile(gdcmHeader *file)
 {
-   this->CoherentGdcmFileList.push_back( file );
+   CoherentGdcmFileList.push_back( file );
 }
 
 /**
@@ -80,7 +80,7 @@ void gdcmSerieHeader::SetDirectory(std::string const & dir)
    {
       //use string and not const char*:
       gdcmHeader *header = new gdcmHeader( *it ); 
-      this->CoherentGdcmFileList.push_back( header );
+      CoherentGdcmFileList.push_back( header );
    }
 }
 
index 953131b2eb84b9d12145a5c5276c80a6d23052b1..d5f2848f5073881b54c00d26458b3aaad22322aa 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmObject.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/21 14:02:10 $
-  Version:   $Revision: 1.23 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.24 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -32,8 +32,9 @@
  */
   
 gdcmObject::gdcmObject(TagDocEntryHT *ptagHT, int depth) 
-          : gdcmSQItem (depth) {
-   this->ptagHT = ptagHT;
+          : gdcmSQItem (depth)
+{
+   PtagHT = ptagHT;
 }
 
 
@@ -41,7 +42,8 @@ gdcmObject::gdcmObject(TagDocEntryHT *ptagHT, int depth)
  * \ingroup gdcmObject
  * \brief   Canonical destructor.
  */
-gdcmObject::~gdcmObject(void) {
+gdcmObject::~gdcmObject()
+{
 }
 
 
@@ -57,13 +59,16 @@ gdcmObject::~gdcmObject(void) {
  *          related to this 'object'
  * @return
  */ 
-TagDocEntryHT gdcmObject::GetEntry(void) {
+TagDocEntryHT gdcmObject::GetEntry()
+{
    TagDocEntryHT HT;
    docEntries=GetDocEntries();   
-   for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i) {
+   for(ListDocEntry::iterator i = docEntries.begin(); 
+                              i != docEntries.end(); ++i)
+   {
       HT[(*i)->GetKey()]=*i;
    }
-   return(HT);
+   return HT;
 }
 
 //-----------------------------------------------------------------------------
@@ -72,8 +77,8 @@ TagDocEntryHT gdcmObject::GetEntry(void) {
  * \brief   add the 'Object' related Dicom Elements to the listEntries
  *          of a partially created DICOMDIR
  */
-void gdcmObject::FillObject(std::list<gdcmElement> elemList) {
-
+void gdcmObject::FillObject(std::list<gdcmElement> elemList)
+{
   // FillObject rempli le SQItem qui sera accroche au bon endroit
 
    std::list<gdcmElement>::iterator it;
@@ -82,12 +87,12 @@ void gdcmObject::FillObject(std::list<gdcmElement> elemList) {
    gdcmValEntry *entry;
       
    // for all the Elements found in they own part of the DicomDir dict.     
-   for(it=elemList.begin();it!=elemList.end();++it)
+   for(it = elemList.begin(); it != elemList.end(); ++it)
    {
-      tmpGr=it->group;
-      tmpEl=it->elem;
-      dictEntry=gdcmGlobal::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
-      entry=new gdcmValEntry(dictEntry);
+      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);
 
@@ -97,15 +102,15 @@ void gdcmObject::FillObject(std::list<gdcmElement> elemList) {
       {
          entry->SetLength(entry->GetValue().length());
       }
-      else if( (dictEntry->GetVR()=="UL") || (dictEntry->GetVR()=="SL") ) 
+      else if( dictEntry->GetVR() == "UL" || dictEntry->GetVR() == "SL" ) 
       {
          entry->SetLength(4);
       } 
-      else if( (dictEntry->GetVR()=="US") || (dictEntry->GetVR()=="SS") ) 
+      else if( dictEntry->GetVR() == "US" || dictEntry->GetVR() == "SS" ) 
       {
          entry->SetLength(2); 
       } 
-      else if(dictEntry->GetVR()=="SQ") 
+      else if( dictEntry->GetVR() == "SQ" )
       {
          entry->SetLength(0xffffffff);
       }
index 92a10313c7dccbde1c721423c97054d11c470374..2f4317fade93a769d2bfc5199783d881d44bd7ee 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmObject.h,v $
   Language:  C++
-  Date:      $Date: 2004/06/20 18:08:48 $
-  Version:   $Revision: 1.17 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  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
@@ -39,15 +39,13 @@ typedef std::list<gdcmObject *> ListContent;
 class GDCM_EXPORT gdcmObject : public gdcmSQItem
 {
 public:
-
    /**
     * \brief   Sets the print level for the Dicom Header 
     * \note    0 for Light Print; 1 for 'medium' Print, 2 for Heavy
     */
-   void SetPrintLevel(int level) 
-      { printLevel = level; };
+   void SetPrintLevel(int level) { PrintLevel = level; };
    
-   TagDocEntryHT GetEntry(void);
+   TagDocEntryHT GetEntry();
    void FillObject(std::list<gdcmElement> elemList);
 
 protected:
@@ -55,13 +53,11 @@ protected:
    // Constructor and destructor are protected to avoid end user to
    // instanciate from this class.
    gdcmObject(TagDocEntryHT *ptagHT, int depth = 0);
-   virtual ~gdcmObject(void);
+   virtual ~gdcmObject();
 
 // Members :
    ///\brief detail level to be printed 
-   int printLevel;
-
-private:
+   int PrintLevel;
 };
 
 //-----------------------------------------------------------------------------
index d34f7a9d640f622dd96e8f83d9783bea1d54ac7b..cdd330d0b00a4f1dcac4f44d2d8163faa5b0faa5 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSQItem.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/17 22:47:01 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2004/08/01 00:59:21 $
+  Version:   $Revision: 1.22 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -33,7 +33,8 @@
  * \brief   Constructor from a given gdcmSQItem
  */
 gdcmSQItem::gdcmSQItem(int depthLevel ) 
-          : gdcmDocEntrySet(depthLevel) {
+          : gdcmDocEntrySet(depthLevel)
+{
    SQDepthLevel = depthLevel +1;
 }
 
@@ -56,16 +57,19 @@ gdcmSQItem::~gdcmSQItem()
 /*
  * \brief   canonical Printer
  */
- void gdcmSQItem::Print(std::ostream & os) {
+ void gdcmSQItem::Print(std::ostream & os)
+ {
    std::ostringstream s;
 
-   if (SQDepthLevel>0)
+   if (SQDepthLevel > 0)
    {
-      for (int i=0;i<SQDepthLevel;i++)
+      for (int i = 0; i < SQDepthLevel; ++i)
+      {
          s << "   | " ;
+      }
    }
    std::cout << s.str() << " --- SQItem number " << SQItemNumber  << std::endl;
-   for (ListDocEntry::iterator i  = docEntries.begin();  
+   for (ListDocEntry::iterator i  = docEntries.begin();
                                i != docEntries.end();
                              ++i)
    {
@@ -81,7 +85,9 @@ gdcmSQItem::~gdcmSQItem()
          PrintEndLine = false;
       }
       if (PrintEndLine)
+      {
          os << std::endl;
+      }
    } 
 }
 
@@ -100,13 +106,17 @@ void gdcmSQItem::Write(FILE *fp,FileType filetype)
       // It will be written outside, because ALL the SQItems are written
       // as 'no length'
       if ( (*i)->isItemDelimitor() )
+      {
          break;
+      }
 
       // Fix in order to make some MR PHILIPS images e-film readable
       // see gdcmData/gdcm-MR-PHILIPS-16-Multi-Seq.dcm:
       // we just *always* ignore spurious fffe|0000 tag ! 
-      if ( ((*i)->GetGroup() == 0xfffe) && ((*i)->GetElement() == 0x0000) )  
-         break; 
+      if ( (*i)->GetGroup() == 0xfffe && (*i)->GetElement() == 0x0000 )
+      {
+         break;
+      }
 
       // It's up to the gdcmDocEntry Writter to write the SQItem begin element
       // (fffe|e000) as a 'no length' one
@@ -142,57 +152,67 @@ bool gdcmSQItem::AddEntry(gdcmDocEntry *entry)
 bool gdcmSQItem::SetEntryByNumber(std::string val,uint16_t group, 
                                   uint16_t element)
 {
-   for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
+   for(ListDocEntry::iterator i = docEntries.begin(); i != docEntries.end(); ++i)
    { 
       if ( (*i)->GetGroup() == 0xfffe && (*i)->GetElement() == 0xe000 ) 
+      {
          continue;
+      }
 
       if (  ( group   < (*i)->GetGroup() )
           ||( group == (*i)->GetGroup() && element < (*i)->GetElement()) )
       {
          // instead of ReplaceOrCreateByNumber 
          // that is a method of gdcmDocument :-( 
-         gdcmValEntry* Entry = (gdcmValEntry*)0;
+         gdcmValEntry* entry = 0;
          gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
 
-         if ( ! ptagHT->count(key))
+         if ( ! PtagHT->count(key))
          {
             // we assume a Public Dictionnary *is* loaded
-            gdcmDict *PubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
+            gdcmDict *pubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
             // if the invoked (group,elem) doesn't exist inside the Dictionary
             // we create a VirtualDictEntry
-            gdcmDictEntry *DictEntry = PubDict->GetDictEntryByNumber(group,
+            gdcmDictEntry *dictEntry = pubDict->GetDictEntryByNumber(group,
                                                                      element);
-            if (DictEntry == NULL)
+            if (dictEntry == NULL)
             {
-              DictEntry=gdcmGlobal::GetDicts()->NewVirtualDictEntry(group,
-                                                                    element,
-                                                                    "UN",
-                                                                    "??","??");
+               dictEntry = 
+                  gdcmGlobal::GetDicts()->NewVirtualDictEntry(group, element,
+                                                              "UN", "??", "??");
             } 
             // we assume the constructor didn't fail
-            Entry = new gdcmValEntry(DictEntry);
+            entry = new gdcmValEntry(dictEntry);
             /// \todo
             /// ----
             /// better we don't assume too much !
             /// gdcmSQItem is now used to describe any DICOMDIR related object
-         } else {
-            gdcmDocEntry* FoundEntry = ptagHT->find(key)->second;
-            Entry = dynamic_cast<gdcmValEntry*>(FoundEntry);
-            if (!Entry) 
+         }
+         else
+         {
+            gdcmDocEntry* foundEntry = PtagHT->find(key)->second;
+            entry = dynamic_cast<gdcmValEntry*>(foundEntry);
+            if (!entry)
+            {
                dbg.Verbose(0, "gdcmSQItem::SetEntryByNumber: docEntries"
                               " contains non gdcmValEntry occurences");
+            }
          }
-         if (Entry)
-            Entry->SetValue(val); 
-         Entry->SetLength(val.length());
-         docEntries.insert(i,Entry); 
+         if (entry)
+         {
+            entry->SetValue(val); 
+         }
+         entry->SetLength(val.length());
+         docEntries.insert(i,entry);
+
          return true;
       }   
       if (group == (*i)->GetGroup() && element == (*i)->GetElement() )
       {
-         if ( gdcmValEntry* Entry = dynamic_cast<gdcmValEntry*>(*i) )
-            Entry->SetValue(val);
+         if ( gdcmValEntry* entry = dynamic_cast<gdcmValEntry*>(*i) )
+         {
+            entry->SetValue(val);
+         }
          (*i)->SetLength(val.length()); 
          return true;    
       }
@@ -209,14 +229,15 @@ bool gdcmSQItem::SetEntryByNumber(std::string val,uint16_t group,
  */
 gdcmDocEntry *gdcmSQItem::GetDocEntryByNumber(uint16_t group, uint16_t element)
 {
-   for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
+   for(ListDocEntry::iterator i = docEntries.begin();
+                              i != docEntries.end(); ++i)
    {
-      if ( (*i)->GetGroup()==group && (*i)->GetElement()==element)
+      if ( (*i)->GetGroup() == group && (*i)->GetElement() == element )
       {
-         return (*i);
+         return *i;
       }
-   }   
-   return NULL;
+   }
+   return 0;
 }
 
 /**
@@ -225,14 +246,15 @@ gdcmDocEntry *gdcmSQItem::GetDocEntryByNumber(uint16_t group, uint16_t element)
  */ 
 
 std::string gdcmSQItem::GetEntryByNumber(uint16_t group, uint16_t element)
-{ 
-   for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
+{
+   for(ListDocEntry::iterator i = docEntries.begin();
+                              i != docEntries.end(); ++i)
    {
-      if ( (*i)->GetGroup()==group && (*i)->GetElement()==element)
+      if ( (*i)->GetGroup() == group && (*i)->GetElement() == element)
       {
-         return ((gdcmValEntry *)(*i))->GetValue();
+         return ((gdcmValEntry *)(*i))->GetValue();   //FIXME
       }
-   }   
+   }
    return GDCM_UNFOUND;
 }
 //-----------------------------------------------------------------------------
index fe7f7938a4053e1f11ebcf3fb364a032fef9c9b6..540e2538303b10435e803d2323c3571644bbd5b2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSQItem.h,v $
   Language:  C++
-  Date:      $Date: 2004/07/19 11:51:26 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2004/08/01 00:59:22 $
+  Version:   $Revision: 1.13 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -33,7 +33,7 @@ class GDCM_EXPORT gdcmSQItem : public gdcmDocEntrySet
 {
 public:
    gdcmSQItem(int);
-   ~gdcmSQItem(void);
+   ~gdcmSQItem();
 
    virtual void Print(std::ostream &os = std::cout); 
    virtual void Write(FILE *fp, FileType filetype);
@@ -57,7 +57,7 @@ public:
 
    int GetSQItemNumber() { return SQItemNumber; };
 
-   void SetSQItemNumber(int itemNumber) { SQItemNumber=itemNumber; };
+   void SetSQItemNumber(int itemNumber) { SQItemNumber = itemNumber; };
 
 protected:
 
@@ -71,7 +71,7 @@ protected:
 
    ///\brief pointer to the HTable of the gdcmDocument,
    ///       (because we don't know it within any gdcmObject nor any gdcmSQItem)
-   TagDocEntryHT *ptagHT;
+   TagDocEntryHT *PtagHT;
        
 private:
 
index 36bdca4f6fa6926b9acd2a6a57bb2d6442c50ee9..2ab55cbfaf39685372e476628e464dde7c47ed3d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmValEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/07/20 08:29:13 $
-  Version:   $Revision: 1.18 $
+  Date:      $Date: 2004/08/01 00:59:22 $
+  Version:   $Revision: 1.19 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -41,27 +41,29 @@ gdcmValEntry::gdcmValEntry(gdcmDictEntry* e) : gdcmDocEntry(e)
  */
 gdcmValEntry::gdcmValEntry(gdcmDocEntry* e) : gdcmDocEntry(e->GetDictEntry())
 {
-   this->UsableLength = e->GetLength();
-   this->ReadLength   = e->GetReadLength();
-   this->ImplicitVR   = e->IsImplicitVR();
-   this->Offset       = e->GetOffset();
-   this->printLevel   = e->GetPrintLevel();
-   this->SQDepthLevel = e->GetDepthLevel();
+   UsableLength = e->GetLength();
+   ReadLength   = e->GetReadLength();
+   ImplicitVR   = e->IsImplicitVR();
+   Offset       = e->GetOffset();
+   printLevel   = e->GetPrintLevel();
+   SQDepthLevel = e->GetDepthLevel();
 
-   this->voidArea = NULL; // will be in BinEntry ?
+   voidArea = NULL; // will be in BinEntry ?
 }
 
 
 /**
  * \brief   Canonical destructor.
  */
-gdcmValEntry::~gdcmValEntry (void)
+gdcmValEntry::~gdcmValEntry ()
 {
    if (!voidArea)  // will be in BinEntry
+   {
       free(voidArea);
+      voidArea = NULL; // let's be carefull !
+   }
 }
 
-
 //-----------------------------------------------------------------------------
 // Print
 /**
@@ -101,27 +103,50 @@ void gdcmValEntry::Print(std::ostream & os)
    
    // Display the UID value (instead of displaying only the rough code)
    // First 'clean' trailing character (space or zero) 
-   if (g == 0x0002) {  // Any more to be displayed ?
-      if ( (e == 0x0010) || (e == 0x0002) ) {
+   if (g == 0x0002)
+   {
+      // Any more to be displayed ?
+      if ( (e == 0x0010) || (e == 0x0002) )
+      {
          if ( v.length() != 0 )  // for brain damaged headers
+         {
             if ( ! isdigit(v[v.length()-1]) )
+            {
                v.erase(v.length()-1, 1);
+            }
+         }
          s << "  ==>\t[" << ts->GetValue(v) << "]";
       }
-   } else {
-      if (g == 0x0008) {
-         if ( (e == 0x0016) || (e == 0x1150)  ) {
+   }
+   else
+   {
+      if (g == 0x0008)
+      {
+         if ( e == 0x0016 || e == 0x1150 )
+         {
             if ( v.length() != 0 )  // for brain damaged headers
+            {
                if ( ! isdigit(v[v.length()-1]) )
+               {
                   v.erase(v.length()-1, 1);
+               }
+            }
             s << "  ==>\t[" << ts->GetValue(v) << "]";
          }
-      } else {
-         if (g == 0x0004) {
-           if ( (e == 0x1510) || (e == 0x1512)  ) {
-              if ( v.length() != 0 )  // for brain damaged headers  
-                 if ( ! isdigit(v[v.length()-1]) )
-                    v.erase(v.length()-1, 1);  
+      }
+      else
+      {
+         if (g == 0x0004)
+         {
+            if ( (e == 0x1510) || (e == 0x1512)  )
+            {
+               if ( v.length() != 0 )  // for brain damaged headers  
+               {
+                  if ( ! isdigit(v[v.length()-1]) )
+                  {
+                     v.erase(v.length()-1, 1);  
+                  }
+               }
               s << "  ==>\t[" << ts->GetValue(v) << "]";
             }
          }     
@@ -131,12 +156,19 @@ void gdcmValEntry::Print(std::ostream & os)
    if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") )
    {
       if (v == "4294967295") // to avoid troubles in convertion 
+      {
          sprintf (st," x(ffffffff)");
-      else {
-         if ( GetLength() !=0 )        
+      }
+      else
+      {
+         if ( GetLength() !=0 )
+         {
             sprintf(st," x(%x)", atoi(v.c_str()));//FIXME
-        else
-            sprintf(st," "); 
+         }
+         else
+         {
+            sprintf(st," ");
+         }
       }
       s << st;
    }
@@ -149,8 +181,8 @@ void gdcmValEntry::Print(std::ostream & os)
 void gdcmValEntry::Write(FILE *fp, FileType filetype)
 {
    gdcmDocEntry::Write(fp, filetype);
-   std::string vr=GetVR();
-   int lgr=GetReadLength();
+   std::string vr = GetVR();
+   int lgr = GetReadLength();
    if (vr == "US" || vr == "SS")
    {
       // some 'Short integer' fields may be mulivaluated
@@ -159,7 +191,8 @@ void gdcmValEntry::Write(FILE *fp, FileType filetype)
       std::vector<std::string> tokens;
       tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
       Tokenize (GetValue(), tokens, "\\");
-      for (unsigned int i=0; i<tokens.size();i++) {
+      for (unsigned int i=0; i<tokens.size();i++)
+      {
          uint16_t val_uint16 = atoi(tokens[i].c_str());
          void *ptr = &val_uint16;
          fwrite ( ptr,(size_t)2 ,(size_t)1 ,fp);
@@ -176,7 +209,8 @@ void gdcmValEntry::Write(FILE *fp, FileType filetype)
       std::vector<std::string> tokens;
       tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
       Tokenize (GetValue(), tokens, "\\");
-      for (unsigned int i=0; i<tokens.size();i++){
+      for (unsigned int i=0; i<tokens.size();i++)
+      {
          uint32_t val_uint32 = atoi(tokens[i].c_str());
          void *ptr = &val_uint32;
          fwrite ( ptr,(size_t)4 ,(size_t)1 ,fp);
index 54c465b19fd352ffbd697ecac7fa0258a9fffc9d..79570c2578d257c1fcb92f3a4b87900df5e7fcac 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmValEntry.h,v $
   Language:  C++
-  Date:      $Date: 2004/07/02 13:55:28 $
-  Version:   $Revision: 1.18 $
+  Date:      $Date: 2004/08/01 00:59:22 $
+  Version:   $Revision: 1.19 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
  * \brief   The dicom header of a Dicom file contains a set of such entries
  *          (when successfuly parsed against a given Dicom dictionary)
  */
-class GDCM_EXPORT gdcmValEntry  : public gdcmDocEntry {
-
+class GDCM_EXPORT gdcmValEntry  : public gdcmDocEntry
+{
 public:
-
    gdcmValEntry(gdcmDictEntry* e);
-
    gdcmValEntry(gdcmDocEntry* d); 
    virtual ~gdcmValEntry();
 
@@ -45,20 +43,19 @@ public:
    std::string GetValue() { return value; };
     
    /// Sets the value (string) of the current Dicom Document Entry
-   void SetValue(std::string val) { value = val; };
+   void SetValue(std::string const & val) { value = val; };
 
    /// Sets the value (void *) of the current Dicom Document Entry
    void SetVoidArea(void * val) { voidArea = val; };
 
    virtual void Print(std::ostream &os = std::cout); 
    virtual void Write(FILE *fp, FileType filetype);
-protected:
 
+protected:
    /// \brief for 'non string' values. Will be move to gdcmBinEntry, later
    void* voidArea;  // clean it out later
    
 private:
-
 // Members :
   
    /// \brief Document Entry value, internaly represented as a std::string