]> Creatis software - gdcm.git/commitdiff
* src/gdcmFile.[h|cxx] : add the Print method
authorregrain <regrain>
Thu, 16 Dec 2004 11:37:01 +0000 (11:37 +0000)
committerregrain <regrain>
Thu, 16 Dec 2004 11:37:01 +0000 (11:37 +0000)
   * src/gdcmPixelReadConvert.[h|cxx] : add the generalized Print method
   * src/gdcmDocEntrySet.h : generalize the Print with the PrintLevel
   * src/gdcmDocument.h : remove the PrintLevel informations
   * Example/PrintFile.cxx : use the new gdcm::File::Print
   -- BeNours

ChangeLog
Example/PrintFile.cxx
src/gdcmDocEntrySet.h
src/gdcmDocument.h
src/gdcmElementSet.cxx
src/gdcmElementSet.h
src/gdcmFile.cxx
src/gdcmFile.h
src/gdcmPixelReadConvert.cxx
src/gdcmPixelReadConvert.h
src/gdcmSQItem.h

index b80390571020f82511642a1c8697eb7235130054..57662535c9cf3fbf560ef7b5ef5370bbe5de52d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-12-16 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+   * src/gdcmFile.[h|cxx] : add the Print method
+   * src/gdcmPixelReadConvert.[h|cxx] : add the generalized Print method
+   * src/gdcmDocEntrySet.h : generalize the Print with the PrintLevel
+   * src/gdcmDocument.h : remove the PrintLevel informations
+   * Example/PrintFile.cxx : use the new gdcm::File::Print
+
 2004-12-16 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
    * src/gdcmFile.cxx : Add the code of ReplaceOrCreateByNumber to not have
      problems when compiling with the python wrapping
index 85275e2ea229c37b7f83f7609ebae99568fbd801..77c00f4ae0ba13e81755cdffd61eaab1d3b6d173 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: PrintFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/12/03 20:16:55 $
-  Version:   $Revision: 1.17 $
+  Date:      $Date: 2004/12/16 11:37:01 $
+  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
@@ -43,8 +43,8 @@ int main(int argc, char* argv[])
    e1= new gdcm::Header( fileName.c_str() );
    f1 = new gdcm::File(e1);
 
-   e1->SetPrintLevel(2);
-   e1->Print();
+   f1->SetPrintLevel(2);
+   f1->Print();
 
    std::cout << "\n\n" << std::endl; 
 
@@ -88,19 +88,6 @@ int main(int argc, char* argv[])
    std::string transferSyntaxName = e1->GetTransfertSyntaxName();
    std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]" << std::endl;
    
-/*   if (  transferSyntaxName != "Implicit VR - Little Endian"
-      && transferSyntaxName != "Explicit VR - Little Endian"     
-      && transferSyntaxName != "Deflated Explicit VR - Little Endian"      
-      && transferSyntaxName != "Explicit VR - Big Endian"
-      && transferSyntaxName != "Uncompressed ACR-NEMA"     )
-   {
-      std::cout << std::endl << "==========================================="
-                  << std::endl; 
-         f1->GetPixelReadConverter()->Print();
-      std::cout << std::endl << "==========================================="
-                  << std::endl; 
-   }*/
-   
    if(e1->IsReadable())
       std::cout <<std::endl<<fileName<<" is Readable"<<std::endl;
    else
index cdca610cf655620da2bab9daceac16c65d2dbed8..6c3cae411de043a786dca11aa64270e8887da1a9 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocEntrySet.h,v $
   Language:  C++
-  Date:      $Date: 2004/12/06 11:37:38 $
-  Version:   $Revision: 1.27 $
+  Date:      $Date: 2004/12/16 11:37:02 $
+  Version:   $Revision: 1.28 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -61,14 +61,16 @@ public:
    DocEntrySet() {};
    virtual ~DocEntrySet() {};
 
+   /// \brief prints any type of entry to the entry set (pure vitual)
+   virtual void Print (std::ostream & os = std::cout) = 0;// pure virtual
+   /// Accessor to \ref PrintLevel
+   void SetPrintLevel(int level) { PrintLevel = level; }
+
    /// \brief adds any type of entry to the entry set (pure vitual)
    virtual bool AddEntry(DocEntry *Entry) = 0; // pure virtual
    virtual bool RemoveEntry(DocEntry *EntryToRemove)=0; // pure virtual
    virtual bool RemoveEntryNoDestroy(DocEntry *EntryToRemove)=0; // pure virtual
 
