]> Creatis software - gdcm.git/commitdiff
* src/gdcmUtil.[cxx|h] split in two. Additional file gdcmGlobal.[cxx|h]
authorfrog <frog>
Sat, 27 Mar 2004 18:41:48 +0000 (18:41 +0000)
committerfrog <frog>
Sat, 27 Mar 2004 18:41:48 +0000 (18:41 +0000)
       now contains all the gdcmGlobal related code.
     * minor coding style and doxygenation changes.

22 files changed:
ChangeLog
gdcmPython/gdcm.i
src/Makefile.am
src/gdcmDicomDir.cxx
src/gdcmDicomDirElement.cxx
src/gdcmDicomDirPatient.cxx
src/gdcmDicomDirSerie.cxx
src/gdcmDicomDirStudy.cxx
src/gdcmDict.cxx
src/gdcmDictEntry.h
src/gdcmGlobal.cxx [new file with mode: 0644]
src/gdcmGlobal.h [new file with mode: 0644]
src/gdcmHeader.cxx
src/gdcmHeader.h
src/gdcmHeaderEntry.cxx
src/gdcmObject.cxx
src/gdcmParser.cxx
src/gdcmParser.h
src/gdcmUtil.cxx
src/gdcmUtil.h
src/gdcmVR.cxx
src/win32/gdcmdll.dsp

index 7c1bf89bdfdcc1262daf2337765a33165c5f862c..f064cfdbb294f51a0244a9085ff014cd36246397 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-27  Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+     * src/gdcmUtil.[cxx|h] split in two. Additional file gdcmGlobal.[cxx|h]
+       now contains all the gdcmGlobal related code.
+     * minor coding style and doxygenation changes.
+
 2004-03-26  Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
      * src/gdcmUtil.[cxx|h] split in two. Additional file gdcmDebug.[cxx|h]
        now contains all the Debug related code.
index d267799810185f76017bf22bf8271ce6e1bca3d1..0e21e5b84834d9ada9336592a549c9a16c5dd31c 100644 (file)
@@ -10,6 +10,7 @@
 #include "gdcmHeaderHelper.h"
 #include "gdcmFile.h"
 #include "gdcmUtil.h"
+#include "gdcmGlobal.h"
 #include "gdcmObject.h"
 #include "gdcmDicomDir.h"
 #include "gdcmDicomDirElement.h"
@@ -255,6 +256,7 @@ extern gdcmGlobal gdcmGlob;
 %include "gdcmHeaderHelper.h"
 %include "gdcmFile.h"
 %include "gdcmUtil.h"
+%include "gdcmGlobal.h"
 %include "gdcmObject.h"
 %include "gdcmDicomDir.h"
 %include "gdcmDicomDirElement.h"
index 3a0be1cb0086db213c26b60dd17578d6961aa10a..8b4d3a1bdd889883e22c07911b163f5e18340c10 100644 (file)
@@ -27,6 +27,7 @@ libgdcm_la_SOURCES=                \
    gdcmDirList.cxx                 \
    gdcmException.cxx               \
    gdcmFile.cxx                    \
+   gdcmGlobal.cxx                  \
    gdcmHeader.cxx                  \
    gdcmHeaderEntry.cxx             \
    gdcmHeaderHelper.cxx            \
@@ -59,6 +60,7 @@ libgdcminclude_HEADERS =           \
    gdcmDirList.h                   \
    gdcmException.h                 \
    gdcmFile.h                      \
+   gdcmGlobal.h                    \
    gdcm.h                          \
    gdcmHeaderEntry.h               \
    gdcmHeader.h                    \
index 4af178557249ba3b307679cab0c4ac45037fbf5b..48ddeb5c3f2085ecbfc59519de98848ec869335f 100644 (file)
@@ -18,6 +18,7 @@
 #include "gdcmDirList.h"
 #include "gdcmUtil.h"
 #include "gdcmDebug.h"
