From 9cd51041e87ba178719523a35ef7ad823924cbf6 Mon Sep 17 00:00:00 2001 From: malaterre Date: Tue, 19 Jul 2005 15:19:25 +0000 Subject: [PATCH] ENH: gdcm now almost compile with GDCM_LEGACY_REMOVE on --- Example/PrintDocument.cxx | 7 +++--- Example/TestCopyDicom.cxx | 8 ++++--- Example/exColorToRGB.cxx | 8 ++++--- Example/exGC.cxx | 8 ++++--- Example/exGrey2RGB.cxx | 8 ++++--- Example/exImageLighten.cxx | 8 ++++--- Example/exReadWriteFile.cxx | 12 ++++++---- src/gdcmDicomDir.cxx | 7 +++--- src/gdcmFile.cxx | 30 ++++++++++++----------- src/gdcmFile.h | 7 +++--- src/gdcmFileHelper.cxx | 47 ++++++++++++++++++++----------------- src/gdcmFileHelper.h | 9 +++---- 12 files changed, 91 insertions(+), 68 deletions(-) diff --git a/Example/PrintDocument.cxx b/Example/PrintDocument.cxx index 81da2f31..fdce422f 100644 --- a/Example/PrintDocument.cxx +++ b/Example/PrintDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: PrintDocument.cxx,v $ Language: C++ - Date: $Date: 2005/07/06 15:49:31 $ - Version: $Revision: 1.16 $ + Date: $Date: 2005/07/19 15:19:25 $ + Version: $Revision: 1.17 $ 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,8 @@ int main(int argc, char *argv[]) if (argc > 4) e1->SetLoadMode(NO_SEQ | NO_SHADOW); - e1->Load( fileName.c_str() ); + e1->SetFileName( fileName.c_str() ); + e1->Load( ); // we use PrintDocument, because we want to print what we get diff --git a/Example/TestCopyDicom.cxx b/Example/TestCopyDicom.cxx index c8f67dc9..2dd66ff3 100644 --- a/Example/TestCopyDicom.cxx +++ b/Example/TestCopyDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyDicom.cxx,v $ Language: C++ - Date: $Date: 2005/07/08 12:02:02 $ - Version: $Revision: 1.25 $ + Date: $Date: 2005/07/19 15:19:25 $ + Version: $Revision: 1.26 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -88,7 +88,9 @@ int main(int argc, char *argv[]) std::cout << "--- Original ----------------------" << std::endl; //original->GetFile()->Print(); - gdcm::FileHelper *copy = new gdcm::FileHelper( output ); + gdcm::FileHelper *copy = new gdcm::FileHelper( ); + copy->SetFileName( output ); + copy->Load(); size_t dataSize = original->GetImageDataSize(); uint8_t *imageData = original->GetImageData(); diff --git a/Example/exColorToRGB.cxx b/Example/exColorToRGB.cxx index 05509fcc..5af2752e 100644 --- a/Example/exColorToRGB.cxx +++ b/Example/exColorToRGB.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exColorToRGB.cxx,v $ Language: C++ - Date: $Date: 2005/07/07 17:31:54 $ - Version: $Revision: 1.3 $ + Date: $Date: 2005/07/19 15:19:25 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -97,7 +97,9 @@ int main(int argc, char *argv[]) // ------ without Sequences ------------- - gdcm::FileHelper *copy = new gdcm::FileHelper( output ); + gdcm::FileHelper *copy = new gdcm::FileHelper( ); + copy->SetFileName( output ); + copy->Load(); gdcm::DocEntry *d = f->GetFirstEntry(); while(d) diff --git a/Example/exGC.cxx b/Example/exGC.cxx index 8d28ecec..6cff2a3b 100644 --- a/Example/exGC.cxx +++ b/Example/exGC.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exGC.cxx,v $ Language: C++ - Date: $Date: 2005/07/07 17:31:54 $ - Version: $Revision: 1.5 $ + Date: $Date: 2005/07/19 15:19:25 $ + 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 @@ -119,7 +119,9 @@ int main(int argc, char *argv[]) // ------ without Sequences ------------- - gdcm::FileHelper *copy = new gdcm::FileHelper( output ); + gdcm::FileHelper *copy = new gdcm::FileHelper( ); + copy->SetFileName( output ); + copy->Load(); gdcm::DocEntry *d = f->GetFirstEntry(); while(d) diff --git a/Example/exGrey2RGB.cxx b/Example/exGrey2RGB.cxx index 2c151985..cc3d5e4b 100644 --- a/Example/exGrey2RGB.cxx +++ b/Example/exGrey2RGB.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exGrey2RGB.cxx,v $ Language: C++ - Date: $Date: 2005/07/07 17:31:54 $ - Version: $Revision: 1.2 $ + Date: $Date: 2005/07/19 15:19:25 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -81,7 +81,9 @@ int main(int argc, char *argv[]) } } - gdcm::FileHelper *fh = new gdcm::FileHelper( filename ); + gdcm::FileHelper *fh = new gdcm::FileHelper( ); + fh->SetFileName( filename ); + fh->Load(); size_t dataSize = fh->GetImageDataSize(); uint8_t *imageData = fh->GetImageData(); diff --git a/Example/exImageLighten.cxx b/Example/exImageLighten.cxx index c0553d12..67d5a464 100644 --- a/Example/exImageLighten.cxx +++ b/Example/exImageLighten.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exImageLighten.cxx,v $ Language: C++ - Date: $Date: 2005/07/07 17:31:54 $ - Version: $Revision: 1.3 $ + Date: $Date: 2005/07/19 15:19:25 $ + Version: $Revision: 1.4 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -89,7 +89,9 @@ int main(int argc, char *argv[]) // Create a new gdcm::Filehelper, to hold new image. // ============================================================ - gdcm::FileHelper *copy = new gdcm::FileHelper( output ); + gdcm::FileHelper *copy = new gdcm::FileHelper( ); + copy->SetFileName( output ); + copy->Load(); // ============================================================ // Selective copy of the entries (including Pixel Element). diff --git a/Example/exReadWriteFile.cxx b/Example/exReadWriteFile.cxx index 792ab823..757296ef 100644 --- a/Example/exReadWriteFile.cxx +++ b/Example/exReadWriteFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exReadWriteFile.cxx,v $ Language: C++ - Date: $Date: 2005/07/06 15:49:31 $ - Version: $Revision: 1.5 $ + Date: $Date: 2005/07/19 15:19:25 $ + 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 @@ -60,7 +60,9 @@ std::cout << " --- WARNING --- WARNING --- WARNING --- WARNING ---" <SetFileName( filename ); + f1->Load(); // Ask content to be printed @@ -255,7 +257,9 @@ std::cout << " --- WARNING --- WARNING --- WARNING --- WARNING ---" <SetFileName( output ); + copy->Load(); d = f1->GetFirstEntry(); while(d) diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index de32b953..de95ee68 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/07/12 17:08:12 $ - Version: $Revision: 1.148 $ + Date: $Date: 2005/07/19 15:19:26 $ + Version: $Revision: 1.149 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -608,7 +608,8 @@ void DicomDir::CreateDicomDirChainedList(std::string const &path) f = new File( ); f->SetLoadMode(LoadMode); // we allow user not to load Sequences, or Shadow // groups, or ...... - f->Load( it->c_str() ); + f->SetFileName( it->c_str() ); + /*int res = */f->Load( ); // if ( !f ) // { diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index 09a9e8fd..085a381c 100644 --- a/src/gdcmFile.cxx +++ b/src/gdcmFile.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.cxx,v $ Language: C++ - Date: $Date: 2005/07/19 14:43:48 $ - Version: $Revision: 1.250 $ + Date: $Date: 2005/07/19 15:19:26 $ + Version: $Revision: 1.251 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -60,18 +60,6 @@ File::File(): NumPixel = 0x0010; } -/** - * \brief Constructor - * @param filename name of the file whose header we want to analyze - */ -File::File( std::string const &filename ) - :Document( ) -{ - RLEInfo = new RLEFramesInfo; - JPEGInfo = new JPEGFragmentsInfo; - - Load( filename ); // gdcm::Document is first Loaded, then the 'File part' -} /** * \brief Canonical destructor. @@ -1713,6 +1701,20 @@ void File::ReadAndSkipEncapsulatedBasicOffsetTable() // These are the deprecated method that one day should be removed (after the next release) #ifndef GDCM_LEGACY_REMOVE +/** + * \brief Constructor + * @param filename name of the file whose header we want to analyze + * @deprecated do not use anymore + */ +File::File( std::string const &filename ) + :Document( ) +{ + RLEInfo = new RLEFramesInfo; + JPEGInfo = new JPEGFragmentsInfo; + + Load( filename ); // gdcm::Document is first Loaded, then the 'File part' +} + /** * \brief Loader. (DEPRECATED : not to break the API) * @param fileName file to be open for parsing diff --git a/src/gdcmFile.h b/src/gdcmFile.h index 47abfd64..2109cb50 100644 --- a/src/gdcmFile.h +++ b/src/gdcmFile.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFile.h,v $ Language: C++ - Date: $Date: 2005/07/19 14:44:57 $ - Version: $Revision: 1.109 $ + Date: $Date: 2005/07/19 15:19:26 $ + Version: $Revision: 1.110 $ 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 "gdcmDebug.h" #include "gdcmDocument.h" namespace gdcm @@ -96,7 +97,7 @@ class GDCM_EXPORT File : public Document { public: File(); - File( std::string const &filename ); + GDCM_LEGACY(File( std::string const &filename )); ~File(); // Loading diff --git a/src/gdcmFileHelper.cxx b/src/gdcmFileHelper.cxx index 850c3344..40c088ea 100644 --- a/src/gdcmFileHelper.cxx +++ b/src/gdcmFileHelper.cxx @@ -4,8 +4,8 @@ Module: $RCSfile: gdcmFileHelper.cxx,v $ Language: C++ - Date: $Date: 2005/07/11 08:30:39 $ - Version: $Revision: 1.48 $ + Date: $Date: 2005/07/19 15:19:27 $ + Version: $Revision: 1.49 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -145,26 +145,6 @@ FileHelper::FileHelper(File *header) Initialize(); } -/** - * \brief DEPRECATED : use SetFilename() + Load() methods - * Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3 - * file (gdcm::File only deals with the ... header) - * Opens (in read only and when possible) an existing file and checks - * for DICOM compliance. Returns NULL on failure. - * It will be up to the user to load the pixels into memory - * \note the in-memory representation of all available tags found in - * the DICOM header is post-poned to first header information access. - * This avoid a double parsing of public part of the header when - * one sets an a posteriori shadow dictionary (efficiency can be - * seen as a side effect). - * @param filename file to be opened for parsing - */ -FileHelper::FileHelper(std::string const &filename ) -{ - FileInternal = new File( filename ); - SelfHeader = true; - Initialize(); -} /** * \brief canonical destructor @@ -1561,5 +1541,28 @@ void FileHelper::Print(std::ostream &os, std::string const &) PixelReadConverter->Print(os); } +#ifndef GDCM_LEGACY_REMOVE +/** + * \brief + * Constructor dedicated to deal with the *pixels* area of a ACR/DICOMV3 + * file (gdcm::File only deals with the ... header) + * Opens (in read only and when possible) an existing file and checks + * for DICOM compliance. Returns NULL on failure. + * It will be up to the user to load the pixels into memory + * \note the in-memory representation of all available tags found in + * the DICOM header is post-poned to first header information access. + * This avoid a double parsing of public part of the header when + * one sets an a posteriori shadow dictionary (efficiency can be + * seen as a side effect). + * @param filename file to be opened for parsing + * @deprecated use SetFilename() + Load() methods + */ +FileHelper::FileHelper(std::string const &filename ) +{ + FileInternal = new File( filename ); + SelfHeader = true; + Initialize(); +} +#endif //----------------------------------------------------------------------------- } // end namespace gdcm diff --git a/src/gdcmFileHelper.h b/src/gdcmFileHelper.h index 327431ba..3661ebfe 100644 --- a/src/gdcmFileHelper.h +++ b/src/gdcmFileHelper.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmFileHelper.h,v $ Language: C++ - Date: $Date: 2005/07/08 14:36:48 $ - Version: $Revision: 1.18 $ + Date: $Date: 2005/07/19 15:19:27 $ + 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 @@ -19,8 +19,9 @@ #ifndef GDCMFILEHELPER_H #define GDCMFILEHELPER_H -#include +#include "gdcmDebug.h" #include "gdcmBase.h" +//#include namespace gdcm { @@ -49,7 +50,7 @@ public: public: FileHelper( ); FileHelper( File *header ); - FileHelper( std::string const &filename ); + GDCM_LEGACY(FileHelper( std::string const &filename )); virtual ~FileHelper(); -- 2.48.1