+2004-01-12 Benoit Regrain
+ * src/*.h : add comments
+
2004-01-09 Benoit Regrain
* gdcmPython/gdcmVersion.py : add a gdcmVERSION variable information
* setup.py : use a reference to gdcmVERSION
#include "gdcmException.h"
#include "gdcmCommon.h"
+
#include "gdcmDictEntry.h"
#include "gdcmDict.h"
#include "gdcmDictSet.h"
+
#include "gdcmElValue.h"
#include "gdcmElValSet.h"
+
#include "gdcmHeader.h"
+#include "gdcmHeaderHelper.h"
+#include "gdcmIdo.h"
#include "gdcmFile.h"
-//class gdcmSerie : gdcmFile;
-//class gdcmMultiFrame : gdcmFile;
+//#include "gdcmTS.h"
+//#include "gdcmVR.h"
+//#include "gdcmUtil.h"
#endif // #ifndef GDCM_H
//For now gdcm is not willing cmake, try to be more quiet
//#cmakedefine GDCM_NO_ANSI_STRING_STREAM
-
#endif
#include "gdcmCommon.h"
+/*
+ * the gdcmDictEntry in an element contained by the gdcmDict.
+ * It contains :
+ * - the key referenced by the DICOM norm or the constructor (for private keys)
+ * - the corresponding name in english (it's equivalent to a label)
+ * - the owner group
+ * - etc.
+ */
class GDCM_EXPORT gdcmDictEntry {
private:
// FIXME : were are the group and element used except from building up
std::string name; // e.g. "Patient_Name"
TagKey key; // Redundant with (group, element) but we add it
// on efficiency purposes.
+
// DCMTK has many fields for handling a DictEntry (see below). What are the
// relevant ones for gdcmlib ?
// struct DBI_SimpleEntry {
DictSetHT Dicts;
/// Directory path to dictionaries
std::string DictPath;
+
int AppendDict(gdcmDict* NewDict);
void LoadDictFromFile(std::string FileName, DictKey Name);
std::string BuildDictPath(void);
+
public:
std::list<std::string> * GetPubDictTagNames(void);
std::map<std::string, std::list<std::string> >*
gdcmDictSet(void);
~gdcmDictSet(void);
void Print(std::ostream& os);
+
gdcmDict* GetDict(DictKey DictName);
gdcmDict* GetDefaultPubDict(void);
};
-// $Header: /cvs/public/gdcm/src/Attic/gdcmElValSet.h,v 1.19 2003/11/13 18:08:34 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmElValSet.h,v 1.20 2004/01/12 13:12:28 regrain Exp $
#ifndef GDCMELVALSET_H
#define GDCMELVALSET_H
#include "gdcmCommon.h"
#include "gdcmElValue.h"
-#include <stdio.h> // FIXME For FILE on GCC only
+#include <stdio.h>
#include <map>
#include <list> // for linking together *all* the Dicom Elements
-////////////////////////////////////////////////////////////////////////////
-// Container for a set of successfully parsed ElValues.
-
+/*
+ * Container for a set of successfully parsed ElValues.
+ */
typedef std::map<TagKey, gdcmElValue*> TagElValueHT;
typedef std::map<std::string, gdcmElValue*> TagElValueNameHT;
-// $Header: /cvs/public/gdcm/src/Attic/gdcmElValue.h,v 1.9 2003/11/10 14:17:12 jpr Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmElValue.h,v 1.10 2004/01/12 13:12:28 regrain Exp $
#ifndef GDCMELVALUE_H
#define GDCMELVALUE_H
#include <stdio.h>
-///////////////////////////////////////////////////////////////////////////
-// The dicom header of a Dicom file contains a set of such ELement VALUES
-// (when successfuly parsed against a given Dicom dictionary)
+/*
+ * The dicom header of a Dicom file contains a set of such ELement VALUES
+ * (when successfuly parsed against a given Dicom dictionary)
+ */
class GDCM_EXPORT gdcmElValue {
private:
gdcmDictEntry *entry;
guint32 UsableLength; // Updated from ReadLength, by FixFoungLentgh()
// for fixing a bug in the header or helping
- // the parser going on
+ // the parser going on
guint32 ReadLength; // 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.
- // *for internal* use only
+ // 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.
+ // *for internal* use only
- bool ImplicitVr; // Even when reading explicit vr files, some
+ bool ImplicitVr; // Even when reading explicit vr files, some
// elements happen to be implicit. Flag them here
// since we can't use the entry->vr without breaking
// the underlying dictionary.
void SetOffset(size_t of){ Offset = of; };
+
// FIXME: In fact we should be more specific and use :
- //friend gdcmElValue * gdcmHeader::ReadNextElement(void);
+ // friend gdcmElValue * gdcmHeader::ReadNextElement(void);
friend class gdcmHeader;
+
public:
std::string value;
void * voidArea; // unsecure memory area to hold 'non string' values
#include <iostream>
#include <exception>
-/**
+/*
* Any exception thrown in the gdcm library
*/
class GDCM_EXPORT gdcmException : public std::exception {
std::string error;
public:
- /**
+ /*
* Builds an exception with minimal information: name of the thrower
* method and error message
*
throw();
- /**
+ /*
* virtual destructor makes this class dynamic
*/
virtual ~gdcmException() throw() {
};
-/** prints exception stack on output stream
+/* prints exception stack on output stream
* @param os output stream
* @param e exception to print
* @returns output stream os
std::ostream& operator<<(std::ostream &os, const gdcmException &e);
-/**
+/*
* File error exception thrown in the gdcm library
*/
class GDCM_EXPORT gdcmFileError : public gdcmException {
public:
- /**
+ /*
* Builds an file-related exception with minimal information: name of
* the thrower method and error message
*
};
-/**
+/*
* Invalid file format exception
*/
class GDCM_EXPORT gdcmFormatError : public gdcmException {
public:
- /**
+ /*
* Builds an file-related exception with minimal information: name of
* the thrower method and error message
*
#include "gdcmCommon.h"
#include "gdcmHeader.h"
-////////////////////////////////////////////////////////////////////////////
-// In addition to Dicom header exploration, this class is designed
-// for accessing the image/volume content. One can also use it to
-// write Dicom files.
-
+/*
+ * In addition to Dicom header exploration, this class is designed
+ * for accessing the image/volume content. One can also use it to
+ * write Dicom files.
+ */
class GDCM_EXPORT gdcmFile
{
private:
// For Run Length Encoding (TOCHECK)
bool gdcm_read_RLE_file (FILE *fp,void * image_buffer);
-
protected:
int WriteBase(std::string FileName, FileType type);
// 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).
+ // different from the constructor's one (no overwriting allowed).
// TODO Swig int SetFileName(std::string filename);
void SetPixelDataSizeFromHeader(void);
// Ecrit sur disque les pixels d'UNE image
// Aucun test n'est fait sur l'"Endiannerie" du processeur.
// Ca sera à l'utilisateur d'appeler son Reader correctement
-
int WriteRawData (std::string fileName);
int WriteDcmImplVR(std::string fileName);
int WriteDcmImplVR(const char * fileName);
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.45 2003/12/22 12:46:16 regrain Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeader.h,v 1.46 2004/01/12 13:12:28 regrain Exp $
#ifndef GDCMHEADER_H
#define GDCMHEADER_H
typedef std::string VRAtr;
typedef std::map<VRKey, VRAtr> VRHT; // Value Representation Hash Table
-/// The purpose of an instance of gdcmHeader is to act as a container of
-/// all the DICOM elements and their corresponding values (and
-/// additionaly the corresponding DICOM dictionary entry) of the header
-/// of a DICOM file.
-///
-/// The typical usage of instances of class gdcmHeader is to classify a set of
-/// dicom files according to header information e.g. to create a file hierarchy
-/// reflecting the Patient/Study/Serie informations, or extracting a given
-/// SerieId. Accesing the content (image[s] or volume[s]) is beyond the
-/// functionality of this class and belongs to gdmcFile.
-/// \note The various entries of the explicit value representation (VR) shall
-/// be managed within a dictionary which is shared by all gdcmHeader
-/// instances.
-/// \note The gdcmHeader::Set*Tag* family members cannot be defined as
-/// protected due to Swig limitations for as Has_a dependency between
-/// gdcmFile and gdcmHeader.
-
+/*
+ * The purpose of an instance of gdcmHeader is to act as a container of
+ * all the DICOM elements and their corresponding values (and
+ * additionaly the corresponding DICOM dictionary entry) of the header
+ * of a DICOM file.
+ *
+ * The typical usage of instances of class gdcmHeader is to classify a set of
+ * dicom files according to header information e.g. to create a file hierarchy
+ * reflecting the Patient/Study/Serie informations, or extracting a given
+ * SerieId. Accesing the content (image[s] or volume[s]) is beyond the
+ * functionality of this class and belongs to gdmcFile.
+ * \note The various entries of the explicit value representation (VR) shall
+ * be managed within a dictionary which is shared by all gdcmHeader
+ * instances.
+ * \note The gdcmHeader::Set*Tag* family members cannot be defined as
+ * protected due to Swig limitations for as Has_a dependency between
+ * gdcmFile and gdcmHeader.
+ */
class GDCM_EXPORT gdcmHeader {
private:
/// Pointer to the Value Representation Hash Table which contains all
-// $Header: /cvs/public/gdcm/src/Attic/gdcmHeaderHelper.h,v 1.8 2003/12/22 12:46:16 regrain Exp $
+// $Header: /cvs/public/gdcm/src/Attic/gdcmHeaderHelper.h,v 1.9 2004/01/12 13:12:28 regrain Exp $
#ifndef GDCMHEADERHELPER_H
#define GDCMHEADERHELPER_H
XC // Photographic Imaging
};
-/**
- This class is meant to *interpret* data given from gdcmHeader
- That is to say :
- * it will help other dev to link against there lib
- * return value instead of string
- * will be able to search for data at some other place
- * return *default value* which is not a gdcmHeader goal
- * ...
-*/
+/*
+ * This class is meant to *interpret* data given from gdcmHeader
+ * That is to say :
+ * - it will help other dev to link against there lib
+ * - return value instead of string
+ * - will be able to search for data at some other place
+ * - return *default value* which is not a gdcmHeader goal
+ * - ...
+ */
class GDCM_EXPORT gdcmHeaderHelper : public gdcmHeader {
public:
gdcmHeaderIdo::gdcmHeaderIdo (char* InFilename)
: gdcmHeader(InFilename)
-{ }
+{
+}
void gdcmHeaderIdo::BuildHeader(void) {
- gdcmHeaderIdo::BuildHeader();
+ gdcmHeaderIdo::BuildHeader();
setAcrLibido();
}
#include "gdcmHeader.h"
+/*
+ * A gdcmHeaderIdo is a specific gdcmHeader that recognize
+ * the creation's source of the file : the libIdo library.
+ * Thus the file type is modified in consequence.
+ *
+ * \see gdcmHeader
+ */
class gdcmHeaderIdo: protected gdcmHeader {
private:
void setAcrLibido(void);
void BuildHeader(void);
+
public:
gdcmHeaderIdo(char* filename);
};
typedef std::string TSAtr;
typedef std::map<TSKey, TSAtr> TSHT; // Transfert Syntax Hash Table
-/// Container for dicom Transfert Syntax Hash Table
-/// \note This is a singleton
+/*
+ * Container for dicom Transfert Syntax Hash Table
+ * \note This is a singleton
+ */
class GDCM_EXPORT gdcmTS {
private:
TSHT ts;
-// $Header: /cvs/public/gdcm/src/gdcmUtil.h,v 1.16 2003/10/02 11:26:16 malaterre Exp $
+// $Header: /cvs/public/gdcm/src/gdcmUtil.h,v 1.17 2004/01/12 13:12:28 regrain Exp $
#ifndef GDCMUTIL_H
#define GDCMUTIL_H
#include <vector>
#include <string>
+/*
+ * gdcmDebug is an object for debugging in program.
+ * It has 2 debugging modes :
+ * - error : for bad library use
+ * - debug : for debugging messages
+ *
+ * A debugging message has a level of priority and is
+ * Shown only when the debug level is higher than the
+ * message level.
+ */
class gdcmDebug {
private:
int DebugLevel;
public:
gdcmDebug(int = 0);
void Verbose(int, const char*, const char* ="");
-// void Verbose(int, char*, char*);
void Error(bool, const char*, const char* ="");
void Error(const char*, const char* ="", const char* ="");
void Assert(int, bool, const char*, const char*);
void SetDebug (int i) {DebugLevel = i;}
};
+/*
+ * This class contains all globals elements that might be
+ * instanciated only one time
+ */
class gdcmGlobal {
private:
static gdcmVR *VR;
typedef std::string VRAtr;
typedef std::map<VRKey, VRAtr> VRHT; // Value Representation Hash Table
-/// Container for dicom Value Representation Hash Table
-/// \note This is a singleton
+/*
+ * Container for dicom Value Representation Hash Table
+ * \note This is a singleton
+ */
class GDCM_EXPORT gdcmVR {
private:
VRHT vr;