-   /// \brief prints any type of entry to the entry set (pure vitual)
-   virtual void Print (std::ostream & os = std::cout) = 0;// pure virtual
-
    /// \brief write any type of entry to the entry set
    virtual void WriteContent (std::ofstream *fp, FileType filetype) = 0;// pure virtual
 
@@ -84,7 +86,6 @@ public:
                                    TagName const & name   = "unkn" );
   
 protected:
-
 // DocEntry  related utilities 
    ValEntry* NewValEntryByNumber(uint16_t group, 
                                  uint16_t element);
@@ -103,6 +104,9 @@ protected:
    DictEntry *GetDictEntryByName  (TagName const & name);
    DictEntry *GetDictEntryByNumber(uint16_t, uint16_t);
 
+   /// \brief Amount of printed details for each Header Entry (Dicom Element):
+   /// 0 : stands for the least detail level.
+   int PrintLevel;
 };
 
 } // end namespace gdcm
index ed1d87d406b5a853c2ff4ee51768a0934a7be23b..6a5538aeddaba9c110faa72aa26be6fe0733d88c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDocument.h,v $
   Language:  C++
-  Date:      $Date: 2004/12/07 13:39:33 $
-  Version:   $Revision: 1.68 $
+  Date:      $Date: 2004/12/16 11:37:02 $
+  Version:   $Revision: 1.69 $
  
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -116,10 +116,6 @@ protected:
    /// Store the JPEG fragments info obtained during parsing of pixels.
    JPEGFragmentsInfo* JPEGInfo;
 
-   /// \brief Amount of printed details for each Header Entry (Dicom Element):
-   /// 0 : stands for the least detail level.
-   int PrintLevel;
-   
 public:
 // the 2 following will be merged
    virtual void PrintPubDict (std::ostream &os = std::cout);
@@ -261,9 +257,6 @@ private:
    void HandleBrokenEndian(uint16_t  group, uint16_t  elem);
 public:
 // Accessors:
-   /// Accessor to \ref PrintLevel
-   void SetPrintLevel(int level) { PrintLevel = level; }
-
    /// Accessor to \ref Filename
    const std::string &GetFileName() const { return Filename; }
 
@@ -274,7 +267,6 @@ public:
    int GetSwapCode() { return SwapCode; }
    
    bool operator<(Document &document);
-
 };
 } // end namespace gdcm
 
index dd2c6d1976c5d0383d5846379ad972c0c3d473a8..fa33af292edb4988e759195859730f6abb3c35db 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmElementSet.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/12/03 17:13:18 $
-  Version:   $Revision: 1.33 $
+  Date:      $Date: 2004/12/16 11:37:02 $
+  Version:   $Revision: 1.34 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -54,11 +54,6 @@ ElementSet::~ElementSet()
    TagHT.clear();
 }
 
