]> Creatis software - gdcm.git/commitdiff
* src/gdcmBinEntry.cxx, gdcmValEntry.cxx: gdcmBinEntry::Print() now
authorfrog <frog>
Mon, 21 Jun 2004 12:38:28 +0000 (12:38 +0000)
committerfrog <frog>
Mon, 21 Jun 2004 12:38:28 +0000 (12:38 +0000)
      properly calls gdcmValEntry::Print() (that was weed out from
      code related to gdcmBinEntry).

ChangeLog
src/gdcmBinEntry.cxx
src/gdcmDocument.cxx
src/gdcmValEntry.cxx
src/gdcmValEntry.h

index 2253ee223b895e4cce5b73003f5fc15e749ba422..7d0707239e74fc99e9786a147bed9253657b0c8b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@
     * src/gdcmHeader.h: the declaration of gdcmHeader::gdcmHeader(bool)
       as explicit constructor didn't do the trick to fix the above problem.
       Could anyone explain why ?
+    * src/gdcmBinEntry.cxx, gdcmValEntry.cxx: gdcmBinEntry::Print() now
+      properly calls gdcmValEntry::Print() (that was weed out from 
+      code related to gdcmBinEntry).
 
 2004-06-20 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
     * In order to fix memory leaks:
index 0a18e65f34300bbaebf4adf9d70a32e15214bb75..aca20db63551838859222ae84214443dfb212958 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmBinEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/20 18:08:47 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2004/06/21 12:38:28 $
+  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
@@ -26,7 +26,8 @@
 /**
  * \brief   Constructor from a given gdcmBinEntry
  */
-gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e) {
+gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e)
+{
    this->voidArea = NULL;
 }
 
