X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FBuildUpDicomDir.cxx;h=0f84a446bbd7c31eb6d0c7fbf2d756662fdfc464;hb=1d69b92978803204089d270599133917d944c651;hp=c95e707295c84b3c7753670d3deeed8a4e3a524c;hpb=018ae9242a852cb91debaf71951d00876fc3d876;p=gdcm.git diff --git a/Example/BuildUpDicomDir.cxx b/Example/BuildUpDicomDir.cxx index c95e7072..0f84a446 100644 --- a/Example/BuildUpDicomDir.cxx +++ b/Example/BuildUpDicomDir.cxx @@ -42,54 +42,53 @@ int main(int argc, char* argv[]) { - if (argc) { - // std::cerr << "Usage: " << argv[0] << " dummy "; - } + std::string dirName = "NewDICOMDIR"; - gdcmDicomDir *dcmdir; - std::string dirName; + if ( argc > 2 ) + { + std::cerr << "Usage: " << argv[0] << " [dicomdirname] "; + dirName = argv[1]; + } - printf( "BuildUpDicomDir: entering BuildUpDicomDir\n"); - - dcmdir=new gdcmDicomDir(); - printf( "BuildUpDicomDir: exiting new DicomDir\n"); + gdcm::DicomDir *dcmdir; + dcmdir = new gdcm::DicomDir(); printf( "\n------- BuildUpDicomDir: Test Print Meta only -----\n"); - ((gdcmDocument *)dcmdir)->Print(); + ((gdcm::Document *)dcmdir)->Print(); - gdcmDicomDirPatient *p1=dcmdir->NewPatient(); + gdcm::DicomDirPatient *p1=dcmdir->NewPatient(); p1->SetEntryByNumber("patientONE",0x0010, 0x0010); - gdcmDicomDirPatient *p2=dcmdir->NewPatient(); + gdcm::DicomDirPatient *p2=dcmdir->NewPatient(); p2->SetEntryByNumber("patientTWO",0x0010, 0x0010); - gdcmDicomDirStudy *s21=p2->NewStudy(); + gdcm::DicomDirStudy *s21=p2->NewStudy(); s21->SetEntryByNumber("StudyDescrTwo.One",0x0008, 0x1030); - gdcmDicomDirSerie *s211=s21->NewSerie(); - gdcmDicomDirImage *s2111=s211->NewImage(); + gdcm::DicomDirSerie *s211=s21->NewSerie(); + gdcm::DicomDirImage *s2111=s211->NewImage(); (void)s2111; //not used - gdcmDicomDirStudy *s11=p1->NewStudy(); - s11->SetEntryByNumber("StudyDescrOne.One",0x0008, 0x1030); - // Name of the physician reading study - // Header Entry to be created - s11->SetEntryByNumber("Dr Mabuse",0x0008, 0x1060); + gdcm::DicomDirStudy *s11=p1->NewStudy(); + s11->SetEntryByNumber("StudyDescrOne.One",0x0008, 0x1030); + // Name of the physician reading study + // Header Entry to be created + s11->SetEntryByNumber("Dr Mabuse",0x0008, 0x1060); - gdcmDicomDirPatient *p3=dcmdir->NewPatient(); + gdcm::DicomDirPatient *p3 = dcmdir->NewPatient(); p3->SetEntryByNumber("patientTHREE",0x0010, 0x0010); - printf( "\n------- BuildUpDicomDir: Test Print of Patient ONE -----\n"); + std::cout << "\n------- BuildUpDicomDir: Test Print of Patient ONE -----\n"; p1->Print(); - printf( "\n------- BuildUpDicomDir: Test Print of Patient THREE -----\n"); + std::cout << "\n------- BuildUpDicomDir: Test Print of Patient THREE -----\n"; p3->Print(); - printf( "\n------- BuildUpDicomDir: Test Print of Patient TWO -------\n"); + std::cout << "\n------- BuildUpDicomDir: Test Print of Patient TWO -------\n"; p2->Print(); - printf( "\n------- BuildUpDicomDir: Test Full Print-------------------\n"); + std::cout << "\n------- BuildUpDicomDir: Test Full Print-------------------\n"; dcmdir->SetPrintLevel(-1); dcmdir->Print(); - dcmdir->Write("NewDICOMDIR"); - std::cout<WriteDicomDir( dirName ); + std::cout << std::endl; delete dcmdir;