-
-//-----------------------------------------------------------------------------
-// Public
-
-
 //-----------------------------------------------------------------------------
 // Print
 /**
@@ -82,6 +77,8 @@ void ElementSet::Print(std::ostream& os)
    }
 }
 
+//-----------------------------------------------------------------------------
+// Public
 /**
   * \brief   Writes the Header Entries (Dicom Elements)
   *          from the H Table
@@ -96,10 +93,9 @@ void ElementSet::WriteContent(std::ofstream* fp, FileType filetype)
       i->second->WriteContent(fp, filetype);
    } 
 }
-//-----------------------------------------------------------------------------
-// Protected
 
 //-----------------------------------------------------------------------------
+// Protected
 
 //-----------------------------------------------------------------------------
 // Private
index 819435e151363674bd75abbf1ff7f5a4826d01ef..6678c05c366c38027afc4e324b60c2ae67f4eb56 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmElementSet.h,v $
   Language:  C++
-  Date:      $Date: 2004/12/03 20:16:58 $
-  Version:   $Revision: 1.26 $
+  Date:      $Date: 2004/12/16 11:37:03 $
+  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
@@ -41,11 +41,12 @@ public:
    ElementSet(int);
    ~ElementSet();
 
+   virtual void Print(std::ostream &os = std::cout); 
+
    bool AddEntry(DocEntry *Entry);
    bool RemoveEntry(DocEntry *EntryToRemove);
    bool RemoveEntryNoDestroy(DocEntry *EntryToRemove);
    
-   void Print(std::ostream &os = std::cout); 
    void WriteContent(std::ofstream *fp, FileType filetype); 
    
    /// Accessor to \ref TagHT
index 353b7cd6dbc7911b1edbd085aa46269409fd12ab..336713c68cd5028d031927657ba75806ff3d1168 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/12/16 10:51:49 $
-  Version:   $Revision: 1.177 $
+  Date:      $Date: 2004/12/16 11:37:03 $
+  Version:   $Revision: 1.178 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -125,6 +125,12 @@ File::~File()
 
 //-----------------------------------------------------------------------------
 // Print
+void File::Print(std::ostream &os)
+{
+   HeaderInternal->SetPrintLevel(PrintLevel);
+   HeaderInternal->Print(os);
+   PixelReadConverter->Print(os);
+}
 
 //-----------------------------------------------------------------------------
 // Public
index ce3d99565c7b6e4c18d50ce109fb03c946be79d6..859a9949362d951071aaf670d00d7bb51bdd789a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmFile.h,v $
   Language:  C++
-  Date:      $Date: 2004/12/16 10:51:49 $
-  Version:   $Revision: 1.87 $
+  Date:      $Date: 2004/12/16 11:37:03 $
+  Version:   $Revision: 1.88 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -19,6 +19,7 @@
 #ifndef GDCMFILE_H
 #define GDCMFILE_H
 
+#include <iostream>
 #include "gdcmCommon.h"
 
 namespace gdcm 
@@ -51,6 +52,10 @@ public:
  
    virtual ~File();
 
+   void Print(std::ostream &os = std::cout); 
+   /// Accessor to \ref PrintLevel
+   void SetPrintLevel(int level) { PrintLevel = level; }
+
    /// Accessor to \ref Header
    Header* GetHeader() { return HeaderInternal; }
 
@@ -128,14 +133,16 @@ protected:
    ValEntry* CopyValEntry(uint16_t group,uint16_t element);
    BinEntry* CopyBinEntry(uint16_t group,uint16_t element);
 
+   /// \brief Amount of printed details for each Header Entry (Dicom Element):
+   /// 0 : stands for the least detail level.
+   int PrintLevel;
+
 private:
    void Initialise();
 
    uint8_t* GetRaw();
 
-private:
 // members variables:
-
    /// Header to use to load the file
    Header *HeaderInternal;
 
index 6c26c7a54e5a98db0f49d34070d0e0a8549f77e1..2d6e0545343db63c889fafd913593a574c68624c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmPixelReadConvert.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/12/14 13:05:34 $
-  Version:   $Revision: 1.11 $
+  Date:      $Date: 2004/12/16 11:37:03 $
+  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
@@ -1303,6 +1303,15 @@ bool PixelReadConvert::BuildRGBImage()
    return true;
 }
 
+/**
+ * \brief        Print self.
+ * @param os     Stream to print to.
+ */
+void PixelReadConvert::Print( std::ostream &os )
+{
+   Print("",os);
+}
+
 /**
  * \brief        Print self.
  * @param indent Indentation string to be prepended during printing.
@@ -1315,10 +1324,10 @@ void PixelReadConvert::Print( std::string indent, std::ostream &os )
       << std::endl;
    os << indent
       << "Pixel Data: offset " << PixelOffset
-      << " x" << std::hex << PixelOffset << std::dec
-      << "   length " << PixelDataLength
-      << " x" << std::hex << PixelDataLength << std::dec
-      << std::endl;
+      << " x(" << std::hex << PixelOffset << std::dec
+      << ")   length " << PixelDataLength
+      << " x(" << std::hex << PixelDataLength << std::dec
+      << ")" << std::endl;
 
    if ( IsRLELossless )
    {
index af5e4bbd3513aa16270b19797d1d6c85035543d0..da8d8d0fcd245d1dcfadf7491aa9bc1ef31c31bd 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmPixelReadConvert.h,v $
   Language:  C++
-  Date:      $Date: 2004/12/12 17:21:07 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2004/12/16 11:37:03 $
+  Version:   $Revision: 1.6 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -48,6 +48,7 @@ public:
    //// Predicates:
    bool IsRawRGB();
 
+   void Print( std::ostream &os = std::cout );
    void Print( std::string indent = "", std::ostream &os = std::cout );
 
 // In progress
index ea771ed2cedcb61b4ade2d463227c8ca79fe82b5..f519d7af00ea7fe33199460594c77fefd0913846 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSQItem.h,v $
   Language:  C++
-  Date:      $Date: 2004/12/06 11:37:38 $
-  Version:   $Revision: 1.26 $
+  Date:      $Date: 2004/12/16 11:37:03 $
+  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
@@ -37,7 +37,7 @@ public:
    SQItem(int depthLevel);
    ~SQItem();
 
-   void Print(std::ostream &os = std::cout); 
+   virtual void Print(std::ostream &os = std::cout); 
    void WriteContent(std::ofstream *fp, FileType filetype);
 
    /// \brief   returns the DocEntry chained List for this SQ Item.