]> Creatis software - gdcm.git/blobdiff - Example/makeDicomDir.cxx
Try to explain better what SwapCode means
[gdcm.git] / Example / makeDicomDir.cxx
index 540842c96086a3c13984e00d7924289d6e947223..fbaf7f3530c0abcf308a549dcc23a49ca3d23e6b 100644 (file)
@@ -1,34 +1,26 @@
-#include <iostream>
-#include "gdcm.h"
+/*=========================================================================
+                                                                                
+  Program:   gdcm
+  Module:    $RCSfile: makeDicomDir.cxx,v $
+  Language:  C++
+  Date:      $Date: 2004/12/03 20:16:56 $
+  Version:   $Revision: 1.9 $
+                                                                                
+  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 <fstream>
-#ifdef GDCM_NO_ANSI_STRING_STREAM
-#  include <strstream>
-#  define  ostringstream ostrstream
-# else
-#  include <sstream>
-#endif
-
-#define  ostringstream ostrstream
-
-#include <sys/types.h>
-#include <errno.h>
-
-// for Directory pb
-#ifdef _MSC_VER 
-   #include <windows.h> 
-   #include <direct.h>
-#else
-   #include <dirent.h>   
-   #include <unistd.h>
-#endif
-
-#include <vector>
-#include <algorithm>
+#include <iostream>
 
 // ---
 void StartMethod(void *toto) {
@@ -52,7 +44,7 @@ void EndMethod(void *toto) {
   */  
 
 int main(int argc, char* argv[]) {
-   gdcmDicomDir *dcmdir;
+  gdcm::DicomDir *dcmdir;
    std::string dirName;   
 
    if (argc > 1)
@@ -60,29 +52,22 @@ int main(int argc, char* argv[]) {
    else
       dirName = GDCM_DATA_ROOT;
 
-   dcmdir=new gdcmDicomDir(dirName, true); // we ask for Directory parsing
+   dcmdir = new gdcm::DicomDir(dirName, true); // we ask for Directory parsing
 
    dcmdir->SetStartMethod(StartMethod, (void *) NULL);
    dcmdir->SetEndMethod(EndMethod);
    
-   ListDicomDirPatient lp = dcmdir->GetDicomDirPatients();
+   gdcm::ListDicomDirPatient lp = dcmdir->GetDicomDirPatients();
    if (! lp.size() ) 
    {
       std::cout << "makeDicomDir: no patient list present. Exiting."
                 << std::endl;
       return 1;
    }
-
-   std::cout << "--------- dcmdir->Print() ------------" << std::endl;   
-
-   dcmdir->SetPrintLevel(-1);
-   //dcmdir->Print(); // just to see
-   std::cout << "---------end  dcmdir->Print() ------------" << std::endl;
     
-   dcmdir->Write("NewDICOMDIR");
+   dcmdir->WriteDicomDir("NewDICOMDIR");
    std::cout<<std::flush;
 
    delete dcmdir;
-
    return 0;
 }