+#include "gdcmGlobal.h"
 
 //-----------------------------------------------------------------------------
 //  For full DICOMDIR description, see:
 // Constructor / Destructor
 
 /**
- * \ingroup gdcmDicomDir
  * \brief Constructor Parses recursively the directory and creates the DicomDir
- *                        or uses an already built DICOMDIR, depending on 'parseDir' value
+ *        or uses an already built DICOMDIR, depending on 'parseDir' value.
  * @param FileName        name 
                       - of the root directory (parseDir = true)
*                      - of the root directory (parseDir = true)
  *                      - of the DICOMDIR       (parseDir = false)
  * @param parseDir boolean
  *                      - true if user passed an entry point 
@@ -447,11 +447,11 @@ void gdcmDicomDir::CheckBoundaries()
             itImage = ((*itSerie)->GetDicomDirImages()).begin();
             while (itImage != (*itSerie)->GetDicomDirImages().end() ) {
                (*itImage)->ResetBoundaries(1);
-               ++itImage;                  
-           }
-           ++itSerie;                                
+               ++itImage;
+       }
+       ++itSerie;
          }
-        ++itStudy;            
+      ++itStudy;
       } 
       ++itPatient;     
    }
@@ -487,9 +487,9 @@ gdcmDicomDirPatient * gdcmDicomDir::NewPatient(void) {
       entry->SetValue(it->value);
 
       if(dictEntry->GetGroup()==0xfffe) 
-        {
-            entry->SetLength(entry->GetValue().length());       
-        }
+      {
+            entry->SetLength(entry->GetValue().length());
+      }
       else if( (dictEntry->GetVR()=="UL") || (dictEntry->GetVR()=="SL") ) 
          {
             entry->SetLength(4);
index be6ce16577dbf4e161370392a78c81a2c047f770..a8309d84a87bb7bcf2b1bde63a90709cdce289b0 100644 (file)
@@ -13,6 +13,7 @@
 #include "gdcmDicomDirElement.h"
 #include "gdcmUtil.h"
 #include "gdcmDebug.h"
+#include "gdcmDictSet.h"
 
 #ifndef PUB_DICT_PATH
 #  define PUB_DICT_PATH     "../Dicts/"
index 57358bbfd107a19ea58af75690fefbb69ec26dbb..50f80ddc32e7ea48a95d675e1c945beeeb74d02f 100644 (file)
@@ -2,7 +2,7 @@
 //-----------------------------------------------------------------------------
 #include "gdcmDicomDirPatient.h"
 #include "gdcmDicomDirElement.h"
-#include "gdcmUtil.h"
+#include "gdcmGlobal.h"
 
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
index e805e27e22ce4506d80e08c5009154b715950de4..1272df3cfb88c61c0a50da666a0cc08d67c4a19c 100644 (file)
@@ -2,12 +2,11 @@
 //-----------------------------------------------------------------------------
 #include "gdcmDicomDirSerie.h"
 #include "gdcmDicomDirElement.h"
-#include "gdcmUtil.h"
+#include "gdcmGlobal.h"
 
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
- * \ingroup gdcmDicomDirSerie
  * \brief  Constructor 
  * @param  begin  iterator (inside the gdcmParser chained list)
  *                on the first Header Entry (i.e Dicom Element)
  */
 gdcmDicomDirSerie::gdcmDicomDirSerie(ListTag::iterator begin,
                                      ListTag::iterator end,              
-                                    TagHeaderEntryHT *ptagHT, 
-                                    ListTag *plistEntries ):
+                                     TagHeaderEntryHT *ptagHT, 
+                                     ListTag *plistEntries ):
    gdcmObject(begin,end,ptagHT,plistEntries)
 {
 }
 
 /**
- * \ingroup gdcmDicomDirSerie
  * \brief   Canonical destructor.
  */
 gdcmDicomDirSerie::~gdcmDicomDirSerie() 
@@ -43,7 +41,6 @@ gdcmDicomDirSerie::~gdcmDicomDirSerie()
 //-----------------------------------------------------------------------------
 // Print
 /**
- * \ingroup gdcmDicomDirSerie
  * \brief   Prints the Object
  * @return
  */ 
@@ -62,7 +59,6 @@ void gdcmDicomDirSerie::Print(std::ostream &os)
 //-----------------------------------------------------------------------------
 // Public
 /**
- * \ingroup gdcmDicomSerie
  * \brief   adds a new Image to a partially created DICOMDIR
  */
 gdcmDicomDirImage * gdcmDicomDirSerie::NewImage(void) {
index a2cf5859ad28ea6067f972d3605ed3418e661f8e..f6509abb380ef41a4cbb06ffd1616d7b47d9160b 100644 (file)
@@ -2,7 +2,7 @@
 //-----------------------------------------------------------------------------
 #include "gdcmDicomDirStudy.h"
 #include "gdcmDicomDirElement.h"
-#include "gdcmUtil.h"
+#include "gdcmGlobal.h"
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 
@@ -22,8 +22,8 @@
  */
 gdcmDicomDirStudy::gdcmDicomDirStudy(ListTag::iterator begin,
                                      ListTag::iterator end,
-                                    TagHeaderEntryHT *ptagHT, 
-                                    ListTag *plistEntries):
+                                     TagHeaderEntryHT *ptagHT, 
+                                     ListTag *plistEntries):
    gdcmObject(begin,end,ptagHT,plistEntries)
 {
 }