@@ -34,7 +35,8 @@ gdcmBinEntry::gdcmBinEntry(gdcmDictEntry* e) : gdcmValEntry(e) {
  * \brief   Constructor from a given gdcmBinEntry
  * @param   e Pointer to existing Doc entry
  */
-gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry()){
+gdcmBinEntry::gdcmBinEntry(gdcmDocEntry* e) : gdcmValEntry(e->GetDictEntry())
+{
    this->UsableLength = e->GetLength();
    this->ReadLength   = e->GetReadLength();
    this->ImplicitVR   = e->IsImplicitVR();
@@ -57,15 +59,25 @@ gdcmBinEntry::~gdcmBinEntry(){
 //-----------------------------------------------------------------------------
 // Print
 /*
- * \ingroup gdcmDocEntry
  * \brief   canonical Printer
  */
  
-void gdcmBinEntry::Print(std::ostream &os) {
-   PrintCommonPart(os);
-   /// \todo Write a true specialisation of Print i.e. display something
-   ///       for BinEntry extension.
-   dbg.Verbose(1, "gdcmBinEntry::Print: so WHAT ?");
+void gdcmBinEntry::Print(std::ostream &os)
+{
+   gdcmValEntry::Print(os);
+   std::ostringstream s;
+   if (voidArea != NULL)
+   {
+      s << " [gdcm::Binary data loaded with lenght is "
+        << GetLength() << "]"
+        << std::endl;
+   }
+   else
+   {
+      s << " [gdcm::Binary data NOT loaded]"
+        << std::endl;
+   }
+   os << s.str();
 }
 //-----------------------------------------------------------------------------
 // Public
index a6bfec4f9c060773439c2ee59fdeeca65fa05b04..fa1d4a7d8d494cd55aa2c6aaba2f0a204cd94227 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/21 04:18:25 $
-  Version:   $Revision: 1.20 $
+  Date:      $Date: 2004/06/21 12:38:29 $
+  Version:   $Revision: 1.21 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -899,8 +899,7 @@ size_t gdcmDocument::GetEntryOffsetByNumber(guint16 Group, guint16 Elem)
    gdcmDocEntry* Entry = GetDocEntryByNumber(Group, Elem);
    if (!Entry) 
    {
-      dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber",
-                      "failed to Locate gdcmDocEntry");
+      dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber: no entry present.");
       return (size_t)0;
    }
    return Entry->GetOffset();
@@ -918,8 +917,7 @@ void * gdcmDocument::GetEntryVoidAreaByNumber(guint16 Group, guint16 Elem)
    gdcmDocEntry* Entry = GetDocEntryByNumber(Group, Elem);
    if (!Entry) 
    {
-      dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber",
-                  "failed to Locate gdcmDocEntry");
+      dbg.Verbose(1, "gdcmDocument::GetDocEntryByNumber: no entry");
       return (NULL);
    }
    return ((gdcmBinEntry *)Entry)->GetVoidArea();
@@ -1160,12 +1158,12 @@ void gdcmDocument::WriteEntryTagVRLength(gdcmDocEntry *tag,
  */
  
 // \todo TODO : to be re -written recursively !
-void gdcmDocument::WriteEntryValue(gdcmDocEntry *tag, FILE *_fp,FileType type)
+void gdcmDocument::WriteEntryValue(gdcmDocEntry *Entry, FILE *_fp,FileType type)
 {
    (void)type;
-   guint16 group  = tag->GetGroup();
-   VRKey   vr     = tag->GetVR();
-   guint32 lgr    = tag->GetReadLength();
+   guint16 group  = Entry->GetGroup();
+   VRKey   vr     = Entry->GetVR();
+   guint32 lgr    = Entry->GetReadLength();
 
    if (vr == "SQ")
       // SeQuences have no value:
@@ -1174,15 +1172,9 @@ void gdcmDocument::WriteEntryValue(gdcmDocEntry *tag, FILE *_fp,FileType type)
       // Delimiters have no associated value:
       return;
                
-               //--------------------------------
-               //
-               // FIXME :right now, both value and voidArea belong to gdcmValue
-               //
-               // -------------------------------
-               
-// if (gdcmBinEntry* BinEntry = dynamic_cast< gdcmBinEntry* >(tag) ) {
+// if (gdcmBinEntry* BinEntry = dynamic_cast< gdcmBinEntry* >(Entry) ) {
       void *voidArea;
-      gdcmBinEntry *BinEntry= (gdcmBinEntry *)tag;;
+      gdcmBinEntry *BinEntry= (gdcmBinEntry *)Entry;;
       voidArea = BinEntry->GetVoidArea();
       if (voidArea != NULL) 
       { // there is a 'non string' LUT, overlay, etc
@@ -1198,7 +1190,7 @@ void gdcmDocument::WriteEntryValue(gdcmDocEntry *tag, FILE *_fp,FileType type)
       // 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 (((gdcmValEntry *)tag)->GetValue(), tokens, "\\");
+      Tokenize (((gdcmValEntry *)Entry)->GetValue(), tokens, "\\");
       for (unsigned int i=0; i<tokens.size();i++) 
       {
          guint16 val_uint16 = atoi(tokens[i].c_str());
@@ -1216,7 +1208,7 @@ void gdcmDocument::WriteEntryValue(gdcmDocEntry *tag, FILE *_fp,FileType type)
       // 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 (((gdcmValEntry *)tag)->GetValue(), tokens, "\\");
+      Tokenize (((gdcmValEntry *)Entry)->GetValue(), tokens, "\\");
       for (unsigned int i=0; i<tokens.size();i++) 
       {
          guint32 val_uint32 = atoi(tokens[i].c_str());
@@ -1226,7 +1218,7 @@ void gdcmDocument::WriteEntryValue(gdcmDocEntry *tag, FILE *_fp,FileType type)
       tokens.clear();
       return;
    }           
-   fwrite (((gdcmValEntry *)tag)->GetValue().c_str(),
+   fwrite (((gdcmValEntry *)Entry)->GetValue().c_str(),
            (size_t)lgr ,(size_t)1, _fp); // Elem value
 }
 
index 7f9613dccc45a16711a54f466f6ba96e56a80c54..194bd88d1921c6e71cfff590706e7ca761bd9a61 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmValEntry.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/06/21 04:43:02 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2004/06/21 12:38:29 $
+  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
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
- * \ingroup gdcmValEntry
  * \brief   Constructor from a given gdcmDictEntry
  * @param   e Pointer to existing dictionary entry
  */
-gdcmValEntry::gdcmValEntry(gdcmDictEntry* e) : gdcmDocEntry(e) {
+gdcmValEntry::gdcmValEntry(gdcmDictEntry* e) : gdcmDocEntry(e)
+{
    voidArea = NULL; // will be in BinEntry ?
 }
 
 /**
- * \ingroup gdcmValEntry
  * \brief   Constructor from a given gdcmDocEntry
  * @param   e Pointer to existing Doc entry
  */
-gdcmValEntry::gdcmValEntry(gdcmDocEntry* e) : gdcmDocEntry(e->GetDictEntry()){
+gdcmValEntry::gdcmValEntry(gdcmDocEntry* e) : gdcmDocEntry(e->GetDictEntry())
+{
    this->UsableLength = e->GetLength();
    this->ReadLength   = e->GetReadLength();
    this->ImplicitVR   = e->IsImplicitVR();
@@ -55,7 +55,8 @@ gdcmValEntry::gdcmValEntry(gdcmDocEntry* e) : gdcmDocEntry(e->GetDictEntry()){
 /**
  * \brief   Canonical destructor.
  */
-gdcmValEntry::~gdcmValEntry (void) {
+gdcmValEntry::~gdcmValEntry (void)
+{
    if (!voidArea)  // will be in BinEntry
       free(voidArea);
 }
@@ -64,13 +65,11 @@ gdcmValEntry::~gdcmValEntry (void) {
 //-----------------------------------------------------------------------------
 // Print
 /**
- * \ingroup gdcmValEntry
  * \brief   canonical Printer
  */
-void gdcmValEntry::Print(std::ostream & os) { 
-
+void gdcmValEntry::Print(std::ostream & os)
+{
    std::ostringstream s; 
-   //size_t o;  //not used
    unsigned short int g, e;
    char st[20];
    TSKey v;
@@ -90,20 +89,16 @@ void gdcmValEntry::Print(std::ostream & os) {
    vr = GetVR();
    gdcmTS * ts = gdcmGlobal::GetTS();
     
-   if (voidArea != NULL) { // should be moved in gdcmBinEntry Printer (when any)
-       s << " [gdcm::Non String Data Loaded in Unsecure Area (" 
-         << GetLength() << ") ]";
-   } 
-   
-   else {
-      v  = GetValue();  // not applicable for SQ ...     
-      d2 = CreateCleanString(v);  // replace non printable characters by '.'            
-      if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) || 
-          (printLevel>=3)  || 
-          (d2.find("gdcm::NotLoaded.") < d2.length()) )
-         s << " [" << d2 << "]";
-      else 
-         s << " [gdcm::too long for print (" << GetLength() << ") ]";
+   v  = GetValue();  // not applicable for SQ ...     
+   d2 = CreateCleanString(v);  // replace non printable characters by '.'            
+   if( (GetLength()<=MAX_SIZE_PRINT_ELEMENT_VALUE) || 
+       (printLevel>=3)  || (d2.find("gdcm::NotLoaded.") < d2.length()) )
+   {
+      s << " [" << d2 << "]";
+   }
+   else
+   {
+      s << " [gdcm::too long for print (" << GetLength() << ") ]";
    }
    
    // Display the UID value (instead of displaying only the rough code)  
index 86f4f43679c6bc4d5234381dae3813bd60f8ec12..5a23a02a90403a9cb169e4658237510bfa3820be 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmValEntry.h,v $
   Language:  C++
-  Date:      $Date: 2004/06/21 04:43:02 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2004/06/21 12:38:29 $
+  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
@@ -55,11 +55,11 @@ protected:
    
 private:
 
-// Variables
+// Members :
   
-   /// \brief Document Entry value, stored as a std::string (VR will be used,
-   /// later, to decode)
-   
+   /// \brief Document Entry value, internaly represented as a std::string
+   ///        The Value Representation (\ref gdcmVR) is indenpendently used
+   ///        in order to interpret (decode) this field.
    std::string  value;
 
 };