/*========================================================================= Program: gdcm Module: $RCSfile: TestMakeDicomDir.cxx,v $ Language: C++ Date: $Date: 2005/08/30 15:13:07 $ Version: $Revision: 1.8 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "gdcmDocEntry.h" #include "gdcmDicomDir.h" #include "gdcmDicomDirPatient.h" #include "gdcmDirList.h" #include "gdcmDebug.h" // --- void StartMethod(void *startMethod) { (void)startMethod; std::cout<<"Start parsing"< 1) { dirName = argv[1]; } else { dirName = GDCM_DATA_ROOT; } gdcm::DicomDir *dcmdir; // new style (user is allowed no to load Sequences an/or Shadow Groups) dcmdir = new gdcm::DicomDir( ); // dcmdir->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW); // some images have a wrong length for element 0x0000 of private groups dcmdir->SetLoadMode(gdcm::LD_NOSEQ); dcmdir->SetDirectoryName(dirName); dcmdir->Load( ); dcmdir->SetStartMethod(StartMethod); dcmdir->SetEndMethod(EndMethod); if ( !dcmdir->GetFirstPatient() ) { std::cout << "makeDicomDir: no patient found. Exiting." << std::endl; delete dcmdir; return 1; } // Create the corresponding DicomDir dcmdir->WriteDicomDir("NewDICOMDIR"); delete dcmdir; // Read from disc the just written DicomDir gdcm::DicomDir *newDicomDir = new gdcm::DicomDir(); newDicomDir->SetFileName("NewDICOMDIR"); newDicomDir->Load(); if( !newDicomDir->IsReadable() ) { std::cout<<" Written DicomDir 'NewDICOMDIR'" <<" is not readable"<GetFirstPatient() ) { std::cout<<" Written DicomDir 'NewDICOMDIR'" <<" has no patient"<