Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// ----------------------------------------------------------------------------
//
// Dicom PS 3.3 describes the relationship between Directory Records, as follow
// ----------------------------------------------------------------------------
//
// Dicom PS 3.3 describes the relationship between Directory Records, as follow
-// STUDY SERIES, VISIT, RESULTS, STUDY COMPONENT
+// STUDY SERIES, VISIT, RESULTS, STUDY COMPONENT, PRIVATE
//
// SERIES IMAGE, OVERLAYS, MODALITY LUT, VOI LUT,
// CURVE, STORED PRINT, RT DOSE, RT STRUCTURE SET
// RT PLAN, RT TREAT RECORD, PRESENTATION, WAVEFORM,
// SR DOCUMENT, KEY OBJECT DOC, SPECTROSCOPY,
//
// SERIES IMAGE, OVERLAYS, MODALITY LUT, VOI LUT,
// CURVE, STORED PRINT, RT DOSE, RT STRUCTURE SET
// RT PLAN, RT TREAT RECORD, PRESENTATION, WAVEFORM,
// SR DOCUMENT, KEY OBJECT DOC, SPECTROSCOPY,
-// RAW DATA, REGISTRATION, FIDUCIAL
+// RAW DATA, REGISTRATION, FIDUCIAL, PRIVATE,
+// ENCAP DOC
// and whatever the value of parseDir was.
// (nothing is cheked in Document constructor, to avoid overhead)
// and whatever the value of parseDir was.
// (nothing is cheked in Document constructor, to avoid overhead)
- // Only if user passed a root directory
- // ------------------------------------
- if ( fileName == "." )
- {
- // user passed '.' as Name
- // we get current directory name
- char dummy[1000];
- getcwd(dummy, (size_t)1000);
- SetFileName( dummy ); // will be converted into a string
- }
+//-----------------------------------------------------------------------------
+// Public
// Directory record sequence
DocEntry *e = GetDocEntry(0x0004, 0x1220);
if ( !e )
{
gdcmWarningMacro( "NO 'Directory record sequence' (0x0004,0x1220)"
<< " in file " << fileName);
// Directory record sequence
DocEntry *e = GetDocEntry(0x0004, 0x1220);
if ( !e )
{
gdcmWarningMacro( "NO 'Directory record sequence' (0x0004,0x1220)"
<< " in file " << fileName);
+ // Only if user passed a root directory
+ // ------------------------------------
+ if ( fileName == "." )
+ {
+ // user passed '.' as Name
+ // we get current directory name
+ char dummy[1000];
+ getcwd(dummy, (size_t)1000);
+ SetFileName( dummy ); // will be converted into a string
+ }
+ NewMeta();
+ gdcmWarningMacro( "Parse directory and create the DicomDir : " << Filename );
+
+ ParseDirectory();
/**
* \brief This predicate, based on hopefully reasonable heuristics,
* decides whether or not the current document was properly parsed
/**
* \brief This predicate, based on hopefully reasonable heuristics,
* decides whether or not the current document was properly parsed
void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg,
DicomDir::Method *argDelete )
{
void DicomDir::SetStartMethod( DicomDir::Method *method, void *arg,
DicomDir::Method *argDelete )
{
void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg,
DicomDir::Method *argDelete )
{
void DicomDir::SetProgressMethod( DicomDir::Method *method, void *arg,
DicomDir::Method *argDelete )
{
void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg,
DicomDir::Method *argDelete )
{
void DicomDir::SetEndMethod( DicomDir::Method *method, void *arg,
DicomDir::Method *argDelete )
{
* \brief writes on disc a DICOMDIR
* \ warning does NOT add the missing elements in the header :
* it's up to the user doing it !
* \brief writes on disc a DICOMDIR
* \ warning does NOT add the missing elements in the header :
* it's up to the user doing it !
std::ofstream *fp = new std::ofstream(fileName.c_str(),
std::ios::out | std::ios::binary);
std::ofstream *fp = new std::ofstream(fileName.c_str(),
std::ios::out | std::ios::binary);
binary_write( *fp, "DICM");
DicomDirMeta *ptrMeta = GetMeta();
binary_write( *fp, "DICM");
DicomDirMeta *ptrMeta = GetMeta();
+/**
+ * \brief Anonymize a DICOMDIR
+ * @return true
+ */
+
+bool DicomDir::AnonymizeDicomDir()
+{
+ ValEntry *v;
+ // Something clever to be found to forge the Patient names
+ std::ostringstream s;
+ int i = 1;
+ for(ListDicomDirPatient::iterator cc = Patients.begin();
+ cc!= Patients.end();
+ ++cc)
+ {
+ s << i;
+ v = (*cc)->GetValEntry(0x0010, 0x0010) ; // Patient's Name
+ if (v)
+ {
+ v->SetValue(s.str());
+ }
+
+ v = (*cc)->GetValEntry(0x0010, 0x0020) ; // Patient ID
+ if (v)
+ {
+ v->SetValue(" ");
+ }
+
+ v = (*cc)->GetValEntry(0x0010, 0x0030) ; // Patient's BirthDate
+ if (v)
+ {
+ v->SetValue(" ");
+ }
+ s << "";
+ i++;
+ }
+ return true;
+}
+
- header = new File( it->c_str() );
- if( !header )
- {
- gdcmWarningMacro( "Failure in new gdcm::File " << it->c_str() );
- continue;
- }
+ f = new File( );
+ f->SetLoadMode(LoadMode); // we allow user not to load Sequences...
+ f->Load( it->c_str() );
+
+// if ( !f )
+// {
+// gdcmWarningMacro( "Failure in new gdcm::File " << it->c_str() );
+// continue;
+// }
serCurInstanceUID = (*it)->GetEntryValue(0x0020,0x000e);
serCurID = (*it)->GetEntryValue(0x0020,0x0011);
serCurInstanceUID = (*it)->GetEntryValue(0x0020,0x000e);
serCurID = (*it)->GetEntryValue(0x0020,0x0011);
{
SetElement(path, GDCM_DICOMDIR_PATIENT, *it);
first = true;
}
// if new Study Deal with 'STUDY' Elements
{
SetElement(path, GDCM_DICOMDIR_PATIENT, *it);
first = true;
}
// if new Study Deal with 'STUDY' Elements
case GDCM_DICOMDIR_IMAGE:
elemList = Global::GetDicomDirElements()->GetDicomDirImageElements();
si = new DicomDirImage(true);
case GDCM_DICOMDIR_IMAGE:
elemList = Global::GetDicomDirElements()->GetDicomDirImageElements();
si = new DicomDirImage(true);
case GDCM_DICOMDIR_SERIE:
elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements();
si = new DicomDirSerie(true);
case GDCM_DICOMDIR_SERIE:
elemList = Global::GetDicomDirElements()->GetDicomDirSerieElements();
si = new DicomDirSerie(true);
case GDCM_DICOMDIR_STUDY:
elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements();
si = new DicomDirStudy(true);
case GDCM_DICOMDIR_STUDY:
elemList = Global::GetDicomDirElements()->GetDicomDirStudyElements();
si = new DicomDirStudy(true);
case GDCM_DICOMDIR_PATIENT:
elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements();
si = new DicomDirPatient(true);
case GDCM_DICOMDIR_PATIENT:
elemList = Global::GetDicomDirElements()->GetDicomDirPatientElements();
si = new DicomDirPatient(true);