+2004-02-06 Jean-Pierre Roux
+ * ENH : now gdcmDicomDir::CreateDicomDir() returns also the meta elements
+ GDCM_META added to gdcmDicomDirType
+ class gdcmMeta created
+
2004-02-05 Benoit Regrain
* ENH : add methods in gdcmObject to get the hash table or the list of
header entries
return(1);
}
+// Exemples exploitation de la structure
+
+// DON'T REMOVE neither the folowong code, nor the commented out lines
+
+
+ cout << std::endl << std::endl
+ << " = Liste des PATIENT =========================================="
+ << std::endl<< std::endl;
+
+
+ itPatient = e1->GetPatients().begin();
+ while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
+ std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
+ itPatient ++;
+ }
+
+/*
+
+ cout << std::endl << std::endl
+ << " = Liste des PATIENT/STUDY =========================================="
+ << std::endl<< std::endl;
+
+ itPatient = e1->GetPatients().begin();
+ while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
+ std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
+ itStudy = ((*itPatient)->GetStudies()).begin();
+ while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
+ std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Stdy Description
+ ++itStudy;
+ }
+ itPatient ++;
+ }
+
+ */
+
+ cout << std::endl << std::endl
+ << " = Liste des PATIENT/STUDY/SERIE =========================================="
+ << std::endl<< std::endl;
+
+ itPatient = e1->GetPatients().begin();
+ while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
+ std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
+ itStudy = ((*itPatient)->GetStudies()).begin();
+ while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
+ std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
+ itSerie = ((*itStudy)->GetSeries()).begin();
+ while (itSerie != (*itStudy)->GetSeries().end() ) { // on degouline les SERIES de cette study
+ std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
+ ++itSerie;
+ }
+ ++itStudy;
+ }
+ itPatient ++;
+ }
+
+
+ /*
+ cout << std::endl << std::endl
+ << " = Liste des PATIENT/STUDY/SERIE/IMAGE ==================================="
+ << std::endl<< std::endl;
+
+ itPatient = e1->GetPatients().begin();
+ while ( itPatient != e1->GetPatients().end() ) { // on degouline la liste de PATIENT
+ std::cout << (*itPatient)->GetEntryByNumber(0x0010, 0x0010) << std::endl; // Patient's Name
+ itStudy = ((*itPatient)->GetStudies()).begin();
+ while (itStudy != (*itPatient)->GetStudies().end() ) { // on degouline les STUDY de ce patient
+ std::cout << "--- "<< (*itStudy)->GetEntryByNumber(0x0008, 0x1030) << std::endl; // Study Description
+ itSerie = ((*itStudy)->GetSeries()).begin();
+ while (itSerie != (*itStudy)->GetSeries().end() ) { // on degouline les SERIES de cette study
+ std::cout << "--- --- "<< (*itSerie)->GetEntryByNumber(0x0008, 0x103e) << std::endl; // Serie Description
+ itImage = ((*itSerie)->GetImages()).begin();
+ while (itImage != (*itSerie)->GetImages().end() ) { // on degouline les SERIES de cette study
+ std::cout << "--- --- --- "<< (*itImage)->GetEntryByNumber(0x0004, 0x1500) << std::endl; // File name
+ ++itImage;
+ }
+ ++itSerie;
+ }
+ ++itStudy;
+ }
+ itPatient ++;
+ }
+
+ */
+
// DICOM DIR
+
+//What about the META informations?
+
cout << std::endl << std::endl
<< " = Contenu Complet du DICOMDIR =========================================="
<< std::endl<< std::endl;
-SUBDIRS = jpeg
+&SUBDIRS = jpeg
LTVERSION = 0:1:0
gdcmHeaderEntry.cxx \
gdcmHeaderHelper.cxx \
gdcmImage.cxx \
+ gdcmMeta.cxx \
gdcmJpeg12.cxx \
gdcmJpeg2000.cxx \
gdcmJpeg.cxx \
gdcmStudy.cxx \
gdcmTS.cxx \
gdcmUtil.cxx \
- gdcmVR.cxx
+ gdcmVR.cxx
libgdcmincludedir = $(includedir)
-libgdcminclude_HEADERS = \
+libgdcminclude_HEADERS = \
gdcmCommon.h \
gdcmDicomDir.h \
- gdcmDicomDirElement.h \
+ gdcmDicomDirElement.h \
gdcmDictEntry.h \
gdcmDict.h \
gdcmDictSet.h \
gdcmHeader.h \
gdcmHeaderHelper.h \
gdcmImage.h \
+ gdcmMeta.h \
gdcmObject.h \
gdcmParser.h \
gdcmPatient.h \
gdcmSerie.h \
gdcmStudy.h \
gdcmVR.h \
- gdcmTS.h
+ gdcmTS.h
EXTRA_DIST = \
*/
gdcmDicomDir::~gdcmDicomDir()
{
+ delete metaelems;
+
for(ListPatient::iterator cc=patients.begin();cc!=patients.end();++cc)
{
delete *cc;
*/
void gdcmDicomDir::Print(std::ostream &os)
{
+ (*metaelems).SetPrintLevel(printLevel);
+ (*metaelems).Print(os);
+
for(ListPatient::iterator cc=patients.begin();cc!=patients.end();++cc)
{
(*cc)->SetPrintLevel(printLevel);
// Protected
/*
* \ingroup gdcmDicomDir
- * \brief
+ * \brief create a gdcmDicomDir from a root Directory
* @param path entry point of the stree-like structure
*/
void gdcmDicomDir::NewDicomDir(std::string path)
/*
* \ingroup gdcmDicomDir
- * \brief Get the dicom dir path
+ * \brief Get the DicomDir path
* @param
*/
std::string gdcmDicomDir::GetPath(void)
// Private
/*
* \ingroup gdcmDicomDir
- * \brief
- * @param
+ * \brief create a 'gdcmDicomDir' from a DICOMDIR gdcmHeader
*/
void gdcmDicomDir::CreateDicomDir()
{
gdcmDicomDirType type=gdcmDicomDir::GDCM_NONE;
ListTag::iterator begin;
ListTag::iterator end;
+ ListTag::iterator k;
begin=listEntries.begin();
end=begin;
- for(ListTag::iterator i=listEntries.begin();i !=listEntries.end();++i)
+
+ for(ListTag::iterator j=listEntries.begin();j !=listEntries.end();++j)
+ {
+ if((*j)->GetValue()=="PATIENT ") {
+ k = j;
+ break;
+ }
+ AddObjectToEnd(gdcmDicomDir::GDCM_META,begin,j);
+ }
+
+// for(ListTag::iterator i=listEntries.begin();i !=listEntries.end();++i)
+ for(ListTag::iterator i=k;i !=listEntries.end();++i)
{
std::string v=(*i)->GetValue();
if(v=="PATIENT ")
switch(type)
{
+ case gdcmDicomDir::GDCM_META:
+ AddMetaToEnd(begin,end);
+ break;
case gdcmDicomDir::GDCM_PATIENT:
AddPatientToEnd(begin,end);
break;
}
}
+
+/*
+ * \ingroup gdcmDicomDir
+ * \brief Well ... Not realy to end, there is only one occurence
+ * @param begin
+ * @param end
+*/
+void gdcmDicomDir::AddMetaToEnd(ListTag::iterator begin,ListTag::iterator end)
+{
+ metaelems = new gdcmMeta(begin,end);
+}
+
/*
* \ingroup gdcmDicomDir
* \brief
// if new Serie Deal with 'SERIE' Elements
if(serCurInstanceUID!=serPrevInstanceUID || serCurID!=serPrevID)
- {
SetElement(path,GDCM_SERIE,*it);
- }
// Always Deal with 'IMAGE' Elements
SetElement(path,GDCM_IMAGE,*it);
#include "gdcmHeader.h"
#include "gdcmCommon.h"
#include "gdcmPatient.h"
+#include "gdcmMeta.h"
#include "gdcmDicomDirElement.h"
#include <list>
#include <vector>
//-----------------------------------------------------------------------------
-typedef std::list<gdcmPatient *> ListPatient;
+typedef std::list<gdcmPatient *> ListPatient;
typedef std::vector<gdcmHeader *> ListHeader;
//-----------------------------------------------------------------------------
class GDCM_EXPORT gdcmDicomDir: public gdcmParser
{
public:
-// gdcmDicomDir(ListTag *l, bool exception_on_error = false);
- gdcmDicomDir(const char *FileName, bool parseDir = false,
+// gdcmDicomDir(ListTag *l, bool exception_on_error = false);
+ gdcmDicomDir(const char *FileName,
+ bool parseDir = false,
bool exception_on_error = false);
~gdcmDicomDir(void);
void SetPrintLevel(int level) { printLevel = level; };
virtual void Print(std::ostream &os = std::cout);
+ inline gdcmMeta *GetMeta() {return metaelems;};
inline ListPatient &GetPatients() {return patients;};
// Write
typedef enum
{
GDCM_NONE,
+ GDCM_META,
GDCM_PATIENT,
GDCM_STUDY,
GDCM_SERIE,
private:
void CreateDicomDir(void);
- void AddObjectToEnd(gdcmDicomDirType type,ListTag::iterator begin,ListTag::iterator end);
+ void AddObjectToEnd(gdcmDicomDirType type,
+ ListTag::iterator begin,ListTag::iterator end);
+ void AddMetaToEnd (ListTag::iterator begin,ListTag::iterator end);
void AddPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
- void AddStudyToEnd(ListTag::iterator begin,ListTag::iterator end);
- void AddSerieToEnd(ListTag::iterator begin,ListTag::iterator end);
- void AddImageToEnd(ListTag::iterator begin,ListTag::iterator end);
+ void AddStudyToEnd (ListTag::iterator begin,ListTag::iterator end);
+ void AddSerieToEnd (ListTag::iterator begin,ListTag::iterator end);
+ void AddImageToEnd (ListTag::iterator begin,ListTag::iterator end);
void SetElements(std::string &path,ListHeader &list);
- void SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader *header);
+ void SetElement (std::string &path,gdcmDicomDirType type,gdcmHeader *header);
static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
+ gdcmMeta *metaelems;
ListPatient patients;
};
* \ingroup gdcmDicomDirElement
* \brief constructor
*/
- gdcmDicomDirElement::gdcmDicomDirElement(void)
-{
+ gdcmDicomDirElement::gdcmDicomDirElement(void) {
std::string filename=gdcmDictSet::BuildDictPath() + std::string(DICT_ELEM);
std::ifstream from(filename.c_str());
dbg.Error(!from, "gdcmDicomDirElement::gdcmDicomDirElement: can't open dictionary",filename.c_str());
from.getline(buff, 1024, ' ');
type = buff;
- if( (type=="metaElem") || (type=="patientElem") ||
- (type=="studyElem") || (type=="serieElem") ||
+ if( (type=="metaElem") || (type=="patientElem") ||
+ (type=="studyElem") || (type=="serieElem") ||
(type=="imageElem") )
{
from >> std::hex >> elem.group >> elem.elem;
* \ingroup gdcmDicomDirElement
* \brief destructor
*/
- gdcmDicomDirElement::~gdcmDicomDirElement()
-{
+ gdcmDicomDirElement::~gdcmDicomDirElement() {
MetaList.clear();
PatientList.clear();
StudyList.clear();
* \todo add a 'Print Level' check
* @param os The output stream to be written to.
*/
-void gdcmDicomDirElement::Print(std::ostream &os)
-{
+void gdcmDicomDirElement::Print(std::ostream &os) {
std::ostringstream s;
std::list<gdcmElement>::iterator it;
char greltag[10]; //group element tag
/*
* \ingroup gdcmDirList
* \brief Destructor
- * @param
*/
gdcmDirList::~gdcmDirList(void)
{
-// gdcmDir.h
+// gdcmDirList.h
//-----------------------------------------------------------------------------
#ifndef GDCMDIRLIST_H
#define GDCMDIRLIST_H
--- /dev/null
+// gdcmMeta.cxx
+//-----------------------------------------------------------------------------
+#include "gdcmMeta.h"
+
+//-----------------------------------------------------------------------------
+// Constructor / Destructor
+/**
+ * \ingroup gdcmMeta
+ * \brief
+ * @param begin iterator of begin for the object
+ * @param end iterator of end for the object
+ */
+gdcmMeta::gdcmMeta(ListTag::iterator begin,ListTag::iterator end):
+ gdcmObject(begin,end)
+{
+}
+
+/**
+ * \ingroup gdcmMeta
+ * \brief Canonical destructor.
+ */
+gdcmMeta::~gdcmMeta()
+{
+}
+
+//-----------------------------------------------------------------------------
+// Print
+/**
+ * \ingroup gdcmMeta
+ * \brief Prints the Object
+ * @return
+ */
+void gdcmMeta::Print(std::ostream &os)
+{
+ os<<"META : ";
+ os<<std::endl;
+
+ gdcmObject::Print(os);
+}
+
+//-----------------------------------------------------------------------------
+// Public
+
+//-----------------------------------------------------------------------------
+// Protected
+
+//-----------------------------------------------------------------------------
+// Private
+
+//-----------------------------------------------------------------------------
--- /dev/null
+// gdcmMeta.h
+//-----------------------------------------------------------------------------
+#ifndef GDCMMETA_H
+#define GDCMMETA_H
+
+#include "gdcmObject.h"
+
+//-----------------------------------------------------------------------------
+class GDCM_EXPORT gdcmMeta : public gdcmObject
+{
+public:
+ gdcmMeta(ListTag::iterator begin,ListTag::iterator end);
+ ~gdcmMeta(void);
+
+ virtual void Print(std::ostream &os = std::cout);
+};
+
+//-----------------------------------------------------------------------------
+#endif
TagHeaderEntryHT GetEntry(void);
ListTag GetListEntry(void);
-
+ ListTag::iterator debut(void) { return(beginObj);}
+ ListTag::iterator fin (void) { return(endObj); }
+
protected:
+
ListTag::iterator beginObj;
ListTag::iterator endObj;
-
int printLevel;
private: