]> Creatis software - gdcm.git/commitdiff
ENH: Minor cleanup, mostly cosmetic
authormalaterre <malaterre>
Thu, 28 Oct 2004 03:10:56 +0000 (03:10 +0000)
committermalaterre <malaterre>
Thu, 28 Oct 2004 03:10:56 +0000 (03:10 +0000)
12 files changed:
Testing/CMakeLists.txt
Testing/TestTS.cxx [new file with mode: 0644]
Testing/TestVR.cxx [new file with mode: 0644]
src/gdcmDocument.h
src/gdcmFile.cxx
src/gdcmFile.h
src/gdcmHeader.cxx
src/gdcmHeader.h
src/gdcmSQItem.cxx
src/gdcmSQItem.h
src/gdcmVR.h
src/gdcmValEntry.h

index d6cf96bb2759892e80dbdbdd3a4f75633dc7cd08..0899b62aa90b9e38028933774cc079a7a92ee392 100644 (file)
@@ -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 (file)
index 0000000..4aa6b6e
--- /dev/null
@@ -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 (file)
index 0000000..6370ad9
--- /dev/null
@@ -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;
+}
index 7d44ebb776538c50ef672dd96c9a58815138bbb1..628f8bca77c40f22255d23aeeb26d9fc7a7004e4 100644 (file)
@@ -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; }
index a528e28c3bfac903213acbd32c7c7726d5a12e3d..f044feb11eb06bf4ffbd20d45c59ca749f2cb6af 100644 (file)
@@ -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;
    }
 
    // --------------------------------------------------------------
index 5e30d57e70b6fd22293eed87c7b2a14a62f2fdfd..8491fb5297529cbed7b169a95621856092e1790e 100644 (file)
@@ -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
index 21227e47a86f7d6994475e3892296914c1ffe2eb..0b41ac10b30547898f276397987004b86e80f838 100644 (file)
@@ -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
 /**
index 85291cac8968e17f56ccbcbe4d382729a2880489..13a5d39817ccc3cdc4d03975c684b3d3c93b2d22 100644 (file)
@@ -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
 
 #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();
index d7d0b19fe58f527802a47f232aa02610df650e1f..329a5a6dd95c0adc1638ef27ae0ea87ed4f873fe 100644 (file)
@@ -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)
index fc5e755210ecf1e2069f9400ce22cb6f5c924e02..22eaedb32a1e7cda2037a576591a7bed466ac93c 100644 (file)
@@ -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; }
index 78eba77999fe5d5fd795cd3b9c12d05dc9a4ad32..933e7f0f8bce82dac03c644b100439a492cb4321 100644 (file)
@@ -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 <map>
 #include <string>
 #include <iostream>
+
 namespace gdcm 
 {
 
index a249dbd2c4ebc20a1480ce4206ce8653f61e554b..6afc162f2180fc6b47f4dd57cfb48814e59e1c2d 100644 (file)
@@ -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; };