From ee91cee9d641284ed6a410f2af286bb681829055 Mon Sep 17 00:00:00 2001 From: regrain Date: Thu, 16 Dec 2004 11:37:01 +0000 Subject: [PATCH] * 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 -- BeNours --- ChangeLog | 7 +++++++ Example/PrintFile.cxx | 21 ++++----------------- src/gdcmDocEntrySet.h | 16 ++++++++++------ src/gdcmDocument.h | 12 ++---------- src/gdcmElementSet.cxx | 14 +++++--------- src/gdcmElementSet.h | 7 ++++--- src/gdcmFile.cxx | 10 ++++++++-- src/gdcmFile.h | 15 +++++++++++---- src/gdcmPixelReadConvert.cxx | 21 +++++++++++++++------ src/gdcmPixelReadConvert.h | 5 +++-- src/gdcmSQItem.h | 6 +++--- 11 files changed, 72 insertions(+), 62 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8039057..57662535 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-12-16 Benoit Regrain + * 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 * src/gdcmFile.cxx : Add the code of ReplaceOrCreateByNumber to not have problems when compiling with the python wrapping diff --git a/Example/PrintFile.cxx b/Example/PrintFile.cxx index 85275e2e..77c00f4a 100644 --- a/Example/PrintFile.cxx +++ b/Example/PrintFile.cxx @@ -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 <second->WriteContent(fp, filetype); } } -//----------------------------------------------------------------------------- -// Protected //----------------------------------------------------------------------------- +// Protected //----------------------------------------------------------------------------- // Private diff --git a/src/gdcmElementSet.h b/src/gdcmElementSet.h index 819435e1..6678c05c 100644 --- a/src/gdcmElementSet.h +++ b/src/gdcmElementSet.h @@ -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 diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 353b7cd6..336713c6 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -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 diff --git a/src/gdcmFile.h b/src/gdcmFile.h index ce3d9956..859a9949 100644 --- a/src/gdcmFile.h +++ b/src/gdcmFile.h @@ -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 #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; diff --git a/src/gdcmPixelReadConvert.cxx b/src/gdcmPixelReadConvert.cxx index 6c26c7a5..2d6e0545 100644 --- a/src/gdcmPixelReadConvert.cxx +++ b/src/gdcmPixelReadConvert.cxx @@ -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 ) { diff --git a/src/gdcmPixelReadConvert.h b/src/gdcmPixelReadConvert.h index af5e4bbd..da8d8d0f 100644 --- a/src/gdcmPixelReadConvert.h +++ b/src/gdcmPixelReadConvert.h @@ -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 diff --git a/src/gdcmSQItem.h b/src/gdcmSQItem.h index ea771ed2..f519d7af 100644 --- a/src/gdcmSQItem.h +++ b/src/gdcmSQItem.h @@ -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. -- 2.45.1