3 #include "gdcmDocEntry.h"
4 #include "gdcmDicomDir.h"
5 #include "gdcmDicomDirPatient.h"
6 #include "gdcmDirList.h"
10 #ifdef GDCM_NO_ANSI_STRING_STREAM
12 # define ostringstream ostrstream
17 #define ostringstream ostrstream
19 #include <sys/types.h>
34 // ===============================================================
37 * \brief Builds up ex-nihilo a DICOMDIR file
38 * adding Patient, Study, Serie, Image descriptions
39 * to an empty gdcmDicomDir occurence
40 * and writes a file named NewDICOMDIR.
43 int main(int argc, char* argv[])
46 std::cerr << "Usage: " << argv[0] << " dummy ";
52 printf( "BuildUpDicomDir: entering BuildUpDicomDir\n");
54 dcmdir=new gdcmDicomDir();
55 printf( "BuildUpDicomDir: exiting new DicomDir\n");
57 gdcmDicomDirPatient *p1=dcmdir->NewPatient();
58 p1->SetEntryByNumber("patientONE",0x0010, 0x0010);
61 gdcmDicomDirPatient *p2=dcmdir->NewPatient();
62 p2->SetEntryByNumber("patientTWO",0x0010, 0x0010);
63 gdcmDicomDirStudy *s21=p2->NewStudy();
64 s21->SetEntryByNumber("StudyDescrTwo.One",0x0008, 0x1030);
65 gdcmDicomDirSerie *s211=s21->NewSerie();
66 gdcmDicomDirImage *s2111=s211->NewImage();
67 (void)s2111; //not used
69 gdcmDicomDirStudy *s11=p1->NewStudy();
70 s11->SetEntryByNumber("StudyDescrOne.One",0x0008, 0x1030);
71 // Name of the physician reading study
72 // Header Entry to be created
73 s11->SetEntryByNumber("Dr Mabuse",0x0008, 0x1060);
75 gdcmDicomDirPatient *p3=dcmdir->NewPatient();
76 p3->SetEntryByNumber("patientTHREE",0x0010, 0x0010);
78 printf( "\n------- BuildUpDicomDir: Test Print of Patient ONE -----\n");
80 printf( "\n------- BuildUpDicomDir: Test Print of Patient THREE -----\n");
82 printf( "\n------- BuildUpDicomDir: Test Print of Patient TWO -------\n");
84 printf( "\n------- BuildUpDicomDir: Test Full Print-------------------\n");
85 dcmdir->SetPrintLevel(-1);
88 dcmdir->Write("NewDICOMDIR");
89 std::cout<<std::flush;