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
// Directory Record Type Directory Record Types which may be included
// in the next lower-level directory Entity
//
// Directory Record Type Directory Record Types which may be included
// in the next lower-level directory Entity
//
-// 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
- if ( parseDir ) // user asked for a recursive parsing of a root directory
- {
- NewMeta();
+bool DicomDir::Load(std::string const &fileName )
+{
+ Filename = fileName;
+ // We should clean out anything that already exists.
+
+ Initialize(); // sets all private fields to NULL
// 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
+/**
+ * \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;
+// }