X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmDicomDir.cxx;h=d8e60efe966f7bc517b955ae8f8da74b01ab6d17;hb=3abb6c11e8de2088367ed37676e5748e05084242;hp=97ad3707b89501d048b8560319bdce72985cd695;hpb=d39850f79b642ca72e0c49d8242e7101c4bb4481;p=gdcm.git diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index 97ad3707..d8e60efe 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/03/02 17:16:48 $ - Version: $Revision: 1.134 $ + Date: $Date: 2005/05/03 09:43:04 $ + Version: $Revision: 1.138 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -130,79 +130,89 @@ DicomDir::DicomDir() * and wants to use it */ DicomDir::DicomDir(std::string const &fileName, bool parseDir ): - Document( fileName ) + Document( ) { // At this step, Document constructor is already executed, // whatever user passed (a root directory or a DICOMDIR) // and whatever the value of parseDir was. // (nothing is cheked in Document constructor, to avoid overhead) - Initialize(); // sets all private fields to NULL + ParseDir = parseDir; + SetLoadMode (0x00000000); // concerns only dicom files + Load( fileName ); +} - // if user passed a root directory, sure we didn't get anything +/** + * \brief Canonical destructor + */ +DicomDir::~DicomDir() +{ + SetStartMethod(NULL); + SetProgressMethod(NULL); + SetEndMethod(NULL); - if ( GetFirstEntry() == 0 ) // when user passed a Directory to parse + ClearPatient(); + if ( MetaElems ) { - if (!parseDir) - gdcmWarningMacro( "Entry HT empty for file: "<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; +} + + + + + + + + + //----------------------------------------------------------------------------- // Protected /** @@ -488,7 +546,7 @@ void DicomDir::CreateDicomDirChainedList(std::string const &path) DirList dirList(path,1); // gets recursively the file list unsigned int count = 0; VectDocument list; - File *header; + File *f; DirListType fileList = dirList.GetFilenames(); @@ -503,22 +561,25 @@ void DicomDir::CreateDicomDirChainedList(std::string const &path) break; } - 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; +// } - if( header->IsReadable() ) + if( f->IsReadable() ) { // Add the file to the chained list: - list.push_back(header); + list.push_back(f); gdcmWarningMacro( "Readable " << it->c_str() ); } else { - delete header; + delete f; } count++; } @@ -598,7 +659,7 @@ void DicomDir::Initialize() } /** - * \brief create a 'DicomDir' from a DICOMDIR Header + * \brief create a 'gdcm::DicomDir' from a DICOMDIR Header */ void DicomDir::CreateDicomDir() { @@ -641,7 +702,7 @@ void DicomDir::CreateDicomDir() } else { - gdcmWarningMacro( "Not a ValEntry."); + gdcmWarningMacro( "(0004,1430) not a ValEntry ?!?"); continue; }