]> Creatis software - gdcm.git/commitdiff
gdcmDocEntry::PrintCommonPart() and ::WriteCommonPart() removed.
authorfrog <frog>
Wed, 23 Jun 2004 13:02:35 +0000 (13:02 +0000)
committerfrog <frog>
Wed, 23 Jun 2004 13:02:35 +0000 (13:02 +0000)
     Use the gdcmDocEntry::Print() and Write() instead.

13 files changed:
ChangeLog
src/gdcmBinEntry.cxx
src/gdcmBinEntry.h
src/gdcmDicomDir.cxx
src/gdcmDocEntry.cxx
src/gdcmDocEntry.h
src/gdcmDocument.cxx
src/gdcmElementSet.cxx
src/gdcmSQItem.cxx
src/gdcmSeqEntry.cxx
src/gdcmSeqEntry.h
src/gdcmValEntry.cxx
src/gdcmValEntry.h

index f386e0319c9495d8447804e37aee6d375de82cc8..19137b56a85e4f59586524fa21b7c8059471d0af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-06-21 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+   * gdcmDocEntry::PrintCommonPart() and ::WriteCommonPart() removed.
+     Use the gdcmDocEntry::Print() and Write() instead.
+
 2004-06-22 Jean-Pierre Roux
    In order : to write Sequences, whatever their imbrication level, 
                 : to allow user to create his own Sequences
