From: malaterre Date: Thu, 28 Oct 2004 03:10:56 +0000 (+0000) Subject: ENH: Minor cleanup, mostly cosmetic X-Git-Tag: Version0.6.bp~33 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9649936f884197f6f6260aae051d33729bce07d5;p=gdcm.git ENH: Minor cleanup, mostly cosmetic --- diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index d6cf96bb..0899b62a 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -10,6 +10,8 @@ SET(GDCM_TESTS ${CXX_TEST_PATH}/gdcmTests) SET(TEST_SOURCES TestBug.cxx TestHash.cxx + TestTS.cxx + TestVR.cxx ) # add tests that require data diff --git a/Testing/TestTS.cxx b/Testing/TestTS.cxx new file mode 100644 index 00000000..4aa6b6ee --- /dev/null +++ b/Testing/TestTS.cxx @@ -0,0 +1,10 @@ +#include "gdcmTS.h" + +int TestTS(int , char *[]) +{ + gdcm::TS ts; + // There should be 150 entries + ts.Print( std::cout ); + + return ts.GetValue( "" ) != GDCM_UNFOUND; +} diff --git a/Testing/TestVR.cxx b/Testing/TestVR.cxx new file mode 100644 index 00000000..6370ad92 --- /dev/null +++ b/Testing/TestVR.cxx @@ -0,0 +1,12 @@ +#include "gdcmVR.h" + +int TestVR(int , char *[]) +{ + gdcm::VR vr; + // There should be 16 entries + vr.Print( std::cout ); + vr.IsVROfGdcmStringRepresentable( "" ); + vr.IsVROfGdcmBinaryRepresentable( "" ); + + return 0; +} diff --git a/src/gdcmDocument.h b/src/gdcmDocument.h index 7d44ebb7..628f8bca 100644 --- a/src/gdcmDocument.h +++ b/src/gdcmDocument.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.h,v $ Language: C++ - Date: $Date: 2004/10/24 03:33:41 $ - Version: $Revision: 1.55 $ + Date: $Date: 2004/10/28 03:10:57 $ + Version: $Revision: 1.56 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -261,14 +261,13 @@ private: void BuildFlatHashTableRecurse( TagDocEntryHT& builtHT, DocEntrySet* set ); - public: // Accessors: /// Accessor to \ref PrintLevel void SetPrintLevel(int level) { PrintLevel = level; } /// Accessor to \ref Filename - const std::string &GetFileName() { return Filename; } + const std::string &GetFileName() const { return Filename; } /// Accessor to \ref Filename void SetFileName(std::string const & fileName) { Filename = fileName; } diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index a528e28c..f044feb1 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/10/22 13:56:46 $ - Version: $Revision: 1.149 $ + Date: $Date: 2004/10/28 03:10:58 $ + Version: $Revision: 1.150 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -274,7 +274,7 @@ int File::ComputeDecompressedPixelDataSizeFromHeader() // - it is not defined (i.e. it's value is 0) // - it's 12, since we will expand the image to 16 bits (see // PixelConvert::ConvertDecompress12BitsTo16Bits() ) - if ( ( numberBitsAllocated == 0 ) || ( numberBitsAllocated == 12 ) ) + if ( numberBitsAllocated == 0 || numberBitsAllocated == 12 ) { numberBitsAllocated = 16; } @@ -641,12 +641,10 @@ bool File::WriteBase (std::string const & fileName, FileType type) if ( type == ImplicitVR || type == ExplicitVR ) { // writing Dicom File Preamble - uint8_t* filePreamble = new uint8_t[128]; + uint8_t filePreamble[128]; memset(filePreamble, 0, 128); fp1->write((char*)filePreamble, 128); fp1->write("DICM", 4); - - delete[] filePreamble; } // -------------------------------------------------------------- diff --git a/src/gdcmFile.h b/src/gdcmFile.h index 5e30d57e..8491fb52 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/10/25 04:08:20 $ - Version: $Revision: 1.67 $ + Date: $Date: 2004/10/28 03:10:58 $ + Version: $Revision: 1.68 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -25,7 +25,6 @@ namespace gdcm { - //----------------------------------------------------------------------------- /* * In addition to Dicom header exploration, this class is designed diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 21227e47..0b41ac10 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmHeader.cxx,v $ Language: C++ - Date: $Date: 2004/10/22 03:05:41 $ - Version: $Revision: 1.195 $ + Date: $Date: 2004/10/28 03:10:58 $ + Version: $Revision: 1.196 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -27,7 +27,6 @@ namespace gdcm { - //----------------------------------------------------------------------------- // Constructor / Destructor /** diff --git a/src/gdcmHeader.h b/src/gdcmHeader.h index 85291cac..13a5d398 100644 --- a/src/gdcmHeader.h +++ b/src/gdcmHeader.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmHeader.h,v $ Language: C++ - Date: $Date: 2004/10/22 03:05:42 $ - Version: $Revision: 1.91 $ + Date: $Date: 2004/10/28 03:10:58 $ + Version: $Revision: 1.92 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -21,10 +21,9 @@ #include "gdcmCommon.h" #include "gdcmDocument.h" + namespace gdcm { - - //----------------------------------------------------------------------------- /** * \brief @@ -114,10 +113,10 @@ public: Header(); Header( std::string const & filename ); - virtual ~Header(); + ~Header(); // Standard values and informations contained in the header - virtual bool IsReadable(); + bool IsReadable(); // Some heuristic based accessors, end user intended int GetBitsStored(); @@ -143,7 +142,6 @@ public: float GetXSpacing(); float GetYSpacing(); float GetZSpacing(); - //void GetSpacing(float &x, float &y, float &z); // Useful for rescaling graylevel: float GetRescaleIntercept(); @@ -158,7 +156,6 @@ public: float GetXOrigin(); float GetYOrigin(); float GetZOrigin(); - //void GetOrigin(float &x, float &y, float &z); bool HasLUT(); int GetLUTNbits(); diff --git a/src/gdcmSQItem.cxx b/src/gdcmSQItem.cxx index d7d0b19f..329a5a6d 100644 --- a/src/gdcmSQItem.cxx +++ b/src/gdcmSQItem.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.cxx,v $ Language: C++ - Date: $Date: 2004/10/27 22:31:12 $ - Version: $Revision: 1.32 $ + Date: $Date: 2004/10/28 03:10:58 $ + Version: $Revision: 1.33 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -27,7 +27,6 @@ namespace gdcm { - //----------------------------------------------------------------------------- // Constructor / Destructor /** @@ -49,7 +48,7 @@ SQItem::~SQItem() cc != DocEntries.end(); ++cc) { - delete (*cc); + delete *cc; } DocEntries.clear(); } @@ -70,7 +69,7 @@ SQItem::~SQItem() s << " | " ; } } - std::cout << s.str() << " --- SQItem number " << SQItemNumber << std::endl; + //std::cout << s.str() << " --- SQItem number " << SQItemNumber << std::endl; for (ListDocEntry::iterator i = DocEntries.begin(); i != DocEntries.end(); ++i) diff --git a/src/gdcmSQItem.h b/src/gdcmSQItem.h index fc5e7552..22eaedb3 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/10/25 03:35:20 $ - Version: $Revision: 1.21 $ + Date: $Date: 2004/10/28 03:10:58 $ + Version: $Revision: 1.22 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -40,7 +40,7 @@ public: void Write(std::ofstream *fp, FileType filetype); /// \brief returns the DocEntry chained List for this SQ Item. - ListDocEntry const &GetDocEntries() const { return DocEntries; }; + ListDocEntry const & GetDocEntries() const { return DocEntries; }; /// \brief adds the passed DocEntry to the DocEntry chained List for /// this SQ Item. @@ -52,7 +52,8 @@ public: // FIXME method to write //DocEntry *GetDocEntryByName (std::string Name); - bool SetEntryByNumber(std::string const & val, uint16_t group, uint16_t element); + bool SetEntryByNumber(std::string const & val, uint16_t group, + uint16_t element); std::string GetEntryByNumber(uint16_t group, uint16_t element); @@ -69,7 +70,7 @@ public: void SetDepthLevel(int depth) { SQDepthLevel = depth; } /// Accessor on \ref BaseTagKey. - void SetBaseTagKey( BaseTagKey const & key ) { BaseTagKeyNested = key; } + void SetBaseTagKey( BaseTagKey const & key ) { BaseTagKeyNested = key; } /// Accessor on \ref BaseTagKey. BaseTagKey const & GetBaseTagKey() const { return BaseTagKeyNested; } diff --git a/src/gdcmVR.h b/src/gdcmVR.h index 78eba779..933e7f0f 100644 --- a/src/gdcmVR.h +++ b/src/gdcmVR.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmVR.h,v $ Language: C++ - Date: $Date: 2004/10/27 21:28:56 $ - Version: $Revision: 1.13 $ + Date: $Date: 2004/10/28 03:10:58 $ + Version: $Revision: 1.14 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -23,6 +23,7 @@ #include #include #include + namespace gdcm { diff --git a/src/gdcmValEntry.h b/src/gdcmValEntry.h index a249dbd2..6afc162f 100644 --- a/src/gdcmValEntry.h +++ b/src/gdcmValEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmValEntry.h,v $ Language: C++ - Date: $Date: 2004/10/25 03:03:45 $ - Version: $Revision: 1.28 $ + Date: $Date: 2004/10/28 03:10:58 $ + Version: $Revision: 1.29 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -35,10 +35,10 @@ class GDCM_EXPORT ValEntry : public DocEntry public: ValEntry(DictEntry* e); ValEntry(DocEntry* d); - virtual ~ValEntry(); + ~ValEntry(); /// \brief Returns the 'Value' (e.g. "Dupond Marcel") converted into a - /// 'string', if it's stored as an integer in the header of the + /// 'string', event if it's stored as an integer in the header of the /// current Dicom Document Entry std::string const & GetValue() const { return Value; };