From: frog Date: Sat, 27 Mar 2004 18:41:48 +0000 (+0000) Subject: * src/gdcmUtil.[cxx|h] split in two. Additional file gdcmGlobal.[cxx|h] X-Git-Tag: Version0.5.bp~274 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=1bc5ccd72098866fc29ca8a786e8bb6852f388ea;p=gdcm.git * 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. --- diff --git a/ChangeLog b/ChangeLog index 7c1bf89b..f064cfdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-03-27 Eric Boix + * 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 * src/gdcmUtil.[cxx|h] split in two. Additional file gdcmDebug.[cxx|h] now contains all the Debug related code. diff --git a/gdcmPython/gdcm.i b/gdcmPython/gdcm.i index d2677998..0e21e5b8 100644 --- a/gdcmPython/gdcm.i +++ b/gdcmPython/gdcm.i @@ -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" diff --git a/src/Makefile.am b/src/Makefile.am index 3a0be1cb..8b4d3a1b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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 \ diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index 4af17855..48ddeb5c 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -18,6 +18,7 @@ #include "gdcmDirList.h" #include "gdcmUtil.h" #include "gdcmDebug.h" +#include "gdcmGlobal.h" //----------------------------------------------------------------------------- // For full DICOMDIR description, see: @@ -27,11 +28,10 @@ // 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); diff --git a/src/gdcmDicomDirElement.cxx b/src/gdcmDicomDirElement.cxx index be6ce165..a8309d84 100644 --- a/src/gdcmDicomDirElement.cxx +++ b/src/gdcmDicomDirElement.cxx @@ -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/" diff --git a/src/gdcmDicomDirPatient.cxx b/src/gdcmDicomDirPatient.cxx index 57358bbf..50f80ddc 100644 --- a/src/gdcmDicomDirPatient.cxx +++ b/src/gdcmDicomDirPatient.cxx @@ -2,7 +2,7 @@ //----------------------------------------------------------------------------- #include "gdcmDicomDirPatient.h" #include "gdcmDicomDirElement.h" -#include "gdcmUtil.h" +#include "gdcmGlobal.h" //----------------------------------------------------------------------------- // Constructor / Destructor diff --git a/src/gdcmDicomDirSerie.cxx b/src/gdcmDicomDirSerie.cxx index e805e27e..1272df3c 100644 --- a/src/gdcmDicomDirSerie.cxx +++ b/src/gdcmDicomDirSerie.cxx @@ -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) @@ -22,14 +21,13 @@ */ 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) { diff --git a/src/gdcmDicomDirStudy.cxx b/src/gdcmDicomDirStudy.cxx index a2cf5859..f6509abb 100644 --- a/src/gdcmDicomDirStudy.cxx +++ b/src/gdcmDicomDirStudy.cxx @@ -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) { } diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index b5bdea34..fd3e990c 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -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()); diff --git a/src/gdcmDictEntry.h b/src/gdcmDictEntry.h index 5828bfd7..affbd53d 100644 --- a/src/gdcmDictEntry.h +++ b/src/gdcmDictEntry.h @@ -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 index 00000000..7be5abe6 --- /dev/null +++ b/src/gdcmGlobal.cxx @@ -0,0 +1,91 @@ +// gdcmGlobal.cxx +//----------------------------------------------------------------------------- +#include "gdcmGlobal.h" +#include "gdcmDebug.h" +#include +#include // For isspace +#include // 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 index 00000000..e17c8ed5 --- /dev/null +++ b/src/gdcmGlobal.h @@ -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 diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index f0fdcf33..1bbac5c4 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -6,6 +6,7 @@ #include #include "gdcmHeader.h" +#include "gdcmGlobal.h" #include "gdcmUtil.h" #include "gdcmDebug.h" #include "gdcmTS.h" @@ -13,20 +14,18 @@ //----------------------------------------------------------------------------- // 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) diff --git a/src/gdcmHeader.h b/src/gdcmHeader.h index f4580fdc..e8f6146c 100644 --- a/src/gdcmHeader.h +++ b/src/gdcmHeader.h @@ -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); diff --git a/src/gdcmHeaderEntry.cxx b/src/gdcmHeaderEntry.cxx index cca4311b..4ed41724 100644 --- a/src/gdcmHeaderEntry.cxx +++ b/src/gdcmHeaderEntry.cxx @@ -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; } diff --git a/src/gdcmObject.cxx b/src/gdcmObject.cxx index cef90977..72b41f23 100644 --- a/src/gdcmObject.cxx +++ b/src/gdcmObject.cxx @@ -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; } } } diff --git a/src/gdcmParser.cxx b/src/gdcmParser.cxx index 871c8086..b02949c6 100644 --- a/src/gdcmParser.cxx +++ b/src/gdcmParser.cxx @@ -19,6 +19,7 @@ # include #include "gdcmParser.h" +#include "gdcmGlobal.h" #include "gdcmUtil.h" #include "gdcmDebug.h" @@ -27,59 +28,6 @@ #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; diff --git a/src/gdcmParser.h b/src/gdcmParser.h index c9f39666..74ef0526 100644 --- a/src/gdcmParser.h +++ b/src/gdcmParser.h @@ -29,7 +29,6 @@ typedef std::map 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 diff --git a/src/gdcmUtil.cxx b/src/gdcmUtil.cxx index 9b8bf11b..c2e169dd 100644 --- a/src/gdcmUtil.cxx +++ b/src/gdcmUtil.cxx @@ -6,98 +6,6 @@ #include // For isspace #include // 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 diff --git a/src/gdcmUtil.h b/src/gdcmUtil.h index ac624c87..b77fcb24 100644 --- a/src/gdcmUtil.h +++ b/src/gdcmUtil.h @@ -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 #include -//----------------------------------------------------------------------------- /** - * \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 diff --git a/src/gdcmVR.cxx b/src/gdcmVR.cxx index fd4f9858..536aea36 100644 --- a/src/gdcmVR.cxx +++ b/src/gdcmVR.cxx @@ -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(); } diff --git a/src/win32/gdcmdll.dsp b/src/win32/gdcmdll.dsp index 2afbd82e..c94c8586 100644 --- a/src/win32/gdcmdll.dsp +++ b/src/win32/gdcmdll.dsp @@ -160,6 +160,10 @@ SOURCE=..\gdcmFile.cxx # End Source File # Begin Source File +SOURCE=..\gdcmGlobal.cxx +# End Source File +# Begin Source File + SOURCE=..\gdcmHeader.cxx # End Source File # Begin Source File @@ -280,6 +284,10 @@ SOURCE=..\gdcmFile.h # End Source File # Begin Source File +SOURCE=..\gdcmGlobal.h +# End Source File +# Begin Source File + SOURCE=..\gdcmHeader.h # End Source File # Begin Source File