2004-07-02 Eric Boix <Eric.Boix@creatis.insa-lyon.fr>
+ * 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
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
/// \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:
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
//-----------------------------------------------------------------------------
#ifdef __GNUC__
#ifndef HAVE_NO_STDINT_H
-#include <stdint.h>
-#define guint16 uint16_t
-#define guint32 uint32_t
-#define gint16 int16_t
-#define gint32 int32_t
+#include <stdint.h> // 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
const std::string GDCM_UNFOUND = "gdcm::Unfound"; /// MEMORY LEAK
-typedef std::string TagKey;
+typedef std::string gdcmTagKey;
typedef std::string TagName;
enum FileType {
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
* \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);
/**
- * \ingroup gdcmDicomDir
* \brief adds a new Patient (with the basic elements) to a partially created DICOMDIR
*/
gdcmDicomDirPatient * gdcmDicomDir::NewPatient(void) {
std::list<gdcmElement> elemList;
std::list<gdcmElement>::iterator it;
- guint16 tmpGr,tmpEl;
+ uint16_t tmpGr,tmpEl;
gdcmDictEntry *dictEntry;
gdcmValEntry *entry;
elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements();
- // TODO : use FillObject !!!
+ /// \todo TODO : use FillObject !!!
// for all the DicomDirPatient Elements
{
std::list<gdcmElement> elemList;
std::list<gdcmElement>::iterator it;
- guint16 tmpGr, tmpEl;
+ uint16_t tmpGr, tmpEl;
gdcmDictEntry *dictEntry;
gdcmValEntry *entry;
std::string val;
}
/**
- * \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;
+///
}
//-----------------------------------------------------------------------------
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
#include <vector>
//-----------------------------------------------------------------------------
-typedef std::list<gdcmDicomDirPatient *> ListDicomDirPatient;
-typedef std::vector<gdcmDocument *> VectDocument;
+typedef std::list<gdcmDicomDirPatient*> ListDicomDirPatient;
+typedef std::vector<gdcmDocument*> VectDocument;
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);
~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);
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,
protected:
void CreateDicomDirChainedList(std::string path);
-
void CallStartMethod(void);
void CallProgressMethod(void);
void CallEndMethod(void);
private:
void Initialize(void);
void CreateDicomDir(void);
-// void AddObjectToEnd(gdcmDicomDirType type, gdcmSQItem *s);
void AddDicomDirMeta ();
void AddDicomDirPatientToEnd(gdcmSQItem *s);
void AddDicomDirStudyToEnd (gdcmSQItem *s);
// 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
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
#include "gdcmDicomDirStudy.h"
#include "gdcmSQItem.h"
//-----------------------------------------------------------------------------
-typedef std::list<gdcmDicomDirStudy *> ListDicomDirStudy;
+typedef std::list<gdcmDicomDirStudy*> ListDicomDirStudy;
//-----------------------------------------------------------------------------
class GDCM_EXPORT gdcmDicomDirPatient : public gdcmObject
~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;
};
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
* \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);};
/**
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
* \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);};
/**
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
* @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;
from >> element;
from >> vr;
from >> fourth;
- eatwhite(from);
+ eatwhite(from);
getline(from, name); /// MEMORY LEAK in std::getline<>
gdcmDictEntry * newEntry = new gdcmDictEntry(group, element,
* \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;
* 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;
*/
bool gdcmDict::AddNewEntry(gdcmDictEntry *NewEntry)
{
- TagKey key;
+ gdcmTagKey key;
key = NewEntry->GetKey();
if(KeyHt.count(key) == 1)
* @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)
{
}
/**
- * \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 !
* 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<std::string> *gdcmDict::GetDictEntryNames(void)
+std::list<std::string>* gdcmDict::GetDictEntryNames(void)
{
std::list<std::string> *Result = new std::list<std::string>;
for (TagKeyHT::iterator tag = KeyHt.begin(); tag != KeyHt.end(); ++tag)
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
#include <map>
//-----------------------------------------------------------------------------
-typedef std::map<TagKey, gdcmDictEntry*> TagKeyHT;
+typedef std::map<gdcmTagKey, gdcmDictEntry*> TagKeyHT;
typedef std::map<TagName, gdcmDictEntry*> TagNameHT;
//-----------------------------------------------------------------------------
// 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<std::string> *GetDictEntryNames(void);
std::map<std::string, std::list<std::string> > *
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;
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
* @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)
{
//-----------------------------------------------------------------------------
// 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;
}
/**
*/
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");
+ }
}
//-----------------------------------------------------------------------------
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
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.
*
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;
};
//-----------------------------------------------------------------------------
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
}
/**
- * \ingroup gdcmDictSet
* \brief Retrieve the default reference DICOM V3 public dictionary.
* \result The retrieved default dictionary.
*/
}
/**
- * \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<std::string,gdcmDictEntry *>::iterator it;
it=virtualEntry.find(tag);
}
/**
- * \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
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
*/
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);
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");
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
TSKey v;
std::string d2, vr;
std::ostringstream s;
- guint32 lgth;
+ uint32_t lgth;
char greltag[10]; //group element tag
g = GetGroup();
*/
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
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
* \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)
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
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(); };
/// \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 !
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);
/// \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;}
/// \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
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
* @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);
* @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);
* @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);
* @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();
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
class GDCM_EXPORT gdcmDocEntrySet
{
-
public:
gdcmDocEntrySet(int depth = 0);
/// \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
/// \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;
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
* @param exception_on_error
*/
gdcmDocument::gdcmDocument(bool exception_on_error)
- :gdcmElementSet(-1) {
+ :gdcmElementSet(-1)
+{
(void)exception_on_error;
//enableSequences=0; // ?!? JPR
/**
* \brief Canonical destructor.
*/
-gdcmDocument::~gdcmDocument (void) {
+gdcmDocument::~gdcmDocument ()
+{
RefPubDict = NULL;
RefShaDict = NULL;
* \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);
}
* \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);
}
/**
* \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;
}
* \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;
}
* \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;
}
* @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
* \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);
}
* 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);
}
* 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);
}
* 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);
}
* 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);
}
* 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);
}
* 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);
}
* @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);
}
* @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);
}
* 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)
* @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) );
* \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 ?
* (ACR, ACR_LIBIDO, ExplicitVR, ImplicitVR, Unknown)
* @return the FileType code
*/
-FileType gdcmDocument::GetFileType(void) {
+FileType gdcmDocument::GetFileType()
+{
return Filetype;
}
if ( fp )
{
- guint16 zero;
+ uint16_t zero;
fread(&zero, (size_t)2, (size_t)1, fp);
//ACR -- or DICOM with no Preamble --
* \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)
* (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
gdcmValEntry * gdcmDocument::ReplaceOrCreateByNumber(
std::string Value,
- guint16 Group,
- guint16 Elem )
+ uint16_t Group,
+ uint16_t Elem )
{
gdcmDocEntry* CurrentEntry;
gdcmValEntry* ValEntry;
gdcmBinEntry * gdcmDocument::ReplaceOrCreateByNumber(
void *voidArea,
int lgth,
- guint16 Group,
- guint16 Elem)
+ uint16_t Group,
+ uint16_t Elem)
{
gdcmDocEntry* a;
gdcmBinEntry* b = 0;
return b;
}
-
-
/**
* \brief Set a new value if the invoked element exists
* Seems to be useless !!!
* @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);
* @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);
}
* @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;
* @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;
* @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;
* @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;
* @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;
* @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;
* @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)
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") )
* @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;
* @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
* @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)
* @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)
* @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 )
* @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 ?
* \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;
* @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;
* @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;
* 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)
* @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);
* 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;
* processor order.
* @return The properly unswaped 32 bits integer.
*/
-guint32 gdcmDocument::UnswapLong(guint32 a) {
+uint32_t gdcmDocument::UnswapLong(uint32_t a)
+{
return SwapLong(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;
* \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);
}
* @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;
* 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);
// (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;
}
// 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)";
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) )
}
// 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;
// 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;
}
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 !");
+ }
}
* \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;
* @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;
{
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;
if (vr == "US" || vr == "SS")
{
- guint16 NewInt16;
+ uint16_t NewInt16;
nbInt = length / 2;
for (int i=0; i < nbInt; i++)
// 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++)
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, "\\");
}
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, "\\");
* 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;
* @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
* @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;
* (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 ) {
* (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 ) {
* \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);
}
* \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;
// 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;
// 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 :
// 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 :
* \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.");
{
if (NewSize < 0)
return;
- if ((guint32)NewSize >= (guint32)0xffffffff)
+ if ((uint32_t)NewSize >= (uint32_t)0xffffffff)
{
MaxSizeLoadEntry = 0xffffffff;
return;
{
if (NewSize < 0)
return;
- if ((guint32)NewSize >= (guint32)0xffffffff)
+ if ((uint32_t)NewSize >= (uint32_t)0xffffffff)
{
MaxSizePrintEntry = 0xffffffff;
return;
* 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
/**
- * \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;
}
//// Then read the associated Item Length
long CurrentPosition = ftell(fp);
- guint32 ItemLength;
+ uint32_t ItemLength;
ItemLength = ReadInt32();
{
std::ostringstream s;
* No other way so 'skip' the Data
*
*/
-void gdcmDocument::Parse7FE0 (void)
+void gdcmDocument::Parse7FE0 ()
{
gdcmDocEntry* Element = GetDocEntryByNumber(0x0002, 0x0010);
if ( !Element )
// ---------------- 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 ?)
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;
{
// 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();
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
#include <map>
#include <list>
-//-----------------------------------------------------------------------------
-typedef std::string VRKey;
-typedef std::string VRAtr;
-typedef std::map<VRKey, VRAtr> VRHT; // Value Representation Hash Table
-
//-----------------------------------------------------------------------------
/**
* \brief Derived by both gdcmHeader and gdcmDicomDir
/// 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.
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
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
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 *);
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();
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);
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
* @param NewEntry entry to add
*/
bool gdcmElementSet::AddEntry( gdcmDocEntry *NewEntry) {
- TagKey key;
+ gdcmTagKey key;
key = NewEntry->GetKey();
if(tagHT.count(key) == 1)
*/
bool gdcmElementSet::RemoveEntry( gdcmDocEntry *EntryToRemove)
{
- TagKey key = EntryToRemove->GetKey();
+ gdcmTagKey key = EntryToRemove->GetKey();
if(tagHT.count(key) == 1)
{
tagHT.erase(key);
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
class gdcmSeqEntry;
-typedef std::map<TagKey, gdcmDocEntry *> TagDocEntryHT;
+typedef std::map<gdcmTagKey, gdcmDocEntry *> TagDocEntryHT;
//-----------------------------------------------------------------------------
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
}
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<l; i++)
{
*deb = (*deb >> (nbu - highBit - 1)) & mask;
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
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();
// 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"
// 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:
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
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.
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
/// 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);
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);
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
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<gdcmHeader* > 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();
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
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
*/
// FillObject rempli le SQItem qui sera accroche au bon endroit
std::list<gdcmElement>::iterator it;
- guint16 tmpGr,tmpEl;
+ uint16_t tmpGr;
+ uint16_t tmpEl;
gdcmDictEntry *dictEntry;
gdcmValEntry *entry;
// 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
-
-//-----------------------------------------------------------------------------
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
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;
// 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;i<ln;i+=4){
- a=str2num(&BasicOffsetTableItemValue[i],guint32);
+ a=str2num(&BasicOffsetTableItemValue[i],uint32_t);
printf(" x(%08x) %d\n",a,a);
}
}
// RLE Image
long RleSegmentLength[15],fragmentLength;
- guint32 nbRleSegments;
- guint32 RleSegmentOffsetTable[15];
+ uint32_t nbRleSegments;
+ uint32_t RleSegmentOffsetTable[15];
ftellRes=ftell(fp);
// Basic Offset Table with Item Value
// Item Tag
// 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;i<ln;i+=4){
- a=str2num(&BasicOffsetTableItemValue[i],guint32);
+ a=str2num(&BasicOffsetTableItemValue[i],uint32_t);
printf(" x(%08x) %d\n",a,a);
}
}
Program: gdcm
Module: $RCSfile: gdcmRLE.cxx,v $
Language: C++
- Date: $Date: 2004/06/26 04:09:33 $
- 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
long RleSegmentLength[15],fragmentLength,uncompressedSegmentSize;;
long ftellRes, ln;
- guint32 nbRleSegments;
- guint32 RleSegmentOffsetTable[15];
- guint16 ItemTagGr,ItemTagEl;
+ uint32_t nbRleSegments;
+ uint32_t RleSegmentOffsetTable[15];
+ uint16_t ItemTagGr,ItemTagEl;
uncompressedSegmentSize=Header->GetXSize()*Header->GetYSize();
ftellRes=ftell(fp);
// Basic Offset Table with Item Value
// 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;i<ln;i+=4){
- a=str2num(&BasicOffsetTableItemValue[i],guint32);
+ a=str2num(&BasicOffsetTableItemValue[i],uint32_t);
}
}
Program: gdcm
Module: $RCSfile: gdcmSQItem.cxx,v $
Language: C++
- Date: $Date: 2004/06/25 12:54:35 $
- 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
* @return true if element was found or created successfully
*/
-bool gdcmSQItem::SetEntryByNumber(std::string val,guint16 group,
- guint16 element)
+bool gdcmSQItem::SetEntryByNumber(std::string val, uint16_t group,
+ uint16_t element)
{
for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
{
// instead of ReplaceOrCreateByNumber
// that is a method of gdcmDocument :-(
gdcmValEntry* Entry = (gdcmValEntry*)0;
- TagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ gdcmTagKey key = gdcmDictEntry::TranslateToKey(group, element);
if ( ! ptagHT->count(key))
{
* \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);
* @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();
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
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
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
*/
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();
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
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);
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;
};
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
{
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 : "<<it->first<<" = "<<it->second<<std::endl;
}
* \brief Get the count for an element
* @param key key to count
*/
-int gdcmVR::Count(VRKey key)
+int gdcmVR::Count(gdcmVRKey key)
{
return vr.count(key);
}
* \ref gdcmVR::IsVROfGdcmStringRepresentable .
* @param tested value represenation to check for.
*/
-bool gdcmVR::IsVROfGdcmBinaryRepresentable(VRKey tested)
+bool gdcmVR::IsVROfGdcmBinaryRepresentable(gdcmVRKey tested)
{
if ( ! Count(tested) )
{
* but NOT a \ref gdcmBinEntry.
* @param tested value represenation to check for.
*/
-bool gdcmVR::IsVROfGdcmStringRepresentable(VRKey tested)
+bool gdcmVR::IsVROfGdcmStringRepresentable(gdcmVRKey tested)
{
if ( ! Count(tested) )
{
Program: gdcm
Module: $RCSfile: gdcmVR.h,v $
Language: C++
- Date: $Date: 2004/06/20 18:08:48 $
- 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
#include <iostream>
//-----------------------------------------------------------------------------
-typedef std::string VRKey;
-typedef std::string VRAtr;
-typedef std::map<VRKey, VRAtr> VRHT; // Value Representation Hash Table
+typedef std::string gdcmVRKey;
+typedef std::string gdcmVRAtr;
+/// Value Representation Hash Table
+typedef std::map<gdcmVRKey, gdcmVRAtr> gdcmVRHT;
//-----------------------------------------------------------------------------
/*
~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;
};
//-----------------------------------------------------------------------------
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
*/
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];
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
Tokenize (GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++) {
- guint16 val_uint16 = atoi(tokens[i].c_str());
+ uint16_t val_uint16 = atoi(tokens[i].c_str());
void *ptr = &val_uint16;
fwrite ( ptr,(size_t)2 ,(size_t)1 ,fp);
}
tokens.erase(tokens.begin(),tokens.end()); // clean any previous value
Tokenize (GetValue(), tokens, "\\");
for (unsigned int i=0; i<tokens.size();i++){
- guint32 val_uint32 = atoi(tokens[i].c_str());
+ uint32_t val_uint32 = atoi(tokens[i].c_str());
void *ptr = &val_uint32;
fwrite ( ptr,(size_t)4 ,(size_t)1 ,fp);
}
Program: gdcm
Module: $RCSfile: gdcmValEntry.h,v $
Language: C++
- Date: $Date: 2004/06/24 18:03:14 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2004/07/02 13:55:28 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// \brief Returns the 'Value' (e.g. "Dupond Marcel") converted into a
/// 'string', if it's stored as an integer in the header of the
/// current Dicom Document Entry
- inline std::string GetValue() { return value; };
+ std::string GetValue() { return value; };
/// Sets the value (string) of the current Dicom Document Entry
- inline void SetValue(std::string val) { value = val; };
-
+ void SetValue(std::string val) { value = val; };
+
/// Sets the value (void *) of the current Dicom Document Entry
- inline void SetVoidArea(void * val) { voidArea = val; };
-
+ void SetVoidArea(void * val) { voidArea = val; };
+
virtual void Print(std::ostream &os = std::cout);
virtual void Write(FILE *fp, FileType filetype);
protected: