X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FBuildUpDicomDir.cxx;h=f531f2cbeaabee0bf6ea2e1ca78fd25b5d63e7b9;hb=7f5f66f57c85e30920d807612d32a65800cb1df0;hp=54493a15a01a791764d471a7fad2b1fdadf8d320;hpb=a12b9768f8dad74ef6b76c5c77b312ebab679625;p=gdcm.git diff --git a/Example/BuildUpDicomDir.cxx b/Example/BuildUpDicomDir.cxx index 54493a15..f531f2cb 100644 --- a/Example/BuildUpDicomDir.cxx +++ b/Example/BuildUpDicomDir.cxx @@ -1,35 +1,28 @@ -#include -#include "gdcm.h" +/*========================================================================= + + Program: gdcm + Module: $RCSfile: BuildUpDicomDir.cxx,v $ + Language: C++ + Date: $Date: 2004/12/03 20:16:55 $ + Version: $Revision: 1.10 $ + + 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" - -#include -#ifdef GDCM_NO_ANSI_STRING_STREAM -# include -# define ostringstream ostrstream -# else -# include -#endif - -#define ostringstream ostrstream - -#include -#include - -// for Directory pb -#ifdef _MSC_VER - #include - #include -#else - #include - #include -#endif - -#include -#include +#include "gdcmDicomDirStudy.h" +#include "gdcmDicomDirSerie.h" +#include "gdcmDicomDirImage.h" // =============================================================== /** @@ -42,51 +35,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"); + gdcm::DicomDir *dcmdir; + dcmdir = new gdcm::DicomDir(); - dcmdir=new gdcmDicomDir(); - printf( "BuildUpDicomDir: exiting new DicomDir\n"); + std::cout << "\n------- BuildUpDicomDir: Test Print Meta only -----" << std::endl; + ((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;