index b5bdea348deeb07d384a01dbae5436514e1d30d6..fd3e990c26905caa7c4f9895ae717e90d74ffc8e 100644 (file)
@@ -18,7 +18,6 @@
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
- * \ingroup gdcmDict
  * \brief   Construtor
  * @param   FileName from which to build the dictionary.
  */
@@ -45,7 +44,7 @@ gdcmDict::gdcmDict(std::string & FileName) {
       name = buff;
 
       gdcmDictEntry * newEntry = new gdcmDictEntry(group, element,
-                                                  vr, fourth, name);
+                                                   vr, fourth, name);
       AddNewEntry(newEntry);
    }
    from.close();
@@ -54,7 +53,6 @@ gdcmDict::gdcmDict(std::string & FileName) {
 }
 
 /**
- * \ingroup gdcmDict
  * \brief  Destructor 
  */
 gdcmDict::~gdcmDict() {
@@ -83,7 +81,6 @@ void gdcmDict::Print(std::ostream &os) {
 }
 
 /**
- * \ingroup gdcmDict
  * \brief   Print all the dictionary entries contained in this dictionary.
  *          Entries will be sorted by tag i.e. the couple (group, element).
  * @param   os The output stream to be written to.
@@ -103,7 +100,6 @@ void gdcmDict::PrintByKey(std::ostream &os) {
 }
 
 /**
- * \ingroup gdcmDict
  * \brief   Print all the dictionary entries contained in this dictionary.
  *          Entries will be sorted by the name of the dictionary entries.
  * \warning AVOID USING IT : the name IS NOT an identifier; 
@@ -137,7 +133,7 @@ bool gdcmDict::AddNewEntry(gdcmDictEntry *NewEntry)
 {
    TagKey key;
    key = NewEntry->GetKey();
-       
+
    if(KeyHt.count(key) == 1)
    {
       dbg.Verbose(1, "gdcmDict::AddNewEntry already present", key.c_str());
index 5828bfd72c1e1aa1a8788a4288d27df06dbbbe1b..affbd53d4438c8561fce349b41f67c282bd70f78 100644 (file)
@@ -110,23 +110,70 @@ private:
     */ 
    std::string vr;
                                                
-       // CLEANME: find the official dicom name for this field !
    /**
-    * \ingroup gdcmDictEntry
-    * \brief   Fourth field containing some semantics
-    *          (Group Name abbr.) 
-    *          DON'T USER ANY LONGER !
-    */         
+    * \brief AVOID using the following fourth field at all costs.
+    * 
+    *  They are at leat two good reasons for NOT using fourth:
+    *  - the main reason is that it is NOT part of the 'official'
+    *    Dicom Dictionnary.
+    *  - a second reason is that it is not defined for all the groups.
+    *  .
+    *  Still it provides some semantics as group name abbreviation that
+    *  can prove of some help when organizing things in an interface.
+    *  For the time being we keep it in gdcm but it migth be removed in
+    *  future releases it proves to be source of confusion.
+    *  Here is a small dictionary we encountered in "nature":
+    *  - CMD      Command        
+    *  - META     Meta Information 
+    *  - DIR      Directory
+    *  - ID       ???
+    *  - PAT      Patient
+    *  - ACQ      Acquisition
+    *  - REL      Related
+    *  - IMG      Image
+    *  - SDY      Study
+    *  - VIS      Visit 
+    *  - WAV      Waveform
+    *  - PRC      ???
+    *  - DEV      Device
+    *  - NMI      Nuclear Medicine
+    *  - MED      ???
+    *  - BFS      Basic Film Session
+    *  - BFB      Basic Film Box
+    *  - BIB      Basic Image Box
+    *  - BAB
+    *  - IOB
+    *  - PJ
+    *  - PRINTER
+    *  - RT       Radio Therapy
+    *  - DVH   
+    *  - SSET
+    *  - RES      Results
+    *  - CRV      Curve
+    *  - OLY      Overlays
+    *  - PXL      Pixels
+    *  - DL       Delimiters
+    *  .
+    *
+    *  Other usefull abreviations used for Radiographic view associated with
+    *  Patient Position (0018,5100):
+    *  -  AP = Anterior/Posterior 
+    *  -  PA = Posterior/Anterior 
+    *  -  LL = Left Lateral 
+    *  -  RL = Right Lateral 
+    *  - RLD = Right Lateral Decubitus 
+    *  - LLD = Left  Lateral Decubitus 
+    *  - RLO = Right Lateral Oblique 
+    *  - LLO = Left  Lateral Oblique  
+    *  .
+    */
    std::string fourth; 
+
    /// e.g. "Patient's Name"                    
    std::string name;      
-   /// Redundant with (group, element) but we add it
-   /// on efficiency purposes.
-   /**
-    * \ingroup gdcmDictEntry
-    * \brief   Redundant with (group, element) but we add it
-    *          on efficiency purposes. 
-    */            TagKey  key;
+
+   /// Redundant with (group, element) but we add it on efficiency purposes. 
+   TagKey  key;
                      
        // DCMTK has many fields for handling a DictEntry (see below). What are the
        // relevant ones for gdcmlib ?
diff --git a/src/gdcmGlobal.cxx b/src/gdcmGlobal.cxx
new file mode 100644 (file)
index 0000000..7be5abe
--- /dev/null
@@ -0,0 +1,91 @@
+// gdcmGlobal.cxx
+//-----------------------------------------------------------------------------
+#include "gdcmGlobal.h"
+#include "gdcmDebug.h"
+#include <stdio.h>
+#include <ctype.h>   // For isspace
+#include <string.h>  // CLEANME: could this be only string ? Related to Win32 ?
+
+/**
+ * \ingroup Globals
+ * \brief Pointer to a container, holding _all_ the Dicom Dictionaries.
+ */
+gdcmDictSet         *gdcmGlobal::Dicts  = (gdcmDictSet *)0;
+
+/**
+ * \ingroup Globals
+ * \brief   Pointer to a hash table containing the 'Value Representations'.
+ */
+gdcmVR              *gdcmGlobal::VR     = (gdcmVR *)0;
+
+/**
+ * \ingroup Globals
+ * \brief   Pointer to a hash table containing the Transfer Syntax codes
+ *          and their english description 
+ */
+gdcmTS              *gdcmGlobal::TS     = (gdcmTS *)0;
+
+/**
+ * \ingroup Globals
+ * \brief   Pointer to the hash table containing the Dicom Elements
+ *          necessary to describe each part of a DICOMDIR 
+ */
+gdcmDicomDirElement *gdcmGlobal::ddElem = (gdcmDicomDirElement *)0;
+
+/**
+ * \ingroup Globals
+ * \brief   Global container
+ */
+gdcmGlobal gdcmGlob;
+
+/**
+ * \ingroup gdcmGlobal
+ * \brief   constructor : populates the various H Tables
+ */
+gdcmGlobal::gdcmGlobal(void) {
+   if (VR || TS || Dicts || ddElem)
+      dbg.Verbose(0, "gdcmGlobal::gdcmGlobal : VR or TS or Dicts already allocated");
+   Dicts  = new gdcmDictSet();
+   VR     = new gdcmVR();
+   TS     = new gdcmTS();
+   ddElem = new gdcmDicomDirElement();
+}
+
+/**
+ * \ingroup gdcmGlobal
+ * \brief   canonical destructor 
+ */
+gdcmGlobal::~gdcmGlobal() {
+   delete Dicts;
+   delete VR;
+   delete TS;
+   delete ddElem;
+}
+/**
+ * \ingroup gdcmGlobal
+ * \brief   returns a pointer to the 'Value Representation Table' 
+ */
+gdcmVR *gdcmGlobal::GetVR(void) {
+   return VR;
+}
+/**
+ * \ingroup gdcmGlobal
+ * \brief   returns a pointer to the 'Transfert Syntax Table' 
+ */
+gdcmTS *gdcmGlobal::GetTS(void) {
+   return TS;
+}
+/**
+ * \ingroup gdcmGlobal
+ * \brief   returns a pointer to Dictionaries Table 
+ */
+gdcmDictSet *gdcmGlobal::GetDicts(void) {
+   return Dicts;
+}
+/**
+ * \ingroup gdcmGlobal
+ * \brief   returns a pointer to the DicomDir related elements Table 
+ */
+gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements(void) {
+   return ddElem;
+}
diff --git a/src/gdcmGlobal.h b/src/gdcmGlobal.h
new file mode 100644 (file)
index 0000000..e17c8ed
--- /dev/null
@@ -0,0 +1,34 @@
+// gdcmGlobal.h
+//-----------------------------------------------------------------------------
+#ifndef GDCMGLOBAL_H
+#define GDCMGLOBAL_H
+
+#include "gdcmVR.h"
+#include "gdcmTS.h"
+#include "gdcmDictSet.h"
+#include "gdcmDicomDirElement.h"
+
+//-----------------------------------------------------------------------------
+/**
+ * \brief   This class contains all globals elements that might be
+ *          instanciated only once (singletons).
+ */
+class GDCM_EXPORT gdcmGlobal {
+public:
+   gdcmGlobal(void);
+   ~gdcmGlobal();
+
+   static gdcmDictSet *GetDicts(void);
+   static gdcmVR *GetVR(void);
+   static gdcmTS *GetTS(void);
+   static gdcmDicomDirElement *GetDicomDirElements(void);
+
+private:
+   static gdcmDictSet *Dicts; 
+   static gdcmVR *VR;
+   static gdcmTS *TS; 
+   static gdcmDicomDirElement *ddElem;
+};
+
+//-----------------------------------------------------------------------------
+#endif
index f0fdcf33d2e2ba2fdd5d2d878798ad6dd3ab8336..1bbac5c40b1b4c497bf997ebfb930c0aeafe5587 100644 (file)
@@ -6,6 +6,7 @@
 #include <vector>
 
 #include "gdcmHeader.h"
+#include "gdcmGlobal.h"
 #include "gdcmUtil.h"
 #include "gdcmDebug.h"
 #include "gdcmTS.h"
 //-----------------------------------------------------------------------------
 // Constructor / Destructor
 /**
- * \ingroup gdcmHeader
  * \brief  Constructor 
- * @param   InFilename name of the file whose header we want to analyze
- * @param   exception_on_error whether we want to throw an exception or not
- * @param   enable_sequences = true to allow the header 
- *          to be parsed *inside* the SeQuences, 
- *          when they have an actual length 
- * @param   ignore_shadow = true if user wants to skip shadow groups 
- *           during parsing, to save memory space        
+ * @param  InFilename name of the file whose header we want to analyze
+ * @param  exception_on_error whether we want to throw an exception or not
+ * @param  enable_sequences = true to allow the header 
+ *         to be parsed *inside* the SeQuences, when they have an actual length 
+ * @param  ignore_shadow = true if user wants to skip shadow groups 
+ *         during parsing, to save memory space
  */
 gdcmHeader::gdcmHeader(const char *InFilename, 
                        bool exception_on_error,
                        bool enable_sequences, 
-                      bool ignore_shadow):
+                       bool ignore_shadow):
    gdcmParser(InFilename,exception_on_error,enable_sequences,ignore_shadow)
 { 
    
@@ -55,15 +54,14 @@ gdcmHeader::gdcmHeader(const char *InFilename,
          NumPixel = 0x1010;
       else
          NumPixel = 0x0010;
-        
+
       TagKey key = gdcmDictEntry::TranslateToKey(GrPixel, NumPixel);
       countGrPixel = GetEntry().count(key);
 }
 
 /**
- * \ingroup gdcmHeader
  * \brief Constructor  
- * @param   exception_on_error whether we want to throw an exception or not
+ * @param exception_on_error whether we want to throw an exception or not
  */
 gdcmHeader::gdcmHeader(bool exception_on_error) :
    gdcmParser(exception_on_error)
index f4580fdc641ad9d8beeab8dea50efadb2105e019..e8f6146cacba655eb001560fe3db4995eb5aca13 100644 (file)
@@ -8,7 +8,6 @@
 
 //-----------------------------------------------------------------------------
 /**
- * \ingroup gdcmHeader
  * \brief
  * The purpose of an instance of gdcmHeader is to act as a container of
  * all the DICOM elements and their corresponding values (and
@@ -34,8 +33,8 @@ public:
    gdcmHeader(const char *filename, 
               bool  exception_on_error = false, 
               bool  enable_sequences   = false,
-             bool  skip_shadow        = false);
-             
+              bool  skip_shadow        = false);
    virtual ~gdcmHeader();
 
    // Standard values and informations contained in the header
@@ -50,7 +49,7 @@ public:
    bool IsDicomV3(void); 
 
    // Some heuristic based accessors, end user intended 
-   // (to be move to gdcmHeaderHelper?) 
+   // (to be moved to gdcmHeaderHelper?) 
    int GetXSize(void);
    int GetYSize(void);
    int GetZSize(void);
@@ -81,20 +80,15 @@ public:
    // TODO Swig int SetPubDict(std::string filename);
    
 // System access
-/**
- * \ingroup gdcmHeader
- * \brief   the Header Entry Group Number of the 'Pixel Group' 
- *          is not allways 0x7fe0
- * @return  GrPixel
- */
+   /**
+    * \brief   the Header Entry Group Number of the 'Pixel Group' 
+    *          is not allways 0x7fe0
+    * @return  GrPixel
+    */
    guint16 GetGrPixel(void)  {return GrPixel;}
-/**
- * \ingroup gdcmHeader
- * \brief   the Header Entry Element Number of the 'Pixel Element' 
- *          is not allways 0x0010
- * @return  NumPixel
- */
-    guint16 GetNumPixel(void) {return NumPixel;}   
+   
+   /// Accessor to \ref gdcmParser::NumPixel
+   guint16 GetNumPixel(void) {return NumPixel;}
 
 // Entry
 
@@ -125,7 +119,7 @@ public:
    inline virtual void UpdateShaEntries(void)
       { gdcmParser::UpdateShaEntries(); }
 
-// Read (used in gdcmFile)
+   /// Read (used in gdcmFile)
    void SetImageDataSize(size_t ExpectedSize);
 
    bool operator<(gdcmHeader &header);
index cca4311b3d76c89b827cd2a24aa7704da5fb9ade..4ed417243198fd72831d9e68cbb0ade3f7e60271 100644 (file)
@@ -3,6 +3,7 @@
 //
 #include "gdcmHeaderEntry.h"
 #include "gdcmTS.h"
+#include "gdcmGlobal.h"
 #include "gdcmUtil.h"
 
 #ifdef GDCM_NO_ANSI_STRING_STREAM
@@ -24,9 +25,9 @@
  * @param   in Pointer to existing dictionary entry
  */
 gdcmHeaderEntry::gdcmHeaderEntry(gdcmDictEntry* in) {
-       ImplicitVR = false;
-       voidArea = NULL; // unsecure memory area to hold 'non string' values
-       entry = in;
+   ImplicitVR = false;
+   voidArea = NULL; // unsecure memory area to hold 'non string' values
+   entry = in;
 }
 
 //-----------------------------------------------------------------------------
@@ -84,7 +85,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
 
    if (printLevel>=1) {      
       s.setf(std::ios::left);
-      s << std::setw(66-GetName().length()) << " ";             
+      s << std::setw(66-GetName().length()) << " ";
    }
     
    s << "[" << GetName()<< "]";
@@ -122,7 +123,7 @@ void gdcmHeaderEntry::Print(std::ostream & os) {
    if ( (vr == "UL") || (vr == "US") || (vr == "SL") || (vr == "SS") ) {
       if (v == "4294967295") // to avoid troubles in convertion 
          sprintf (st," x(ffffffff)");
-      else     
+      else
          sprintf(st," x(%x)",(unsigned long)atof(v.c_str()));
       s << st;
    }
index cef909778526d8736e2b2191156d384a8fb22e63..72b41f234af01fe6104e633e663fe1f39f567c19 100644 (file)
@@ -1,7 +1,7 @@
 // gdcmObject.cxx
 //-----------------------------------------------------------------------------
 #include "gdcmObject.h"
-#include "gdcmUtil.h"
+#include "gdcmGlobal.h"
 #include "gdcmDebug.h"
 
 //-----------------------------------------------------------------------------
@@ -47,7 +47,7 @@ void gdcmObject::Print(std::ostream &os) {
       for(i=beginObj;;++i) {
          (*i)->SetPrintLevel(printLevel);
          (*i)->Print(os);
-        if (i == endObj) break;
+         if (i == endObj) break;
       }
    }
 }
index 871c8086f4b78cfcf61dd3f1380ba04d0343983d..b02949c667a4b94d3928ddf78de92b047eecf889 100644 (file)
@@ -19,6 +19,7 @@
 #  include <iomanip>
 
 #include "gdcmParser.h"
+#include "gdcmGlobal.h"
 #include "gdcmUtil.h"
 #include "gdcmDebug.h"
 
 #define UI1_2_840_10008_1_2_2    "1.2.840.10008.1.2.2"
 #define UI1_2_840_10008_1_2_1_99 "1.2.840.10008.1.2.1.99"
 
-   // Fourth semantics:
-   //
-   // ---> Warning : This fourth field is NOT part 
-   //                of the 'official' Dicom Dictionnary
-   //                and should NOT be used.
-   //                (Not defined for all the groups
-   //                 may be removed in a future release)
-   //
-   // CMD      Command        
-   // META     Meta Information 
-   // DIR      Directory
-   // ID
-   // PAT      Patient
-   // ACQ      Acquisition
-   // REL      Related
-   // IMG      Image
-   // SDY      Study
-   // VIS      Visit 
-   // WAV      Waveform
-   // PRC
-   // DEV      Device
-   // NMI      Nuclear Medicine
-   // MED
-   // BFS      Basic Film Session
-   // BFB      Basic Film Box
-   // BIB      Basic Image Box
-   // BAB
-   // IOB
-   // PJ
-   // PRINTER
-   // RT       Radio Therapy
-   // DVH   
-   // SSET
-   // RES      Results
-   // CRV      Curve
-   // OLY      Overlays
-   // PXL      Pixels
-   // DL       Delimiters
-   //
-
-   // Other usefull abreviations :
-   // Radiographic view associated with Patient Position (0018,5100).
-   // Defined Terms:
-   // 
-   //  AP = Anterior/Posterior 
-   //  PA = Posterior/Anterior 
-   //  LL = Left Lateral 
-   //  RL = Right Lateral 
-   //  RLD = Right Lateral Decubitus 
-   //  LLD  = Left Lateral Decubitus 
-   //  RLO = Right Lateral Oblique 
-   //  LLO = Left Lateral Oblique  
-
 //-----------------------------------------------------------------------------
 // Refer to gdcmParser::CheckSwap()
 const unsigned int gdcmParser::HEADER_LENGTH_TO_READ = 256;
@@ -95,23 +43,22 @@ const unsigned int gdcmParser::MAX_SIZE_PRINT_ELEMENT_VALUE = 64;
 // Constructor / Destructor
 
 /**
- * \ingroup gdcmParser
- * \brief constructor  
+ * \brief   constructor  
  * @param   inFilename
  * @param   exception_on_error whether we throw an exception or not
  * @param   enable_sequences = true to allow the header 
  *          to be parsed *inside* the SeQuences, 
  *          when they have an actual length 
- * @param ignore_shadow to allow skipping the shadow elements, 
- *           to save memory space.
- * \warning  The TRUE value for this param has to be used 
- *          with a FALSE value for the 'enable_sequence' param.
- *          ('public elements' may be embedded in 'shadow Sequences')
+ * @param   ignore_shadow to allow skipping the shadow elements, 
+ *          to save memory space.
+ * \warning The TRUE value for this param has to be used 
+ *          with a FALSE value for the 'enable_sequence' param.
+ *          ('public elements' may be embedded in 'shadow Sequences')
  */
 gdcmParser::gdcmParser(const char *inFilename, 
                        bool exception_on_error,
                        bool enable_sequences,
-                      bool ignore_shadow) {
+                       bool ignore_shadow) {
    enableSequences=enable_sequences;
    ignoreShadow   =ignore_shadow;
    
index c9f39666b5443a7a083f2e0fbe24186f21359a35..74ef05261d0ded042a8c532a2ca2dbad132e8578 100644 (file)
@@ -29,7 +29,6 @@ typedef std::map<GroupKey, int> GroupHT;
 
 //-----------------------------------------------------------------------------
 /**
- * \ingroup gdcmParser
  * \brief used by both gdcmHeader and gdcmDicomDir
  */
 class GDCM_EXPORT gdcmParser
@@ -211,9 +210,11 @@ protected:
    */   
    guint16 GrPixel;
    
-   /** 
-   * \brief For some ACR-NEMA images, it's *not* 0010 ... 
-   */    
+   /// In some cases (e.g. for some ACR-NEMA images) the Header Entry Element
+   /// Number of the 'Pixel Element' is *not* found at 0x0010. In order to
+   /// make things easier the parser shall store the proper value in
+   /// NumPixel to provide a unique access facility. See also
+   /// \ref gdcmHeader::gdcmHeader
    guint16 NumPixel;
    /**
    * \brief some files may contain icons; GrPixel,NumPixel appears several times
index 9b8bf11b8dec7861b40cbf771b511b79985b1e9c..c2e169ddb1563bb2f5fcb9288b6ff0c38340e395 100644 (file)
@@ -6,98 +6,6 @@
 #include <ctype.h>   // For isspace
 #include <string.h>  // CLEANME: could this be only string ? Related to Win32 ?
 
-/**
- * \ingroup Globals
- * \brief Pointer to a container, holding _all_ the Dicom Dictionaries.
- */
-gdcmDictSet         *gdcmGlobal::Dicts  = (gdcmDictSet *)0;
-
-/**
- * \ingroup Globals
- * \brief   Pointer to a hash table containing the 'Value Representations'.
- */
-gdcmVR              *gdcmGlobal::VR     = (gdcmVR *)0;
-
-/**
- * \ingroup Globals
- * \brief   Pointer to a hash table containing the Transfer Syntax codes
- *          and their english description 
- */
-gdcmTS              *gdcmGlobal::TS     = (gdcmTS *)0;
-
-/**
- * \ingroup Globals
- * \brief   Pointer to the hash table containing the Dicom Elements
- *          necessary to describe each part of a DICOMDIR 
- */
-gdcmDicomDirElement *gdcmGlobal::ddElem = (gdcmDicomDirElement *)0;
-
-/**
- * \ingroup Globals
- * \brief   Global container
- */
-gdcmGlobal gdcmGlob;
-
-/**
- * \ingroup gdcmGlobal
- * \brief   constructor : populates the various H Tables
- */
-gdcmGlobal::gdcmGlobal(void) {
-   if (VR || TS || Dicts || ddElem)
-      dbg.Verbose(0, "gdcmGlobal::gdcmGlobal : VR or TS or Dicts already allocated");
-   Dicts  = new gdcmDictSet();
-   VR     = new gdcmVR();
-   TS     = new gdcmTS();
-   ddElem = new gdcmDicomDirElement();
-}
-
-/**
- * \ingroup gdcmGlobal
- * \brief   canonical destructor 
- */
-gdcmGlobal::~gdcmGlobal() {
-   delete Dicts;
-   delete VR;
-   delete TS;
-   delete ddElem;
-}
-/**
- * \ingroup gdcmGlobal
- * \brief   returns a pointer to the 'Value Representation Table' 
- */
-gdcmVR *gdcmGlobal::GetVR(void) {
-   return VR;
-}
-/**
- * \ingroup gdcmGlobal
- * \brief   returns a pointer to the 'Transfert Syntax Table' 
- */
-gdcmTS *gdcmGlobal::GetTS(void) {
-   return TS;
-}
-/**
- * \ingroup gdcmGlobal
- * \brief   returns a pointer to Dictionaries Table 
- */
-gdcmDictSet *gdcmGlobal::GetDicts(void) {
-   return Dicts;
-}
-/**
- * \ingroup gdcmGlobal
- * \brief   returns a pointer to the DicomDir related elements Table 
- */
-gdcmDicomDirElement *gdcmGlobal::GetDicomDirElements(void) {
-   return ddElem;
-}
-
-/**
- * \defgroup Globals Utility functions
- * \brief    Here are some utility functions, belonging to NO class,
- *           dealing with strings, file names... that can be called
- *           from anywhere by whomsoever they can help.
- */
-
-
 /**
  * \ingroup Globals
  * \brief   Because is not yet available in g++2.96
index ac624c87de93b162e8035b12da30046a287ee1ba..b77fcb249740095ec16aa0355d568875fb43ef87 100644 (file)
@@ -3,36 +3,15 @@
 #ifndef GDCMUTIL_H
 #define GDCMUTIL_H
 
-#include "gdcmCommon.h"
-#include "gdcmVR.h"
-#include "gdcmTS.h"
-#include "gdcmDictSet.h"
-#include "gdcmDicomDirElement.h"
 #include <vector>
 #include <string>
 
-//-----------------------------------------------------------------------------
 /**
- * \ingroup gdcmGlobal
- * \brief   This class contains all globals elements that might be
- *          instanciated only once (singletons).
+ * \defgroup Globals Utility functions
+ * \brief    Here are some utility functions, belonging to NO class,
+ *           dealing with strings, file names... that can be called
+ *           from anywhere by whomsoever they can help.
  */
-class GDCM_EXPORT gdcmGlobal {
-public:
-   gdcmGlobal(void);
-   ~gdcmGlobal();
-
-   static gdcmDictSet *GetDicts(void);
-   static gdcmVR *GetVR(void);
-   static gdcmTS *GetTS(void);
-   static gdcmDicomDirElement *GetDicomDirElements(void);
-
-private:
-   static gdcmDictSet *Dicts; 
-   static gdcmVR *VR;
-   static gdcmTS *TS; 
-   static gdcmDicomDirElement *ddElem;
-};
 
 //-----------------------------------------------------------------------------
 std::istream & eatwhite(std::istream & is);
@@ -45,4 +24,5 @@ std::string CreateCleanString(std::string s);
 void        NormalizePath(std::string &name);
 std::string GetPath(std::string &fullName);
 std::string GetName(std::string &fullName);
+//-----------------------------------------------------------------------------
 #endif
index fd4f985813e326920a978a878804bc0b1490153e..536aea3695acd93c8094f62f478bc1e74642b408 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "gdcmVR.h"
 #include "gdcmUtil.h"
+#include "gdcmDictSet.h"
 #include "gdcmDebug.h"
 
 #ifndef PUB_DICT_PATH
@@ -20,7 +21,9 @@
 #define DICT_VR "dicomVR.dic"
 
 //-----------------------------------------------------------------------------
-// Constructor / Destructor
+/**
+ * \brief Constructor
+ */
 gdcmVR::gdcmVR(void) 
 {
    std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_VR);
@@ -51,6 +54,9 @@ gdcmVR::gdcmVR(void)
    from.close();
 }
 
+/**
+ * \brief Destructor
+ */
 gdcmVR::~gdcmVR() {
    vr.clear();
 }
index 2afbd82e8e87745f1c6cf9abf7d2fa8e479439a3..c94c85864d1d8f33d3ff75dcfcc8a5174cb788d2 100644 (file)
@@ -160,6 +160,10 @@ SOURCE=..\gdcmFile.cxx
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmGlobal.cxx\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmHeader.cxx\r
 # End Source File\r
 # Begin Source File\r
@@ -280,6 +284,10 @@ SOURCE=..\gdcmFile.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\gdcmGlobal.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\gdcmHeader.h\r
 # End Source File\r
 # Begin Source File\r