From: frog Date: Fri, 2 Jul 2004 13:55:26 +0000 (+0000) Subject: - guint16 and guint32 removed. Use ISO C uint16_t, uint32_t instead. X-Git-Tag: Version0.5.bp~62 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=e40fc77cef3155aab87305ce2f8f14d1acbf158f;p=gdcm.git - guint16 and guint32 removed. Use ISO C uint16_t, uint32_t instead. - TagKey renamed to gdcmTagKey (for external usage) - VRKey renamed to gdcmVRKey (for external usage) - removal of typedef duplication. - Removed all unecessary inline keyword from class inline definitions. - Some method|function(void) declarations replaced with method|function(). --- diff --git a/ChangeLog b/ChangeLog index 680d67ad..aaeef5af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,11 @@ 2004-07-02 Eric Boix + * src/*.[h|cxx] : typedef clean up + - guint16 and guint32 removed. Use ISO C uint16_t, uint32_t instead. + - TagKey renamed to gdcmTagKey (for external usage) + - VRKey renamed to gdcmVRKey (for external usage) + - removal of typedef duplication. + - Removed all unecessary inline keyword from class inline definitions. + - Some method|function(void) declarations replaced with method|function(). * src/jpeg/libijg12/jdhuff12.c: - printf polluting ctest removed. - TAB removal for comminting diff --git a/src/gdcmBinEntry.h b/src/gdcmBinEntry.h index 53bf158a..8db65681 100644 --- a/src/gdcmBinEntry.h +++ b/src/gdcmBinEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmBinEntry.h,v $ Language: C++ - Date: $Date: 2004/06/23 13:02:36 $ - Version: $Revision: 1.11 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.12 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -45,10 +45,10 @@ public: /// \brief Returns the area value of the current Dicom Header Entry /// when it's not string-translatable (e.g : a LUT table) - inline void * GetVoidArea(void) { return voidArea; }; + void* GetVoidArea(void) { return voidArea; }; /// \brief Sets the value (non string) of the current Dicom Header Entry - inline void SetVoidArea(void * area) { voidArea = area; }; + void SetVoidArea(void * area) { voidArea = area; }; protected: diff --git a/src/gdcmCommon.h b/src/gdcmCommon.h index 2eaca042..384aa738 100644 --- a/src/gdcmCommon.h +++ b/src/gdcmCommon.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmCommon.h,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.27 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -47,25 +47,17 @@ //----------------------------------------------------------------------------- #ifdef __GNUC__ #ifndef HAVE_NO_STDINT_H -#include -#define guint16 uint16_t -#define guint32 uint32_t -#define gint16 int16_t -#define gint32 int32_t +#include // For uint16_t and uint32_t #else -typedef unsigned short guint16; -typedef unsigned int guint32; -typedef short gint16; -typedef int gint32; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; #define UINT32_MAX (4294967295U) #endif //HAVE_NO_STDINT_H #endif #ifdef _MSC_VER -typedef unsigned short guint16; -typedef unsigned int guint32; -typedef short gint16; -typedef int gint32; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; #define UINT32_MAX (4294967295U) #endif @@ -99,7 +91,7 @@ typedef int gint32; const std::string GDCM_UNFOUND = "gdcm::Unfound"; /// MEMORY LEAK -typedef std::string TagKey; +typedef std::string gdcmTagKey; typedef std::string TagName; enum FileType { diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index 2b07c9b9..37bdf0ef 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2004/06/28 14:29:52 $ - Version: $Revision: 1.54 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.55 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -452,8 +452,8 @@ void gdcmDicomDir::CreateDicomDirChainedList(std::string path) * \brief adds *the* Meta to a partially created DICOMDIR */ - // FIXME : Heuuuuu ! Il prend les Entries du Document deja parse, - // il ne fabrique rien ! + /// \todo FIXME : Heuuuuu ! Il prend les Entries du Document deja parse, + /// il ne fabrique rien ! gdcmDicomDirMeta * gdcmDicomDir::NewMeta(void) { gdcmDicomDirMeta *m = new gdcmDicomDirMeta(&tagHT); @@ -465,13 +465,12 @@ gdcmDicomDirMeta * gdcmDicomDir::NewMeta(void) { /** - * \ingroup gdcmDicomDir * \brief adds a new Patient (with the basic elements) to a partially created DICOMDIR */ gdcmDicomDirPatient * gdcmDicomDir::NewPatient(void) { std::list elemList; std::list::iterator it; - guint16 tmpGr,tmpEl; + uint16_t tmpGr,tmpEl; gdcmDictEntry *dictEntry; gdcmValEntry *entry; @@ -479,7 +478,7 @@ gdcmDicomDirPatient * gdcmDicomDir::NewPatient(void) { elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements(); - // TODO : use FillObject !!! + /// \todo TODO : use FillObject !!! // for all the DicomDirPatient Elements @@ -535,7 +534,7 @@ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type, { std::list elemList; std::list::iterator it; - guint16 tmpGr, tmpEl; + uint16_t tmpGr, tmpEl; gdcmDictEntry *dictEntry; gdcmValEntry *entry; std::string val; @@ -935,37 +934,35 @@ bool gdcmDicomDir::HeaderLessThan(gdcmDocument *header1,gdcmDocument *header2) } /** - * \ingroup gdcmDicomDir * \brief Sets the accurate value for the (0x0004,0x1220) element of a DICOMDIR */ void gdcmDicomDir::UpdateDirectoryRecordSequenceLength() { -// FIXME : to go on compiling - -// to be re written ! -/* - int offset = 0; - ListTag::iterator it; - guint16 gr, el; - std::string vr; - for(it=listEntries.begin();it!=listEntries.end();++it) { - gr = (*it)->GetGroup(); - el = (*it)->GetElement(); - vr = (*it)->GetVR(); - if (gr !=0xfffe) { - if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") ) { - offset += 4; // explicit VR AND OB, OW, SQ : 4 more bytes - } - offset += 2 + 2 + 4 + (*it)->GetLength(); - } else { - offset += 4; // delimiters don't have a value. - } - } - //bool res=SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps. - SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps. - return; - */ +/// \todo FIXME : to go on compiling +/// +/// to be re written ! +/// int offset = 0; +/// ListTag::iterator it; +/// uint16_t gr, el; +/// std::string vr; +/// for(it=listEntries.begin();it!=listEntries.end();++it) { +/// gr = (*it)->GetGroup(); +/// el = (*it)->GetElement(); +/// vr = (*it)->GetVR(); +/// if (gr !=0xfffe) { +/// if ( (vr == "OB") || (vr == "OW") || (vr == "SQ") ) { +/// offset += 4; // explicit VR AND OB, OW, SQ : 4 more bytes +/// } +/// offset += 2 + 2 + 4 + (*it)->GetLength(); +/// } else { +/// offset += 4; // delimiters don't have a value. +/// } +/// } +/// //bool res=SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps. +/// SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps. +/// return; +/// } //----------------------------------------------------------------------------- diff --git a/src/gdcmDicomDir.h b/src/gdcmDicomDir.h index 98ee8ac4..eef34e48 100644 --- a/src/gdcmDicomDir.h +++ b/src/gdcmDicomDir.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.h,v $ Language: C++ - Date: $Date: 2004/06/19 23:51:03 $ - Version: $Revision: 1.22 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.23 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -29,8 +29,8 @@ #include //----------------------------------------------------------------------------- -typedef std::list ListDicomDirPatient; -typedef std::vector VectDocument; +typedef std::list ListDicomDirPatient; +typedef std::vector VectDocument; typedef GDCM_EXPORT void(gdcmMethod)(void * = NULL); //----------------------------------------------------------------------------- @@ -43,8 +43,6 @@ typedef GDCM_EXPORT void(gdcmMethod)(void * = NULL); class GDCM_EXPORT gdcmDicomDir: public gdcmDocument { public: -// gdcmDicomDir(ListTag *l, -// bool exception_on_error = false); gdcmDicomDir(const char *FileName, bool parseDir = false, bool exception_on_error = false); @@ -52,30 +50,23 @@ public: ~gdcmDicomDir(void); - /** - * \ingroup gdcmDicomDir - * \brief Sets the print level for the Dicom Header - * \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy - */ + /// \brief Sets the print level for the Dicom Header + /// \note 0 for Light Print; 1 for 'medium' Print, 2 for Heavy void SetPrintLevel(int level) { printLevel = level; }; - /** - * \ingroup gdcmDicomDir - * \brief canonical Printer - * \sa SetPrintLevel - */ + + /// \brief canonical Printer + /// \sa SetPrintLevel virtual void Print(std::ostream &os = std::cout); // Informations contained in the parser virtual bool IsReadable(void); -/// \brief returns a pointer to the gdcmDicomDirMeta for this DICOMDIR. - inline gdcmDicomDirMeta *GetDicomDirMeta() - {return metaElems;}; + /// Returns a pointer to the gdcmDicomDirMeta for this DICOMDIR. + gdcmDicomDirMeta* GetDicomDirMeta() { return metaElems; }; - /// \brief returns the PATIENT chained List for this DICOMDIR. - inline ListDicomDirPatient &GetDicomDirPatients() - {return patients;}; + /// Returns the PATIENT chained List for this DICOMDIR. + ListDicomDirPatient &GetDicomDirPatients() { return patients; }; // Parsing void ParseDirectory(void); @@ -87,27 +78,24 @@ public: void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL); void SetEndMethodArgDelete(gdcmMethod *); -/// \brief GetProgress GetProgress - inline float GetProgress(void) - {return(progress);}; + /// GetProgress GetProgress + float GetProgress(void) { return(progress); }; -/// \brief AbortProgress AbortProgress - inline void AbortProgress(void) - {abort=true; }; + /// AbortProgress AbortProgress + void AbortProgress(void) {abort=true; }; -/// \brief IsAborted IsAborted - inline bool IsAborted(void) - {return(abort); }; + /// IsAborted IsAborted + bool IsAborted(void) {return(abort); }; // Adding - gdcmDicomDirMeta * NewMeta(void); - gdcmDicomDirPatient * NewPatient(void); + gdcmDicomDirMeta* NewMeta(void); + gdcmDicomDirPatient* NewPatient(void); // Write void WriteEntries(FILE *_fp); bool Write(std::string fileName); -/// Types of the gdcmObject within the gdcmDicomDir + /// Types of the gdcmObject within the gdcmDicomDir typedef enum { GDCM_DICOMDIR_NONE, @@ -120,7 +108,6 @@ public: protected: void CreateDicomDirChainedList(std::string path); - void CallStartMethod(void); void CallProgressMethod(void); void CallEndMethod(void); @@ -128,7 +115,6 @@ protected: private: void Initialize(void); void CreateDicomDir(void); -// void AddObjectToEnd(gdcmDicomDirType type, gdcmSQItem *s); void AddDicomDirMeta (); void AddDicomDirPatientToEnd(gdcmSQItem *s); void AddDicomDirStudyToEnd (gdcmSQItem *s); @@ -145,10 +131,10 @@ private: // Variables -/// \brief pointer on *the* gdcmObject 'DicomDirMeta Elements' + /// Pointer on *the* gdcmObject 'DicomDirMeta Elements' gdcmDicomDirMeta *metaElems; -/// \brief chained list of DicomDirPatient (to be exploited recursively) + /// Chained list of DicomDirPatient (to be exploited recursively) ListDicomDirPatient patients; /// pointer to the initialisation method for any progress bar diff --git a/src/gdcmDicomDirPatient.h b/src/gdcmDicomDirPatient.h index cbd99e4a..ad11f96f 100644 --- a/src/gdcmDicomDirPatient.h +++ b/src/gdcmDicomDirPatient.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirPatient.h,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.4 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -23,7 +23,7 @@ #include "gdcmDicomDirStudy.h" #include "gdcmSQItem.h" //----------------------------------------------------------------------------- -typedef std::list ListDicomDirStudy; +typedef std::list ListDicomDirStudy; //----------------------------------------------------------------------------- class GDCM_EXPORT gdcmDicomDirPatient : public gdcmObject @@ -35,29 +35,19 @@ public: ~gdcmDicomDirPatient(void); virtual void Print(std::ostream &os = std::cout); -/** - * \ingroup gdcmDicomDirPatient - * \brief returns the STUDY chained List for this PATIENT. - */ - inline ListDicomDirStudy &GetDicomDirStudies() - {return studies;}; -/** - * \ingroup gdcmDicomDirPatient - * \brief adds the passed STUDY to the STUDY chained List for this PATIENT. - */ - inline void AddDicomDirStudy(gdcmDicomDirStudy *obj) - {studies.push_back(obj);}; -/** - * \ingroup gdcmDicomDirPatient - * \brief TODO - */ + + /// Returns the STUDY chained List for this PATIENT. + ListDicomDirStudy &GetDicomDirStudies() { return studies; }; + + /// adds the passed STUDY to the STUDY chained List for this PATIENT. + void AddDicomDirStudy(gdcmDicomDirStudy *obj) { studies.push_back(obj); }; + + /// TODO gdcmDicomDirStudy* NewStudy(void); private: -/** -* \brief chained list of DicomDirStudy -*/ + /// chained list of DicomDirStudy ListDicomDirStudy studies; }; diff --git a/src/gdcmDicomDirSerie.h b/src/gdcmDicomDirSerie.h index f96f18bf..acde92f4 100644 --- a/src/gdcmDicomDirSerie.h +++ b/src/gdcmDicomDirSerie.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirSerie.h,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.4 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -38,13 +38,13 @@ public: * \ingroup gdcmDicomDirSerie * \brief returns the IMAGE chained List for this SERIE. */ - inline ListDicomDirImage &GetDicomDirImages() + ListDicomDirImage &GetDicomDirImages() {return images;}; /** * \ingroup gdcmDicomDirSerie * \brief adds the passed IMAGE to the IMAGE chained List for this SERIE. */ - inline void AddDicomDirImage(gdcmDicomDirImage *obj) + void AddDicomDirImage(gdcmDicomDirImage *obj) {images.push_back(obj);}; /** diff --git a/src/gdcmDicomDirStudy.h b/src/gdcmDicomDirStudy.h index 26c7834f..0dbd781f 100644 --- a/src/gdcmDicomDirStudy.h +++ b/src/gdcmDicomDirStudy.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDirStudy.h,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.4 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.5 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -38,13 +38,13 @@ public: * \ingroup gdcmDicomDirStudy * \brief returns the SERIE chained List for this STUDY. */ - inline ListDicomDirSerie &GetDicomDirSeries() + ListDicomDirSerie &GetDicomDirSeries() {return series;}; /** * \ingroup gdcmDicomDirStudy * \brief adds the passed SERIE to the SERIE chained List for this STUDY. */ - inline void AddDicomDirSerie(gdcmDicomDirSerie *obj) + void AddDicomDirSerie(gdcmDicomDirSerie *obj) {series.push_back(obj);}; /** diff --git a/src/gdcmDict.cxx b/src/gdcmDict.cxx index b8ed20ab..6b2efbec 100644 --- a/src/gdcmDict.cxx +++ b/src/gdcmDict.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDict.cxx,v $ Language: C++ - Date: $Date: 2004/06/22 13:47:33 $ - Version: $Revision: 1.37 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.38 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -31,7 +31,8 @@ * @param FileName from which to build the dictionary. */ gdcmDict::gdcmDict(std::string & FileName) { - guint16 group, element; + uint16_t group; + uint16_t element; //char buff[1024]; TagName vr; TagName fourth; @@ -47,7 +48,7 @@ gdcmDict::gdcmDict(std::string & FileName) { from >> element; from >> vr; from >> fourth; - eatwhite(from); + eatwhite(from); getline(from, name); /// MEMORY LEAK in std::getline<> gdcmDictEntry * newEntry = new gdcmDictEntry(group, element, @@ -63,7 +64,8 @@ gdcmDict::gdcmDict(std::string & FileName) { * \brief Destructor */ gdcmDict::~gdcmDict() { - for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) { + for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) + { gdcmDictEntry* EntryToDelete = tag->second; if ( EntryToDelete ) delete EntryToDelete; @@ -92,13 +94,16 @@ void gdcmDict::Print(std::ostream &os) { * Entries will be sorted by tag i.e. the couple (group, element). * @param os The output stream to be written to. */ -void gdcmDict::PrintByKey(std::ostream &os) { +void gdcmDict::PrintByKey(std::ostream &os) +{ std::ostringstream s; - for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag){ + for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) + { s << "Entry : "; s << "(" << std::hex << std::setw(4) << tag->second->GetGroup() << ','; - s << std::hex << std::setw(4) << tag->second->GetElement() << ") = " << std::dec; + s << std::hex << std::setw(4) << tag->second->GetElement() << ") = " + << std::dec; s << tag->second->GetVR() << ", "; s << tag->second->GetFourth() << ", "; s << tag->second->GetName() << "." << std::endl; @@ -138,7 +143,7 @@ void gdcmDict::PrintByName(std::ostream& os) { */ bool gdcmDict::AddNewEntry(gdcmDictEntry *NewEntry) { - TagKey key; + gdcmTagKey key; key = NewEntry->GetKey(); if(KeyHt.count(key) == 1) @@ -177,7 +182,7 @@ bool gdcmDict::ReplaceEntry(gdcmDictEntry *NewEntry) { * @param key (group|element) * @return false if Dicom Dictionary Entry doesn't exist */ -bool gdcmDict::RemoveEntry(TagKey key) +bool gdcmDict::RemoveEntry(gdcmTagKey key) { if(KeyHt.count(key) == 1) { @@ -200,19 +205,18 @@ bool gdcmDict::RemoveEntry(TagKey key) } /** - * \ingroup gdcmDict * \brief removes an already existing Dicom Dictionary Entry, * identified by its group,element number * @param group Dicom group number of the Dicom Element * @param element Dicom element number of the Dicom Element * @return false if Dicom Dictionary Entry doesn't exist */ -bool gdcmDict::RemoveEntry (guint16 group, guint16 element) { - return( RemoveEntry(gdcmDictEntry::TranslateToKey(group, element)) ); +bool gdcmDict::RemoveEntry (uint16_t group, uint16_t element) +{ + return( RemoveEntry(gdcmDictEntry::TranslateToKey(group, element)) ); } /** - * \ingroup gdcmDict * \brief Get the dictionnary entry identified by it's name. * @param name element of the ElVal to modify * \warning : NEVER use it ! @@ -220,34 +224,33 @@ bool gdcmDict::RemoveEntry (guint16 group, guint16 element) { * the name MAY CHANGE between two versions ! * @return the corresponding dictionnary entry when existing, NULL otherwise */ -gdcmDictEntry *gdcmDict::GetDictEntryByName(TagName name) { +gdcmDictEntry* gdcmDict::GetDictEntryByName(TagName name) { if ( ! NameHt.count(name)) return NULL; return NameHt.find(name)->second; } /** - * \ingroup gdcmDict * \brief Get the dictionnary entry identified by a given tag (group,element) * @param group group of the entry to be found * @param element element of the entry to be found * @return the corresponding dictionnary entry when existing, NULL otherwise */ -gdcmDictEntry *gdcmDict::GetDictEntryByNumber(guint16 group, guint16 element) { - TagKey key = gdcmDictEntry::TranslateToKey(group, element); +gdcmDictEntry* gdcmDict::GetDictEntryByNumber(uint16_t group, uint16_t element) +{ + gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element); if ( ! KeyHt.count(key)) return NULL; return KeyHt.find(key)->second; } /** - * \ingroup gdcmDict * \brief Consider all the entries of the public dicom dictionnary. * Build all list of all the tag names of all those entries. * \sa gdcmDictSet::GetPubDictTagNamesByCategory * @return A list of all entries of the public dicom dictionnary. */ -std::list *gdcmDict::GetDictEntryNames(void) +std::list* gdcmDict::GetDictEntryNames(void) { std::list *Result = new std::list; for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag) diff --git a/src/gdcmDict.h b/src/gdcmDict.h index 9931f7bc..29e17624 100644 --- a/src/gdcmDict.h +++ b/src/gdcmDict.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDict.h,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.15 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.16 $ 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,7 @@ #include //----------------------------------------------------------------------------- -typedef std::map TagKeyHT; +typedef std::map TagKeyHT; typedef std::map TagNameHT; //----------------------------------------------------------------------------- @@ -54,35 +54,29 @@ public: // Entries bool AddNewEntry (gdcmDictEntry *NewEntry); bool ReplaceEntry(gdcmDictEntry *NewEntry); - bool RemoveEntry (TagKey key); - bool RemoveEntry (guint16 group, guint16 element); + bool RemoveEntry (gdcmTagKey key); + bool RemoveEntry (uint16_t group, uint16_t element); // Tag gdcmDictEntry *GetDictEntryByName(TagName name); - gdcmDictEntry *GetDictEntryByNumber(guint16 group, guint16 element); + gdcmDictEntry *GetDictEntryByNumber(uint16_t group, uint16_t element); std::list *GetDictEntryNames(void); std::map > * GetDictEntryNamesByCategory(void); - /** - * \ingroup gdcmDict - * \brief returns a ref to the Dicom Dictionary H table (map) - * return the Dicom Dictionary H table - */ - inline TagKeyHT & GetEntriesByKey(void) { return KeyHt; } + /// \brief Returns a ref to the Dicom Dictionary H table (map) + /// @return the Dicom Dictionary H table + TagKeyHT & GetEntriesByKey(void) { return KeyHt; } - /** - * \ingroup gdcmDict - * \brief returns a ref to the Dicom Dictionary H table (map) - * return the Dicom Dictionary H table - */ - inline TagNameHT & GetEntriesByName(void) { return NameHt; } + /// \brief Returns a ref to the Dicom Dictionary H table (map) + /// @return the Dicom Dictionary H table + TagNameHT & GetEntriesByName(void) { return NameHt; } private: /// ASCII file holding the Dictionnary std::string filename; - /// Access through TagKey (see alternate access with NameHt) + /// Access through gdcmTagKey (see alternate access with NameHt) TagKeyHT KeyHt; /// Access through TagName (see alternate access with KeyHt) TagNameHT NameHt; diff --git a/src/gdcmDictEntry.cxx b/src/gdcmDictEntry.cxx index 8001f2d9..bb4e748b 100644 --- a/src/gdcmDictEntry.cxx +++ b/src/gdcmDictEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictEntry.cxx,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.21 $ + Date: $Date: 2004/07/02 13:55:27 $ + 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 @@ -33,7 +33,7 @@ * @param InName description of the element */ -gdcmDictEntry::gdcmDictEntry(guint16 InGroup, guint16 InElement, +gdcmDictEntry::gdcmDictEntry(uint16_t InGroup, uint16_t InElement, std::string InVr, std::string InFourth, std::string InName) { @@ -51,22 +51,22 @@ gdcmDictEntry::gdcmDictEntry(guint16 InGroup, guint16 InElement, //----------------------------------------------------------------------------- // Public /** - * \brief concatenates 2 guint16 (supposed to be a Dicom group number + * \brief concatenates 2 uint16_t (supposed to be a Dicom group number * and a Dicom element number) * @param group the Dicom group number used to build the tag * @param element the Dicom element number used to build the tag * @return the built tag */ -TagKey gdcmDictEntry::TranslateToKey(guint16 group, guint16 element) +gdcmTagKey gdcmDictEntry::TranslateToKey(uint16_t group, uint16_t element) { - char trash[10]; - TagKey key; - // CLEANME: better call the iostream<< with the hex manipulator on. - // This requires some reading of the stdlibC++ sources to make the - // proper call (or copy). - sprintf(trash, "%04x|%04x", group , element); - key = trash; // Convertion through assignement - return key; + char trash[10]; + gdcmTagKey key; + // CLEANME: better call the iostream<< with the hex manipulator on. + // This requires some reading of the stdlibC++ sources to make the + // proper call (or copy). + sprintf(trash, "%04x|%04x", group , element); + key = trash; // Convertion through assignement + return key; } /** @@ -76,13 +76,13 @@ TagKey gdcmDictEntry::TranslateToKey(guint16 group, guint16 element) */ void gdcmDictEntry::SetVR(std::string NewVr) { - if ( IsVRUnknown() ) - vr = NewVr; - else + if ( IsVRUnknown() ) + vr = NewVr; + else { - dbg.Error(true, "gdcmDictEntry::SetVR", - "Overwriting vr might compromise a dictionary"); - } + dbg.Error(true, "gdcmDictEntry::SetVR", + "Overwriting vr might compromise a dictionary"); + } } //----------------------------------------------------------------------------- diff --git a/src/gdcmDictEntry.h b/src/gdcmDictEntry.h index fda8b998..240c1066 100644 --- a/src/gdcmDictEntry.h +++ b/src/gdcmDictEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictEntry.h,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.14 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -35,97 +35,72 @@ class GDCM_EXPORT gdcmDictEntry { public: - gdcmDictEntry(guint16 group, - guint16 element, + gdcmDictEntry(uint16_t group, + uint16_t element, std::string vr = "Unknown", std::string fourth = "Unknown", std::string name = "Unknown"); - - static TagKey TranslateToKey(guint16 group, guint16 element); + + static gdcmTagKey TranslateToKey(uint16_t group, uint16_t element); void SetVR(std::string); - /** - * \ingroup gdcmDictEntry - * \brief tells if the V(alue) R(epresentation) is known (?!) - * - * @return - */ - inline bool IsVRUnknown() {return vr == "??"; } + /// \brief tells if the V(alue) R(epresentation) is known (?!) + /// @return + bool IsVRUnknown() {return vr == "??"; } - /** - * \ingroup gdcmDictEntry - * \brief returns the Dicom Group Number of the current gdcmDictEntry - * return the Dicom Group Number - */ - inline guint16 GetGroup(void) { return group; } + /// \brief Returns the Dicom Group Number of the current gdcmDictEntry + /// @return the Dicom Group Number + uint16_t GetGroup() { return group; } - /** - * \ingroup gdcmDictEntry - * \brief returns the Dicom Element Number of the current gdcmDictEntry - * return the Dicom Element Number - */ - inline guint16 GetElement(void) { return element; } + /// \brief Returns the Dicom Element Number of the current gdcmDictEntry + /// @return the Dicom Element Number + uint16_t GetElement() { return element; } - /** - * \ingroup gdcmDictEntry - * \brief returns the Dicom Value Representation of the current gdcmDictEntry - * return the Dicom Value Representation - */ - inline std::string GetVR(void) { return vr; } + /// \brief Returns the Dicom Value Representation of the current + /// gdcmDictEntry + /// @return the Dicom Value Representation + std::string GetVR() { return vr; } - /** - * \ingroup gdcmDictEntry - * \brief sets the key of the current gdcmDictEntry - * @param k New key to be set. - */ - inline void SetKey(std::string k) { key = k; } + /// \brief sets the key of the current gdcmDictEntry + /// @param k New key to be set. + void SetKey(std::string k) { key = k; } - /** - * \ingroup gdcmDictEntry - * \brief returns the Fourth field of the current gdcmDictEntry - * \warning NOT part of the Dicom Standard - * \ May be REMOVED an any time - * \ NEVER use it - * return the Fourth field - */ - inline std::string GetFourth(void) { return fourth; } + /// \brief returns the Fourth field of the current gdcmDictEntry + /// \warning NOT part of the Dicom Standard. + /// May be REMOVED an any time. NEVER use it. + /// @return The Fourth field + std::string GetFourth(void) { return fourth; } - /** - * \ingroup gdcmDictEntry - * \brief returns the Dicom Name of the current gdcmDictEntry - * \ e.g. "Patient Name" for Dicom Tag (0x0010, 0x0010) - * return the Dicom Name - */ - inline std::string GetName(void) { return name; } + /// \brief Returns the Dicom Name of the current gdcmDictEntry + /// e.g. "Patient Name" for Dicom Tag (0x0010, 0x0010) + /// @return the Dicom Name + std::string GetName(void) { return name; } - /** - * \ingroup gdcmDictEntry - * \brief Gets the key of the current gdcmDictEntry - * @return the key . - */ - inline std::string GetKey(void) { return key; } + /// \brief Gets the key of the current gdcmDictEntry + /// @return the key. + std::string GetKey(void) { return key; } private: - // FIXME : where are the group and element used except from building up - // a TagKey. If the answer is nowhere then there is no need - // to store the group and element independently. - // - // --> EVERYWHERE ! The alternate question would be : - // What's TagKey used for ? + /// \todo FIXME + /// where are the group and element used except from building up + /// a gdcmTagKey. If the answer is nowhere then there is no need + /// to store the group and element independently. + /// + /// --> EVERYWHERE ! The alternate question would be : + /// What's gdcmTagKey used for ? /// DicomGroup number - guint16 group; // e.g. 0x0010 + uint16_t group; // e.g. 0x0010 + /// DicomElement number - guint16 element; // e.g. 0x0103 - /** - * \ingroup gdcmDictEntry - * \brief Value Representation i.e. some clue about the nature - * of the data represented - * e.g. "FD" short for "Floating Point Double" - */ + uint16_t element; // e.g. 0x0103 + + /// \brief Value Representation i.e. some clue about the nature + /// of the data represented e.g. "FD" short for + /// "Floating Point Double" (see \ref gdcmVR) std::string vr; - + /** * \brief AVOID using the following fourth field at all costs. * @@ -189,21 +164,7 @@ private: std::string name; /// 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 ? - // struct DBI_SimpleEntry { - // Uint16 upperGroup; - // Uint16 upperElement; - // DcmEVR evr; - // const char* tagName; - // int vmMin; - // int vmMax; - // const char* standardVersion; - // DcmDictRangeRestriction groupRestriction; - // DcmDictRangeRestriction elementRestriction; - // }; + gdcmTagKey key; }; //----------------------------------------------------------------------------- diff --git a/src/gdcmDictSet.cxx b/src/gdcmDictSet.cxx index e15f6a7f..c26768c0 100644 --- a/src/gdcmDictSet.cxx +++ b/src/gdcmDictSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictSet.cxx,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.31 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.32 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -157,7 +157,6 @@ gdcmDict *gdcmDictSet::GetDict(DictKey DictName) } /** - * \ingroup gdcmDictSet * \brief Retrieve the default reference DICOM V3 public dictionary. * \result The retrieved default dictionary. */ @@ -167,17 +166,19 @@ gdcmDict *gdcmDictSet::GetDefaultPubDict() } /** - * \ingroup gdcmDictSet * \brief Create a gdcmDictEntry which will be reference * in no dictionnary * @return virtual entry */ -gdcmDictEntry *gdcmDictSet::NewVirtualDictEntry(guint16 group, guint16 element, - std::string vr,std::string fourth, +gdcmDictEntry *gdcmDictSet::NewVirtualDictEntry(uint16_t group, + uint16_t element, + std::string vr, + std::string fourth, std::string name) { - gdcmDictEntry *entry; - std::string tag=gdcmDictEntry::TranslateToKey(group,element)+"#"+vr+"#"+fourth+"#"+name; + gdcmDictEntry* entry; + std::string tag = gdcmDictEntry::TranslateToKey(group,element) + + "#" + vr + "#" + fourth + "#" + name; std::map::iterator it; it=virtualEntry.find(tag); @@ -194,7 +195,6 @@ gdcmDictEntry *gdcmDictSet::NewVirtualDictEntry(guint16 group, guint16 element, } /** - * \ingroup gdcmDictSet * \brief Obtain from the GDCM_DICT_PATH environnement variable the * path to directory containing the dictionnaries. When * the environnement variable is absent the path is defaulted diff --git a/src/gdcmDictSet.h b/src/gdcmDictSet.h index c4cca7c9..b9d57a9d 100644 --- a/src/gdcmDictSet.h +++ b/src/gdcmDictSet.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDictSet.h,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:47 $ - Version: $Revision: 1.20 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.21 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -37,13 +37,13 @@ typedef std::map DictSetHT; */ class GDCM_EXPORT gdcmDictSet { public: - // TODO Swig int LoadDictFromFile(std::string filename); + // TODO Swig int LoadDictFromFile(std::string filename); // QUESTION: the following function might not be thread safe !? Maybe // we need some mutex here, to avoid concurent creation of // the same dictionary !?!?! - // TODO Swig int LoadDictFromName(std::string filename); - // TODO Swig int LoadAllDictFromDirectory(std::string DirectoryName); - // TODO Swig std::string* GetAllDictNames(); + // TODO Swig int LoadDictFromName(std::string filename); + // TODO Swig int LoadAllDictFromDirectory(std::string DirectoryName); + // TODO Swig std::string* GetAllDictNames(); gdcmDictSet(void); ~gdcmDictSet(void); @@ -58,7 +58,7 @@ public: gdcmDict *GetDict(DictKey DictName); gdcmDict *GetDefaultPubDict(void); - gdcmDictEntry *NewVirtualDictEntry(guint16 group, guint16 element, + gdcmDictEntry *NewVirtualDictEntry(uint16_t group, uint16_t element, std::string vr = "Unknown", std::string fourth = "Unknown", std::string name = "Unknown"); diff --git a/src/gdcmDocEntry.cxx b/src/gdcmDocEntry.cxx index 6357bdbd..5b1a9f3b 100644 --- a/src/gdcmDocEntry.cxx +++ b/src/gdcmDocEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntry.cxx,v $ Language: C++ - Date: $Date: 2004/06/28 11:23:20 $ - Version: $Revision: 1.12 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.13 $ 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,7 @@ void gdcmDocEntry::Print(std::ostream & os) { TSKey v; std::string d2, vr; std::ostringstream s; - guint32 lgth; + uint32_t lgth; char greltag[10]; //group element tag g = GetGroup(); @@ -107,11 +107,11 @@ void gdcmDocEntry::Print(std::ostream & os) { */ void gdcmDocEntry::Write(FILE *fp, FileType filetype) { - guint32 FFFF = 0xffffffff; - guint16 group = GetGroup(); - VRKey vr = GetVR(); - guint16 el = GetElement(); - guint32 lgr = GetReadLength(); + uint32_t FFFF = 0xffffffff; + uint16_t group = GetGroup(); + gdcmVRKey vr = GetVR(); + uint16_t el = GetElement(); + uint32_t lgr = GetReadLength(); if ( (group == 0xfffe) && (el == 0x0000) ) // Fix in order to make some MR PHILIPS images e-film readable @@ -144,8 +144,8 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype) { return; } - guint16 z=0; - guint16 shortLgr = lgr; + uint16_t z=0; + uint16_t shortLgr = lgr; if (vr == "unkn") { // Unknown was 'written' // deal with Little Endian @@ -187,8 +187,8 @@ void gdcmDocEntry::Write(FILE *fp, FileType filetype) { * \ingroup gdcmDocEntry * \brief Gets the full length of the elementary DocEntry (not only value length) */ -guint32 gdcmDocEntry::GetFullLength(void) { - guint32 l; +uint32_t gdcmDocEntry::GetFullLength(void) { + uint32_t l; l = GetReadLength(); if ( IsImplicitVR() ) l = l + 8; // 2 (gr) + 2 (el) + 4 (lgth) diff --git a/src/gdcmDocEntry.h b/src/gdcmDocEntry.h index 4ee6f7f5..bdce223d 100644 --- a/src/gdcmDocEntry.h +++ b/src/gdcmDocEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntry.h,v $ Language: C++ - Date: $Date: 2004/06/24 11:44:35 $ - Version: $Revision: 1.12 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.13 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -40,11 +40,11 @@ public: gdcmDocEntry(gdcmDictEntry*); /// Returns the Dicom Group number of the current Dicom Header Entry - guint16 GetGroup(void) { return entry->GetGroup(); }; + uint16_t GetGroup(void) { return entry->GetGroup(); }; /// Returns the Dicom Element number of the current Dicom Header Entry - guint16 GetElement(void) { return entry->GetElement();}; - + uint16_t GetElement(void) { return entry->GetElement();}; + /// Returns the 'key' of the current Dicom Header Entry std::string GetKey(void) { return entry->GetKey(); }; @@ -65,30 +65,30 @@ public: /// \brief Returns the actual value length of the current Dicom Header Entry /// \warning this value is not *always* the one stored in the Dicom Header /// in case of well knowned bugs - guint32 GetLength(void) { return UsableLength; }; + uint32_t GetLength(void) { return UsableLength; }; /// \brief Returns the 'read length' of the current Dicom Header Entry /// \warning this value is the one stored in the Dicom Header but not /// mandatoryly the one thats's used (in case on SQ, or delimiters, /// the usable length is set to zero) - guint32 GetReadLength(void) { return ReadLength; }; + uint32_t GetReadLength(void) { return ReadLength; }; /// Sets the 'Value Representation' of the current Dicom Header Entry void SetVR(std::string v) { entry->SetVR(v); }; /// \brief Sets both 'Read Length' and 'Usable Length' of the current /// Dicom Header Entry - void SetLength(guint32 l) { ReadLength=UsableLength=l;}; + void SetLength(uint32_t l) { ReadLength=UsableLength=l;}; // The following 3 members, for internal use only ! /// \brief Sets only 'Read Length' (*not* 'Usable Length') of the current /// Dicom Header Entry - void SetReadLength(guint32 l) { ReadLength = l; }; + void SetReadLength(uint32_t l) { ReadLength = l; }; /// \brief Sets only 'Usable Length' (*not* 'Read Length') of the current /// Dicom Header Entry - void SetUsableLength(guint32 l) { UsableLength = l; }; + void SetUsableLength(uint32_t l) { UsableLength = l; }; /// \brief Sets the offset of the Dicom Element /// \warning use with caution ! @@ -125,7 +125,7 @@ public: virtual void Print (std::ostream & os = std::cout); virtual void Write(FILE *fp, FileType filetype); - guint32 GetFullLength(void); + uint32_t GetFullLength(void); void Copy(gdcmDocEntry *doc); @@ -135,7 +135,7 @@ public: /// \brief Gets the depth level of a Dicom header entry embedded in /// a SeQuence int GetDepthLevel(void) {return(SQDepthLevel);} - + /// \brief Sets the depth level of a Dicom header entry embedded in /// a SeQuence void SetDepthLevel(int depth) {SQDepthLevel = depth;} @@ -153,12 +153,12 @@ protected: /// \brief Updated from ReadLength, by FixFoungLentgh() for fixing a bug /// in the header or helping the parser going on - guint32 UsableLength; + uint32_t UsableLength; /// \brief Length actually read on disk (before FixFoundLength). ReadLength /// will be updated only when FixFoundLength actually fixes a bug in the /// header, not when it performs a trick to help the Parser going on. - guint32 ReadLength; + uint32_t ReadLength; /// \brief Even when reading explicit vr files, some elements happen to /// be implicit. Flag them here since we can't use the entry->vr without diff --git a/src/gdcmDocEntrySet.cxx b/src/gdcmDocEntrySet.cxx index c5a03273..ad85c126 100644 --- a/src/gdcmDocEntrySet.cxx +++ b/src/gdcmDocEntrySet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntrySet.cxx,v $ Language: C++ - Date: $Date: 2004/06/22 14:11:34 $ - Version: $Revision: 1.12 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.13 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -61,7 +61,8 @@ gdcmDocEntrySet::~gdcmDocEntrySet(){ * @param Group group number of the underlying DictEntry * @param Elem element number of the underlying DictEntry */ -gdcmValEntry *gdcmDocEntrySet::NewValEntryByNumber(guint16 Group, guint16 Elem) +gdcmValEntry *gdcmDocEntrySet::NewValEntryByNumber(uint16_t Group, + uint16_t Elem) { // Find out if the tag we encountered is in the dictionaries: gdcmDictEntry *DictEntry = GetDictEntryByNumber(Group, Elem); @@ -86,7 +87,8 @@ gdcmValEntry *gdcmDocEntrySet::NewValEntryByNumber(guint16 Group, guint16 Elem) * @param Group group number of the underlying DictEntry * @param Elem element number of the underlying DictEntry */ -gdcmBinEntry *gdcmDocEntrySet::NewBinEntryByNumber(guint16 Group, guint16 Elem) +gdcmBinEntry *gdcmDocEntrySet::NewBinEntryByNumber(uint16_t Group, + uint16_t Elem) { // Find out if the tag we encountered is in the dictionaries: gdcmDictEntry *DictEntry = GetDictEntryByNumber(Group, Elem); @@ -142,22 +144,22 @@ std::string gdcmDocEntrySet::GetEntryByName(TagName name) { * @param fourth owner group * @param name english name */ -gdcmDictEntry *gdcmDocEntrySet::NewVirtualDictEntry(guint16 group, guint16 element, - std::string vr, - std::string fourth, - std::string name) +gdcmDictEntry* gdcmDocEntrySet::NewVirtualDictEntry(uint16_t group, + uint16_t element, + std::string vr, + std::string fourth, + std::string name) { return gdcmGlobal::GetDicts()->NewVirtualDictEntry(group,element,vr,fourth,name); } -/// \brief - -// -// Probabely move, as is, to gdcmDocEntrySet, as a non virtual method -// an remove gdcmDocument::NewDocEntryByNumber -gdcmDocEntry *gdcmDocEntrySet::NewDocEntryByNumber(guint16 group, - guint16 elem) { - +/** \brief + * Probabely move, as is, to gdcmDocEntrySet, as a non virtual method + * an remove gdcmDocument::NewDocEntryByNumber + */ +gdcmDocEntry* gdcmDocEntrySet::NewDocEntryByNumber(uint16_t group, + uint16_t elem) +{ // Find out if the tag we encountered is in the dictionaries: gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict(); gdcmDictEntry *DictEntry = (*PubDict).GetDictEntryByNumber(group, elem); @@ -223,7 +225,8 @@ gdcmDictEntry *gdcmDocEntrySet::GetDictEntryByName(std::string Name) * @param element element number of the searched DictEntry * @return Corresponding DictEntry when it exists, NULL otherwise. */ -gdcmDictEntry *gdcmDocEntrySet::GetDictEntryByNumber(guint16 group,guint16 element) +gdcmDictEntry *gdcmDocEntrySet::GetDictEntryByNumber(uint16_t group, + uint16_t element) { gdcmDictEntry *found = (gdcmDictEntry *)0; gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict(); diff --git a/src/gdcmDocEntrySet.h b/src/gdcmDocEntrySet.h index 695eb39e..4ed6d4a0 100644 --- a/src/gdcmDocEntrySet.h +++ b/src/gdcmDocEntrySet.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntrySet.h,v $ Language: C++ - Date: $Date: 2004/06/22 13:47:33 $ - Version: $Revision: 1.12 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.13 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -26,7 +26,6 @@ class GDCM_EXPORT gdcmDocEntrySet { - public: gdcmDocEntrySet(int depth = 0); @@ -34,7 +33,7 @@ public: /// \brief adds any type of entry to the entry set (pure vitual) virtual bool AddEntry(gdcmDocEntry *Entry) = 0; // pure virtual - + /// \brief prints any type of entry to the entry set (pure vitual) virtual void Print (std::ostream & os = std::cout) = 0;// pure virtual @@ -43,39 +42,38 @@ public: /// \brief Gets the depth level of a Dicom Header Entry embedded in a /// SeQuence - inline int GetDepthLevel(void) { return SQDepthLevel; } + int GetDepthLevel(void) { return SQDepthLevel; } /// \brief Sets the depth level of a Dicom Header Entry embedded in a /// SeQuence - inline void SetDepthLevel(int depth) { SQDepthLevel = depth; } + void SetDepthLevel(int depth) { SQDepthLevel = depth; } - virtual gdcmDocEntry *GetDocEntryByNumber(guint16 group,guint16 element) = 0; + virtual gdcmDocEntry* GetDocEntryByNumber(uint16_t group, + uint16_t element) = 0; gdcmDocEntry *GetDocEntryByName(std::string name); - virtual std::string GetEntryByNumber(guint16 group,guint16 element) = 0; - std::string GetEntryByName(TagName name); - gdcmDictEntry *NewVirtualDictEntry(guint16 group, - guint16 element, + virtual std::string GetEntryByNumber(uint16_t group,uint16_t element) = 0; + std::string GetEntryByName(TagName name); + gdcmDictEntry *NewVirtualDictEntry(uint16_t group, + uint16_t element, std::string vr = "unkn", std::string fourth = "unkn", std::string name = "unkn"); - - protected: - - // DocEntry related utilities - gdcmValEntry *NewValEntryByNumber(guint16 group, - guint16 element); - gdcmBinEntry *NewBinEntryByNumber(guint16 group, - guint16 element); - gdcmDocEntry *NewDocEntryByNumber(guint16 group, - guint16 element); - gdcmDocEntry *NewDocEntryByName (std::string Name); - - // DictEntry related utilities - +protected: + +// DocEntry related utilities + gdcmValEntry* NewValEntryByNumber(uint16_t group, + uint16_t element); + gdcmBinEntry* NewBinEntryByNumber(uint16_t group, + uint16_t element); + gdcmDocEntry* NewDocEntryByNumber(uint16_t group, + uint16_t element); + gdcmDocEntry* NewDocEntryByName (std::string Name); + +// DictEntry related utilities gdcmDictEntry *GetDictEntryByName (std::string Name); - gdcmDictEntry *GetDictEntryByNumber(guint16, guint16); - + gdcmDictEntry *GetDictEntryByNumber(uint16_t, uint16_t); + /// Gives the depth level of the element set inside SeQuences int SQDepthLevel; diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 2400eb0b..66abee0e 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2004/06/30 00:10:59 $ - Version: $Revision: 1.45 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.46 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -175,7 +175,8 @@ gdcmDocument::gdcmDocument(std::string const & inFilename, * @param exception_on_error */ gdcmDocument::gdcmDocument(bool exception_on_error) - :gdcmElementSet(-1) { + :gdcmElementSet(-1) +{ (void)exception_on_error; //enableSequences=0; // ?!? JPR @@ -188,7 +189,8 @@ gdcmDocument::gdcmDocument(bool exception_on_error) /** * \brief Canonical destructor. */ -gdcmDocument::~gdcmDocument (void) { +gdcmDocument::~gdcmDocument () +{ RefPubDict = NULL; RefShaDict = NULL; @@ -207,7 +209,8 @@ gdcmDocument::~gdcmDocument (void) { * \brief Prints The Dict Entries of THE public Dicom Dictionary * @return */ -void gdcmDocument::PrintPubDict(std::ostream & os) { +void gdcmDocument::PrintPubDict(std::ostream & os) +{ RefPubDict->Print(os); } @@ -215,7 +218,8 @@ void gdcmDocument::PrintPubDict(std::ostream & os) { * \brief Prints The Dict Entries of THE shadow Dicom Dictionary * @return */ -void gdcmDocument::PrintShaDict(std::ostream & os) { +void gdcmDocument::PrintShaDict(std::ostream & os) +{ RefShaDict->Print(os); } @@ -224,14 +228,16 @@ void gdcmDocument::PrintShaDict(std::ostream & os) { /** * \brief Get the public dictionary used */ -gdcmDict *gdcmDocument::GetPubDict(void) { +gdcmDict *gdcmDocument::GetPubDict() +{ return RefPubDict; } /** * \brief Get the shadow dictionary used */ -gdcmDict *gdcmDocument::GetShaDict(void) { +gdcmDict *gdcmDocument::GetShaDict() +{ return RefShaDict; } @@ -239,7 +245,8 @@ gdcmDict *gdcmDocument::GetShaDict(void) { * \brief Set the shadow dictionary used * \param dict dictionary to use in shadow */ -bool gdcmDocument::SetShaDict(gdcmDict *dict){ +bool gdcmDocument::SetShaDict(gdcmDict *dict) +{ RefShaDict=dict; return !RefShaDict; } @@ -248,7 +255,8 @@ bool gdcmDocument::SetShaDict(gdcmDict *dict){ * \brief Set the shadow dictionary used * \param dictName name of the dictionary to use in shadow */ -bool gdcmDocument::SetShaDict(DictKey dictName){ +bool gdcmDocument::SetShaDict(DictKey dictName) +{ RefShaDict=gdcmGlobal::GetDicts()->GetDict(dictName); return !RefShaDict; } @@ -261,7 +269,7 @@ bool gdcmDocument::SetShaDict(DictKey dictName){ * @return true when gdcmDocument is the one of a reasonable Dicom/Acr file, * false otherwise. */ -bool gdcmDocument::IsReadable(void) { +bool gdcmDocument::IsReadable() { if(Filetype==gdcmUnknown) { std::cout << " gdcmDocument::IsReadable: Filetype " << Filetype @@ -320,7 +328,7 @@ bool gdcmDocument::IsGivenTransferSyntax(const std::string & SyntaxToCheck) * \sa \ref gdcmDocument::IsGivenTransferSyntax. * @return True when ImplicitVRLittleEndian found. False in all other cases. */ -bool gdcmDocument::IsImplicitVRLittleEndianTransferSyntax(void) +bool gdcmDocument::IsImplicitVRLittleEndianTransferSyntax() { return IsGivenTransferSyntax(UI1_2_840_10008_1_2); } @@ -330,7 +338,7 @@ bool gdcmDocument::IsImplicitVRLittleEndianTransferSyntax(void) * and if it corresponds to a ExplicitVRLittleEndian one. * @return True when ExplicitVRLittleEndian found. False in all other cases. */ -bool gdcmDocument::IsExplicitVRLittleEndianTransferSyntax(void) +bool gdcmDocument::IsExplicitVRLittleEndianTransferSyntax() { return IsGivenTransferSyntax(UI1_2_840_10008_1_2_1); } @@ -340,7 +348,7 @@ bool gdcmDocument::IsExplicitVRLittleEndianTransferSyntax(void) * and if it corresponds to a DeflatedExplicitVRLittleEndian one. * @return True when DeflatedExplicitVRLittleEndian found. False in all other cases. */ -bool gdcmDocument::IsDeflatedExplicitVRLittleEndianTransferSyntax(void) +bool gdcmDocument::IsDeflatedExplicitVRLittleEndianTransferSyntax() { return IsGivenTransferSyntax(UI1_2_840_10008_1_2_1_99); } @@ -350,7 +358,7 @@ bool gdcmDocument::IsDeflatedExplicitVRLittleEndianTransferSyntax(void) * and if it corresponds to a Explicit VR Big Endian one. * @return True when big endian found. False in all other cases. */ -bool gdcmDocument::IsExplicitVRBigEndianTransferSyntax(void) +bool gdcmDocument::IsExplicitVRBigEndianTransferSyntax() { return IsGivenTransferSyntax(UI1_2_840_10008_1_2_2); } @@ -360,7 +368,7 @@ bool gdcmDocument::IsExplicitVRBigEndianTransferSyntax(void) * and if it corresponds to a JPEGBaseLineProcess1 one. * @return True when JPEGBaseLineProcess1found. False in all other cases. */ -bool gdcmDocument::IsJPEGBaseLineProcess1TransferSyntax(void) +bool gdcmDocument::IsJPEGBaseLineProcess1TransferSyntax() { return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_50); } @@ -370,7 +378,7 @@ bool gdcmDocument::IsJPEGBaseLineProcess1TransferSyntax(void) * and if it corresponds to a JPEGExtendedProcess2-4 one. * @return True when JPEGExtendedProcess2-4 found. False in all other cases. */ -bool gdcmDocument::IsJPEGExtendedProcess2_4TransferSyntax(void) +bool gdcmDocument::IsJPEGExtendedProcess2_4TransferSyntax() { return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_51); } @@ -380,7 +388,7 @@ bool gdcmDocument::IsJPEGExtendedProcess2_4TransferSyntax(void) * and if it corresponds to a JPEGExtendeProcess3-5 one. * @return True when JPEGExtendedProcess3-5 found. False in all other cases. */ -bool gdcmDocument::IsJPEGExtendedProcess3_5TransferSyntax(void) +bool gdcmDocument::IsJPEGExtendedProcess3_5TransferSyntax() { return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_52); } @@ -391,7 +399,7 @@ bool gdcmDocument::IsJPEGExtendedProcess3_5TransferSyntax(void) * @return True when JPEGSpectralSelectionProcess6-8 found. False in all * other cases. */ -bool gdcmDocument::IsJPEGSpectralSelectionProcess6_8TransferSyntax(void) +bool gdcmDocument::IsJPEGSpectralSelectionProcess6_8TransferSyntax() { return IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_53); } @@ -402,7 +410,7 @@ bool gdcmDocument::IsJPEGSpectralSelectionProcess6_8TransferSyntax(void) * @return True when RLE Lossless found. False in all * other cases. */ -bool gdcmDocument::IsRLELossLessTransferSyntax(void) +bool gdcmDocument::IsRLELossLessTransferSyntax() { return IsGivenTransferSyntax(UI1_2_840_10008_1_2_5); } @@ -414,7 +422,7 @@ bool gdcmDocument::IsRLELossLessTransferSyntax(void) * other cases. */ -bool gdcmDocument::IsJPEGLossless(void) +bool gdcmDocument::IsJPEGLossless() { return ( IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_55) || IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_57) @@ -427,7 +435,7 @@ bool gdcmDocument::IsJPEGLossless(void) * @return True when JPEG2000 (Lossly or LossLess) found. False in all * other cases. */ -bool gdcmDocument::IsJPEG2000(void) +bool gdcmDocument::IsJPEG2000() { return ( IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_90) || IsGivenTransferSyntax(UI1_2_840_10008_1_2_4_91) ); @@ -437,7 +445,8 @@ bool gdcmDocument::IsJPEG2000(void) * \brief Predicate for dicom version 3 file. * @return True when the file is a dicom version 3. */ -bool gdcmDocument::IsDicomV3(void) { +bool gdcmDocument::IsDicomV3() +{ // Checking if Transfert Syntax exists is enough // Anyway, it's to late check if the 'Preamble' was found ... // And ... would it be a rich idea to check ? @@ -450,7 +459,8 @@ bool gdcmDocument::IsDicomV3(void) { * (ACR, ACR_LIBIDO, ExplicitVR, ImplicitVR, Unknown) * @return the FileType code */ -FileType gdcmDocument::GetFileType(void) { +FileType gdcmDocument::GetFileType() +{ return Filetype; } @@ -478,7 +488,7 @@ FILE *gdcmDocument::OpenFile(bool exception_on_error) if ( fp ) { - guint16 zero; + uint16_t zero; fread(&zero, (size_t)2, (size_t)1, fp); //ACR -- or DICOM with no Preamble -- @@ -505,7 +515,8 @@ FILE *gdcmDocument::OpenFile(bool exception_on_error) * \brief closes the file * @return TRUE if the close was successfull */ -bool gdcmDocument::CloseFile(void) { +bool gdcmDocument::CloseFile() +{ int closed = fclose(fp); fp = (FILE *)0; if (! closed) @@ -520,7 +531,8 @@ bool gdcmDocument::CloseFile(void) { * (ACR-NEMA, ExplicitVR, ImplicitVR) * \return Always true. */ -void gdcmDocument::Write(FILE* fp,FileType filetype) { +void gdcmDocument::Write(FILE* fp,FileType filetype) +{ /// \todo move the following lines (and a lot of others, to be written) /// to a future function CheckAndCorrectHeader @@ -584,8 +596,8 @@ void gdcmDocument::Write(FILE* fp,FileType filetype) { gdcmValEntry * gdcmDocument::ReplaceOrCreateByNumber( std::string Value, - guint16 Group, - guint16 Elem ) + uint16_t Group, + uint16_t Elem ) { gdcmDocEntry* CurrentEntry; gdcmValEntry* ValEntry; @@ -647,8 +659,8 @@ gdcmValEntry * gdcmDocument::ReplaceOrCreateByNumber( gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber( void *voidArea, int lgth, - guint16 Group, - guint16 Elem) + uint16_t Group, + uint16_t Elem) { gdcmDocEntry* a; gdcmBinEntry* b = 0; @@ -667,8 +679,6 @@ gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber( return b; } - - /** * \brief Set a new value if the invoked element exists * Seems to be useless !!! @@ -677,7 +687,8 @@ gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber( * @param Elem element number of the Entry * \return boolean */ -bool gdcmDocument::ReplaceIfExistByNumber(char* Value, guint16 Group, guint16 Elem ) +bool gdcmDocument::ReplaceIfExistByNumber(char* Value, uint16_t Group, + uint16_t Elem ) { std::string v = Value; SetEntryByNumber(v, Group, Elem); @@ -693,7 +704,8 @@ bool gdcmDocument::ReplaceIfExistByNumber(char* Value, guint16 Group, guint16 El * @param element Element number of the searched Dicom Element * @return number of occurences */ -int gdcmDocument::CheckIfEntryExistByNumber(guint16 group, guint16 element ) { +int gdcmDocument::CheckIfEntryExistByNumber(uint16_t group, uint16_t element ) +{ std::string key = gdcmDictEntry::TranslateToKey(group, element ); return tagHT.count(key); } @@ -707,7 +719,8 @@ int gdcmDocument::CheckIfEntryExistByNumber(guint16 group, guint16 element ) { * @return Corresponding element value when it exists, * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ -std::string gdcmDocument::GetEntryByName(TagName tagName) { +std::string gdcmDocument::GetEntryByName(TagName tagName) +{ gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName); if( dictEntry == NULL) return GDCM_UNFOUND; @@ -728,7 +741,8 @@ std::string gdcmDocument::GetEntryByName(TagName tagName) { * @return Corresponding element value representation when it exists, * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ -std::string gdcmDocument::GetEntryVRByName(TagName tagName) { +std::string gdcmDocument::GetEntryVRByName(TagName tagName) +{ gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName); if( dictEntry == NULL) return GDCM_UNFOUND; @@ -748,8 +762,9 @@ std::string gdcmDocument::GetEntryVRByName(TagName tagName) { * @return Corresponding element value representation when it exists, * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ -std::string gdcmDocument::GetEntryByNumber(guint16 group, guint16 element){ - TagKey key = gdcmDictEntry::TranslateToKey(group, element); +std::string gdcmDocument::GetEntryByNumber(uint16_t group, uint16_t element) +{ + gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element); /// \todo use map methods, instead of multimap JPR if ( ! tagHT.count(key)) return GDCM_UNFOUND; @@ -770,7 +785,8 @@ std::string gdcmDocument::GetEntryByNumber(guint16 group, guint16 element){ * @return Corresponding element value representation when it exists, * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. */ -std::string gdcmDocument::GetEntryVRByNumber(guint16 group, guint16 element) { +std::string gdcmDocument::GetEntryVRByNumber(uint16_t group, uint16_t element) +{ gdcmDocEntry* elem = GetDocEntryByNumber(group, element); if ( !elem ) return GDCM_UNFOUND; @@ -785,7 +801,8 @@ std::string gdcmDocument::GetEntryVRByNumber(guint16 group, guint16 element) { * @param element Element number of the searched tag. * @return Corresponding element length; -2 if not found */ -int gdcmDocument::GetEntryLengthByNumber(guint16 group, guint16 element) { +int gdcmDocument::GetEntryLengthByNumber(uint16_t group, uint16_t element) +{ gdcmDocEntry* elem = GetDocEntryByNumber(group, element); if ( !elem ) return -2; @@ -797,7 +814,8 @@ int gdcmDocument::GetEntryLengthByNumber(guint16 group, guint16 element) { * @param tagName name of the searched Dicom Element. * @return true when found */ -bool gdcmDocument::SetEntryByName(std::string content,std::string tagName) { +bool gdcmDocument::SetEntryByName(std::string content,std::string tagName) +{ gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName); if( dictEntry == NULL) return false; @@ -815,8 +833,8 @@ bool gdcmDocument::SetEntryByName(std::string content,std::string tagName) { * @param element element number of the Dicom Element to modify */ bool gdcmDocument::SetEntryByNumber(std::string content, - guint16 group, - guint16 element) + uint16_t group, + uint16_t element) { gdcmValEntry* ValEntry = GetValEntryByNumber(group, element); if (!ValEntry) @@ -832,7 +850,7 @@ bool gdcmDocument::SetEntryByNumber(std::string content, ValEntry->SetValue(content); // Integers have a special treatement for their length: - VRKey vr = ValEntry->GetVR(); + gdcmVRKey vr = ValEntry->GetVR(); if( (vr == "US") || (vr == "SS") ) ValEntry->SetLength(2); else if( (vr == "UL") || (vr == "SL") ) @@ -853,12 +871,12 @@ bool gdcmDocument::SetEntryByNumber(std::string content, * @param element element number of the Dicom Element to modify */ bool gdcmDocument::SetEntryByNumber(void *content, - int lgth, - guint16 group, - guint16 element) + int lgth, + uint16_t group, + uint16_t element) { (void)lgth; //not used - TagKey key = gdcmDictEntry::TranslateToKey(group, element); + gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element); if ( ! tagHT.count(key)) return false; @@ -887,12 +905,12 @@ bool gdcmDocument::SetEntryByNumber(void *content, * @param element element number of the Entry to modify * @return true on success, false otherwise. */ -bool gdcmDocument::SetEntryLengthByNumber(guint32 l, - guint16 group, - guint16 element) +bool gdcmDocument::SetEntryLengthByNumber(uint32_t l, + uint16_t group, + uint16_t element) { /// \todo use map methods, instead of multimap JPR - TagKey key = gdcmDictEntry::TranslateToKey(group, element); + gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element); if ( ! tagHT.count(key)) return false; if (l%2) l++; // length must be even @@ -908,7 +926,7 @@ bool gdcmDocument::SetEntryLengthByNumber(guint32 l, * @param Elem element number of the Entry * @return File Offset of the Element Value */ -size_t gdcmDocument::GetEntryOffsetByNumber(guint16 Group, guint16 Elem) +size_t gdcmDocument::GetEntryOffsetByNumber(uint16_t Group, uint16_t Elem) { gdcmDocEntry* Entry = GetDocEntryByNumber(Group, Elem); if (!Entry) @@ -926,7 +944,7 @@ size_t gdcmDocument::GetEntryOffsetByNumber(guint16 Group, guint16 Elem) * @param Elem element number of the Entry * @return Pointer to the 'non string' area */ -void * gdcmDocument::GetEntryVoidAreaByNumber(guint16 Group, guint16 Elem) +void * gdcmDocument::GetEntryVoidAreaByNumber(uint16_t Group, uint16_t Elem) { gdcmDocEntry* Entry = GetDocEntryByNumber(Group, Elem); if (!Entry) @@ -943,7 +961,7 @@ void * gdcmDocument::GetEntryVoidAreaByNumber(guint16 Group, guint16 Elem) * @param Group group number of the Entry * @param Elem element number of the Entry */ -void *gdcmDocument::LoadEntryVoidArea(guint16 Group, guint16 Elem) +void *gdcmDocument::LoadEntryVoidArea(uint16_t Group, uint16_t Elem) { gdcmDocEntry * Element= GetDocEntryByNumber(Group, Elem); if ( !Element ) @@ -1000,10 +1018,10 @@ void *gdcmDocument::LoadEntryVoidArea(gdcmBinEntry *Element) * @return */ bool gdcmDocument::SetEntryVoidAreaByNumber(void * area, - guint16 group, - guint16 element) + uint16_t group, + uint16_t element) { - TagKey key = gdcmDictEntry::TranslateToKey(group, element); + gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element); if ( ! tagHT.count(key)) return false; // This was for multimap ? @@ -1016,7 +1034,7 @@ bool gdcmDocument::SetEntryVoidAreaByNumber(void * area, * \brief Update the entries with the shadow dictionary. * Only non even entries are analyzed */ -void gdcmDocument::UpdateShaEntries(void) { +void gdcmDocument::UpdateShaEntries() { //gdcmDictEntry *entry; std::string vr; @@ -1066,7 +1084,8 @@ void gdcmDocument::UpdateShaEntries(void) { * @return Corresponding Dicom Element when it exists, and NULL * otherwise. */ - gdcmDocEntry *gdcmDocument::GetDocEntryByName(std::string tagName) { +gdcmDocEntry* gdcmDocument::GetDocEntryByName(std::string tagName) +{ gdcmDictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName); if( dictEntry == NULL) return NULL; @@ -1084,9 +1103,10 @@ void gdcmDocument::UpdateShaEntries(void) { * @param element Element number of the searched Dicom Element * @return */ -gdcmDocEntry* gdcmDocument::GetDocEntryByNumber(guint16 group, guint16 element) +gdcmDocEntry* gdcmDocument::GetDocEntryByNumber(uint16_t group, + uint16_t element) { - TagKey key = gdcmDictEntry::TranslateToKey(group, element); + gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element); if ( ! tagHT.count(key)) return NULL; return tagHT.find(key)->second; @@ -1098,7 +1118,8 @@ gdcmDocEntry* gdcmDocument::GetDocEntryByNumber(guint16 group, guint16 element) * ValEntry. * @return When present, the corresponding ValEntry. */ -gdcmValEntry* gdcmDocument::GetValEntryByNumber(guint16 group, guint16 element) +gdcmValEntry* gdcmDocument::GetValEntryByNumber(uint16_t group, + uint16_t element) { gdcmDocEntry* CurrentEntry = GetDocEntryByNumber(group, element); if (! CurrentEntry) @@ -1118,7 +1139,8 @@ gdcmValEntry* gdcmDocument::GetValEntryByNumber(guint16 group, guint16 element) * @param entry Header Entry whose value shall be loaded. * @return */ -void gdcmDocument::LoadDocEntrySafe(gdcmDocEntry * entry) { +void gdcmDocument::LoadDocEntrySafe(gdcmDocEntry * entry) +{ long PositionOnEntry = ftell(fp); LoadDocEntry(entry); fseek(fp, PositionOnEntry, SEEK_SET); @@ -1129,7 +1151,8 @@ void gdcmDocument::LoadDocEntrySafe(gdcmDocEntry * entry) { * processor order. * @return The properly swaped 32 bits integer. */ -guint32 gdcmDocument::SwapLong(guint32 a) { +uint32_t gdcmDocument::SwapLong(uint32_t a) +{ switch (sw) { case 0 : break; @@ -1158,7 +1181,8 @@ guint32 gdcmDocument::SwapLong(guint32 a) { * processor order. * @return The properly unswaped 32 bits integer. */ -guint32 gdcmDocument::UnswapLong(guint32 a) { +uint32_t gdcmDocument::UnswapLong(uint32_t a) +{ return SwapLong(a); } @@ -1166,7 +1190,8 @@ guint32 gdcmDocument::UnswapLong(guint32 a) { * \brief Swaps the bytes so they agree with the processor order * @return The properly swaped 16 bits integer. */ -guint16 gdcmDocument::SwapShort(guint16 a) { +uint16_t gdcmDocument::SwapShort(uint16_t a) +{ if ( (sw==4321) || (sw==2143) ) a =(((a<<8) & 0x0ff00) | ((a>>8)&0x00ff)); return a; @@ -1176,7 +1201,8 @@ guint16 gdcmDocument::SwapShort(guint16 a) { * \brief Unswaps the bytes so they agree with the processor order * @return The properly unswaped 16 bits integer. */ -guint16 gdcmDocument::UnswapShort(guint16 a) { +uint16_t gdcmDocument::UnswapShort(uint16_t a) +{ return SwapShort(a); } @@ -1188,13 +1214,16 @@ guint16 gdcmDocument::UnswapShort(guint16 a) { * @return length of the parsed set. */ -long gdcmDocument::ParseDES(gdcmDocEntrySet *set, long offset, long l_max, bool delim_mode) { - +long gdcmDocument::ParseDES(gdcmDocEntrySet *set, + long offset, + long l_max, + bool delim_mode) +{ gdcmDocEntry *NewDocEntry = (gdcmDocEntry *)0; gdcmValEntry *NewValEntry = (gdcmValEntry *)0; gdcmBinEntry *bn; gdcmSeqEntry *sq; - VRKey vr; + gdcmVRKey vr; unsigned long l = 0; int depth; @@ -1357,12 +1386,12 @@ long gdcmDocument::ParseSQ(gdcmSeqEntry *set, * the value specified with gdcmDocument::SetMaxSizeLoadEntry() * @param Entry Header Entry (Dicom Element) to be dealt with */ -void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry) +void gdcmDocument::LoadDocEntry(gdcmDocEntry* Entry) { size_t item_read; - guint16 group = Entry->GetGroup(); - std::string vr= Entry->GetVR(); - guint32 length = Entry->GetLength(); + uint16_t group = Entry->GetGroup(); + std::string vr = Entry->GetVR(); + uint32_t length = Entry->GetLength(); fseek(fp, (long)Entry->GetOffset(), SEEK_SET); @@ -1370,13 +1399,15 @@ void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry) // (fffe e000) tells us an Element is beginning // (fffe e00d) tells us an Element just ended // (fffe e0dd) tells us the current SeQuence just ended - if( group == 0xfffe ) { + if( group == 0xfffe ) + { // NO more value field for SQ ! return; } // When the length is zero things are easy: - if ( length == 0 ) { + if ( length == 0 ) + { ((gdcmValEntry *)Entry)->SetValue(""); return; } @@ -1386,7 +1417,8 @@ void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry) // the element content and it's length. std::ostringstream s; - if (length > MaxSizeLoadEntry) { + if (length > MaxSizeLoadEntry) + { if (gdcmBinEntry* BinEntryPtr = dynamic_cast< gdcmBinEntry* >(Entry) ) { s << "gdcm::NotLoaded (BinEntry)"; @@ -1396,7 +1428,7 @@ void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry) BinEntryPtr->SetValue(s.str()); } // to be sure we are at the end of the value ... - fseek(fp,(long)Entry->GetOffset()+(long)Entry->GetLength(),SEEK_SET); + fseek(fp, (long)Entry->GetOffset()+(long)Entry->GetLength(), SEEK_SET); return; // Be carefull : a BinEntry IS_A ValEntry ... if (gdcmValEntry* ValEntryPtr = dynamic_cast< gdcmValEntry* >(Entry) ) @@ -1413,46 +1445,51 @@ void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry) } // When we find a BinEntry not very much can be done : - if (gdcmBinEntry* BinEntryPtr = dynamic_cast< gdcmBinEntry* >(Entry) ) { + if (gdcmBinEntry* BinEntryPtr = dynamic_cast< gdcmBinEntry* >(Entry) ) + { LoadEntryVoidArea(BinEntryPtr); s << "gdcm::Loaded (BinEntry)"; BinEntryPtr->SetValue(s.str()); return; } - - // Any compacter code suggested (?) - if ( IsDocEntryAnInteger(Entry) ) { - guint32 NewInt; + /// \todo Any compacter code suggested (?) + if ( IsDocEntryAnInteger(Entry) ) + { + uint32_t NewInt; std::ostringstream s; int nbInt; - // When short integer(s) are expected, read and convert the following - // n *two characters properly i.e. as short integers as opposed to strings. - // Elements with Value Multiplicity > 1 - // contain a set of integers (not a single one) - if (vr == "US" || vr == "SS") { + // When short integer(s) are expected, read and convert the following + // n *two characters properly i.e. consider them as short integers as + // opposed to strings. + // Elements with Value Multiplicity > 1 + // contain a set of integers (not a single one) + if (vr == "US" || vr == "SS") + { nbInt = length / 2; NewInt = ReadInt16(); s << NewInt; - if (nbInt > 1){ - for (int i=1; i < nbInt; i++) { + if (nbInt > 1) + { + for (int i=1; i < nbInt; i++) + { s << '\\'; NewInt = ReadInt16(); s << NewInt; } } } - // When integer(s) are expected, read and convert the following - // n * four characters properly i.e. as integers as opposed to strings. - // Elements with Value Multiplicity > 1 - // contain a set of integers (not a single one) - else if (vr == "UL" || vr == "SL") { + // See above comment on multiple integers (mutatis mutandis). + else if (vr == "UL" || vr == "SL") + { nbInt = length / 4; NewInt = ReadInt32(); s << NewInt; - if (nbInt > 1) { - for (int i=1; i < nbInt; i++) { + if (nbInt > 1) + { + for (int i=1; i < nbInt; i++) + { s << '\\'; NewInt = ReadInt32(); s << NewInt; @@ -1470,9 +1507,12 @@ void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry) // We need an additional byte for storing \0 that is not on disk std::string NewValue(length,0); item_read = fread(&(NewValue[0]), (size_t)length, (size_t)1, fp); - if (gdcmValEntry* ValEntry = dynamic_cast< gdcmValEntry* >(Entry) ) { - if ( item_read != 1 ) { - dbg.Verbose(1, "gdcmDocument::LoadElementValue","unread element value"); + if (gdcmValEntry* ValEntry = dynamic_cast< gdcmValEntry* >(Entry) ) + { + if ( item_read != 1 ) + { + dbg.Verbose(1, "gdcmDocument::LoadDocEntry", + "unread element value"); ValEntry->SetValue("gdcm::UnRead"); return; } @@ -1481,11 +1521,12 @@ void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry) ValEntry->SetValue(NewValue.c_str()); else ValEntry->SetValue(NewValue); - } else { - // fusible - std::cout << "Should have a ValEntry, here !" << std::endl; } - + else + { + dbg.Error(true, "gdcmDocument::LoadDocEntry" + "Should have a ValEntry, here !"); + } } @@ -1493,7 +1534,8 @@ void gdcmDocument::LoadDocEntry(gdcmDocEntry *Entry) * \brief Find the value Length of the passed Header Entry * @param Entry Header Entry whose length of the value shall be loaded. */ - void gdcmDocument::FindDocEntryLength (gdcmDocEntry *Entry) { +void gdcmDocument::FindDocEntryLength (gdcmDocEntry *Entry) +{ uint16_t element = Entry->GetElement(); std::string vr = Entry->GetVR(); uint16_t length16; @@ -1659,7 +1701,7 @@ void gdcmDocument::FindDocEntryVR( gdcmDocEntry *Entry) * @return false if the VR is incorrect of if the VR isn't referenced * otherwise, it returns true */ -bool gdcmDocument::CheckDocEntryVR(gdcmDocEntry *Entry, VRKey vr) +bool gdcmDocument::CheckDocEntryVR(gdcmDocEntry *Entry, gdcmVRKey vr) { char msg[100]; // for sprintf bool RealExplicit = true; @@ -1734,7 +1776,7 @@ std::string gdcmDocument::GetDocEntryValue(gdcmDocEntry *Entry) { std::string val=((gdcmValEntry *)Entry)->GetValue(); std::string vr=Entry->GetVR(); - guint32 length = Entry->GetLength(); + uint32_t length = Entry->GetLength(); std::ostringstream s; int nbInt; @@ -1747,7 +1789,7 @@ std::string gdcmDocument::GetDocEntryValue(gdcmDocEntry *Entry) if (vr == "US" || vr == "SS") { - guint16 NewInt16; + uint16_t NewInt16; nbInt = length / 2; for (int i=0; i < nbInt; i++) @@ -1768,7 +1810,7 @@ std::string gdcmDocument::GetDocEntryValue(gdcmDocEntry *Entry) // contain a set of integers (not a single one) else if (vr == "UL" || vr == "SL") { - guint32 NewInt32; + uint32_t NewInt32; nbInt = length / 4; for (int i=0; i < nbInt; i++) @@ -1808,7 +1850,7 @@ std::string gdcmDocument::GetDocEntryUnvalue(gdcmDocEntry *Entry) if (vr == "US" || vr == "SS") { - guint16 NewInt16; + uint16_t NewInt16; tokens.erase(tokens.begin(),tokens.end()); // clean any previous value Tokenize (((gdcmValEntry *)Entry)->GetValue(), tokens, "\\"); @@ -1821,7 +1863,7 @@ std::string gdcmDocument::GetDocEntryUnvalue(gdcmDocEntry *Entry) } if (vr == "UL" || vr == "SL") { - guint32 NewInt32; + uint32_t NewInt32; tokens.erase(tokens.begin(),tokens.end()); // clean any previous value Tokenize (((gdcmValEntry *)Entry)->GetValue(), tokens, "\\"); @@ -1870,15 +1912,15 @@ void gdcmDocument::SkipToNextDocEntry(gdcmDocEntry *entry) * applying some heuristics. */ void gdcmDocument::FixDocEntryFoundLength(gdcmDocEntry *Entry, - guint32 FoundLength) + uint32_t FoundLength) { Entry->SetReadLength(FoundLength); // will be updated only if a bug is found if ( FoundLength == 0xffffffff) { FoundLength = 0; } - guint16 gr =Entry->GetGroup(); - guint16 el =Entry->GetElement(); + uint16_t gr =Entry->GetGroup(); + uint16_t el =Entry->GetElement(); if (FoundLength%2) { std::ostringstream s; @@ -1949,10 +1991,10 @@ void gdcmDocument::FixDocEntryFoundLength(gdcmDocEntry *Entry, * @return The result of the heuristical predicate. */ bool gdcmDocument::IsDocEntryAnInteger(gdcmDocEntry *Entry) { - guint16 element = Entry->GetElement(); - guint16 group = Entry->GetGroup(); - std::string vr = Entry->GetVR(); - guint32 length = Entry->GetLength(); + uint16_t element = Entry->GetElement(); + uint16_t group = Entry->GetGroup(); + std::string vr = Entry->GetVR(); + uint32_t length = Entry->GetLength(); // When we have some semantics on the element we just read, and if we // a priori know we are dealing with an integer, then we shall be @@ -1992,7 +2034,7 @@ bool gdcmDocument::IsDocEntryAnInteger(gdcmDocEntry *Entry) { * @return */ -uint32_t gdcmDocument::FindDocEntryLengthOB(void) { +uint32_t gdcmDocument::FindDocEntryLengthOB() { // See PS 3.5-2001, section A.4 p. 49 on encapsulation of encoded pixel data. uint16_t g; uint16_t n; @@ -2041,8 +2083,8 @@ uint32_t gdcmDocument::FindDocEntryLengthOB(void) { * (swaps it depending on processor endianity) * @return read value */ -guint16 gdcmDocument::ReadInt16() { - guint16 g; +uint16_t gdcmDocument::ReadInt16() { + uint16_t g; size_t item_read; item_read = fread (&g, (size_t)2,(size_t)1, fp); if ( item_read != 1 ) { @@ -2061,8 +2103,8 @@ guint16 gdcmDocument::ReadInt16() { * (swaps it depending on processor endianity) * @return read value */ -guint32 gdcmDocument::ReadInt32() { - guint32 g; +uint32_t gdcmDocument::ReadInt32() { + uint32_t g; size_t item_read; item_read = fread (&g, (size_t)4,(size_t)1, fp); if ( item_read != 1 ) { @@ -2081,7 +2123,7 @@ guint32 gdcmDocument::ReadInt32() { * \warning NOT end user intended method ! * @return */ -void gdcmDocument::SkipBytes(guint32 NBytes) { +void gdcmDocument::SkipBytes(uint32_t NBytes) { //FIXME don't dump the returned value (void)fseek(fp, (long)NBytes, SEEK_CUR); } @@ -2090,7 +2132,7 @@ void gdcmDocument::SkipBytes(guint32 NBytes) { * \brief Loads all the needed Dictionaries * \warning NOT end user intended method ! */ -void gdcmDocument::Initialise(void) +void gdcmDocument::Initialise() { RefPubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict(); RefShaDict = NULL; @@ -2111,10 +2153,10 @@ bool gdcmDocument::CheckSwap() { // 0x00000004. Finding the swap code in then straigthforward. Trouble // occurs when we can't find such group... - guint32 x=4; // x : for ntohs + uint32_t x=4; // x : for ntohs bool net2host; // true when HostByteOrder is the same as NetworkByteOrder - guint32 s32; - guint16 s16; + uint32_t s32; + uint16_t s16; int lgrLue; char *entCur; @@ -2212,7 +2254,7 @@ bool gdcmDocument::CheckSwap() { // We assume the array of char we are considering contains the binary // representation of a 32 bits integer. Hence the following dirty // trick : - s32 = *((guint32 *)(entCur)); + s32 = *((uint32_t *)(entCur)); switch (s32) { case 0x00040000 : @@ -2248,7 +2290,7 @@ bool gdcmDocument::CheckSwap() { // the file IS NOT ACR-NEMA nor DICOM V3 // Find a trick to tell it the caller... - s16 = *((guint16 *)(deb)); + s16 = *((uint16_t *)(deb)); switch (s16) { case 0x0002 : @@ -2283,7 +2325,7 @@ bool gdcmDocument::CheckSwap() { * \brief Restore the unproperly loaded values i.e. the group, the element * and the dictionary entry depending on them. */ -void gdcmDocument::SwitchSwapToBigEndian(void) +void gdcmDocument::SwitchSwapToBigEndian() { dbg.Verbose(1, "gdcmDocument::SwitchSwapToBigEndian", "Switching to BigEndian mode."); @@ -2314,7 +2356,7 @@ void gdcmDocument::SetMaxSizeLoadEntry(long NewSize) { if (NewSize < 0) return; - if ((guint32)NewSize >= (guint32)0xffffffff) + if ((uint32_t)NewSize >= (uint32_t)0xffffffff) { MaxSizeLoadEntry = 0xffffffff; return; @@ -2332,7 +2374,7 @@ void gdcmDocument::SetMaxSizePrintEntry(long NewSize) { if (NewSize < 0) return; - if ((guint32)NewSize >= (guint32)0xffffffff) + if ((uint32_t)NewSize >= (uint32_t)0xffffffff) { MaxSizePrintEntry = 0xffffffff; return; @@ -2349,11 +2391,10 @@ void gdcmDocument::SetMaxSizePrintEntry(long NewSize) * gets the VR, gets the length, gets the offset value) * @return On succes the newly created DocEntry, NULL on failure. */ -gdcmDocEntry *gdcmDocument::ReadNextDocEntry(void) { - guint16 g,n; +gdcmDocEntry *gdcmDocument::ReadNextDocEntry() { + uint16_t g = ReadInt16(); + uint16_t n = ReadInt16(); gdcmDocEntry *NewEntry; - g = ReadInt16(); - n = ReadInt16(); if (errno == 1) // We reached the EOF (or an error occured) therefore @@ -2376,16 +2417,16 @@ gdcmDocEntry *gdcmDocument::ReadNextDocEntry(void) { /** - * \brief Generate a free TagKey i.e. a TagKey that is not present + * \brief Generate a free gdcmTagKey i.e. a gdcmTagKey that is not present * in the TagHt dictionary. * @param group The generated tag must belong to this group. * @return The element of tag with given group which is fee. */ -guint32 gdcmDocument::GenerateFreeTagKeyInGroup(guint16 group) +uint32_t gdcmDocument::GenerateFreeTagKeyInGroup(uint16_t group) { - for (guint32 elem = 0; elem < UINT32_MAX; elem++) + for (uint32_t elem = 0; elem < UINT32_MAX; elem++) { - TagKey key = gdcmDictEntry::TranslateToKey(group, elem); + gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, elem); if (tagHT.count(key) == 0) return elem; } @@ -2458,7 +2499,7 @@ uint32_t gdcmDocument::ReadTagLength(uint16_t TestGroup, uint16_t TestElement) //// Then read the associated Item Length long CurrentPosition = ftell(fp); - guint32 ItemLength; + uint32_t ItemLength; ItemLength = ReadInt32(); { std::ostringstream s; @@ -2475,7 +2516,7 @@ uint32_t gdcmDocument::ReadTagLength(uint16_t TestGroup, uint16_t TestElement) * No other way so 'skip' the Data * */ -void gdcmDocument::Parse7FE0 (void) +void gdcmDocument::Parse7FE0 () { gdcmDocEntry* Element = GetDocEntryByNumber(0x0002, 0x0010); if ( !Element ) @@ -2490,7 +2531,7 @@ void gdcmDocument::Parse7FE0 (void) // ---------------- for Parsing : Position on begining of Jpeg/RLE Pixels //// Read the Basic Offset Table Item Tag length... - guint32 ItemLength = ReadTagLength(0xfffe, 0xe000); + uint32_t ItemLength = ReadTagLength(0xfffe, 0xe000); //// ... and then read length[s] itself[themselves]. We don't use // the values read (BTW what is the purpous of those lengths ?) @@ -2499,8 +2540,8 @@ void gdcmDocument::Parse7FE0 (void) char * BasicOffsetTableItemValue = new char[ItemLength + 1]; fread(BasicOffsetTableItemValue, ItemLength, 1, fp); for (unsigned int i=0; i < ItemLength; i += 4){ - guint32 IndividualLength; - IndividualLength = str2num(&BasicOffsetTableItemValue[i],guint32); + uint32_t IndividualLength; + IndividualLength = str2num(&BasicOffsetTableItemValue[i],uint32_t); std::ostringstream s; s << " Read one length: "; s << std::hex << IndividualLength << std::endl; @@ -2529,10 +2570,10 @@ void gdcmDocument::Parse7FE0 (void) { // Parse fragments of the current Fragment (Frame) //------------------ scanning (not reading) fragment pixels - guint32 nbRleSegments = ReadInt32(); + uint32_t nbRleSegments = ReadInt32(); //// Reading RLE Segments Offset Table - guint32 RleSegmentOffsetTable[15]; + uint32_t RleSegmentOffsetTable[15]; for(int k=1; k<=15; k++) { ftellRes=ftell(fp); RleSegmentOffsetTable[k] = ReadInt32(); diff --git a/src/gdcmDocument.h b/src/gdcmDocument.h index 2bab7aba..c44e1c9b 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/06/29 23:43:20 $ - Version: $Revision: 1.20 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.21 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -36,11 +36,6 @@ class gdcmSeqEntry; #include #include -//----------------------------------------------------------------------------- -typedef std::string VRKey; -typedef std::string VRAtr; -typedef std::map VRHT; // Value Representation Hash Table - //----------------------------------------------------------------------------- /** * \brief Derived by both gdcmHeader and gdcmDicomDir @@ -64,12 +59,12 @@ private: /// in memory (to avoid loading the image/volume itself). By default, /// this upper bound is fixed to 1024 bytes (which might look reasonable /// when one considers the definition of the various VR contents). - guint32 MaxSizeLoadEntry; + uint32_t MaxSizeLoadEntry; /// \brief Size threshold above which an element value will NOT be *printed* /// in order no to polute the screen output. By default, this upper bound /// is fixed to 64 bytes. - guint32 MaxSizePrintEntry; + uint32_t MaxSizePrintEntry; protected: /// Refering underlying filename. @@ -113,52 +108,49 @@ public: virtual void PrintShaDict (std::ostream &os = std::cout); // Dictionnaries - gdcmDict *GetPubDict(void); - gdcmDict *GetShaDict(void); + gdcmDict *GetPubDict(); + gdcmDict *GetShaDict(); bool SetShaDict(gdcmDict *dict); bool SetShaDict(DictKey dictName); // Informations contained in the parser - virtual bool IsReadable(void); + virtual bool IsReadable(); bool IsGivenTransferSyntax(const std::string & SyntaxToCheck); - bool IsImplicitVRLittleEndianTransferSyntax(void); - bool IsExplicitVRLittleEndianTransferSyntax(void); - bool IsDeflatedExplicitVRLittleEndianTransferSyntax(void); - bool IsExplicitVRBigEndianTransferSyntax(void); - bool IsJPEGBaseLineProcess1TransferSyntax(void); - bool IsJPEGExtendedProcess2_4TransferSyntax(void); - bool IsJPEGExtendedProcess3_5TransferSyntax(void); - bool IsJPEGSpectralSelectionProcess6_8TransferSyntax(void); - bool IsRLELossLessTransferSyntax(void); - bool IsJPEGLossless(void); - bool IsJPEG2000(void); - bool IsDicomV3(void); - - FileType GetFileType(void); - -// Read (used in gdcmFile, gdcmDicomDir) - FILE *OpenFile(bool exception_on_error = false) throw(gdcmFileError); - bool CloseFile(void); - -// Write (used in gdcmFile, gdcmDicomDir) - - void Write(FILE * fp,FileType type); // New stuff, with recursive exploration - - gdcmValEntry * ReplaceOrCreateByNumber(std::string Value, - guint16 Group, guint16 Elem); - - gdcmBinEntry * ReplaceOrCreateByNumber(void *voidArea, int lgth, - guint16 Group, guint16 Elem); - bool ReplaceIfExistByNumber (char *Value, guint16 Group, guint16 Elem); + bool IsImplicitVRLittleEndianTransferSyntax(); + bool IsExplicitVRLittleEndianTransferSyntax(); + bool IsDeflatedExplicitVRLittleEndianTransferSyntax(); + bool IsExplicitVRBigEndianTransferSyntax(); + bool IsJPEGBaseLineProcess1TransferSyntax(); + bool IsJPEGExtendedProcess2_4TransferSyntax(); + bool IsJPEGExtendedProcess3_5TransferSyntax(); + bool IsJPEGSpectralSelectionProcess6_8TransferSyntax(); + bool IsRLELossLessTransferSyntax(); + bool IsJPEGLossless(); + bool IsJPEG2000(); + bool IsDicomV3(); + + FileType GetFileType(); + + FILE* OpenFile(bool exception_on_error = false) throw(gdcmFileError); + bool CloseFile(); + + void Write(FILE* fp,FileType type); + + gdcmValEntry* ReplaceOrCreateByNumber(std::string Value, + uint16_t Group, uint16_t Elem); + + gdcmBinEntry* ReplaceOrCreateByNumber(void *voidArea, int lgth, + uint16_t Group, uint16_t Elem); + bool ReplaceIfExistByNumber (char* Value, uint16_t Group, uint16_t Elem); - virtual void *LoadEntryVoidArea (guint16 Group, guint16 Element); - virtual void *LoadEntryVoidArea (gdcmBinEntry*); + virtual void* LoadEntryVoidArea(uint16_t Group, uint16_t Element); + virtual void* LoadEntryVoidArea(gdcmBinEntry*); // System access - guint16 SwapShort(guint16); // needed by gdcmFile - guint32 SwapLong(guint32); // needed by gdcmFile - guint16 UnswapShort(guint16); // needed by gdcmFile - guint32 UnswapLong(guint32); // needed by gdcmFile + uint16_t SwapShort(uint16_t); // needed by gdcmFile + uint32_t SwapLong(uint32_t); // needed by gdcmFile + uint16_t UnswapShort(uint16_t); // needed by gdcmFile + uint32_t UnswapLong(uint32_t); // needed by gdcmFile protected: // Constructor and destructor are protected to forbid end user @@ -169,40 +161,41 @@ protected: bool exception_on_error = false, bool enable_sequences = false, bool ignore_shadow = false); - virtual ~gdcmDocument(void); + virtual ~gdcmDocument(); - void gdcmDocument::Parse7FE0 (void); + void gdcmDocument::Parse7FE0 (); // Entry - int CheckIfEntryExistByNumber(guint16 Group, guint16 Elem ); // int ! + int CheckIfEntryExistByNumber(uint16_t Group, uint16_t Elem ); // int ! public: virtual std::string GetEntryByName (TagName tagName); virtual std::string GetEntryVRByName (TagName tagName); - virtual std::string GetEntryByNumber (guint16 group, guint16 element); - virtual std::string GetEntryVRByNumber(guint16 group, guint16 element); - virtual int GetEntryLengthByNumber(guint16 group, guint16 element); + virtual std::string GetEntryByNumber (uint16_t group, uint16_t element); + virtual std::string GetEntryVRByNumber(uint16_t group, uint16_t element); + virtual int GetEntryLengthByNumber(uint16_t group, uint16_t element); protected: virtual bool SetEntryByName (std::string content, std::string tagName); virtual bool SetEntryByNumber(std::string content, - guint16 group, guint16 element); + uint16_t group, uint16_t element); virtual bool SetEntryByNumber(void *content, int lgth, - guint16 group, guint16 element); - virtual bool SetEntryLengthByNumber(guint32 length, - guint16 group, guint16 element); + uint16_t group, uint16_t element); + virtual bool SetEntryLengthByNumber(uint32_t length, + uint16_t group, uint16_t element); - virtual size_t GetEntryOffsetByNumber (guint16 Group, guint16 Elem); - virtual void *GetEntryVoidAreaByNumber(guint16 Group, guint16 Elem); - virtual bool SetEntryVoidAreaByNumber(void *a, guint16 Group, guint16 Elem); + virtual size_t GetEntryOffsetByNumber(uint16_t Group, uint16_t Elem); + virtual void* GetEntryVoidAreaByNumber(uint16_t Group, uint16_t Elem); + virtual bool SetEntryVoidAreaByNumber(void* a, uint16_t Group, + uint16_t Elem); virtual void UpdateShaEntries(); // Header entry - gdcmDocEntry *GetDocEntryByNumber (guint16 group, guint16 element); - gdcmDocEntry *GetDocEntryByName (std::string Name); + gdcmDocEntry* GetDocEntryByNumber(uint16_t group, uint16_t element); + gdcmDocEntry* GetDocEntryByName (std::string Name); - gdcmValEntry *GetValEntryByNumber (guint16 group, guint16 element); - gdcmBinEntry *GetBinEntryByNumber (guint16 group, guint16 element); + gdcmValEntry* GetValEntryByNumber(uint16_t group, uint16_t element); + gdcmBinEntry* GetBinEntryByNumber(uint16_t group, uint16_t element); - void LoadDocEntrySafe(gdcmDocEntry *); + void LoadDocEntrySafe(gdcmDocEntry*); private: // Read @@ -212,7 +205,7 @@ private: void LoadDocEntry (gdcmDocEntry *); void FindDocEntryLength(gdcmDocEntry *); void FindDocEntryVR (gdcmDocEntry *); - bool CheckDocEntryVR (gdcmDocEntry *, VRKey); + bool CheckDocEntryVR (gdcmDocEntry *, gdcmVRKey); std::string GetDocEntryValue (gdcmDocEntry *); std::string GetDocEntryUnvalue(gdcmDocEntry *); @@ -220,15 +213,15 @@ private: void SkipDocEntry (gdcmDocEntry *); void SkipToNextDocEntry (gdcmDocEntry *); - void FixDocEntryFoundLength(gdcmDocEntry *, guint32); + void FixDocEntryFoundLength(gdcmDocEntry *, uint32_t); bool IsDocEntryAnInteger (gdcmDocEntry *); - guint32 FindDocEntryLengthOB(); + uint32_t FindDocEntryLengthOB(); - guint16 ReadInt16(); - guint32 ReadInt32(); - void SkipBytes(guint32); - bool ReadTag(uint16_t, uint16_t); + uint16_t ReadInt16(); + uint32_t ReadInt32(); + void SkipBytes(uint32_t); + bool ReadTag(uint16_t, uint16_t); uint32_t ReadTagLength(uint16_t, uint16_t); void Initialise(); @@ -238,30 +231,29 @@ private: void SetMaxSizePrintEntry(long); // DocEntry related utilities - gdcmDocEntry *ReadNextDocEntry (); - + gdcmDocEntry* ReadNextDocEntry(); - guint32 GenerateFreeTagKeyInGroup(guint16 group); + uint32_t GenerateFreeTagKeyInGroup(uint16_t group); public: // Accessors: /// Accessor to \ref printLevel - inline void SetPrintLevel(int level) { printLevel = level; } + void SetPrintLevel(int level) { printLevel = level; } /// Accessor to \ref Filename - inline std::string &GetFileName() { return Filename; } + std::string &GetFileName() { return Filename; } /// Accessor to \ref Filename - inline void SetFileName(const char* fileName) { Filename = fileName; } + void SetFileName(const char* fileName) { Filename = fileName; } /// Accessor to \ref gdcmElementSet::tagHT - inline TagDocEntryHT &GetEntry() { return tagHT; }; + TagDocEntryHT &GetEntry() { return tagHT; }; /// 'Swap code' accessor (see \ref sw ) - inline int GetSwapCode() { return sw; } + int GetSwapCode() { return sw; } /// File pointer - inline FILE * GetFP() { return fp; } + FILE * GetFP() { return fp; } bool operator<(gdcmDocument &document); diff --git a/src/gdcmElementSet.cxx b/src/gdcmElementSet.cxx index 18af6a70..f22b4ae0 100644 --- a/src/gdcmElementSet.cxx +++ b/src/gdcmElementSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmElementSet.cxx,v $ Language: C++ - Date: $Date: 2004/06/25 03:06:38 $ - Version: $Revision: 1.14 $ + Date: $Date: 2004/07/02 13:55:27 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -104,7 +104,7 @@ void gdcmElementSet::Write(FILE *fp, FileType filetype) * @param NewEntry entry to add */ bool gdcmElementSet::AddEntry( gdcmDocEntry *NewEntry) { - TagKey key; + gdcmTagKey key; key = NewEntry->GetKey(); if(tagHT.count(key) == 1) @@ -126,7 +126,7 @@ bool gdcmElementSet::AddEntry( gdcmDocEntry *NewEntry) { */ bool gdcmElementSet::RemoveEntry( gdcmDocEntry *EntryToRemove) { - TagKey key = EntryToRemove->GetKey(); + gdcmTagKey key = EntryToRemove->GetKey(); if(tagHT.count(key) == 1) { tagHT.erase(key); diff --git a/src/gdcmElementSet.h b/src/gdcmElementSet.h index a7b8b672..88a1c55b 100644 --- a/src/gdcmElementSet.h +++ b/src/gdcmElementSet.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmElementSet.h,v $ Language: C++ - Date: $Date: 2004/06/22 13:47:33 $ - Version: $Revision: 1.9 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -29,7 +29,7 @@ class gdcmBinEntry; class gdcmSeqEntry; -typedef std::map TagDocEntryHT; +typedef std::map TagDocEntryHT; //----------------------------------------------------------------------------- diff --git a/src/gdcmFile.cxx b/src/gdcmFile.cxx index ec0eb7d3..ade5daf0 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/06/28 16:00:18 $ - Version: $Revision: 1.114 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.115 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -473,9 +473,9 @@ size_t gdcmFile::GetImageDataIntoVectorRaw (void *destination, size_t maxSize) } else if ( nb == 32 ) { - guint32 mask = 0xffffffff; + uint32_t mask = 0xffffffff; mask = mask >> (nb - nbu); - guint32 *deb = (guint32 *)destination; + uint32_t *deb = (uint32_t *)destination; for(int i = 0; i> (nbu - highBit - 1)) & mask; diff --git a/src/gdcmFile.h b/src/gdcmFile.h index c824a342..a8926b72 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/06/26 04:09:33 $ - Version: $Revision: 1.36 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.37 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -39,17 +39,8 @@ public: virtual ~gdcmFile(); - /// \brief returns the gdcmHeader *Header - inline gdcmHeader *GetHeader() { return Header; } - - // For promotion (performs a deepcopy of pointed header object) - // TODO Swig gdcmFile(gdcmHeader* header); - // TODO Swig ~gdcmFile(); - - // On writing purposes. When instance was created through - // gdcmFile(std::string filename) then the filename argument MUST be - // different from the constructor's one (no overwriting allowed). - // TODO Swig int SetFileName(std::string filename); + /// Accessor to \ref Header + gdcmHeader* GetHeader() { return Header; } void SetPixelDataSizeFromHeader(); size_t GetImageDataSize(); @@ -68,11 +59,9 @@ public: // voir gdcmHeader::SetImageDataSize ?!? bool SetImageData (void * Data, size_t ExpectedSize); - // When the caller is aware we simply point to the data: - // TODO int SetImageDataNoCopy (void * Data, size_t ExpectedSize); - // Push to disk. - // TODO Swig int Write(); + /// \todo When the caller is aware we simply point to the data: + /// int SetImageDataNoCopy (void * Data, size_t ExpectedSize); // Write pixels of ONE image on hard drive // No test is made on processor "endianity" @@ -86,11 +75,11 @@ public: // It's in file gdcmParsePixels.cxx bool ParsePixelData(); - inline virtual bool SetEntryByNumber(std::string const & content, - guint16 group, guint16 element) + virtual bool SetEntryByNumber(std::string const & content, + uint16_t group, uint16_t element) { GetHeader()->SetEntryByNumber(content,group,element); - return true; //default behavior ? + return true; /// \todo default behavior ? } protected: diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index a517ed5b..64a970af 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/06/29 14:38:29 $ - Version: $Revision: 1.175 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.176 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -57,7 +57,7 @@ gdcmHeader::gdcmHeader(std::string const & filename, if ( ImageLocation == GDCM_UNFOUND ) { // Image Location GrPixel = 0x7fe0; // default value } else { - GrPixel = (guint16) atoi( ImageLocation.c_str() ); + GrPixel = (uint16_t) atoi( ImageLocation.c_str() ); } if (GrPixel == 0xe07f) // sometimes Image Location value doesn't follow GrPixel = 0x7fe0; // the supposed processor endianity. diff --git a/src/gdcmHeader.h b/src/gdcmHeader.h index 2b01cc81..63eec517 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/06/28 09:51:02 $ - Version: $Revision: 1.79 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.80 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -98,13 +98,13 @@ protected: /// make things easier the parser shall store the proper value in /// NumPixel to provide a unique access facility. See also the constructor /// \ref gdcmHeader::gdcmHeader - guint16 NumPixel; + uint16_t NumPixel; /// \brief In some cases (e.g. for some ACR-NEMA images) the header entry for /// the group of pixels is *not* found at 0x7fe0. In order to /// make things easier the parser shall store the proper value in /// GrPixel to provide a unique access facility. See also the constructor /// \ref gdcmHeader::gdcmHeader - guint16 GrPixel; + uint16_t GrPixel; public: gdcmHeader(bool exception_on_error = false); @@ -175,10 +175,10 @@ public: std::string GetTransfertSyntaxName(); /// Accessor to \ref gdcmHeader::GrPixel - guint16 GetGrPixel() {return GrPixel;} + uint16_t GetGrPixel() {return GrPixel;} /// Accessor to \ref gdcmHeader::NumPixel - guint16 GetNumPixel() {return NumPixel;} + uint16_t GetNumPixel() {return NumPixel;} /// Read (used in gdcmFile) void SetImageDataSize(size_t expectedSize); diff --git a/src/gdcmHeaderHelper.h b/src/gdcmHeaderHelper.h index 1cf66015..f2305d41 100644 --- a/src/gdcmHeaderHelper.h +++ b/src/gdcmHeaderHelper.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmHeaderHelper.h,v $ Language: C++ - Date: $Date: 2004/06/25 20:48:25 $ - Version: $Revision: 1.19 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.20 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -35,27 +35,21 @@ public: gdcmSerieHeader(); ~gdcmSerieHeader(); - void AddFileName(std::string const & filename); //should return bool or throw error ? + /// \todo should return bool or throw error ? + void AddFileName(std::string const & filename); void AddGdcmFile(gdcmHeader *file); void SetDirectory(std::string const & dir); void OrderGdcmFileList(); - inline gdcmHeader *GetGdcmHeader() - { - // Assume all element in the list have the same global infos - // Assume the list is not empty - return CoherentGdcmFileList.front(); - } + /// \warning Assumes all elements in the list have the same global infos. + /// Assumes the list is not empty. + gdcmHeader* GetGdcmHeader() { return CoherentGdcmFileList.front(); } typedef std::list GdcmHeaderList; - /** - * \brief Gets the *coherent* File List - * @return the *coherent* File List - */ - const GdcmHeaderList& GetGdcmFileList() - { - return CoherentGdcmFileList; - } + + /// \brief Gets the *coherent* File List + /// @return the *coherent* File List + const GdcmHeaderList& GetGdcmFileList() { return CoherentGdcmFileList; } private: bool ImagePositionPatientOrdering(); diff --git a/src/gdcmObject.cxx b/src/gdcmObject.cxx index 73172ae2..78749dab 100644 --- a/src/gdcmObject.cxx +++ b/src/gdcmObject.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmObject.cxx,v $ Language: C++ - Date: $Date: 2004/06/20 18:08:48 $ - Version: $Revision: 1.20 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.21 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -66,25 +66,9 @@ TagDocEntryHT gdcmObject::GetEntry(void) { return(HT); } -/** - * \ingroup gdcmObject - * \brief Builds a Chained List containing - * pointers to all Header Entries (i.e Dicom Element) - * related to this 'object' - * @return - */ - - // FIXME : what was it used for ?!? - /* -ListTag gdcmObject::GetListEntry(void) { - return(GetDocEntries()); -} -*/ - //----------------------------------------------------------------------------- // Protected /** - * \ingroup gdcmObject * \brief add the 'Object' related Dicom Elements to the listEntries * of a partially created DICOMDIR */ @@ -93,7 +77,8 @@ void gdcmObject::FillObject(std::list elemList) { // FillObject rempli le SQItem qui sera accroche au bon endroit std::list::iterator it; - guint16 tmpGr,tmpEl; + uint16_t tmpGr; + uint16_t tmpEl; gdcmDictEntry *dictEntry; gdcmValEntry *entry; @@ -112,30 +97,25 @@ void gdcmObject::FillObject(std::list elemList) { // dealing with value length ... 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); - } + { + entry->SetLength(4); + } else if( (dictEntry->GetVR()=="US") || (dictEntry->GetVR()=="SS") ) - { - entry->SetLength(2); - } + { + entry->SetLength(2); + } else if(dictEntry->GetVR()=="SQ") - { - entry->SetLength(0xffffffff); - } + { + entry->SetLength(0xffffffff); + } else - { - entry->SetLength(entry->GetValue().length()); - } - //docEntries->insert(debInsertion ,entry); // ??? // add at the begining of the Patient list - AddDocEntry(entry); + { + entry->SetLength(entry->GetValue().length()); + } + AddDocEntry(entry); } } -//----------------------------------------------------------------------------- -// Private - -//----------------------------------------------------------------------------- diff --git a/src/gdcmParsePixels.cxx b/src/gdcmParsePixels.cxx index 8918bd92..5d1a6b23 100644 --- a/src/gdcmParsePixels.cxx +++ b/src/gdcmParsePixels.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmParsePixels.cxx,v $ Language: C++ - Date: $Date: 2004/06/22 13:47:33 $ - Version: $Revision: 1.7 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.8 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -68,7 +68,8 @@ bool gdcmFile::ParsePixelData(void) { printf ("Checking the Dicom-encapsulated Jpeg/RLE Pixels\n"); - guint16 ItemTagGr,ItemTagEl; + uint16_t ItemTagGr; + uint16_t ItemTagEl; int ln; long ftellRes; //char * destination = NULL; @@ -97,9 +98,9 @@ bool gdcmFile::ParsePixelData(void) { // What is it used for ?? char * BasicOffsetTableItemValue= new char[ln+1]; fread(BasicOffsetTableItemValue,ln,1,fp); - guint32 a; + uint32_t a; for (int i=0;iGetXSize()*Header->GetYSize(); ftellRes=ftell(fp); // Basic Offset Table with Item Value @@ -59,9 +59,9 @@ bool gdcmFile::gdcm_read_RLE_file (FILE *fp,void * image_buffer) { // What is it used for ?? char * BasicOffsetTableItemValue= new char[ln+1]; fread(BasicOffsetTableItemValue,ln,1,fp); - guint32 a; + uint32_t a; for (int i=0;icount(key)) { @@ -207,7 +207,8 @@ bool gdcmSQItem::SetEntryByNumber(std::string val,guint16 group, * \brief Gets a Dicom Element inside a SQ Item Entry, by number * @return */ -gdcmDocEntry *gdcmSQItem::GetDocEntryByNumber(guint16 group, guint16 element) { +gdcmDocEntry *gdcmSQItem::GetDocEntryByNumber(uint16_t group, uint16_t element) +{ for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i) { if ( (*i)->GetGroup()==group && (*i)->GetElement()==element) return (*i); @@ -220,7 +221,8 @@ gdcmDocEntry *gdcmSQItem::GetDocEntryByNumber(guint16 group, guint16 element) { * @return */ -std::string gdcmSQItem::GetEntryByNumber(guint16 group, guint16 element) { +std::string gdcmSQItem::GetEntryByNumber(uint16_t group, uint16_t element) +{ for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i) { if ( (*i)->GetGroup()==group && (*i)->GetElement()==element) { return ((gdcmValEntry *)(*i))->GetValue(); diff --git a/src/gdcmSQItem.h b/src/gdcmSQItem.h index 1cfae31f..ee4cd01f 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/06/22 13:47:33 $ - Version: $Revision: 1.10 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -39,32 +39,27 @@ public: virtual void Write(FILE *fp, FileType filetype); /// \brief returns the DocEntry chained List for this SQ Item. - inline ListDocEntry &GetDocEntries() {return docEntries;}; + ListDocEntry &GetDocEntries() { return docEntries; }; /// \brief adds the passed DocEntry to the DocEntry chained List for /// this SQ Item. - inline void AddDocEntry(gdcmDocEntry *e) {docEntries.push_back(e);}; + void AddDocEntry(gdcmDocEntry *e) { docEntries.push_back(e); }; virtual bool AddEntry(gdcmDocEntry *Entry); // add to the List - gdcmDocEntry *GetDocEntryByNumber(guint16 group, guint16 element); + gdcmDocEntry *GetDocEntryByNumber(uint16_t group, uint16_t element); gdcmDocEntry *GetDocEntryByName (std::string Name); - bool SetEntryByNumber(std::string val,guint16 group, guint16 element); + bool SetEntryByNumber(std::string val, uint16_t group, uint16_t element); - virtual std::string GetEntryByNumber(guint16 group, guint16 element); + virtual std::string GetEntryByNumber(uint16_t group, uint16_t element); - inline int GetSQItemNumber() - {return SQItemNumber;}; + int GetSQItemNumber() { return SQItemNumber; }; - inline void SetSQItemNumber(int itemNumber) - {SQItemNumber=itemNumber;}; + void SetSQItemNumber(int itemNumber) { SQItemNumber=itemNumber; }; protected: -// DocEntry related utilities - - // Variables /// \brief chained list of (Elementary) Doc Entries diff --git a/src/gdcmSeqEntry.cxx b/src/gdcmSeqEntry.cxx index fd4d2499..9ba911ee 100644 --- a/src/gdcmSeqEntry.cxx +++ b/src/gdcmSeqEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSeqEntry.cxx,v $ Language: C++ - Date: $Date: 2004/06/24 18:03:14 $ - Version: $Revision: 1.20 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.21 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -88,12 +88,12 @@ void gdcmSeqEntry::Print(std::ostream &os){ */ void gdcmSeqEntry::Write(FILE *fp, FileType filetype) { - guint16 seq_term_gr = 0xfffe; - guint16 seq_term_el = 0xe0dd; - guint32 seq_term_lg = 0x00000000; + uint16_t seq_term_gr = 0xfffe; + uint16_t seq_term_el = 0xe0dd; + uint32_t seq_term_lg = 0x00000000; - guint16 item_term_gr = 0xfffe; - guint16 item_term_el = 0xe00d; + uint16_t item_term_gr = 0xfffe; + uint16_t item_term_el = 0xe00d; gdcmDocEntry::Write(fp, filetype); for(ListSQItem::iterator cc = GetSQItems().begin(); diff --git a/src/gdcmSeqEntry.h b/src/gdcmSeqEntry.h index d5de81da..6eed4cb1 100644 --- a/src/gdcmSeqEntry.h +++ b/src/gdcmSeqEntry.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSeqEntry.h,v $ Language: C++ - Date: $Date: 2004/06/23 13:02:36 $ - Version: $Revision: 1.13 $ + Date: $Date: 2004/07/02 13:55:28 $ + 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 @@ -37,14 +37,14 @@ public: virtual void Print(std::ostream &os = std::cout); virtual void Write(FILE *fp, FileType); - /// \brief returns the SQITEM chained List for this SeQuence. - inline ListSQItem &GetSQItems() { return items; } + /// returns the SQITEM chained List for this SeQuence. + ListSQItem &GetSQItems() { return items; } - /// \brief Sets the delimitor mode - inline void SetDelimitorMode(bool dm) { delimitor_mode = dm;} + /// Sets the delimitor mode + void SetDelimitorMode(bool dm) { delimitor_mode = dm;} - /// \brief Sets the Sequence Delimitation Item - inline void SetSequenceDelimitationItem(gdcmDocEntry * e) { seq_term = e;} + /// Sets the Sequence Delimitation Item + void SetSequenceDelimitationItem(gdcmDocEntry * e) { seq_term = e;} void AddEntry(gdcmSQItem *it, int itemNumber); gdcmSQItem *GetSQItemByOrdinalNumber(int itemNumber); @@ -56,13 +56,13 @@ protected: private: // Variables - /// \brief If this Sequence is in delimitor mode (length =0xffffffff) or not + /// If this Sequence is in delimitor mode (length =0xffffffff) or not bool delimitor_mode; - /// \brief Chained list of SQ Items + /// Chained list of SQ Items ListSQItem items; - /// \brief sequence terminator item + /// sequence terminator item gdcmDocEntry *seq_term; }; diff --git a/src/gdcmVR.cxx b/src/gdcmVR.cxx index bf12afe8..3fcb456c 100644 --- a/src/gdcmVR.cxx +++ b/src/gdcmVR.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmVR.cxx,v $ Language: C++ - Date: $Date: 2004/06/28 09:30:58 $ - Version: $Revision: 1.14 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -76,7 +76,7 @@ void gdcmVR::Print(std::ostream &os) { std::ostringstream s; - for (VRHT::iterator it = vr.begin(); it != vr.end(); ++it) + for (gdcmVRHT::iterator it = vr.begin(); it != vr.end(); ++it) { s << "VR : "<first<<" = "<second< //----------------------------------------------------------------------------- -typedef std::string VRKey; -typedef std::string VRAtr; -typedef std::map VRHT; // Value Representation Hash Table +typedef std::string gdcmVRKey; +typedef std::string gdcmVRAtr; +/// Value Representation Hash Table +typedef std::map gdcmVRHT; //----------------------------------------------------------------------------- /* @@ -41,12 +42,12 @@ public: ~gdcmVR(); void Print(std::ostream &os = std::cout); - int Count(VRKey key); - bool IsVROfGdcmBinaryRepresentable(VRKey); - bool IsVROfGdcmStringRepresentable(VRKey); + int Count(gdcmVRKey key); + bool IsVROfGdcmBinaryRepresentable(gdcmVRKey); + bool IsVROfGdcmStringRepresentable(gdcmVRKey); private: - VRHT vr; + gdcmVRHT vr; }; //----------------------------------------------------------------------------- diff --git a/src/gdcmValEntry.cxx b/src/gdcmValEntry.cxx index 139496c3..d10cacae 100644 --- a/src/gdcmValEntry.cxx +++ b/src/gdcmValEntry.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmValEntry.cxx,v $ Language: C++ - Date: $Date: 2004/06/28 11:01:18 $ - Version: $Revision: 1.15 $ + Date: $Date: 2004/07/02 13:55:28 $ + Version: $Revision: 1.16 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -69,8 +69,8 @@ gdcmValEntry::~gdcmValEntry (void) */ void gdcmValEntry::Print(std::ostream & os) { - guint16 g = GetGroup(); - guint16 e = GetElement(); + uint16_t g = GetGroup(); + uint16_t e = GetElement(); std::string vr = GetVR(); std::ostringstream s; char st[20]; @@ -147,7 +147,7 @@ void gdcmValEntry::Write(FILE *fp, FileType filetype) tokens.erase(tokens.begin(),tokens.end()); // clean any previous value Tokenize (GetValue(), tokens, "\\"); for (unsigned int i=0; i