]> Creatis software - gdcm.git/blobdiff - Example/BuildUpDicomDir.cxx
ENH: Add license to tests since they belong to gdcm
[gdcm.git] / Example / BuildUpDicomDir.cxx
index 175bf13bc70654bba970cc8c29991fbbc6c87270..5fd9b6ad915d42eceab626cd7dcc546b0979b72d 100644 (file)
@@ -1,3 +1,20 @@
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: BuildUpDicomDir.cxx,v $
+  Language:  C++
+  Date:      $Date: 2004/11/16 04:26:17 $
+  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 <iostream>
 #include "gdcm.h"
 #include "gdcmDocEntry.h"
 #include <errno.h>
 
 // for Directory pb
-#ifdef _MSC_VER 
+#if defined(_MSC_VER) || defined(__BORLANDC__) 
    #include <windows.h> 
    #include <direct.h>
+   #include <stdio.h>
 #else
    #include <dirent.h>   
    #include <unistd.h>
@@ -50,36 +68,31 @@ int main(int argc, char* argv[])
       dirName = argv[1];
       }
 
-   gdcmDicomDir *dcmdir;
-   
-
-   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();  
+   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);
 
    std::cout << "\n------- BuildUpDicomDir: Test Print of Patient ONE -----\n";
@@ -92,7 +105,7 @@ int main(int argc, char* argv[])
    dcmdir->SetPrintLevel(-1);
    dcmdir->Print();
 
-   dcmdir->Write( dirName );
+   dcmdir->WriteDicomDir( dirName );
    std::cout << std::endl;
 
    delete dcmdir;