Remove all access to the hash-tables or lists in the objects.
-- BeNours
+2005-01-20 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+ * src/gdcmDicomDir*.[h|cxx] : rename methods to be logik in their name.
+ Remove all access to the hash-tables or lists in the objects.
+
2005-01-20 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
* src/gdcmDebug.h : remove the Debug test in the gdcmErrorMacro
* src/gdcmDocument.[h|cxx] : rename the Initialise method to Initialize, to
Program: gdcm
Module: $RCSfile: PrintDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/01/18 07:55:16 $
- Version: $Revision: 1.16 $
+ Date: $Date: 2005/01/20 11:09:21 $
+ Version: $Revision: 1.17 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
// Test if the DicomDir contains any Patient
- pa = e1->GetFirstEntry();
+ pa = e1->GetFirstPatient();
if ( pa == 0)
{
std::cout<<" DicomDir '"<<fileName
<< " = PATIENT List =========================================="
<< std::endl<< std::endl;
- pa = e1->GetFirstEntry();
+ pa = e1->GetFirstPatient();
while (pa)
{
std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name
- pa = e1->GetNextEntry();
+ pa = e1->GetNextPatient();
}
break;
<< " = PATIENT/STUDY List ======================================="
<< std::endl<< std::endl;
- pa = e1->GetFirstEntry();
+ pa = e1->GetFirstPatient();
while ( pa ) // on degouline les PATIENT de ce DICOMDIR
{
std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name
- st = pa->GetFirstEntry();
+
+ st = pa->GetFirstStudy();
while ( st ) { // on degouline les STUDY de ce patient
std::cout << "--- "<< st->GetEntry(0x0008, 0x1030) << std::endl; // Study Description
- st = pa->GetNextEntry();
+ st = pa->GetNextStudy();
}
- pa = e1->GetNextEntry();
+ pa = e1->GetNextPatient();
}
break;
<< " = PATIENT/STUDY/SERIE List =================================="
<< std::endl<< std::endl;
- pa = e1->GetFirstEntry();
+ pa = e1->GetFirstPatient();
while ( pa ) // on degouline les PATIENT de ce DICOMDIR
{
// Patient's Name, Patient ID
std::cout << "Pat.Name:[" << pa->GetEntry(0x0010, 0x0010) <<"]"; // Patient's Name
std::cout << " Pat.ID:[";
std::cout << pa->GetEntry(0x0010, 0x0020) << "]" << std::endl; // Patient ID
- st = pa->GetFirstEntry();
+
+ st = pa->GetFirstStudy();
while ( st ) { // on degouline les STUDY de ce patient
std::cout << "--- Stud.descr:[" << st->GetEntry(0x0008, 0x1030) << "]";// Study Description
std::cout << " Stud.ID:[" << st->GetEntry(0x0020, 0x0010); // Study ID
std::cout << "]" << std::endl;
- se = st->GetFirstEntry();
+
+ se = st->GetFirstSerie();
while ( se ) { // on degouline les SERIES de cette study
std::cout << "--- --- Ser.Descr:["<< se->GetEntry(0x0008, 0x103e)<< "]"; // Series Description
std::cout << " Ser.nb:[" << se->GetEntry(0x0020, 0x0011); // Series number
std::cout << "] Mod.:[" << se->GetEntry(0x0008, 0x0060) << "]"; // Modality
std::cout << std::endl;
- se = st->GetNextEntry();
+ se = st->GetNextSerie();
}
- st = pa->GetNextEntry();
+ st = pa->GetNextStudy();
}
- pa = e1->GetNextEntry();
+ pa = e1->GetNextPatient();
}
break;
<< " = PATIENT/STUDY/SERIE/IMAGE List ============================"
<< std::endl<< std::endl;
- pa = e1->GetFirstEntry();
+ pa = e1->GetFirstPatient();
while ( pa ) { // les PATIENT de ce DICOMDIR
std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name
- st = pa->GetFirstEntry();
+
+ st = pa->GetFirstStudy();
while ( st ) { // on degouline les STUDY de ce patient
std::cout << "--- "<< st->GetEntry(0x0008, 0x1030) << std::endl; // Study Description
std::cout << " Stud.ID:[" << st->GetEntry(0x0020, 0x0010); // Study ID
- se = st->GetFirstEntry();
+
+ se = st->GetFirstSerie();
while ( se ) { // on degouline les SERIES de cette study
std::cout << "--- --- "<< se->GetEntry(0x0008, 0x103e) << std::endl; // Serie Description
std::cout << " Ser.nb:[" << se->GetEntry(0x0020, 0x0011); // Series number
std::cout << "] Mod.:[" << se->GetEntry(0x0008, 0x0060) << "]"; // Modality
- im = se->GetFirstEntry();
+
+ im = se->GetFirstImage();
while ( im ) { // on degouline les Images de cette serie
std::cout << "--- --- --- "<< im->GetEntry(0x0004, 0x1500) << std::endl; // File name
- im = se->GetNextEntry();
+ im = se->GetNextImage();
}
- se = st->GetNextEntry();
+ se = st->GetNextSerie();
}
- st = pa->GetNextEntry();
+ st = pa->GetNextStudy();
}
- pa = e1->GetNextEntry();
+ pa = e1->GetNextPatient();
}
break;
Program: gdcm
Module: $RCSfile: TestDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/01/18 07:56:21 $
- Version: $Revision: 1.30 $
+ Date: $Date: 2005/01/20 11:09:22 $
+ Version: $Revision: 1.31 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
// Test if the DicomDir contains any Patient
- if( !e1->GetFirstEntry() )
+ if( !e1->GetFirstPatient() )
{
std::cout<<" DicomDir '"<<file
<<" has no patient"<<std::endl
return 1;
}
- // step by step structure full exploitation
-
+ // step by step structure full exploitation
std::cout << std::endl << std::endl
<< " = PATIENT/STUDY/SERIE/IMAGE List ============================"
<< std::endl<< std::endl;
- pa = e1->GetFirstEntry();
- while ( pa ) { // we process all the PATIENT of this DICOMDIR
+ pa = e1->GetFirstPatient();
+ while ( pa )
+ { // we process all the PATIENT of this DICOMDIR
std::cout << pa->GetEntry(0x0010, 0x0010) << std::endl; // Patient's Name
- st = pa->GetFirstEntry();
- while ( st ) { // we process all the STUDY of this patient
+
+ st = pa->GetFirstStudy();
+ while ( st )
+ { // we process all the STUDY of this patient
std::cout << "--- "<< st->GetEntry(0x0008, 0x1030) << std::endl; // Study Description
std::cout << " Stud.ID:[" << st->GetEntry(0x0020, 0x0010); // Study ID
- se = st->GetFirstEntry();
- while ( se ) { // we process all the SERIES of this study
+
+ se = st->GetFirstSerie();
+ while ( se )
+ { // we process all the SERIES of this study
std::cout << "--- --- "<< se->GetEntry(0x0008, 0x103e) << std::endl; // Serie Description
std::cout << " Ser.nb:[" << se->GetEntry(0x0020, 0x0011); // Series number
std::cout << "] Mod.:[" << se->GetEntry(0x0008, 0x0060) << "]"; // Modality
- im = se->GetFirstEntry();
+
+ im = se->GetFirstImage();
while ( im ) { // we process all the IMAGE of this serie
std::cout << "--- --- --- "<< im->GetEntry(0x0004, 0x1500) << std::endl; // File name
- im = se->GetNextEntry();
+ im = se->GetNextImage();
}
- se = st->GetNextEntry();
+ se = st->GetNextSerie();
}
- st = pa->GetNextEntry();
- }
- pa = e1->GetNextEntry();
- }
-
-
+ st = pa->GetNextStudy();
+ }
+ pa = e1->GetNextPatient();
+ }
+
std::cout << std::endl << std::endl
<< " = DICOMDIR full content ===================================="
<< std::endl<< std::endl;
Program: gdcm
Module: $RCSfile: gdcmDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/01/19 15:24:28 $
- Version: $Revision: 1.107 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ Version: $Revision: 1.108 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
*/
DicomDir::DicomDir()
:Document( )
-{
+{
Initialize(); // sets all private fields to NULL
- MetaElems = NewMeta();
+ NewMeta();
}
/**
if ( parseDir ) // user asked for a recursive parsing of a root directory
{
- MetaElems = NewMeta();
+ NewMeta();
gdcmVerboseMacro( "Parse directory and create the DicomDir");
ParseDirectory();
return true;
}
-/**
- * \brief Sets all fields to NULL
- */
-
-void DicomDir::Initialize()
-{
- StartMethod = NULL;
- ProgressMethod = NULL;
- EndMethod = NULL;
- StartMethodArgDelete = NULL;
- ProgressMethodArgDelete = NULL;
- EndMethodArgDelete = NULL;
- StartArg = NULL;
- ProgressArg = NULL;
- EndArg = NULL;
-
- Progress = 0.0;
- Abort = false;
-
- MetaElems = NULL;
-}
-
-
/**
* \brief fills the whole structure, starting from a root Directory
*/
EndMethodArgDelete = method;
}
+/**
+ * \brief Get the first entry while visiting the DicomDirPatients
+ * \return The first DicomDirPatient if found, otherwhise NULL
+ */
+DicomDirPatient *DicomDir::GetFirstPatient()
+{
+ ItPatient = Patients.begin();
+ if ( ItPatient != Patients.end() )
+ return *ItPatient;
+ return NULL;
+}
+
+/**
+ * \brief Get the next entry while visiting the DicomDirPatients
+ * \note : meaningfull only if GetFirstEntry already called
+ * \return The next DicomDirPatient if found, otherwhise NULL
+ */
+DicomDirPatient *DicomDir::GetNextPatient()
+{
+ gdcmAssertMacro (ItPatient != Patients.end());
+ {
+ ++ItPatient;
+ if ( ItPatient != Patients.end() )
+ return *ItPatient;
+ }
+ return NULL;
+}
+
/**
* \brief writes on disc a DICOMDIR
* \ warning does NOT add the missing elements in the header :
fp->write(filePreamble, 128); //FIXME
binary_write( *fp, "DICM");
- DicomDirMeta *ptrMeta = GetDicomDirMeta();
+ DicomDirMeta *ptrMeta = GetMeta();
ptrMeta->WriteContent(fp, ExplicitVR);
// force writing 0004|1220 [SQ ], that CANNOT exist within DicomDirMeta
DicomDirMeta * DicomDir::NewMeta()
{
- DicomDirMeta *m = new DicomDirMeta();
+ if( MetaElems )
+ delete MetaElems;
+
+ MetaElems = new DicomDirMeta();
if ( TagHT.begin() != TagHT.end() ) // after Document Parsing
{
cc != lastOneButSequence;
++cc)
{
- m->AddEntry( cc->second );
+ MetaElems->AddEntry( cc->second );
}
}
else // after root directory parsing
{
ListDicomDirMetaElem const &elemList =
Global::GetDicomDirElements()->GetDicomDirMetaElements();
- m->FillObject(elemList);
+ MetaElems->FillObject(elemList);
}
- m->SetSQItemNumber(0); // To avoid further missprinting
- return m;
+ MetaElems->SetSQItemNumber(0); // To avoid further missprinting
+ return MetaElems;
}
/**
p->AddEntry( entry );
}
- Patients.push_front( p );
-
+ AddPatientToEnd( p );
return p;
}
case GDCM_DICOMDIR_IMAGE:
elemList = Global::GetDicomDirElements()->GetDicomDirImageElements();
si = new DicomDirImage();
- if( !AddDicomDirImageToEnd(static_cast<DicomDirImage *>(si)) )
+ if( !AddImageToEnd(static_cast<DicomDirImage *>(si)) )
{
- gdcmVerboseMacro( "Add DicomDirImageToEnd failed");
+ delete si;
+ gdcmErrorMacro( "Add ImageToEnd failed");
}
break;
case GDCM_DICOMDIR_SERIE:
elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements();
si = new DicomDirSerie();
- if( !AddDicomDirSerieToEnd(static_cast<DicomDirSerie *>(si)) )
+ if( !AddSerieToEnd(static_cast<DicomDirSerie *>(si)) )
{
- gdcmVerboseMacro( "Add DicomDirSerieToEnd failed");
+ delete si;
+ gdcmErrorMacro( "Add SerieToEnd failed");
}
break;
case GDCM_DICOMDIR_STUDY:
elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements();
si = new DicomDirStudy();
- if( !AddDicomDirStudyToEnd(static_cast<DicomDirStudy *>(si)) )
+ if( !AddStudyToEnd(static_cast<DicomDirStudy *>(si)) )
{
- gdcmVerboseMacro( "Add DicomDirStudyToEnd failed");
+ delete si;
+ gdcmErrorMacro( "Add StudyToEnd failed");
}
break;
case GDCM_DICOMDIR_PATIENT:
elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements();
si = new DicomDirPatient();
- if( !AddDicomDirPatientToEnd(static_cast<DicomDirPatient *>(si)) )
+ if( !AddPatientToEnd(static_cast<DicomDirPatient *>(si)) )
{
- gdcmVerboseMacro( "Add DicomDirPatientToEnd failed");
+ delete si;
+ gdcmErrorMacro( "Add PatientToEnd failed");
}
break;
case GDCM_DICOMDIR_META:
si = new DicomDirMeta();
if( MetaElems )
{
- gdcmVerboseMacro( "MetaElements already exist, they will be destroyed");
delete MetaElems;
+ gdcmErrorMacro( "MetaElements already exist, they will be destroyed");
}
MetaElems = static_cast<DicomDirMeta *>(si);
break;
if ( type == GDCM_DICOMDIR_META ) // fusible : should never print !
{
- std::cout << "GDCM_DICOMDIR_META ?!? should never print that"
- << std::endl;
+ gdcmVerboseMacro("GDCM_DICOMDIR_META ?!? should never print that");
}
si->AddEntry(entry);
}
//-----------------------------------------------------------------------------
// Private
+/**
+ * \brief Sets all fields to NULL
+ */
+void DicomDir::Initialize()
+{
+ StartMethod = NULL;
+ ProgressMethod = NULL;
+ EndMethod = NULL;
+ StartMethodArgDelete = NULL;
+ ProgressMethodArgDelete = NULL;
+ EndMethodArgDelete = NULL;
+ StartArg = NULL;
+ ProgressArg = NULL;
+ EndArg = NULL;
+
+ Progress = 0.0;
+ Abort = false;
+
+ MetaElems = NULL;
+}
+
/**
* \brief create a 'DicomDir' from a DICOMDIR Header
*/
return;
}
- MetaElems = NewMeta();
+ NewMeta();
ListSQItem listItems = s->GetSQItems();
if( v == "PATIENT " )
{
si = new DicomDirPatient();
- AddDicomDirPatientToEnd( static_cast<DicomDirPatient *>(si) );
+ if( !AddPatientToEnd( static_cast<DicomDirPatient *>(si)) )
+ {
+ delete si;
+ si = NULL;
+ gdcmErrorMacro( "Add PatientToEnd failed");
+ }
}
else if( v == "STUDY " )
{
si = new DicomDirStudy();
- AddDicomDirStudyToEnd( static_cast<DicomDirStudy *>(si) );
+ if( !AddStudyToEnd( static_cast<DicomDirStudy *>(si)) )
+ {
+ delete si;
+ si = NULL;
+ gdcmErrorMacro( "Add AddStudyToEnd failed");
+ }
}
else if( v == "SERIES" )
{
si = new DicomDirSerie();
- AddDicomDirSerieToEnd( static_cast<DicomDirSerie *>(si) );
+ if( !AddSerieToEnd( static_cast<DicomDirSerie *>(si)) )
+ {
+ delete si;
+ si = NULL;
+ gdcmErrorMacro( "Add AddSerieToEnd failed");
+ }
}
else if( v == "IMAGE " )
{
si = new DicomDirImage();
- AddDicomDirImageToEnd( static_cast<DicomDirImage *>(si) );
+ if( !AddImageToEnd( static_cast<DicomDirImage *>(si)) )
+ {
+ delete si;
+ si = NULL;
+ gdcmErrorMacro( "Add AddImageToEnd failed");
+ }
}
else
{
// neither an 'IMAGE' SQItem. Skip to next item.
continue;
}
- MoveSQItem(si,*i);
- }
- TagHT.clear();
-}
-/**
- * \brief Well ... there is only one occurence
- */
-bool DicomDir::AddDicomDirMeta()
-{
- if( MetaElems )
- {
- delete MetaElems;
+ if( si )
+ MoveSQItem(si,*i);
}
- MetaElems = new DicomDirMeta();
- return true;
+ TagHT.clear();
}
/**
- * \brief AddDicomDirPatientToEnd
+ * \brief AddPatientToEnd
* @param dd SQ Item to enqueue to the DicomPatient chained List
*/
-bool DicomDir::AddDicomDirPatientToEnd(DicomDirPatient *dd)
+bool DicomDir::AddPatientToEnd(DicomDirPatient *dd)
{
Patients.push_back(dd);
return true;
}
/**
- * \brief AddDicomDirStudyToEnd
+ * \brief AddStudyToEnd
* @param dd SQ Item to enqueue to the DicomDirStudy chained List
*/
-bool DicomDir::AddDicomDirStudyToEnd(DicomDirStudy *dd)
+bool DicomDir::AddStudyToEnd(DicomDirStudy *dd)
{
if( Patients.size() > 0 )
{
ListDicomDirPatient::iterator itp = Patients.end();
itp--;
- (*itp)->AddDicomDirStudy(dd);
+ (*itp)->AddStudy(dd);
return true;
}
return false;
}
/**
- * \brief AddDicomDirSerieToEnd
+ * \brief AddSerieToEnd
* @param dd SQ Item to enqueue to the DicomDirSerie chained List
*/
-bool DicomDir::AddDicomDirSerieToEnd(DicomDirSerie *dd)
+bool DicomDir::AddSerieToEnd(DicomDirSerie *dd)
{
if( Patients.size() > 0 )
{
ListDicomDirPatient::iterator itp = Patients.end();
itp--;
- if( (*itp)->GetDicomDirStudies().size() > 0 )
+ DicomDirStudy *study = (*itp)->GetLastStudy();
+ if( study )
+ {
+ study->AddSerie(dd);
+ return true;
+ }
+/* if( (*itp)->GetDicomDirStudies().size() > 0 )
{
ListDicomDirStudy::const_iterator itst =
(*itp)->GetDicomDirStudies().end();
itst--;
- (*itst)->AddDicomDirSerie(dd);
+ (*itst)->AddSerie(dd);
return true;
- }
+ }*/
}
return false;
}
/**
- * \brief AddDicomDirImageToEnd
+ * \brief AddImageToEnd
* @param dd SQ Item to enqueue to the DicomDirImage chained List
*/
-bool DicomDir::AddDicomDirImageToEnd(DicomDirImage *dd)
+bool DicomDir::AddImageToEnd(DicomDirImage *dd)
{
if( Patients.size() > 0 )
{
ListDicomDirPatient::iterator itp = Patients.end();
itp--;
- if( (*itp)->GetDicomDirStudies().size() > 0 )
+ DicomDirStudy *study = (*itp)->GetLastStudy();
+ if( study )
+ {
+ DicomDirSerie *serie = study->GetLastSerie();
+ if( serie )
+ {
+ serie->AddImage(dd);
+ return true;
+ }
+ }
+/* if( (*itp)->GetDicomDirStudies().size() > 0 )
{
ListDicomDirStudy::const_iterator itst =
(*itp)->GetDicomDirStudies().end();
{
ListDicomDirSerie::const_iterator its = (*itst)->GetDicomDirSeries().end();
its--;
- (*its)->AddDicomDirImage(dd);
+ (*its)->AddImage(dd);
return true;
}
- }
+ }*/
}
return false;
}
return *header1 < *header2;
}
-
-/**
- * \brief Get the first entry while visiting the DicomDirPatients
- * \return The first DicomDirPatient if found, otherwhise NULL
- */
-DicomDirPatient *DicomDir::GetFirstEntry()
-{
- ItDicomDirPatient = Patients.begin();
- if ( ItDicomDirPatient != Patients.end() )
- return *ItDicomDirPatient;
- return NULL;
-}
-
-/**
- * \brief Get the next entry while visiting the DicomDirPatients
- * \note : meaningfull only if GetFirstEntry already called
- * \return The next DicomDirPatient if found, otherwhise NULL
- */
-DicomDirPatient *DicomDir::GetNextEntry()
-{
- gdcmAssertMacro (ItDicomDirPatient != Patients.end());
- {
- ++ItDicomDirPatient;
- if ( ItDicomDirPatient != Patients.end() )
- return *ItDicomDirPatient;
- }
- return NULL;
-}
-
-
} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDicomDir.h,v $
Language: C++
- Date: $Date: 2005/01/18 07:53:42 $
- Version: $Revision: 1.48 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ Version: $Revision: 1.49 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// \brief canonical Printer
void Print(std::ostream &os = std::cout, std::string const & indent = "" );
+
/// Informations contained in the parser
virtual bool IsReadable();
- /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
- DicomDirMeta* GetDicomDirMeta() { return MetaElems; };
-
- // should avoid exposing internal mechanism
- DicomDirPatient *GetFirstEntry();
- DicomDirPatient *GetNextEntry();
-
/// Parsing
void ParseDirectory();
void SetStartMethodArgDelete( DicomDir::Method *m );
void SetProgressMethodArgDelete( DicomDir::Method *m );
void SetEndMethodArgDelete( DicomDir::Method *m );
-
/// GetProgress GetProgress
float GetProgress() { return Progress; };
-
/// AbortProgress AbortProgress
void AbortProgress() { Abort = true; };
-
/// IsAborted IsAborted
bool IsAborted() { return Abort; };
-
+
+ /// Returns a pointer to the DicomDirMeta for this DICOMDIR.
+ DicomDirMeta* GetMeta() { return MetaElems; };
+
+ // should avoid exposing internal mechanism
+ DicomDirPatient *GetFirstPatient();
+ DicomDirPatient *GetNextPatient();
+
/// Adding
DicomDirMeta *NewMeta();
DicomDirPatient *NewPatient();
void Initialize();
void CreateDicomDir();
- bool AddDicomDirMeta();
- bool AddDicomDirPatientToEnd(DicomDirPatient *dd);
- bool AddDicomDirStudyToEnd (DicomDirStudy *dd);
- bool AddDicomDirSerieToEnd (DicomDirSerie *dd);
- bool AddDicomDirImageToEnd (DicomDirImage *dd);
+ bool AddPatientToEnd(DicomDirPatient *dd);
+ bool AddStudyToEnd (DicomDirStudy *dd);
+ bool AddSerieToEnd (DicomDirSerie *dd);
+ bool AddImageToEnd (DicomDirImage *dd);
void SetElements(std::string const &path, VectDocument const &list);
void SetElement (std::string const &path, DicomDirType type,
/// Pointer on *the* DicomDirObject 'DicomDirMeta Elements'
DicomDirMeta* MetaElems;
- ListDicomDirPatient::iterator ItDicomDirPatient;
/// Chained list of DicomDirPatient (to be exploited recursively)
ListDicomDirPatient Patients;
+ ListDicomDirPatient::iterator ItPatient;
/// pointer to the initialisation method for any progress bar
Method* StartMethod;
Program: gdcm
Module: $RCSfile: gdcmDicomDirElement.cxx,v $
Language: C++
- Date: $Date: 2005/01/18 07:53:42 $
- Version: $Revision: 1.27 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ 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
std::ifstream from(filename.c_str());
if(!from)
{
- gdcmVerboseMacro( "Can't open dictionary" << filename.c_str());
+ gdcmVerboseMacro( "Can't open DicomDirElement dictionary"
+ << filename.c_str());
FillDefaultDIRDict( this );
}
else
Program: gdcm
Module: $RCSfile: gdcmDicomDirObject.cxx,v $
Language: C++
- Date: $Date: 2005/01/08 15:03:59 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ 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
//-----------------------------------------------------------------------------
// Public
-
-/**
- * \brief Builds a hash table (multimap) containing
- * pointers to all Header Entries (i.e Dicom Element)
- * related to this 'object'
- * @return
- */
-TagDocEntryHT DicomDirObject::GetEntryHT()
-{
- TagDocEntryHT HT;
- DocEntries = GetDocEntries();
- for(ListDocEntry::iterator i = DocEntries.begin();
- i != DocEntries.end(); ++i)
- {
- HT[(*i)->GetKey()] = *i;
- }
- return HT;
-}
-
//-----------------------------------------------------------------------------
// Protected
/**
Program: gdcm
Module: $RCSfile: gdcmDicomDirObject.h,v $
Language: C++
- Date: $Date: 2005/01/11 15:15:38 $
- Version: $Revision: 1.12 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ 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 DicomDirObject;
+//-----------------------------------------------------------------------------
+typedef std::list<DicomDirObject *> ListContent;
//-----------------------------------------------------------------------------
/**
* \ingroup DicomDirObject
*/
class GDCM_EXPORT DicomDirObject : public SQItem
{
-typedef std::list<DicomDirObject *> ListContent;
public:
- TagDocEntryHT GetEntryHT();
void FillObject(ListDicomDirMetaElem const &elemList);
protected:
Program: gdcm
Module: $RCSfile: gdcmDicomDirPatient.cxx,v $
Language: C++
- Date: $Date: 2005/01/18 14:28:32 $
- Version: $Revision: 1.28 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ Version: $Revision: 1.29 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
}
+//-----------------------------------------------------------------------------
+// Public
/**
* \brief Writes the Object
* @param fp ofstream to write to
(*cc)->WriteContent( fp, t );
}
}
-//-----------------------------------------------------------------------------
-// Public
/**
* \brief adds a new Patient at the begining of the PatientList
DicomDirStudy *st = new DicomDirStudy();
st->FillObject(elemList);
- Studies.push_front(st);
+ Studies.push_back(st);
return st;
}
* \brief Get the first entry while visiting the DicomDirStudy
* \return The first DicomDirStudy if found, otherwhise NULL
*/
-DicomDirStudy *DicomDirPatient::GetFirstEntry()
+DicomDirStudy *DicomDirPatient::GetFirstStudy()
{
- ItDicomDirStudy = Studies.begin();
- if (ItDicomDirStudy != Studies.end())
- return *ItDicomDirStudy;
+ ItStudy = Studies.begin();
+ if (ItStudy != Studies.end())
+ return *ItStudy;
return NULL;
}
* \note : meaningfull only if GetFirstEntry already called
* \return The next DicomDirStudies if found, otherwhise NULL
*/
-DicomDirStudy *DicomDirPatient::GetNextEntry()
+DicomDirStudy *DicomDirPatient::GetNextStudy()
{
- gdcmAssertMacro (ItDicomDirStudy != Studies.end())
+ gdcmAssertMacro (ItStudy != Studies.end())
{
- ++ItDicomDirStudy;
- if (ItDicomDirStudy != Studies.end())
- return *ItDicomDirStudy;
+ ++ItStudy;
+ if (ItStudy != Studies.end())
+ return *ItStudy;
}
return NULL;
}
+
+/**
+ * \brief Get the first entry while visiting the DicomDirStudy
+ * \return The first DicomDirStudy if found, otherwhise NULL
+ */
+DicomDirStudy *DicomDirPatient::GetLastStudy()
+{
+ ItStudy = Studies.end();
+ if (ItStudy != Studies.begin())
+ {
+ --ItStudy;
+ return *ItStudy;
+ }
+ return NULL;
+}
+
//-----------------------------------------------------------------------------
// Protected
Program: gdcm
Module: $RCSfile: gdcmDicomDirPatient.h,v $
Language: C++
- Date: $Date: 2005/01/18 07:53:42 $
- Version: $Revision: 1.20 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ 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 Print(std::ostream &os = std::cout, std::string const & indent = "" );
void WriteContent(std::ofstream *fp, FileType t);
- /// Returns the STUDY chained List for this PATIENT.
- ListDicomDirStudy const &GetDicomDirStudies() const { return Studies; };
-
// should avoid exposing internal mechanism
- DicomDirStudy *GetFirstEntry();
- DicomDirStudy *GetNextEntry();
+ DicomDirStudy *GetFirstStudy();
+ DicomDirStudy *GetNextStudy();
+ DicomDirStudy *GetLastStudy();
/// adds the passed STUDY to the STUDY chained List for this PATIENT.
- void AddDicomDirStudy (DicomDirStudy *obj) { Studies.push_back(obj); };
+ void AddStudy(DicomDirStudy *obj) { Studies.push_back(obj); };
DicomDirStudy *NewStudy();
/// chained list of DicomDirStudy (to be exploited recursively)
ListDicomDirStudy Studies;
/// iterator on the DicomDirStudies of the current DicomDirPatient
- ListDicomDirStudy::iterator ItDicomDirStudy;
+ ListDicomDirStudy::iterator ItStudy;
};
} // end namespace gdcm
Program: gdcm
Module: $RCSfile: gdcmDicomDirSerie.cxx,v $
Language: C++
- Date: $Date: 2005/01/18 14:28:32 $
- Version: $Revision: 1.30 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ Version: $Revision: 1.31 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//-----------------------------------------------------------------------------
// Public
-
/**
* \brief Writes the Object
* @param fp ofstream to write to
Global::GetDicomDirElements()->GetDicomDirImageElements();
DicomDirImage *st = new DicomDirImage();
- FillObject(elemList);
- Images.push_front(st);
+ st->FillObject(elemList);
+ Images.push_back(st);
return st;
}
* \brief Get the first entry while visiting the DicomDirImage
* \return The first DicomDirImage if found, otherwhise NULL
*/
-DicomDirImage *DicomDirSerie::GetFirstEntry()
+DicomDirImage *DicomDirSerie::GetFirstImage()
{
- ItDicomDirImage = Images.begin();
- if (ItDicomDirImage != Images.end())
- return *ItDicomDirImage;
+ ItImage = Images.begin();
+ if (ItImage != Images.end())
+ return *ItImage;
return NULL;
}
* \note : meaningfull only if GetFirstEntry already called
* \return The next DicomDirImages if found, otherwhise NULL
*/
-DicomDirImage *DicomDirSerie::GetNextEntry()
+DicomDirImage *DicomDirSerie::GetNextImage()
{
- gdcmAssertMacro (ItDicomDirImage != Images.end());
+ gdcmAssertMacro (ItImage != Images.end());
{
- ++ItDicomDirImage;
- if (ItDicomDirImage != Images.end())
- return *ItDicomDirImage;
+ ++ItImage;
+ if (ItImage != Images.end())
+ return *ItImage;
}
return NULL;
}
+/**
+ * \brief Get the first entry while visiting the DicomDirImage
+ * \return The first DicomDirImage if found, otherwhise NULL
+ */
+DicomDirImage *DicomDirSerie::GetLastImage()
+{
+ ItImage = Images.end();
+ if (ItImage != Images.begin())
+ {
+ --ItImage;
+ return *ItImage;
+ }
+ return NULL;
+}
+
//-----------------------------------------------------------------------------
// Protected
Program: gdcm
Module: $RCSfile: gdcmDicomDirSerie.h,v $
Language: C++
- Date: $Date: 2005/01/18 07:53:42 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ 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
void Print( std::ostream &os = std::cout, std::string const & indent = "" );
void WriteContent( std::ofstream *fp, FileType t );
- /// Returns the IMAGE chained List for this SERIE.
- ListDicomDirImage const &GetDicomDirImages() const { return Images; };
-
// should avoid exposing internal mechanism
- DicomDirImage *GetFirstEntry();
- DicomDirImage *GetNextEntry();
+ DicomDirImage *GetFirstImage();
+ DicomDirImage *GetNextImage();
+ DicomDirImage *GetLastImage();
/// adds the passed IMAGE to the IMAGE chained List for this SERIE.
- void AddDicomDirImage(DicomDirImage *obj) { Images.push_back(obj); };
+ void AddImage(DicomDirImage *obj) { Images.push_back(obj); };
DicomDirImage *NewImage();
///chained list of DicomDirImages (to be exploited recursively)
ListDicomDirImage Images;
/// iterator on the DicomDirImages of the current DicomDirSerie
- ListDicomDirImage::iterator ItDicomDirImage;
+ ListDicomDirImage::iterator ItImage;
};
} // end namespace gdcm
//-----------------------------------------------------------------------------
Program: gdcm
Module: $RCSfile: gdcmDicomDirStudy.cxx,v $
Language: C++
- Date: $Date: 2005/01/18 14:28:32 $
- Version: $Revision: 1.27 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ 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
//-----------------------------------------------------------------------------
// Public
-
/**
* \brief Writes the Object
* @param fp ofstream to write to
Global::GetDicomDirElements()->GetDicomDirSerieElements();
DicomDirSerie* st = new DicomDirSerie();
- FillObject(elemList);
- Series.push_front(st);
+ st->FillObject(elemList);
- return st;
+ Series.push_back(st);
+ return st;
}
- /**
+/**
* \brief Get the first entry while visiting the DicomDirSeries
* \return The first DicomDirSerie if found, otherwhise NULL
*/
-DicomDirSerie *DicomDirStudy::GetFirstEntry()
+DicomDirSerie *DicomDirStudy::GetFirstSerie()
{
- ItDicomDirSerie = Series.begin();
- if (ItDicomDirSerie != Series.end())
- return *ItDicomDirSerie;
+ ItSerie = Series.begin();
+ if (ItSerie != Series.end())
+ return *ItSerie;
return NULL;
}
* \note : meaningfull only if GetFirstEntry already called
* \return The next DicomDirSerie if found, otherwhise NULL
*/
-DicomDirSerie *DicomDirStudy::GetNextEntry()
+DicomDirSerie *DicomDirStudy::GetNextSerie()
{
- gdcmAssertMacro (ItDicomDirSerie != Series.end());
+ gdcmAssertMacro (ItSerie != Series.end());
{
- ++ItDicomDirSerie;
- if (ItDicomDirSerie != Series.end())
- return *ItDicomDirSerie;
+ ++ItSerie;
+ if (ItSerie != Series.end())
+ return *ItSerie;
}
return NULL;
}
+
+/**
+ * \brief Get the last entry while visiting the DicomDirSeries
+ * \return The first DicomDirSerie if found, otherwhise NULL
+ */
+DicomDirSerie *DicomDirStudy::GetLastSerie()
+{
+ ItSerie = Series.end();
+ if (ItSerie != Series.begin())
+ {
+ --ItSerie;
+ return *ItSerie;
+ }
+ return NULL;
+}
+
//-----------------------------------------------------------------------------
// Protected
Program: gdcm
Module: $RCSfile: gdcmDicomDirStudy.h,v $
Language: C++
- Date: $Date: 2005/01/18 07:53:42 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2005/01/20 11:09:23 $
+ 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
void Print(std::ostream &os = std::cout, std::string const & indent = "" );
void WriteContent(std::ofstream *fp, FileType t);
- /// Returns the SERIE chained List for this STUDY.
- ListDicomDirSerie const &GetDicomDirSeries() const { return Series; };
-
// should avoid exposing internal mechanism
- DicomDirSerie *GetFirstEntry();
- DicomDirSerie *GetNextEntry();
+ DicomDirSerie *GetFirstSerie();
+ DicomDirSerie *GetNextSerie();
+ DicomDirSerie *GetLastSerie();
/// adds the passed SERIE to the SERIE chained List for this STUDY.
- void AddDicomDirSerie(DicomDirSerie *obj) { Series.push_back(obj); };
+ void AddSerie(DicomDirSerie *obj) { Series.push_back(obj); };
DicomDirSerie* NewSerie();
/// chained list of DicomDirSeries (to be exploited recursively)
ListDicomDirSerie Series;
/// iterator on the DicomDirSeries of the current DicomDirStudy
- ListDicomDirSerie::iterator ItDicomDirSerie;
+ ListDicomDirSerie::iterator ItSerie;
};
} // end namespace gdcm