]> Creatis software - gdcm.git/blobdiff - Testing/TestAllReadCompareDicom.cxx
* Test/BuildUpDicomDir.cxx : bug fix for windows compilation
[gdcm.git] / Testing / TestAllReadCompareDicom.cxx
index 24e59c982b5bfcdfd23f2650757099e20a12bfc4..08abbcbf012f2525fd6c6a095732128a30c1cbbd 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestAllReadCompareDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/21 11:40:53 $
-  Version:   $Revision: 1.25 $
+  Date:      $Date: 2005/02/01 13:42:44 $
+  Version:   $Revision: 1.29 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -15,6 +15,7 @@
      PURPOSE.  See the above copyright notices for more information.
                                                                                 
 =========================================================================*/
+#include "gdcmDirList.h"
 #include "gdcmFile.h"
 #include "gdcmFileHelper.h"
 
@@ -45,7 +46,6 @@ int InternalTest(std::string const & filename,
       ////// Check for existence of reference baseline dicom file:
       std::cout << "2...";
 
-      //FILE* testFILE = fopen( referenceFileName.c_str(), "r" );
       std::ifstream testFILE( referenceFileName.c_str() );
       if (! testFILE )
       {
@@ -55,10 +55,6 @@ int InternalTest(std::string const & filename,
          tested->SetWriteModeToRGB();
          tested->WriteDcmExplVR( referenceFileName );
       }
-      else
-      {
-         //fclose( testFILE );
-      }
       testFILE.close();
 
       ////// Step 3a:
@@ -201,8 +197,7 @@ int TestAllReadCompareDicom(int argc, char* argv[])
       std::string baseLineDir = GDCM_DATA_ROOT;
       baseLineDir += "/BaselineDicom/";
 
-      std::ifstream* testDIR = new std::ifstream(baseLineDir.c_str(), std::ios::in | std::ios::binary);
-      if (!testDIR )
+      if( !gdcm::DirList::IsDirectory(baseLineDir) )
       {
          std::cerr << "   The reference baseline directory " << std::endl
                    << "      "
@@ -211,10 +206,6 @@ int TestAllReadCompareDicom(int argc, char* argv[])
                    << std::endl;
          return 1;
       }
-      else
-      {
-         testDIR->close();
-      }
 
       ////// Step 1 (see above description):
       std::string filename = GDCM_DATA_ROOT;
@@ -223,7 +214,7 @@ int TestAllReadCompareDicom(int argc, char* argv[])
       
       std::string referenceFileName = baseLineDir + gdcmDataImages[i++];
       std::string::size_type slash_pos = referenceFileName.rfind( "." );
-      if ( slash_pos != std::string::npos )
+      if( slash_pos != std::string::npos )
       {
          referenceFileName.replace( slash_pos + 1, 3, "dcm" );
       }