index 0e37c125ea1d05fe1d3187710a60c7fba00ba2c3..dc8fa2db06873abd07e4737e5af5fed2684eb71b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/22 14:42:01 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2004/06/23 13:02:35 $
+  Version:   $Revision: 1.16 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -64,9 +64,7 @@ gdcmBinEntry::~gdcmBinEntry(){
  
 void gdcmBinEntry::Print(std::ostream &os)
 {
-   //gdcmValEntry::Print(os);  // replaced by PrintCommonPart 
-                               // to avoid bugging the display
-   PrintCommonPart(os);
+   gdcmDocEntry::Print(os);
    std::ostringstream s;
    if (voidArea != NULL)
    {
@@ -79,13 +77,13 @@ void gdcmBinEntry::Print(std::ostream &os)
       s << " [gdcm::Binary data NOT loaded]"
         << std::endl;
    }
-   os << s.str();
 }
 
 /*
  * \brief   canonical Writer
  */
-void gdcmBinEntry::Write(FILE *fp) {
+void gdcmBinEntry::Write(FILE *fp, FileType filetype) {
+   gdcmDocEntry::Write(fp, filetype);
    void *voidArea = GetVoidArea();
    int lgr=GetLength();
    if (voidArea != NULL) 
index 90763e3baccea57a807d30c7dab37b4612486dbb..53bf158a1a2ab4eca300bf76fdcfb6bde8ce2bbc 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.h,v $
   Language:  C++
-  Date:      $Date: 2004/06/22 14:42:02 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  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
@@ -41,7 +41,7 @@ public:
    ~gdcmBinEntry(void);
    
    void Print(std::ostream &os = std::cout);
-   virtual void Write(FILE *fp);
+   virtual void Write(FILE*, FileType);
 
    /// \brief Returns the area value of the current Dicom Header Entry
    ///  when it's not string-translatable (e.g : a LUT table)         
index 5f8c5c17567a436ff5146b2c50bf373773fa3120..7fbc137c187952a3e690a05ee07aa930f246ef4d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/23 02:13:14 $
-  Version:   $Revision: 1.51 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  Version:   $Revision: 1.52 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -556,7 +556,6 @@ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,
    }
 
    for(it=elemList.begin();it!=elemList.end();++it) {
-      std::cout << "it " << std::endl;
       tmpGr=it->group;
       tmpEl=it->elem;
       dictEntry=GetPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
index 6dff08d1c4454a73f1ecd14c8557926bfc65209e..522b16679d847e1eb9db5d11e76b47fb155b488a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/22 13:47:33 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  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
@@ -38,25 +38,14 @@ gdcmDocEntry::gdcmDocEntry(gdcmDictEntry* in) {
    entry = in;
 }
 
-/**
- * \ingroup gdcmDocEntry
- * \brief   Canonical Printer
- * @param   os ostream we want to print in
- */
-void gdcmDocEntry::Print(std::ostream & os) {
-   std::ostringstream s;
-   s << std::endl;
-   PrintCommonPart(os);
-   os << s.str();
-}
-
 //-----------------------------------------------------------------------------
 // Print
 /**
  * \ingroup gdcmDocEntry
  * \brief   Prints the common part of gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
+ * @param   os ostream we want to print in
  */
-void gdcmDocEntry::PrintCommonPart(std::ostream & os) {
+void gdcmDocEntry::Print(std::ostream & os) {
 
    printLevel=2; // FIXME
    
@@ -117,15 +106,6 @@ void gdcmDocEntry::PrintCommonPart(std::ostream & os) {
  * \brief   Writes the common part of any gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
  */
 void gdcmDocEntry::Write(FILE *fp, FileType filetype) {
-   std::cout << "gdcmDocEntry::Write : Is that what you wanted to do ? " << std::endl;
-   WriteCommonPart(fp, filetype);
-}
-
-/**
- * \ingroup gdcmDocEntry
- * \brief   Writes the common part of any gdcmValEntry, gdcmBinEntry, gdcmSeqEntry
- */
-void gdcmDocEntry::WriteCommonPart(FILE *fp, FileType filetype) {
 
    guint16 group  = GetGroup();
    VRKey   vr     = GetVR();
index 11d2b0bf5970469e613e36f2d6234f78ac779c25..9eafc5681eed30b0a6dbecbc3246df6e0e697ed2 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntry.h,v $
   Language:  C++
-  Date:      $Date: 2004/06/22 13:47:33 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  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
@@ -126,9 +126,6 @@ public:
    virtual void Print (std::ostream & os = std::cout); 
    virtual void Write(FILE *fp, FileType filetype);
    
-   void gdcmDocEntry::PrintCommonPart(std::ostream & os);
-   void gdcmDocEntry::WriteCommonPart(FILE *fp, FileType filetype);
-         
    guint32 GetFullLength(void);
    
    void Copy(gdcmDocEntry *doc);
index 43f9b0a199eb97a473651f644d3b2a25dcb4a47e..92bf75e08b07e8ce9e0164953c04cfd7cab29527 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/23 09:30:22 $
-  Version:   $Revision: 1.26 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  Version:   $Revision: 1.27 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -571,8 +571,8 @@ bool gdcmDocument::WriteF(FileType filetype) {
  * if ( filetype == ACR)
  *    UpdateGroupLength(true,ACR);
  */
-   Write(fp,filetype);  // the gdcmElementSet one !
+       
+       gdcmElementSet::Write(fp,filetype);
 
    /// WriteEntries(fp,type); // old stuff
    return true;
index 0b373346fdc4b77ca884123f8f7e6896f6cca8bf..50e40f35769cc1c58b3c615d0a75f3b5daf06832 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmElementSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/22 14:42:02 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  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
@@ -60,11 +60,18 @@ gdcmElementSet::~gdcmElementSet()
   *          from the H Table
   * @return
   */ 
-void gdcmElementSet::Print(std::ostream & os) {
+void gdcmElementSet::Print(std::ostream & os)
+{
+   gdcmDocEntry* Entry;
    for (TagDocEntryHT::iterator i = tagHT.begin(); i != tagHT.end(); ++i)  
    {
-      //(i)->second->SetPrintLevel(printLevel);
-      (i->second)->Print(os);   
+      Entry = i->second;
+      Entry->Print(os);   
+      bool PrintEndLine = true;
+      if ( gdcmSeqEntry* SeqEntry = dynamic_cast<gdcmSeqEntry*>(Entry) )
+         PrintEndLine = false;
+      if (PrintEndLine)
+         os << std::endl;
    } 
 }
 
@@ -73,35 +80,12 @@ void gdcmElementSet::Print(std::ostream & os) {
   *          from the H Table
   * @return
   */ 
-void gdcmElementSet::Write(FILE *fp, FileType filetype) {
-
-// Troubles expected : BinEntries ARE ValEntries :-(
-// BinEntry is checked first, then ValEntry;
+void gdcmElementSet::Write(FILE *fp, FileType filetype)
+{
 
-   gdcmDocEntry *e;
    for (TagDocEntryHT::iterator i = tagHT.begin(); i != tagHT.end(); ++i)  
    {
-      e=i->second;
-      e->WriteCommonPart(fp, filetype);
-      std::cout<<e->GetKey() << " " << std::hex << e->GetVR() << " " 
-               << e->GetName()
-               << std::endl;
-
-// e->Write(fp,filetype); // This will be the right way to proceed !
-
-      if (gdcmBinEntry* BinEntry = dynamic_cast< gdcmBinEntry* >(e) ) {
-         BinEntry->Write(fp);
-         continue;
-      }
-     if (gdcmValEntry* ValEntry = dynamic_cast< gdcmValEntry* >(e) ) {
-         ValEntry->Write(fp);
-         continue;
-      }
-
-      if (gdcmSeqEntry* SeqEntry = dynamic_cast< gdcmSeqEntry* >(e) ) {
-         SeqEntry->Write(fp,filetype);
-         continue;
-      } 
+      i->second->Write(fp, filetype);
    } 
 }
 //-----------------------------------------------------------------------------
@@ -112,7 +96,6 @@ void gdcmElementSet::Write(FILE *fp, FileType filetype) {
 //-----------------------------------------------------------------------------
 // Private
 
-
 /**
  * \brief   add a new Dicom Element pointer to the H Table
  * @param   NewEntry entry to add
index 82c4ed3dfb1f2986c1ebc1c517c4e36d80215346..f0fa250394cedf412acf42db1689260e92bb3271 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSQItem.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/23 02:13:14 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  Version:   $Revision: 1.16 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -59,52 +59,43 @@ gdcmSQItem::~gdcmSQItem()
  void gdcmSQItem::Print(std::ostream & os) {
    std::ostringstream s;
 
-   if (SQDepthLevel>0) {
+   if (SQDepthLevel>0)
+   {
       for (int i=0;i<SQDepthLevel;i++)
          s << "   | " ;
    }
    std::cout << s.str() << " --- SQItem number " << SQItemNumber  << std::endl;
-   for (ListDocEntry::iterator i = docEntries.begin();  
-        i != docEntries.end();
-        ++i)
+   for (ListDocEntry::iterator i  = docEntries.begin();  
+                               i != docEntries.end();
+                             ++i)
    {
-       os << s.str();
-      //(*i)->SetPrintLevel(printLevel); //self->GetPrintLevel() ?
-      (*i)->SetPrintLevel(2);
-      (*i)->Print(os);   
+      gdcmDocEntry* Entry = *i;
+      bool PrintEndLine = true;
+
+      os << s.str();
+      Entry->SetPrintLevel(2);
+      Entry->Print(os);   
+      if ( gdcmSeqEntry* SeqEntry = dynamic_cast<gdcmSeqEntry*>(Entry) )
+         PrintEndLine = false;
+      if (PrintEndLine)
+         os << std::endl;
    } 
 }
 
-
 /*
  * \ingroup gdcmSQItem
  * \brief   canonical Writer
  */
- void gdcmSQItem::Write(FILE *fp,FileType filetype) {
-   gdcmDocEntry *Entry;
+void gdcmSQItem::Write(FILE *fp,FileType filetype)
+{
    for (ListDocEntry::iterator i = docEntries.begin();  
         i != docEntries.end();
         ++i)
    {
-      Entry=*i;
-      (Entry)->WriteCommonPart(fp, filetype);
-
-      if (gdcmBinEntry* BinEntry = dynamic_cast< gdcmBinEntry* >(Entry) ) {
-         BinEntry->Write(fp);
-         return;
-      }
-      if (gdcmValEntry* ValEntry = dynamic_cast< gdcmValEntry* >(Entry) ) {
-         ValEntry->Write(fp);
-         return;
-      }
-      if (gdcmSeqEntry* SeqEntry = dynamic_cast< gdcmSeqEntry* >(Entry) ) {
-         SeqEntry->Write(fp,filetype);
-         return;
-      }
+      (*i)->Write(fp, filetype);
    } 
 }
 
-
 //-----------------------------------------------------------------------------
 // Public
 /**
index 94b3f9bcc670fc61e93fc1ab26b1ce6a01f54179..a42f7f1670f0384083fa684a6191080f752c937a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSeqEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/23 03:36:24 $
-  Version:   $Revision: 1.17 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  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,7 +39,6 @@ gdcmSeqEntry::gdcmSeqEntry(gdcmDictEntry* e, int depth)
 }
 
 /**
- * \ingroup gdcmSeqEntry
  * \brief   Canonical destructor.
  */
 gdcmSeqEntry::~gdcmSeqEntry() {
@@ -52,26 +51,21 @@ gdcmSeqEntry::~gdcmSeqEntry() {
       delete seq_term;
 }
 
-//-----------------------------------------------------------------------------
-// Print
 /*
  * \brief   canonical Printer
  */
 void gdcmSeqEntry::Print(std::ostream &os){
 
-   std::ostringstream s,s2;
-   std::string vr;
    // First, Print the Dicom Element itself.
    SetPrintLevel(2);   
-   PrintCommonPart(os);
-   s << std::endl;
-   os << s.str();   
+   gdcmDocEntry::Print(os);
+   os << std::endl;
 
-    if (GetReadLength() == 0)
-       return;
+   if (GetReadLength() == 0)
+      return;
 
-    // Then, Print each SQ Item   
-     for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
+   // Then, Print each SQ Item   
+   for(ListSQItem::iterator cc = items.begin();cc != items.end();++cc)
    {
       (*cc)->Print(os);   
    }
@@ -79,30 +73,29 @@ void gdcmSeqEntry::Print(std::ostream &os){
    // at end, print the sequence terminator item, if any
    if (delimitor_mode) {
       for (int i=0;i<SQDepthLevel+1;i++)
-         s2 << "   | " ;
-      os << s2.str();
+         os << "   | " ;
       if (seq_term != NULL) {
          seq_term->Print(os);
       } 
       else 
-         std::cout
-             << "      -------------- should have a sequence terminator item"
-             << std::endl;      
+         os << "      -------------- should have a sequence terminator item";
    }                    
- }
-
+}
 
 /*
  * \brief   canonical Writer
  */
-void gdcmSeqEntry::Write(FILE *fp, FileType filetype) {
-  for(ListSQItem::iterator cc  = GetSQItems().begin();
-                           cc != GetSQItems().end();
-                         ++cc) {
-      std::cout << "Et un SQItem !" << std::endl;
-      (*cc)->Write(fp, filetype);  // Don't remove param filetype !
+void gdcmSeqEntry::Write(FILE *fp, FileType filetype)
+{
+   gdcmDocEntry::Write(fp, filetype);
+   for(ListSQItem::iterator cc  = GetSQItems().begin();
+                            cc != GetSQItems().end();
+                          ++cc)
+   {
+      (*cc)->Write(fp, filetype);   
    }  
 }
+
 //-----------------------------------------------------------------------------
 // Public
 
index 764ab321a91c7cb91e1469d04246e0b9d2ad3e34..d5de81da926fce8ae2c13034d0d2213bf24c3d62 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSeqEntry.h,v $
   Language:  C++
-  Date:      $Date: 2004/06/22 13:47:33 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  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
@@ -35,7 +35,7 @@ public:
    virtual ~gdcmSeqEntry();
    
    virtual void Print(std::ostream &os = std::cout); 
-   virtual void Write(FILE *fp,FileType filetype);
+   virtual void Write(FILE *fp, FileType);
 
    /// \brief   returns the SQITEM chained List for this SeQuence.
    inline ListSQItem &GetSQItems() { return items; }
index b5575cfe24c2e2cad30f81a57971f064b9a8d590..c0082d832bb279989dfb8cdf9822fb1630f99fad 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmValEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/22 14:37:04 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  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
@@ -69,24 +69,22 @@ gdcmValEntry::~gdcmValEntry (void)
  */
 void gdcmValEntry::Print(std::ostream & os)
 {
+   guint16 g = GetGroup();
+   guint16 e = GetElement();
+   std::string vr = GetVR();
    std::ostringstream s; 
-   unsigned short int g, e;
    char st[20];
    TSKey v;
-   std::string d2, vr;
+   std::string d2;
      
-   PrintCommonPart(os); 
+   gdcmDocEntry::Print(os); 
 
-   g  = GetGroup();
-   
-   if (g == 0xfffe) {
-      s << std::endl;
-      os << s.str(); 
-      return;  // just to avoid identing all the remaining code     
+   if (g == 0xfffe)
+   {
+      // just to avoid identing all the remaining code     
+      return;
    }
    
-   e  = GetElement();
-   vr = GetVR();
    gdcmTS * ts = gdcmGlobal::GetTS();
     
    v  = GetValue();  // not applicable for SQ ...     
@@ -117,7 +115,8 @@ void gdcmValEntry::Print(std::ostream & os)
       }
    }
    //if (e == 0x0000) {        // elem 0x0000 --> group length 
-   if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") ) {
+   if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") )
+   {
       if (v == "4294967295") // to avoid troubles in convertion 
          sprintf (st," x(ffffffff)");
       else {
@@ -128,51 +127,51 @@ void gdcmValEntry::Print(std::ostream & os)
       }
       s << st;
    }
-        
-   s << std::endl;
-   os << s.str();   
+   os << s.str();
 }
 
-
 /*
  * \brief   canonical Writer
  */
-void gdcmValEntry::Write(FILE *fp) {
-      std::string vr=GetVR();
-      int lgr=GetLength();
-      if (vr == "US" || vr == "SS") {
-         // some 'Short integer' fields may be mulivaluated
-         // each single value is separated from the next one by '\'
-         // we split the string and write each value as a short int
-         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++) {
-            guint16 val_uint16 = atoi(tokens[i].c_str());
-            void *ptr = &val_uint16;
-            fwrite ( ptr,(size_t)2 ,(size_t)1 ,fp);
-         }
-         tokens.clear();
-         return;
+void gdcmValEntry::Write(FILE *fp, FileType filetype)
+{
+   gdcmDocEntry::Write(fp, filetype);
+   std::string vr=GetVR();
+   int lgr=GetLength();
+   if (vr == "US" || vr == "SS")
+   {
+      // some 'Short integer' fields may be mulivaluated
+      // each single value is separated from the next one by '\'
+      // we split the string and write each value as a short int
+      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++) {
+         guint16 val_uint16 = atoi(tokens[i].c_str());
+         void *ptr = &val_uint16;
+         fwrite ( ptr,(size_t)2 ,(size_t)1 ,fp);
+      }
+      tokens.clear();
+      return;
+   }
+   if (vr == "UL" || vr == "SL")
+   {
+      // Some 'Integer' fields may be multivaluated (multiple instances 
+      // of integers). But each single integer value is separated from the
+      // next one by '\' (backslash character). Hence we split the string
+      // along the '\' and write each value as an int:
+      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++){
+         guint32 val_uint32 = atoi(tokens[i].c_str());
+         void *ptr = &val_uint32;
+         fwrite ( ptr,(size_t)4 ,(size_t)1 ,fp);
       }
-      if (vr == "UL" || vr == "SL") {
-         // Some 'Integer' fields may be multivaluated (multiple instances 
-         // of integers). But each single integer value is separated from the
-         // next one by '\' (backslash character). Hence we split the string
-         // along the '\' and write each value as an int:
-         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++){
-            guint32 val_uint32 = atoi(tokens[i].c_str());
-            void *ptr = &val_uint32;
-            fwrite ( ptr,(size_t)4 ,(size_t)1 ,fp);
-         }
-         tokens.clear();
-         return;
-      }           
-      fwrite (GetValue().c_str(),
-              (size_t)lgr ,(size_t)1, fp); // Elem value
+      tokens.clear();
+      return;
+   }           
+   fwrite (GetValue().c_str(), (size_t)lgr ,(size_t)1, fp); // Elem value
 } 
 
 //-----------------------------------------------------------------------------
index 42da400cfed34e15d139da58d614384e0cac355a..3adc99fa1a4172c98d000da6c207180c95caee2a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmValEntry.h,v $
   Language:  C++
-  Date:      $Date: 2004/06/23 03:36:24 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2004/06/23 13:02:36 $
+  Version:   $Revision: 1.16 $
                                                                                 
   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,7 @@ public:
    inline void SetValue(std::string val)  { value = val;  };
    
    virtual void Print(std::ostream &os = std::cout); 
-   virtual void gdcmValEntry::Write(FILE *fp);           
+   virtual void Write(FILE *fp, FileType filetype);
 protected:
 
    /// \brief for 'non string' values. Will be move to gdcmBinEntry, later
@@ -62,7 +62,6 @@ private:
    ///        The Value Representation (\ref gdcmVR) is indenpendently used
    ///        in order to interpret (decode) this field.
    std::string  value;
-
 };
 
 //-----------------------------------------------------------------------------