#include "gdcmDebug.h"
#include "gdcmGlobal.h"
+#include "gdcmSeqEntry.h"
+#include "gdcmSQItem.h"
+#include "gdcmValEntry.h"
+
//-----------------------------------------------------------------------------
// For full DICOMDIR description, see:
// PS 3.3-2003, pages 731-750
*/
gdcmDicomDir::gdcmDicomDir(const char *FileName, bool parseDir,
bool exception_on_error):
- gdcmParser(FileName,exception_on_error,true) // true : enable SeQuences
+ gdcmDocument(FileName,exception_on_error,true) // true : enable SeQuences
{
// que l'on ai passe un root directory ou un DICOMDIR
// et quelle que soit la valeur de parseDir,
- // on a lance gdcmParser
+ // on a lance gdcmDocument
startMethod= NULL;
progressMethod= NULL;
progress=0.0;
abort=false;
- metaElems=NULL;
+ metaElems=NULL;
-// gdcmParser already executed
+// gdcmDocument already executed
// if user passed a root directory, sure we didn't get anything
- if( GetListEntry().begin()==GetListEntry().end() )
+ if( GetEntry().begin()==GetEntry().end() )
{
// if parseDir == false, it should be tagged as an error
- dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : entry list empty");
+ dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : entry HT empty");
if(strlen(FileName)==1 && FileName[0]=='.') { // user passed '.' as Name
// we get current directory name
char* dummy= new char[1000];
getcwd(dummy, (size_t)1000);
SetFileName(dummy); // will be converted into a string
- delete[] dummy; // no longer needed
+ delete[] dummy; // no longer needed
}
if(parseDir)
}
}
else {
+ gdcmDocEntry *e = GetDocEntryByNumber(0x0004, 0x1220); // Directory record sequence
+ if (e==NULL) {
+ dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : NO Directory record sequence (0x0004,0x1220)"
+ );
+ // FIXME : what to do when the parsed file IS NOT a DICOMDIR file ?
+ }
CreateDicomDir();
- CheckBoundaries(); // to maintain consistency between
- // home-made gdcmDicomDir
- // and the ones comming from a DICOMDIR file
}
}
* @param exception_on_error whether we want to throw an exception or not
*/
gdcmDicomDir::gdcmDicomDir(bool exception_on_error):
- gdcmParser(exception_on_error)
+ gdcmDocument(exception_on_error)
{
startMethod= NULL;
progressMethod= NULL;
std::string pathBidon = ""; // Sorry, NULL not allowed ...
SetElement(pathBidon, GDCM_DICOMDIR_META, NULL); // Set the META elements
- AddDicomDirMetaToEnd(listEntries.begin(),--listEntries.end());
+ AddDicomDirMeta();
}
* decides whether or not the current header was properly parsed
* and contains the mandatory information for being considered as
* a well formed and usable DicomDir.
- * @return true when gdcmParser is the one of a reasonable DicomDir,
+ * @return true when gdcmDocument is the one of a reasonable DicomDir,
* false otherwise.
*/
bool gdcmDicomDir::IsReadable(void)
{
- if(!gdcmParser::IsReadable())
+ if(!gdcmDocument::IsReadable())
return(false);
if(!metaElems)
return(false);
/// \todo (?) tester les echecs en ecriture
/// (apres chaque fwrite, dans le WriteEntry)
+
+/* TODO : to go on compiling
+
gdcmDicomDirMeta *ptrMeta;
ListDicomDirPatient::iterator itPatient;
ListDicomDirStudy::iterator itStudy;
}
++itPatient;
}
+ */
}
//-----------------------------------------------------------------------------
/**
* \ingroup gdcmDicomDir
- * \brief create a gdcmHeader-like chained list from a root Directory
+ * \brief create a gdcmDocument-like chained list from a root Directory
* @param path entry point of the tree-like structure
*/
void gdcmDicomDir::CreateDicomDirChainedList(std::string path)
ListHeader list;
gdcmHeader *header;
- listEntries.clear();
+ tagHT.clear();
patients.clear();
for(gdcmDirList::iterator it=fileList.begin();
/**
* \ingroup gdcmDicomDir
- * \brief modifies the limits of a gdcmObject, created from a DICOMDIR file
+ * \brief adds *the* Meta to a partially created DICOMDIR
*/
-
-void gdcmDicomDir::CheckBoundaries()
-{
- ListDicomDirPatient::iterator itPatient;
- ListDicomDirStudy::iterator itStudy;
- ListDicomDirSerie::iterator itSerie;
- ListDicomDirImage::iterator itImage;
- ListTag::iterator i,j;
-
- GetDicomDirMeta()->ResetBoundaries(0);
-
- itPatient = GetDicomDirPatients().begin();
- while ( itPatient != GetDicomDirPatients().end() ) {
- (*itPatient)->ResetBoundaries(1);
- itStudy = ((*itPatient)->GetDicomDirStudies()).begin();
- while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) {
- (*itStudy)->ResetBoundaries(1);
- itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
- while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) {
- (*itSerie)->ResetBoundaries(1);
- itImage = ((*itSerie)->GetDicomDirImages()).begin();
- while (itImage != (*itSerie)->GetDicomDirImages().end() ) {
- (*itImage)->ResetBoundaries(1);
- ++itImage;
- }
- ++itSerie;
- }
- ++itStudy;
- }
- ++itPatient;
+
+ // FIXME : Heuuuuu ! Il prend les Entries du Document deja parse,
+ // il ne fabrique rien !
+
+gdcmDicomDirMeta * gdcmDicomDir::NewMeta(void) {
+ gdcmDicomDirMeta *m = new gdcmDicomDirMeta(&tagHT);
+ for (TagDocEntryHT::iterator cc = tagHT.begin();cc != tagHT.end();++cc) {
+ m->AddDocEntry(cc->second);
}
-}
+ return m;
+}
/**
* \ingroup gdcmDicomDir
- * \brief adds a new Patient to a partially created DICOMDIR
+ * \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;
gdcmDictEntry *dictEntry;
- gdcmHeaderEntry *entry;
+ gdcmValEntry *entry;
+
+ gdcmSQItem *s = new gdcmSQItem(0);
elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements();
- std::list<gdcmHeaderEntry *>::iterator debInsertion, finInsertion, i,j;
-
- debInsertion = metaElems->fin();
- ++debInsertion;
- finInsertion=debInsertion;
+
+ // TODO : use FillObject !!!
- // for all the DicomDirPatient Elements
+ // for all the DicomDirPatient Elements
+
for(it=elemList.begin();it!=elemList.end();++it)
{
tmpGr=it->group;
tmpEl=it->elem;
dictEntry=GetPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
- entry=new gdcmHeaderEntry(dictEntry);
- entry->SetOffset(0); // just to avoid missprinting
- entry->SetValue(it->value);
+ entry=new gdcmValEntry(dictEntry);
+ entry->SetOffset(0); // just to avoid further missprinting
+ entry->SetValue(it->value);
+ // dealing with value length ...
+
if(dictEntry->GetGroup()==0xfffe)
- {
+ {
entry->SetLength(entry->GetValue().length());
- }
+ }
else if( (dictEntry->GetVR()=="UL") || (dictEntry->GetVR()=="SL") )
{
entry->SetLength(4);
{
entry->SetLength(entry->GetValue().length());
}
-
- tagHT.insert( PairHT(entry->GetKey(),entry) ); // add in the (multimap) H Table
- listEntries.insert(debInsertion ,entry); // en tete de liste des Patients
- ++finInsertion;
+ s->AddDocEntry(entry);
}
- i=metaElems->fin();
- i++;
-
- gdcmDicomDirPatient *p = new gdcmDicomDirPatient(i, --debInsertion,
- &tagHT, &listEntries);
+ gdcmDicomDirPatient *p = new gdcmDicomDirPatient(s, &tagHT);
patients.push_front(p);
return p;
}
+
+/**
+ * \ingroup gdcmDicomDir
+ * \brief adds to the HTable
+ * the gdcmEntries (Dicom Elements) corresponding to the given type
+ * @param path full path file name (only used when type = GDCM_DICOMDIR_IMAGE
+ * @param type gdcmObject type to create (GDCM_DICOMDIR_PATIENT, GDCM_DICOMDIR_STUDY, GDCM_DICOMDIR_SERIE ...)
+ * @param header gdcmHeader of the current file
+ */
+void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader *header)
+{
+ std::list<gdcmElement> elemList;
+ std::list<gdcmElement>::iterator it;
+ guint16 tmpGr, tmpEl;
+ gdcmDictEntry *dictEntry;
+ gdcmDocEntry *entry;
+ std::string val;
+
+ switch(type)
+ {
+ case GDCM_DICOMDIR_PATIENT:
+ elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements();
+ break;
+ case GDCM_DICOMDIR_STUDY:
+ elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
+ break;
+ case GDCM_DICOMDIR_SERIE:
+ elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirSerieElements();
+ break;
+ case GDCM_DICOMDIR_IMAGE:
+ elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
+ break;
+ case GDCM_DICOMDIR_META:
+ elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirMetaElements();
+ break;
+ default:
+ return;
+ }
+
+ for(it=elemList.begin();it!=elemList.end();++it)
+ {
+ tmpGr=it->group;
+ tmpEl=it->elem;
+ dictEntry=GetPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
+ entry=new gdcmDocEntry(dictEntry);
+ entry->SetOffset(0); // just to avoid further missprinting
+
+ if(header)
+ val=header->GetEntryByNumber(tmpGr,tmpEl);
+ else
+ val=GDCM_UNFOUND;
+
+ if(val==GDCM_UNFOUND)
+ {
+ if((tmpGr==0x0004) &&(tmpEl==0x1130) ) // File-set ID
+ {
+ // force to the *end* File Name
+ val=GetName(path);
+ }
+ else if( (tmpGr==0x0004) && (tmpEl==0x1500) ) // Only used for image
+ {
+ if(header->GetFileName().substr(0,path.length())!=path)
+ {
+ dbg.Verbose(0, "gdcmDicomDir::SetElement : the base path of file name is incorrect");
+ val=header->GetFileName();
+ }
+ else {
+ val=&(header->GetFileName().c_str()[path.length()]);
+ }
+ }
+ else
+ {
+ val=it->value;
+ }
+ }
+ else
+ {
+ if (header->GetEntryLengthByNumber(tmpGr,tmpEl)== 0)
+ val=it->value;
+ }
+
+ ((gdcmValEntry *)entry)->SetValue(val);
+
+ if(dictEntry)
+ {
+ if(dictEntry->GetGroup()==0xfffe)
+ {
+ entry->SetLength(((gdcmValEntry *)entry)->GetValue().length());
+ }
+ else if( (dictEntry->GetVR()=="UL") || (dictEntry->GetVR()=="SL") )
+ {
+ entry->SetLength(4);
+ }
+ else if( (dictEntry->GetVR()=="US") || (dictEntry->GetVR()=="SS") )
+ {
+ entry->SetLength(2);
+ }
+ else if(dictEntry->GetVR()=="SQ")
+ {
+ entry->SetLength(0xffffffff);
+ }
+ else
+ {
+ entry->SetLength(((gdcmValEntry *)entry)->GetValue().length());
+ }
+ }
+ //AddDocEntry(entry); // both in H Table and in chained list
+ tagHT[entry->GetKey()] = entry; // FIXME : use a SEQUENCE !
+ }
+}
/**
* \ingroup gdcmDicomDir
* \brief CallStartMethod
// + loop to 1 -
gdcmDicomDirType type=gdcmDicomDir::GDCM_DICOMDIR_META;
- ListTag::iterator begin;
- ListTag::iterator end, end2;
-
- begin=listEntries.begin();
- end=begin;
- for(ListTag::iterator i=end;i !=listEntries.end();++i)
- {
- std::string v=(*i)->GetValue();
+
+ gdcmDocEntry *e = GetDocEntryByNumber(0x0004, 0x1220); // Directory record sequence
+ if (e==NULL) {
+ dbg.Verbose(0, "gdcmDicomDir::gdcmDicomDir : NO Directory record sequence (0x0004,0x1220)"
+ );
+ // FIXME : what to do when the parsed file IS NOT a DICOMDIR file ?
+ return;
+ }
+
+ gdcmDicomDirMeta *m = new gdcmDicomDirMeta(&tagHT);
+
+ gdcmSeqEntry *s = (gdcmSeqEntry *)e; // FIXME : It is allowed ???
+ ListSQItem listItems = s->GetSQItems();
+
+ gdcmDocEntry * d;
+ for(ListSQItem::iterator i=listItems.begin(); i !=listItems.end();++i)
+ {
+ d=(*i)->GetDocEntryByNumber(0x0004, 0x1430); // Directory Record Type
+ std::string v=((gdcmValEntry *)d)->GetValue();
+
if(v=="PATIENT ")
- {
- end=end2=i;
- AddObjectToEnd(type,begin,--end2);
+ {
+ AddDicomDirPatientToEnd(*i);
+ //AddObjectToEnd(type,*i);
type=gdcmDicomDir::GDCM_DICOMDIR_PATIENT;
- begin=end;
}
- if(v=="STUDY ")
+ else if(v=="STUDY ")
{
- end=end2=i;
- AddObjectToEnd(type,begin,--end2);
+ AddDicomDirStudyToEnd(*i);
+ // AddObjectToEnd(type,*i);
type=gdcmDicomDir::GDCM_DICOMDIR_STUDY;
- begin=end;
}
- if(v=="SERIES")
+ else if(v=="SERIES")
{
- end=end2=i;
- AddObjectToEnd(type,begin,--end2);
+ AddDicomDirSerieToEnd(*i);
+ // AddObjectToEnd(type,*i);
type=gdcmDicomDir::GDCM_DICOMDIR_SERIE;
- begin=end;
}
- if(v=="IMAGE ")
+ else if(v=="IMAGE ")
{
- end=end2=i;
- AddObjectToEnd(type,begin,--end2);
+ AddDicomDirImageToEnd(*i);
+ // AddObjectToEnd(type,*i);
type=gdcmDicomDir::GDCM_DICOMDIR_IMAGE;
- begin=end;
}
+
+ else
+ continue ; // It was 'non PATIENT', 'non STUDY', 'non SERIE', 'non IMAGE' SQItem
}
-
- end=end2=listEntries.end();
- if(begin!=end)
- AddObjectToEnd(type,begin,--end2);
}
/**
* \ingroup gdcmDicomDir
* \brief AddObjectToEnd
* @param type
- * @param begin iterator on the first HeaderEntry within the chained List
- * @param end iterator on the last HeaderEntry within the chained List
+ * @param begin iterator on the first DocEntry within the chained List
+ * @param end iterator on the last DocEntry within the chained List
*/
-void gdcmDicomDir::AddObjectToEnd(gdcmDicomDirType type,ListTag::iterator begin,ListTag::iterator end)
+
+// now useless ?
+
+/*void gdcmDicomDir::AddObjectToEnd(gdcmDicomDirType type,gdcmSQItem *s)
{
- if(begin==end)
+ if(s==NULL) // ??
return;
switch(type)
{
case gdcmDicomDir::GDCM_DICOMDIR_META:
- AddDicomDirMetaToEnd(begin,end);
+ AddDicomDirMeta();
break;
case gdcmDicomDir::GDCM_DICOMDIR_PATIENT:
- AddDicomDirPatientToEnd(begin,end);
+ AddDicomDirPatientToEnd(s);
break;
case gdcmDicomDir::GDCM_DICOMDIR_STUDY:
- AddDicomDirStudyToEnd(begin,end);
+ AddDicomDirStudyToEnd(s);
break;
case gdcmDicomDir::GDCM_DICOMDIR_SERIE:
- AddDicomDirSerieToEnd(begin,end);
+ AddDicomDirSerieToEnd(s);
break;
case gdcmDicomDir::GDCM_DICOMDIR_IMAGE:
- AddDicomDirImageToEnd(begin,end);
+ AddDicomDirImageToEnd(s);
+ break;
+ case gdcmDicomDir::GDCM_DICOMDIR_NONE:
+ AddDicomDirImageToEnd(s); //FIXME
break;
- case gdcmDicomDir::GDCM_DICOMDIR_NONE:
- AddDicomDirImageToEnd(begin,end); //FIXME
- break;
}
}
+*/
+
/**
* \ingroup gdcmDicomDir
- * \brief Well ... Not realy to end, there is only one occurence
- * @param begin iterator on the first HeaderEntry within the chained List
- * @param end iterator on the last HeaderEntry within the chained List
+ * \brief Well ... there is only one occurence
*/
-void gdcmDicomDir::AddDicomDirMetaToEnd(ListTag::iterator begin,ListTag::iterator end)
+void gdcmDicomDir::AddDicomDirMeta()
{
if(metaElems)
delete metaElems;
- metaElems = new gdcmDicomDirMeta(begin,end,&tagHT,&listEntries);
+ metaElems = new gdcmDicomDirMeta(&tagHT);
}
/**
* \ingroup gdcmDicomDir
* \brief AddDicomDirPatientToEnd
- * @param begin iterator on the first HeaderEntry within the chained List
- * @param end iterator on the last HeaderEntry within the chained List
+ * @param s SQ Item to enqueue to the DicomPatient chained List
*/
-void gdcmDicomDir::AddDicomDirPatientToEnd(ListTag::iterator begin,ListTag::iterator end)
+void gdcmDicomDir::AddDicomDirPatientToEnd(gdcmSQItem *s)
{
- patients.push_back(new gdcmDicomDirPatient(begin,end,&tagHT, &listEntries));
+ patients.push_back(new gdcmDicomDirPatient(s, &tagHT));
}
/**
* \ingroup gdcmDicomDir
* \brief AddDicomDirStudyToEnd
- * @param begin iterator on the first HeaderEntry within the chained List
- * @param end iterator on the last HeaderEntry within the chained List
+ * @param s SQ Item to enqueue to the DicomDirStudy chained List
*/
- void gdcmDicomDir::AddDicomDirStudyToEnd(ListTag::iterator begin,ListTag::iterator end)
+ void gdcmDicomDir::AddDicomDirStudyToEnd(gdcmSQItem *s)
{
if(patients.size()>0)
{
ListDicomDirPatient::iterator itp=patients.end();
itp--;
- (*itp)->AddDicomDirStudy(new gdcmDicomDirStudy(begin,end,&tagHT, &listEntries));
+ (*itp)->AddDicomDirStudy(new gdcmDicomDirStudy(s, &tagHT));
}
}
/**
* \ingroup gdcmDicomDir
* \brief AddDicomDirSerieToEnd
- * @param begin iterator on the first HeaderEntry within the chained List
- * @param end iterator on the last HeaderEntry within the chained List
+ * @param s SQ Item to enqueue to the DicomDirSerie chained List
*/
-void gdcmDicomDir::AddDicomDirSerieToEnd(ListTag::iterator begin,ListTag::iterator end)
+void gdcmDicomDir::AddDicomDirSerieToEnd(gdcmSQItem *s)
{
if(patients.size()>0)
{
{
ListDicomDirStudy::iterator itst=(*itp)->GetDicomDirStudies().end();
itst--;
- (*itst)->AddDicomDirSerie(new gdcmDicomDirSerie(begin,end,&tagHT, &listEntries));
+ (*itst)->AddDicomDirSerie(new gdcmDicomDirSerie(s, &tagHT));
}
}
}
/**
* \ingroup gdcmDicomDir
* \brief AddDicomDirImageToEnd
- * @param begin iterator on the first HeaderEntry within the chained List
- * @param end iterator on the last HeaderEntry within the chained List
+ * @param s SQ Item to enqueue to the DicomDirImage chained List
*/
- void gdcmDicomDir::AddDicomDirImageToEnd(ListTag::iterator begin,ListTag::iterator end)
+ void gdcmDicomDir::AddDicomDirImageToEnd(gdcmSQItem *s)
{
if(patients.size()>0)
{
{
ListDicomDirSerie::iterator its=(*itst)->GetDicomDirSeries().end();
its--;
- (*its)->AddDicomDirImage(new gdcmDicomDirImage(begin,end,&tagHT, &listEntries));
+ (*its)->AddDicomDirImage(new gdcmDicomDirImage(s, &tagHT));
}
}
}
SetElement(path,GDCM_DICOMDIR_META,NULL);
- ListTag::iterator debPat=listEntries.begin();
for(ListHeader::iterator it=list.begin();it!=list.end();++it)
{
// get the current file characteristics
}
}
-/**
- * \ingroup gdcmDicomDir
- * \brief adds to the HTable and at the end of the Chained List
- * the gdcmEntries (Dicom Elements) corresponding to the given type
- * @param path full path file name(only used when type = GDCM_DICOMDIR_IMAGE
- * @param type gdcmObject type to create (GDCM_DICOMDIR_PATIENT, GDCM_DICOMDIR_STUDY, GDCM_DICOMDIR_SERIE ...)
- * @param header gdcmHeader of the current file
- */
-void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader *header)
-{
- std::list<gdcmElement> elemList;
- std::list<gdcmElement>::iterator it;
- guint16 tmpGr, tmpEl;
- gdcmDictEntry *dictEntry;
- gdcmHeaderEntry *entry;
- std::string val;
-
- switch(type)
- {
- case GDCM_DICOMDIR_PATIENT:
- elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirPatientElements();
- break;
- case GDCM_DICOMDIR_STUDY:
- elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
- break;
- case GDCM_DICOMDIR_SERIE:
- elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirSerieElements();
- break;
- case GDCM_DICOMDIR_IMAGE:
- elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
- break;
- case GDCM_DICOMDIR_META:
- elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirMetaElements();
- break;
- default:
- return;
- }
-
- for(it=elemList.begin();it!=elemList.end();++it)
- {
- tmpGr=it->group;
- tmpEl=it->elem;
- dictEntry=GetPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
- entry=new gdcmHeaderEntry(dictEntry);
- entry->SetOffset(0); // just to avoid missprinting
-
- if(header)
- val=header->GetEntryByNumber(tmpGr,tmpEl);
- else
- val=GDCM_UNFOUND;
-
- if(val==GDCM_UNFOUND)
- {
- if((tmpGr==0x0004) &&(tmpEl==0x1130) ) // File-set ID
- {
- // force to the *end* File Name
- val=GetName(path);
- }
- else if( (tmpGr==0x0004) && (tmpEl==0x1500) ) // Only used for image
- {
- if(header->GetFileName().substr(0,path.length())!=path)
- {
- dbg.Verbose(0, "gdcmDicomDir::SetElement : the base path of file name is incorrect");
- val=header->GetFileName();
- }
- else {
- val=&(header->GetFileName().c_str()[path.length()]);
- }
- }
- else
- {
- val=it->value;
- }
- }
- else
- {
- if (header->GetEntryLengthByNumber(tmpGr,tmpEl)== 0)
- val=it->value;
- }
-
- entry->SetValue(val);
-
- if(dictEntry)
- {
- if(dictEntry->GetGroup()==0xfffe)
- {
- entry->SetLength(entry->GetValue().length());
- }
- else if( (dictEntry->GetVR()=="UL") || (dictEntry->GetVR()=="SL") )
- {
- entry->SetLength(4);
- }
- else if( (dictEntry->GetVR()=="US") || (dictEntry->GetVR()=="SS") )
- {
- entry->SetLength(2);
- }
- else if(dictEntry->GetVR()=="SQ")
- {
- entry->SetLength(0xffffffff);
- }
- else
- {
- entry->SetLength(entry->GetValue().length());
- }
- }
- //AddHeaderEntry(entry); // both in H Table and in chained list
- tagHT.insert( PairHT( entry->GetKey(),entry) );
- listEntries.push_back(entry);
- //wasUpdated = 1; // is private
- }
-}
/**
* \ingroup gdcmDicomDir
* \brief compares two dgcmHeaders
*/
void gdcmDicomDir::UpdateDirectoryRecordSequenceLength() {
+
+// FIXME : to go on compiling
+
+// to be re written !
+/*
int offset = 0;
ListTag::iterator it;
guint16 gr, el;
//bool res=SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps.
SetEntryLengthByNumber(offset, 0x0004, 0x1220); // Hope there is no dupps.
return;
+ */
}
//-----------------------------------------------------------------------------
* \brief gdcmDicomDir defines an object representing a DICOMDIR in memory.
*
*/
-class GDCM_EXPORT gdcmDicomDir: public gdcmParser
+class GDCM_EXPORT gdcmDicomDir: public gdcmDocument
{
public:
// gdcmDicomDir(ListTag *l,
~gdcmDicomDir(void);
/**
- * \ingroup gdcmParser
+ * \ingroup gdcmDicomDir
* \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 gdcmParser
+ * \ingroup gdcmDicomDir
* \brief canonical Printer
* \sa SetPrintLevel
*/
// Informations contained in the parser
virtual bool IsReadable(void);
-/**
- * \ingroup gdcmDicomDir
- * \brief returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
- */
+
+/// \brief returns a pointer to the gdcmDicomDirMeta for this DICOMDIR.
inline gdcmDicomDirMeta *GetDicomDirMeta()
{return metaElems;};
-/**
- * \ingroup gdcmDicomDir
- * \brief returns the PATIENT chained List for this DICOMDIR.
- */
+
+ /// \brief returns the PATIENT chained List for this DICOMDIR.
inline ListDicomDirPatient &GetDicomDirPatients()
{return patients;};
// Parsing
void ParseDirectory(void);
- void CheckBoundaries(void);
void SetStartMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
void SetStartMethodArgDelete(gdcmMethod *);
void SetProgressMethodArgDelete(gdcmMethod *);
void SetEndMethod(gdcmMethod *,void * =NULL,gdcmMethod * =NULL);
void SetEndMethodArgDelete(gdcmMethod *);
-/**
- * \ingroup gdcmDicomDir
- * \brief GetProgress.
- */
+
+/// \brief GetProgress GetProgress
inline float GetProgress(void)
{return(progress);};
-/**
- * \ingroup gdcmDicomDir
- * \brief AbortProgress.
- */ inline void AbortProgress(void)
+
+/// \brief AbortProgress AbortProgress
+ inline void AbortProgress(void)
{abort=true; };
-/**
- * \ingroup gdcmDicomDir
- * \brief IsAborted.
- */ inline bool IsAborted(void)
+
+/// \brief IsAborted IsAborted
+ inline bool IsAborted(void)
{return(abort); };
// Adding
+ gdcmDicomDirMeta * NewMeta(void);
gdcmDicomDirPatient * NewPatient(void);
// Write
private:
void CreateDicomDir(void);
- void AddObjectToEnd(gdcmDicomDirType type,
- ListTag::iterator begin,ListTag::iterator end);
- void AddDicomDirMetaToEnd (ListTag::iterator begin,ListTag::iterator end);
- void AddDicomDirPatientToEnd(ListTag::iterator begin,ListTag::iterator end);
- void AddDicomDirStudyToEnd (ListTag::iterator begin,ListTag::iterator end);
- void AddDicomDirSerieToEnd (ListTag::iterator begin,ListTag::iterator end);
- void AddDicomDirImageToEnd (ListTag::iterator begin,ListTag::iterator end);
+// void AddObjectToEnd(gdcmDicomDirType type, gdcmSQItem *s);
+ void AddDicomDirMeta ();
+ void AddDicomDirPatientToEnd(gdcmSQItem *s);
+ void AddDicomDirStudyToEnd (gdcmSQItem *s);
+ void AddDicomDirSerieToEnd (gdcmSQItem *s);
+ void AddDicomDirImageToEnd (gdcmSQItem *s);
void SetElements(std::string &path,ListHeader &list);
void SetElement (std::string &path,gdcmDicomDirType type,gdcmHeader *header);
static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2);
// Variables
-/**
-* \brief pointer on *the* gdcmObject 'DicomDirMeta Elements'
-*/
+
+/// \brief pointer on *the* gdcmObject 'DicomDirMeta Elements'
gdcmDicomDirMeta *metaElems;
-/**
-* \brief chained list of DicomDirPatient (to be exploited recursively)
-*/
+
+/// \brief chained list of DicomDirPatient (to be exploited recursively)
ListDicomDirPatient patients;
/// pointer to the initialisation method for any progress bar
// gdcmDicomDirImage.cxx
//-----------------------------------------------------------------------------
#include "gdcmDicomDirImage.h"
-
+#include "gdcmValEntry.h"
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
* \ingroup gdcmDicomDirImage
* \brief Constructor
- * @param begin iterator (inside the gdcmParser chained list)
- * on the first Header Entry (i.e Dicom Element)
- * related to this "IMAGE" part
- * @param end iterator (inside the gdcmParser chained list)
- * on the last Header Entry (i.e Dicom Element)
- * related to this 'IMAGE' part
+ * @param s SQ Item holdoing the elements
* @param ptagHT pointer to the HTable (gdcmObject needs it
- * to build the gdcmHeaderEntries)
- * @param plistEntries pointer to the chained List (gdcmObject needs it
- * to build the gdcmHeaderEntries)
+ * to build the gdcmDocEntries)
*/
-gdcmDicomDirImage::gdcmDicomDirImage(ListTag::iterator begin,
- ListTag::iterator end,
- TagHeaderEntryHT *ptagHT,
- ListTag *plistEntries):
- gdcmObject(begin,end,ptagHT,plistEntries)
+gdcmDicomDirImage::gdcmDicomDirImage(gdcmSQItem *s, TagDocEntryHT *ptagHT):
+ gdcmObject(ptagHT)
{
+ docEntries = s->GetDocEntries();
}
+gdcmDicomDirImage::gdcmDicomDirImage(TagDocEntryHT *ptagHT):
+ gdcmObject(ptagHT)
+{
+}
/**
* \ingroup gdcmDicomDirImage
* \brief Canonical destructor.
void gdcmDicomDirImage::Print(std::ostream &os)
{
os<<"IMAGE : ";
- for(ListTag::iterator i=beginObj;i!=endObj;++i)
+ for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i)
{
if( ((*i)->GetGroup()==0x0004) && ((*i)->GetElement()==0x1500) )
- os<<(*i)->GetValue();
+ os<<((gdcmValEntry *)(*i))->GetValue();
}
os<<std::endl;
//-----------------------------------------------------------------------------
class GDCM_EXPORT gdcmDicomDirImage : public gdcmObject {
public:
- gdcmDicomDirImage(ListTag::iterator begin,ListTag::iterator end,
- TagHeaderEntryHT *ptagHT, ListTag *plistEntries);
+ gdcmDicomDirImage(gdcmSQItem *s, TagDocEntryHT *ptagHT);
+ gdcmDicomDirImage(TagDocEntryHT *ptagHT);
~gdcmDicomDirImage(void);
// gdcmDicomDirMeta.h
//-----------------------------------------------------------------------------
#include "gdcmDicomDirMeta.h"
+#include "gdcmDocument.h"
//-----------------------------------------------------------------------------
// Constructor / Destructor
/**
* \ingroup gdcmMeta
* \brief Constructor
- * @param begin iterator (inside the gdcmParser chained list)
- * on the first Header Entry (i.e Dicom Element)
- * related to the "META" part
- * @param end iterator (inside the gdcmParser chained list)
- * on the last Header Entry (i.e Dicom Element)
- * related to the 'META' part
- * @param ptagHT pointer to the HTable (gdcmObject needs it
- * to build the gdcmHeaderEntries)
- * @param plistEntries pointer to the chained List (gdcmObject needs it
- * to build the gdcmHeaderEntries)
*/
-gdcmDicomDirMeta::gdcmDicomDirMeta(ListTag::iterator begin,
- ListTag::iterator end,
- TagHeaderEntryHT *ptagHT,
- ListTag *plistEntries):
- gdcmObject(begin,end,ptagHT,plistEntries)
+gdcmDicomDirMeta::gdcmDicomDirMeta(TagDocEntryHT *ptagHT):
+ gdcmObject(ptagHT)
{
+
}
/**
*/
gdcmDicomDirMeta::~gdcmDicomDirMeta()
{
+
}
//-----------------------------------------------------------------------------
class GDCM_EXPORT gdcmDicomDirMeta : public gdcmObject
{
public:
- gdcmDicomDirMeta(ListTag::iterator begin,ListTag::iterator end,
- TagHeaderEntryHT *ptagHT, ListTag *plistEntries);
+ gdcmDicomDirMeta(TagDocEntryHT *ptagHT);
~gdcmDicomDirMeta(void);
/**
* \ingroup gdcmDicomDirPatient
* \brief Constructor
- * @param begin iterator (inside the gdcmParser chained list)
- * on the first Header Entry (i.e Dicom Element)
- * related to this "PATIENT" part
- * @param end iterator (inside the gdcmParser chained list)
- * on the last Header Entry (i.e Dicom Element)
- * related to this 'PATIENT' part
+ * @param s SQ Item holding the elements related to this "PATIENT" part
* @param ptagHT pointer to the HTable (gdcmObject needs it
* to build the gdcmHeaderEntries)
- * @param plistEntries pointer to the chained List (gdcmObject needs it
- * to build the gdcmHeaderEntries)
*/
-gdcmDicomDirPatient::gdcmDicomDirPatient(ListTag::iterator begin,
- ListTag::iterator end,
- TagHeaderEntryHT *ptagHT,
- ListTag *plistEntries):
- gdcmObject(begin,end,ptagHT,plistEntries)
+gdcmDicomDirPatient::gdcmDicomDirPatient(gdcmSQItem *s, TagDocEntryHT *ptagHT):
+ gdcmObject(ptagHT)
{
+ docEntries = s->GetDocEntries();
}
+gdcmDicomDirPatient::gdcmDicomDirPatient(TagDocEntryHT *ptagHT):
+ gdcmObject(ptagHT)
+{
+}
/**
* \ingroup gdcmDicomDirPatient
* \brief Canonical destructor.
std::list<gdcmElement> elemList;
elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirStudyElements();
- FillObject(elemList);
- gdcmDicomDirStudy *st = new gdcmDicomDirStudy(i, j, ptagHT, plistEntries);
+ gdcmDicomDirStudy *st = new gdcmDicomDirStudy( ptagHT);
+ st->FillObject(elemList);
+
studies.push_front(st);
return st;
#include "gdcmObject.h"
#include "gdcmDicomDirStudy.h"
-
+#include "gdcmSQItem.h"
//-----------------------------------------------------------------------------
typedef std::list<gdcmDicomDirStudy *> ListDicomDirStudy;
class GDCM_EXPORT gdcmDicomDirPatient : public gdcmObject
{
public:
- gdcmDicomDirPatient(ListTag::iterator begin,ListTag::iterator end,
- TagHeaderEntryHT *ptagHT, ListTag *plistEntries);
+ gdcmDicomDirPatient(gdcmSQItem *s, TagDocEntryHT *ptagHT);
+ gdcmDicomDirPatient(TagDocEntryHT *ptagHT);
+
~gdcmDicomDirPatient(void);
virtual void Print(std::ostream &os = std::cout);
// Constructor / Destructor
/**
* \brief Constructor
- * @param begin iterator (inside the gdcmParser chained list)
- * on the first Header Entry (i.e Dicom Element)
- * related to this "SERIE" part
- * @param end iterator (inside the gdcmParser chained list)
- * on the last Header Entry (i.e Dicom Element)
- * related to this 'SERIE' part
+ * @param s SQ Item holding the elements related to this "SERIE" part
* @param ptagHT pointer to the HTable (gdcmObject needs it
- * to build the gdcmHeaderEntries)
- * @param plistEntries pointer to the chained List (gdcmObject needs it
- * to build the gdcmHeaderEntries)
+ * to build the gdcmDocEntries)
*/
-gdcmDicomDirSerie::gdcmDicomDirSerie(ListTag::iterator begin,
- ListTag::iterator end,
- TagHeaderEntryHT *ptagHT,
- ListTag *plistEntries ):
- gdcmObject(begin,end,ptagHT,plistEntries)
+gdcmDicomDirSerie::gdcmDicomDirSerie(gdcmSQItem *s, TagDocEntryHT *ptagHT):
+ gdcmObject(ptagHT)
+{
+ docEntries = s->GetDocEntries();
+}
+gdcmDicomDirSerie::gdcmDicomDirSerie(TagDocEntryHT *ptagHT):
+ gdcmObject(ptagHT)
{
}
-
/**
* \brief Canonical destructor.
*/
std::list<gdcmElement> elemList;
elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirImageElements();
+ gdcmDicomDirImage *st = new gdcmDicomDirImage(ptagHT);
FillObject(elemList);
- gdcmDicomDirImage *st = new gdcmDicomDirImage(i, j, ptagHT, plistEntries);
images.push_front(st);
return st;
}
class GDCM_EXPORT gdcmDicomDirSerie : public gdcmObject
{
public:
- gdcmDicomDirSerie(ListTag::iterator begin,ListTag::iterator end,
- TagHeaderEntryHT *ptagHT, ListTag *plistEntries);
+ gdcmDicomDirSerie(gdcmSQItem *s, TagDocEntryHT *ptagHT);
+ gdcmDicomDirSerie(TagDocEntryHT *ptagHT);
~gdcmDicomDirSerie(void);
virtual void Print(std::ostream &os = std::cout);
/**
* \ingroup gdcmDicomDirStudy
* \brief constructor
- * @param begin iterator (inside the gdcmParser chained list)
- * on the first Header Entry (i.e Dicom Element)
- * related to this "STUDY" part
- * @param end iterator (inside the gdcmParser chained list)
- * on the last Header Entry (i.e Dicom Element)
- * related to this 'STUDY' part
+ * @param s SQ Item holding the elements related to this "STUDY" part
* @param ptagHT pointer to the HTable (gdcmObject needs it
* to build the gdcmHeaderEntries)
- * @param plistEntries pointer to the chained List (gdcmObject needs it
- * to build the gdcmHeaderEntries)
*/
-gdcmDicomDirStudy::gdcmDicomDirStudy(ListTag::iterator begin,
- ListTag::iterator end,
- TagHeaderEntryHT *ptagHT,
- ListTag *plistEntries):
- gdcmObject(begin,end,ptagHT,plistEntries)
+gdcmDicomDirStudy::gdcmDicomDirStudy(gdcmSQItem *s, TagDocEntryHT *ptagHT):
+ gdcmObject(ptagHT)
{
+ docEntries = s->GetDocEntries();
}
+gdcmDicomDirStudy::gdcmDicomDirStudy(TagDocEntryHT *ptagHT):
+ gdcmObject(ptagHT)
+{
+}
/**
* \ingroup gdcmDicomDirStudy
* \brief Canonical destructor.
std::list<gdcmElement> elemList;
elemList=gdcmGlobal::GetDicomDirElements()->GetDicomDirSerieElements();
+ gdcmDicomDirSerie *st = new gdcmDicomDirSerie(ptagHT);
FillObject(elemList);
- gdcmDicomDirSerie *st = new gdcmDicomDirSerie(i, j, ptagHT, plistEntries);
series.push_front(st);
return st;
}
//-----------------------------------------------------------------------------
class GDCM_EXPORT gdcmDicomDirStudy : public gdcmObject {
public:
- gdcmDicomDirStudy(ListTag::iterator begin,ListTag::iterator end,
- TagHeaderEntryHT *ptagHT, ListTag *plistEntries);
+ gdcmDicomDirStudy(gdcmSQItem *s, TagDocEntryHT *ptagHT);
+ gdcmDicomDirStudy(TagDocEntryHT *ptagHT);
~gdcmDicomDirStudy(void);
}
#else
- // None of these functions is in POSIX. The functions scandir() and
- // alphasort() are from BSD 4.3, and have been available under Linux since
- // libc4. Libc4 and libc5 use the more precise prototype
-
struct dirent **namelist;
int n=scandir(dirName.c_str(), &namelist, 0, alphasort);
- //if n < 0 should raise error
-
for (int i= 0;i < n; i++)
{
fileName=namelist[i]->d_name;
{
this->push_back(dirName+fileName);
}
- free(namelist[i]);
}
- free(namelist);
#endif
}
#include "gdcmDebug.h"
#include "jpeg/ljpg/jpegless.h"
-typedef std::pair<TagHeaderEntryHT::iterator,TagHeaderEntryHT::iterator> IterHT;
+typedef std::pair<TagDocEntryHT::iterator,TagDocEntryHT::iterator> IterHT;
//-----------------------------------------------------------------------------
// Constructor / Destructor
// the *last* of the (GrPixel, NumPixel), if many.
TagKey key = gdcmDictEntry::TranslateToKey(grPixel, numPixel);
- TagHeaderEntryHT::iterator p2;
- gdcmHeaderEntry *PixelElement;
+ TagDocEntryHT::iterator p2;
+ gdcmDocEntry *PixelElement;
IterHT it= Header->GetEntry().equal_range(key); // get a pair of iterators first-last synonym
#include "gdcmUtil.h"
#include "gdcmDebug.h"
#include "gdcmTS.h"
+#include "gdcmValEntry.h"
#include <vector>
bool exception_on_error,
bool enable_sequences,
bool ignore_shadow):
- gdcmParser(InFilename,exception_on_error,enable_sequences,ignore_shadow)
+ gdcmDocument(InFilename,exception_on_error,enable_sequences,ignore_shadow)
{
-
+/*
typedef struct {
guint32 totalSQlength;
guint32 alreadyParsedlength;
} pileElem;
-
+*/
// for some ACR-NEMA images GrPixel, NumPixel is *not* 7fe0,0010
// We may encounter the 'RETired' (0x0028, 0x0200) tag
NumPixel = 0x1010;
else
NumPixel = 0x0010;
-
- TagKey key = gdcmDictEntry::TranslateToKey(GrPixel, NumPixel);
- countGrPixel = GetEntry().count(key);
-
- // we set the SQ Depth of each Header Entry
-
- int top =-1;
- int countSQ = 0;
- pileElem pile[100]; // Hope embedded sequence depth is no that long !
-
- int currentParsedlength = 0;
- int totalElementlength;
- std::ostringstream tab;
- tab << " ";
-
- // GDCM_DEBUG
- // Sorry; Dealing with e-film breaker images
- // will (certainly) cause a lot of troubles ...
- // I prefer keeping my 'trace' on .
- for (ListTag::iterator i = listEntries.begin();
- i != listEntries.end();
- ++i) {
- (*i)->SetSQDepthLevel(countSQ);
- if ( (*i)->GetVR() == "SQ" && (*i)->GetReadLength() != 0) { // SQ found
- countSQ++;
- top ++;
- if ( top >= 20) {
-#ifdef GDCM_DEBUG
- std::cout << "Kaie ! Kaie! SQ Stack Overflow" << std::endl;
-#endif //GDCM_DEBUG
- return;
- }
-#ifdef GDCM_DEBUG
- std::cout << "\n >>>>> empile niveau " << top
- << "; Lgr SeQ: " << (*i)->GetReadLength()
- << "\n" <<std::endl;
-#endif //GDCM_DEBUG
-
- pile[top].totalSQlength = (*i)->GetReadLength();
- pile[top].alreadyParsedlength = 0;
- currentParsedlength = 0;
-
- } else { // non SQ found
- if (countSQ != 0) { // we are 'inside a SeQuence'
- if ( (*i)->GetGroup()==0xfffe && (*i)->GetElement()==0xe0dd) {
- // we just found 'end of SeQuence'
-
-#ifdef GDCM_DEBUG
- std::cout << "fffe,e0dd : depile" << std::endl;
-#endif //GDCM_DEBUG
-
- currentParsedlength += 8; // gr:2 elem:2 vr:2 lgt:2
- countSQ --;
- top --;
- pile[top].alreadyParsedlength += currentParsedlength;
- } else {
- // we are on a 'standard' elem
- // or a Zero-length SeQuence
-
- totalElementlength = (*i)->GetFullLength();
- currentParsedlength += totalElementlength;
- pile[top].alreadyParsedlength += totalElementlength;
-
- if (pile[top].totalSQlength == 0xffffffff) {
-#ifdef GDCM_DEBUG
- std::cout << "totalSeQlength == 0xffffffff" << std::endl;
-#endif //GDCM_DEBUG
- } else {
-#ifdef GDCM_DEBUG
- std::cout << "alrdyPseLgt:"
- << pile[top].alreadyParsedlength << " totSeQlgt: "
- << pile[top].totalSQlength << " curPseLgt: "
- << currentParsedlength
- << std::endl;
-#endif //GDCM_DEBUG
- while (pile[top].alreadyParsedlength==pile[top].totalSQlength) {
-#ifdef GDCM_DEBUG
- std::cout << " \n<<<<<< On depile niveau " << top
- << " \n" << std::endl;
-#endif //GDCM_DEBUG
- (*i)->SetSQDepthLevel(countSQ);
- currentParsedlength = pile[top].alreadyParsedlength;
- countSQ --;
- top --;
- if (top >=0) {
- pile[top].alreadyParsedlength += currentParsedlength +12;
- // 12 : length of 'SQ embedded' SQ element
- currentParsedlength += 8; // gr:2 elem:2 vr:2 lgt:2
-
-#ifdef GDCM_DEBUG
- std::cout << pile[top].alreadyParsedlength << " "
- << pile[top].totalSQlength << " "
- << currentParsedlength
- << std::endl;
-#endif //GDCM_DEBUG
- }
- if (top == -1) {
- currentParsedlength = 0;
- break;
- }
- }
- }
- }
- } // end : 'inside a SeQuence'
- }
-#ifdef GDCM_DEBUG
- for (int k=0; k<(*i)->GetSQDepthLevel();k++) {
- std::cout << tab;
- }
- (*i)->SetPrintLevel(2);
- (*i)->Print();
-#endif //GDCM_DEBUG
- } // end for
}
/**
* @param exception_on_error whether we want to throw an exception or not
*/
gdcmHeader::gdcmHeader(bool exception_on_error) :
- gdcmParser(exception_on_error)
+ gdcmDocument(exception_on_error)
{
}
*/
void gdcmHeader::PrintEntryNoSQ(std::ostream & os) {
+// FIXME : Is it of any use, now?
+
+/*
int depth;
for (ListTag::iterator i = listEntries.begin();
i != listEntries.end();
++i)
{
depth= (*i)->GetSQDepthLevel();
- if ( depth != 0 /*|| (*i)->GetVR() =="SQ" */){
+ if ( depth != 0 ){
continue;
}
(*i)->SetPrintLevel(printLevel);
(*i)->Print(os);
}
+ */
}
/**
* \warning : will be removed
* @return
*/
-void gdcmHeader::PrintEntryNiceSQ(std::ostream & os) {
+void gdcmHeader::PrintEntryNiceSQ(std::ostream & os) {
+
+/*
std::ostringstream tab;
tab << " ";
(*i)->SetPrintLevel(printLevel);
(*i)->Print(os);
- } // end for
+ } // end for
+
+ */
}
//-----------------------------------------------------------------------------
* false otherwise.
*/
bool gdcmHeader::IsReadable(void) {
- if(!gdcmParser::IsReadable()) {
+ if(!gdcmDocument::IsReadable()) {
return(false);
}
std::string res = GetEntryByNumber(0x0028, 0x0005);
if ( res != GDCM_UNFOUND && atoi(res.c_str()) > 4 )
return false; // Image Dimensions
- if ( !GetHeaderEntryByNumber(0x0028, 0x0100) )
+ if ( !GetDocEntryByNumber(0x0028, 0x0100) )
return false; // "Bits Allocated"
- if ( !GetHeaderEntryByNumber(0x0028, 0x0101) )
+ if ( !GetDocEntryByNumber(0x0028, 0x0101) )
return false; // "Bits Stored"
- if ( !GetHeaderEntryByNumber(0x0028, 0x0102) )
+ if ( !GetDocEntryByNumber(0x0028, 0x0102) )
return false; // "High Bit"
- if ( !GetHeaderEntryByNumber(0x0028, 0x0103) )
+ if ( !GetDocEntryByNumber(0x0028, 0x0103) )
return false; // "Pixel Representation" i.e. 'Sign'
return true;
}
* @return True when JPEGBaseLineProcess1found. False in all other cases.
*/
bool gdcmHeader::IsJPEGBaseLineProcess1TransferSyntax(void) {
- gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
+ gdcmDocEntry* Element = GetDocEntryByNumber(0x0002, 0x0010);
if ( !Element )
return false;
- LoadHeaderEntrySafe(Element);
+ LoadDocEntrySafe(Element);
- std::string Transfer = Element->GetValue();
+ std::string Transfer = ((gdcmValEntry *)Element)->GetValue();
if ( Transfer == "1.2.840.10008.1.2.4.50" )
return true;
return false;
* @return True when JPEGExtendedProcess2-4 found. False in all other cases.
*/
bool gdcmHeader::IsJPEGExtendedProcess2_4TransferSyntax(void) {
- gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
+ gdcmDocEntry* Element = GetDocEntryByNumber(0x0002, 0x0010);
if ( !Element )
return false;
- LoadHeaderEntrySafe(Element);
- return ( Element->GetValue() == "1.2.840.10008.1.2.4.51" );
+ LoadDocEntrySafe(Element);
+ return ( ((gdcmValEntry *)Element)->GetValue() == "1.2.840.10008.1.2.4.51" );
}
/**
* @return True when JPEGExtendedProcess3-5 found. False in all other cases.
*/
bool gdcmHeader::IsJPEGExtendedProcess3_5TransferSyntax(void) {
- gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
+ gdcmDocEntry* Element = GetDocEntryByNumber(0x0002, 0x0010);
if ( !Element )
return false;
- LoadHeaderEntrySafe(Element);
+ LoadDocEntrySafe(Element);
- std::string Transfer = Element->GetValue();
+ std::string Transfer = ((gdcmValEntry *)Element)->GetValue();
if ( Transfer == "1.2.840.10008.1.2.4.52" )
return true;
return false;
* other cases.
*/
bool gdcmHeader::IsJPEGSpectralSelectionProcess6_8TransferSyntax(void) {
- gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
+ gdcmDocEntry* Element = GetDocEntryByNumber(0x0002, 0x0010);
if ( !Element )
return false;
- LoadHeaderEntrySafe(Element);
+ LoadDocEntrySafe(Element);
- std::string Transfer = Element->GetValue();
+ std::string Transfer = ((gdcmValEntry *)Element)->GetValue();
if ( Transfer == "1.2.840.10008.1.2.4.53" )
return true;
return false;
* other cases.
*/
bool gdcmHeader::IsRLELossLessTransferSyntax(void) {
- gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
+ gdcmDocEntry* Element = GetDocEntryByNumber(0x0002, 0x0010);
if ( !Element )
return false;
- LoadHeaderEntrySafe(Element);
+ LoadDocEntrySafe(Element);
- std::string Transfer = Element->GetValue();
+ std::string Transfer = ((gdcmValEntry *)Element)->GetValue();
if ( Transfer == "1.2.840.10008.1.2.5" ) {
return true;
}
* other cases.
*/
bool gdcmHeader::IsJPEGLossless(void) {
- gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
+ gdcmDocEntry* Element = GetDocEntryByNumber(0x0002, 0x0010);
// faire qq chose d'intelligent a la place de ça
if ( !Element )
return false;
- LoadHeaderEntrySafe(Element);
+ LoadDocEntrySafe(Element);
- const char * Transfert = Element->GetValue().c_str();
+ const char * Transfert = ((gdcmValEntry *)Element)->GetValue().c_str();
+
if ( memcmp(Transfert+strlen(Transfert)-2 ,"70",2)==0) return true;
if ( memcmp(Transfert+strlen(Transfert)-2 ,"55",2)==0) return true;
- if (Element->GetValue() == "1.2.840.10008.1.2.4.57") return true;
+
+ if (((gdcmValEntry *)Element)->GetValue() == "1.2.840.10008.1.2.4.57") return true;
return false;
}
* other cases.
*/
bool gdcmHeader::IsJPEG2000(void) {
- gdcmHeaderEntry* Element = GetHeaderEntryByNumber(0x0002, 0x0010);
+ gdcmDocEntry* Element = GetDocEntryByNumber(0x0002, 0x0010);
if ( !Element )
return false;
- LoadHeaderEntrySafe(Element);
+ LoadDocEntrySafe(Element);
- std::string Transfer = Element->GetValue();
+ std::string Transfer = ((gdcmValEntry *)Element)->GetValue();
if ( (Transfer == "1.2.840.10008.1.2.4.90")
|| (Transfer == "1.2.840.10008.1.2.4.91") )
return true;
// Anyway, it's to late check if the 'Preamble' was found ...
// And ... would it be a rich idea to check ?
// (some 'no Preamble' DICOM images exist !)
- return (GetHeaderEntryByNumber(0x0002, 0x0010) != NULL);
+ return (GetDocEntryByNumber(0x0002, 0x0010) != NULL);
}
/**
* @return Pixel Offset
*/
size_t gdcmHeader::GetPixelOffset(void) {
- //
- // If the element (0x0088,0x0200) 'icone image sequence' is found
- // (grPixel,numPixel) is stored twice : the first one for the icon
- // the second one for the image ...
- // pb : sometimes , (0x0088,0x0200) exists, but doesn't contain *anything*
- // see gdcmData/MxTwinLossLess.dcm ...
-
- /**
- * \todo Clean me
- *std::string icone = GetEntryByNumber(0x0088,0x0200); //icone image sequence
- */
- IterHT it = GetHeaderEntrySameNumber(GrPixel,NumPixel);
- TagKey key = gdcmDictEntry::TranslateToKey(GrPixel,NumPixel);
- gdcmHeaderEntry* PixelElement;
- if (countGrPixel == 1)
- PixelElement = (it.first)->second;
- else {
- PixelElement = (++it.first)->second; // hope there are no more than 2 !
- }
+ gdcmDocEntry* PixelElement = GetDocEntryByNumber(GrPixel,NumPixel);
+
if (PixelElement) {
return PixelElement->GetOffset();
} else {
*/
size_t gdcmHeader::GetPixelAreaLength(void) {
- IterHT it = GetHeaderEntrySameNumber(GrPixel,NumPixel);
- TagKey key = gdcmDictEntry::TranslateToKey(GrPixel,NumPixel);
- gdcmHeaderEntry* PixelElement;
-
- if (countGrPixel==1)
- PixelElement = (it.first)->second;
- else
- PixelElement = (++it.first)->second;
+ gdcmDocEntry* PixelElement = GetDocEntryByNumber(GrPixel,NumPixel);
if (PixelElement) {
return PixelElement->GetLength();
// Check the presence of the LUT Descriptors, and LUT Tables
// LutDescriptorRed
- if ( !GetHeaderEntryByNumber(0x0028,0x1101) )
+ if ( !GetDocEntryByNumber(0x0028,0x1101) )
return false;
// LutDescriptorGreen
- if ( !GetHeaderEntryByNumber(0x0028,0x1102) )
+ if ( !GetDocEntryByNumber(0x0028,0x1102) )
return false;
// LutDescriptorBlue
- if ( !GetHeaderEntryByNumber(0x0028,0x1103) )
+ if ( !GetDocEntryByNumber(0x0028,0x1103) )
return false;
// Red Palette Color Lookup Table Data
- if ( !GetHeaderEntryByNumber(0x0028,0x1201) )
+ if ( !GetDocEntryByNumber(0x0028,0x1201) )
return false;
// Green Palette Color Lookup Table Data
- if ( !GetHeaderEntryByNumber(0x0028,0x1202) )
+ if ( !GetDocEntryByNumber(0x0028,0x1202) )
return false;
// Blue Palette Color Lookup Table Data
- if ( !GetHeaderEntryByNumber(0x0028,0x1203) )
+ if ( !GetDocEntryByNumber(0x0028,0x1203) )
return false;
// FIXME : (0x0028,0x3006) : LUT Data (CTX dependent)
// NOT taken into account, but we don't know how to use it ...
std::string content1;
char car[20];
- // Assumes HeaderEntry (GrPixel, NumPixel) is unique ...
+ // Assumes DocEntry (GrPixel, NumPixel) is unique ...
//\todo deal with multiplicity (see gdcmData/icone.dcm)
sprintf(car,"%d",ImageDataSize);
- gdcmHeaderEntry *a = GetHeaderEntryByNumber(GrPixel, NumPixel);
+ gdcmDocEntry *a = GetDocEntryByNumber(GrPixel, NumPixel);
a->SetLength(ImageDataSize);
ImageDataSize+=8;
return(false);
}
-bool gdcmHeader::WriteEntry(gdcmHeaderEntry *tag, FILE *_fp,FileType type)
+bool gdcmHeader::WriteEntry(gdcmDocEntry *tag, FILE *_fp,FileType type)
{
guint32 length = tag->GetLength();
// bytes. When this is not the case, pad with an additional byte:
if(length%2==1)
{
- tag->SetValue(tag->GetValue()+"\0");
+ // tag->SetValue(tag->GetValue()+"\0"); // to go on compiling
tag->SetLength(tag->GetReadLength()+1);
}
*/
bool gdcmHeader::anonymizeHeader() {
- gdcmHeaderEntry *patientNameHE = GetHeaderEntryByNumber (0x0010, 0x0010);
- // gdcmHeaderEntry *patientIDHE = GetHeaderEntryByNumber (0x0010, 0x0020);
+ gdcmDocEntry *patientNameHE = GetDocEntryByNumber (0x0010, 0x0010);
+ // gdcmDocEntry *patientIDHE = GetDocEntryByNumber (0x0010, 0x0020);
ReplaceIfExistByNumber (" ",0x0010, 0x2154); // Telephone
ReplaceIfExistByNumber (" ",0x0010, 0x1040); // Adress
#define GDCMHEADER_H
#include "gdcmCommon.h"
-#include "gdcmParser.h"
-
+//#include "gdcmParser.h"
+#include "gdcmDocument.h"
//-----------------------------------------------------------------------------
/**
* \brief
* protected due to Swig limitations for as Has_a dependency between
* gdcmFile and gdcmHeader.
*/
-class GDCM_EXPORT gdcmHeader : public gdcmParser
+class GDCM_EXPORT gdcmHeader : public gdcmDocument
{
protected:
/// In some cases (e.g. for some ACR-NEMA images) the Header Entry Element
// there are protected in the parent class
inline virtual std::string GetEntryByNumber (guint16 group, guint16 element)
- { return(gdcmParser::GetEntryByNumber(group,element)); }
+ { return(gdcmDocument::GetEntryByNumber(group,element)); }
inline virtual std::string GetEntryVRByNumber(guint16 group, guint16 element)
- { return(gdcmParser::GetEntryVRByNumber(group,element)); }
+ { return(gdcmDocument::GetEntryVRByNumber(group,element)); }
inline virtual int GetEntryLengthByNumber(guint16 group, guint16 element)
- { return(gdcmParser::GetEntryLengthByNumber(group,element)); }
+ { return(gdcmDocument::GetEntryLengthByNumber(group,element)); }
inline virtual std::string GetEntryByName (std::string tagName)
- { return(gdcmParser::GetEntryByName(tagName)); }
+ { return(gdcmDocument::GetEntryByName(tagName)); }
inline virtual std::string GetEntryVRByName (std::string tagName)
- { return(gdcmParser::GetEntryVRByName(tagName)); }
+ { return(gdcmDocument::GetEntryVRByName(tagName)); }
inline virtual bool SetEntryByNumber(std::string content,
guint16 group, guint16 element)
- { return(gdcmParser::SetEntryByNumber(content,group,element)); }
+ { return(gdcmDocument::SetEntryByNumber(content,group,element)); }
inline virtual bool SetEntryByName(std::string content,std::string tagName)
- { return(gdcmParser::SetEntryByName(content,tagName)); }
+ { return(gdcmDocument::SetEntryByName(content,tagName)); }
inline virtual bool SetEntryLengthByNumber(guint32 l,
guint16 group, guint16 element)
- { return(gdcmParser::SetEntryLengthByNumber(l,group,element)); }
+ { return(gdcmDocument::SetEntryLengthByNumber(l,group,element)); }
inline virtual void UpdateShaEntries(void)
- { gdcmParser::UpdateShaEntries(); }
+ { gdcmDocument::UpdateShaEntries(); }
/// Read (used in gdcmFile)
void SetImageDataSize(size_t ExpectedSize);
bool operator<(gdcmHeader &header);
- bool WriteEntry(gdcmHeaderEntry *tag,FILE *_fp,FileType type);
+ bool WriteEntry(gdcmDocEntry *tag,FILE *_fp,FileType type);
virtual void PrintEntryNoSQ (std::ostream &os = std::cout);
#include "gdcmObject.h"
#include "gdcmGlobal.h"
#include "gdcmDebug.h"
+#include "gdcmValEntry.h"
//-----------------------------------------------------------------------------
/**
* \ingroup gdcmObject
* \brief Constructor
- * @param begin iterator on the first Header Entry (i.e Dicom Element)
- * related to this 'Object'
- * @param end iterator on the last Header Entry
- * (i.e Dicom Element) related to this 'Object'
+ *
* @param ptagHT pointer to the HTable (gdcmObject needs it
- * to build the gdcmHeaderEntries)
- * @param plistEntries pointer to the chained List (gdcmObject needs it
- * to build the gdcmHeaderEntries)
+ * to build the gdcmDocEntries)
+ * @param depth Seaquence depth level
*/
-gdcmObject::gdcmObject(ListTag::iterator begin, ListTag::iterator end,
- TagHeaderEntryHT *ptagHT, ListTag *plistEntries) {
- beginObj = begin;
- endObj = end;
+
+gdcmObject::gdcmObject(TagDocEntryHT *ptagHT, int depth)
+ : gdcmSQItem (depth) {
this->ptagHT = ptagHT;
- this->plistEntries = plistEntries;
- if(begin==end)
- dbg.Verbose(0, "gdcmObject::gdcmObject empty list");
}
+
/**
* \ingroup gdcmObject
* \brief Canonical destructor.
gdcmObject::~gdcmObject(void) {
}
-//-----------------------------------------------------------------------------
-// Print
-/**
- * \ingroup gdcmObject
- * \brief Prints the Object
- * @return
- */
-void gdcmObject::Print(std::ostream &os) {
- if(printLevel>=0) {
- ListTag::iterator i;
- for(i=beginObj;;++i) {
- (*i)->SetPrintLevel(printLevel);
- (*i)->Print(os);
- if (i == endObj) break;
- }
- }
-}
+
//-----------------------------------------------------------------------------
// Public
-/**
- * \ingroup gdcmObject
- * \brief Get the value of an Header Entries (i.e Dicom Element) by number
- * @return
- */
-std::string gdcmObject::GetEntryByNumber(guint16 group, guint16 element) {
- for(ListTag::iterator i=beginObj;;++i) {
- if ( (*i)->GetGroup()==group && (*i)->GetElement()==element)
- return (*i)->GetValue();
- if (i == endObj) break;
- }
- return GDCM_UNFOUND;
-}
-
-/**
- * \ingroup gdcmObject
- * \brief Get the value of an Header Entries (i.e Dicom Element) by name
- * @param name : name of the searched element.
- * @return
- */
-std::string gdcmObject::GetEntryByName(TagName name) {
- gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict();
- gdcmDictEntry *dictEntry = (*PubDict).GetDictEntryByName(name);
-
- if( dictEntry == NULL)
- return GDCM_UNFOUND;
- return GetEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement());
-}
-/**
- * \ingroup gdcmObject
- * \brief Set the 'boundaries' gdcmObject (gdcmDicomDirPatient,
- * gdcmDicomDirStudy, gdcmDicomDirSerie, gdcmDicomDirImage)
- * comming for the parsing of a DICOMDIR file
- * \warning NOT en user intended function
- * @param flag = 0 when META to be dealt with
- */
-void gdcmObject::ResetBoundaries(int flag) {
-
- if (flag) { // it's NOT a META
- // upwards to fffe,e000
- for( i=j=debut();
- ((*i)->GetGroup() != 0xfffe) && ((*i)->GetElement() != 0xe000);
- --i,j--) {
- }
- beginObj=j;
- }
-
- // upwards again to fffe,e000
- if (fin()== (--(plistEntries->end())) ) // Don't try anything more when end
- return; // of Chained List is reached
-
- for( i=j=fin();
- ((*i)->GetGroup() != 0xfffe) && ((*i)->GetElement() != 0xe000);
- --i,j--) {
- }
- j--;
- endObj=j;
-}
-/**
- * \brief Sets Entry (Dicom Element) value of an element,
- * specified by it's tag (Group, Number)
- * and the length, too ...
- * If the Element is not found, it's just created !
- * \warning we suppose, right now, the element belongs to a Public Group
- * (NOT a shadow one)
- * @param val string value to set
- * @param group Group of the searched tag.
- * @param element Element of the searched tag.
- * @return true if element was found or created successfully
- */
- bool gdcmObject::SetEntryByNumber(std::string val,guint16 group,
- guint16 element) {
-
- for(ListTag::iterator i=beginObj;;++i) {
- if ( (*i)->GetGroup() == 0xfffe && (*i)->GetElement() == 0xe000 )
- continue;
- if ( group < (*i)->GetGroup() ||
- (group == (*i)->GetGroup() && element < (*i)->GetElement()) ){
- // instead of ReplaceOrCreateByNumber
- // that is a method of gdcmParser :-(
- gdcmHeaderEntry *Entry;
- TagKey key = gdcmDictEntry::TranslateToKey(group, element);
- if ( ! ptagHT->count(key)) {
- // we assume a Public Dictionnary *is* loaded
- gdcmDict *PubDict = gdcmGlobal::GetDicts()->GetDefaultPubDict();
- // if the invoked (group,elem) doesn't exist inside the Dictionary
- // we create a VirtualDictEntry
- gdcmDictEntry *DictEntry = PubDict->GetDictEntryByNumber(group, element);
- if (DictEntry == NULL) {
- DictEntry=gdcmGlobal::GetDicts()->NewVirtualDictEntry(group,element,"UN","??","??");
- }
- // we assume the constructor didn't fail
- Entry = new gdcmHeaderEntry(DictEntry);
- /// \todo
- /// ----
- /// better we don't assume too much !
- /// in the next release, gdcmObject will be used
- /// to describe any Header Entry ...
- } else {
- Entry = ptagHT->find(key)->second;
- }
- Entry->SetValue(val);
- Entry->SetLength(val.length());
- plistEntries->insert(i,Entry);
- return true;
- }
- if (group == (*i)->GetGroup() && element == (*i)->GetElement() ) {
- (*i)->SetValue(val);
- (*i)->SetLength(val.length());
- return true;
- }
- }
-}
/**
* \ingroup gdcmObject
* \brief Builds a hash table (multimap) containing
* related to this 'object'
* @return
*/
-TagHeaderEntryHT gdcmObject::GetEntry(void) {
- TagHeaderEntryHT HT;
- for(ListTag::iterator i=beginObj;;++i) {
- HT.insert( PairHT( (*i)->GetKey(),(*i)) );
- if (i == endObj) break;
+TagDocEntryHT gdcmObject::GetEntry(void) {
+ TagDocEntryHT HT;
+ docEntries=GetDocEntries();
+ for(ListDocEntry::iterator i=docEntries.begin();i!=docEntries.end();++i) {
+ HT[(*i)->GetKey()]=*i;
}
return(HT);
}
* pointers to all Header Entries (i.e Dicom Element)
* related to this 'object'
* @return
- */
+ */
+
+ // FIXME : what was it used for ?!?
+ /*
ListTag gdcmObject::GetListEntry(void) {
- ListTag list;
- for(ListTag::iterator i=beginObj;;++i) {
- list.push_back(*i);
- if (i == endObj) break;
- }
- return(list);
+ return(GetDocEntries());
}
-
+*/
//-----------------------------------------------------------------------------
// Protected
* of a partially created DICOMDIR
*/
void gdcmObject::FillObject(std::list<gdcmElement> elemList) {
+
+ // FillObject rempli le SQItem qui sera accroche au bon endroit
+
std::list<gdcmElement>::iterator it;
guint16 tmpGr,tmpEl;
gdcmDictEntry *dictEntry;
- gdcmHeaderEntry *entry;
-
- debInsertion = this->fin();
- ++debInsertion;
- finInsertion=debInsertion;
+ gdcmValEntry *entry;
+
+ //gdcmSQItem *s = new gdcmSQItem;
+ // for all the Elements found in they own part of the DicomDir dict.
for(it=elemList.begin();it!=elemList.end();++it)
{
tmpGr=it->group;
tmpEl=it->elem;
dictEntry=gdcmGlobal::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl);
- entry=new gdcmHeaderEntry(dictEntry);
+ entry=new gdcmValEntry(dictEntry);
entry->SetOffset(0); // just to avoid further missprinting
entry->SetValue(it->value);
+ // dealing with value length ...
+
if(dictEntry->GetGroup()==0xfffe)
{
entry->SetLength(entry->GetValue().length());
}
else
{
- entry->SetLength(entry->GetValue().length());
+ entry->SetLength(entry->GetValue().length());
}
- ptagHT->insert( PairHT(entry->GetKey(),entry) ); // add in the (multimap) H Table
- plistEntries->insert(debInsertion ,entry); // add at the begining of the Patient list
- ++finInsertion;
- }
-
- i=fin();
- i++;
- j=debInsertion;
- j--;
+ //docEntries->insert(debInsertion ,entry); // ??? // add at the begining of the Patient list
+ AddDocEntry(entry);
+ }
}
//-----------------------------------------------------------------------------
// Private
#include <string>
#include <list>
#include "gdcmCommon.h"
-#include "gdcmHeaderEntry.h"
-#include "gdcmParser.h"
+#include "gdcmDocEntry.h"
+//#include "gdcmParser.h"
+#include "gdcmDocument.h"
#include "gdcmDicomDirElement.h"
+#include "gdcmSQItem.h"
+
//-----------------------------------------------------------------------------
class gdcmObject;
typedef std::list<gdcmObject *> ListContent;
* \ingroup gdcmObject
* \brief Base object
*/
-class GDCM_EXPORT gdcmObject
+class GDCM_EXPORT gdcmObject : public gdcmSQItem
{
public:
+
/**
* \ingroup gdcmParser
* \brief Sets the print level for the Dicom Header
*/
void SetPrintLevel(int level)
{ printLevel = level; };
- virtual void Print(std::ostream &os = std::cout);
-
- std::string GetEntryByNumber(guint16 group, guint16 element);
- std::string GetEntryByName(TagName name);
+
+ // std::string GetEntryByNumber(guint16 group, guint16 element);
+ // std::string GetEntryByName(TagName name);
bool SetEntryByNumber(std::string val,guint16 group,guint16 element);
- TagHeaderEntryHT GetEntry(void);
- ListTag GetListEntry(void);
-
- void ResetBoundaries(int flag);
-/**
- * \ingroup gdcmObject
- * \brief returns an iterator on the first Header Entry (i.e Dicom Element),
- * inside the DICOMDIR chained list,
- * related to this 'Object'
- * @return
- */
- ListTag::iterator debut(void)
- { return(beginObj);}
- /**
- * \ingroup gdcmObject
- * \brief returns an iterator on the last Header Entry (i.e Dicom Element),
- * inside the DICOMDIR chained list,
- * related to this 'Object'
- * @return
- */
- ListTag::iterator fin (void)
- { return(endObj); }
+ TagDocEntryHT GetEntry(void);
+ void FillObject(std::list<gdcmElement> elemList);
protected:
+
// constructor and destructor are protected to avoid end user to instanciate this class.
- gdcmObject(ListTag::iterator begin,ListTag::iterator end,
- TagHeaderEntryHT *ptagHT, ListTag *plistEntries);
+ gdcmObject(TagDocEntryHT *ptagHT, int depth = 0);
virtual ~gdcmObject(void);
- void FillObject(std::list<gdcmElement> elemList);
+// variables :
-/**
-* \brief iterator on the first Header Entry (i.e Dicom Element),
-* inside the DICOMDIR chained list,
-* related to this 'Object'
-*/
- ListTag::iterator beginObj;
-/**
-* \brief iterator on the last Header Entry (i.e Dicom Element),
-* inside the DICOMDIR chained list,
-* related to this 'Object'
-*/
- ListTag::iterator endObj;
-/**
-* \brief pointer to the HTable of the gdcmParser,
-* (because we don't know it within any gdcmObject)
-*/
- TagHeaderEntryHT *ptagHT;
-/**
-* \brief pointer to the Chained List of the gdcmParser,
-* (because we don't know it within any gdcmObject)
-*/
- ListTag *plistEntries;
-/**
-* \brief detail level to be printed
-*/
+///\brief detail level to be printed
int printLevel;
-
- /**
- * \brief used to pass variables to FillObject function
- * Works as 'global' variable
- */
- std::list<gdcmHeaderEntry *>::iterator debInsertion, finInsertion, i,j;
private:
-
};
//-----------------------------------------------------------------------------