]> Creatis software - gdcm.git/blobdiff - Testing/TestAllReadCompareDicom.cxx
Save some CPU time, when parsing ACR-NAMA files :
[gdcm.git] / Testing / TestAllReadCompareDicom.cxx
index 1ac5df48b66e32f8d898eb8e5bee8de3c814ccea..53afc93357638381ad9a636c14e2099b4f86488b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestAllReadCompareDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/07/06 09:53:43 $
-  Version:   $Revision: 1.43 $
+  Date:      $Date: 2005/10/25 14:52:30 $
+  Version:   $Revision: 1.49 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -396,16 +396,23 @@ int InternalTest(std::string const &filename,
 
       ////// Step 1:
       std::cout << "1...";
-      gdcm::FileHelper *tested = new gdcm::FileHelper( filename );
-      if( !tested->GetFile()->IsReadable() )
+
+       // new style 
+      gdcm::File *f = gdcm::File::New();
+      f->SetLoadMode ( gdcm::LD_ALL ); // Load everything
+      f->SetFileName( filename );
+      f->Load();
+      if( !f->IsReadable() )
       {
         std::cout << " Failed" << std::endl
                    << "      Image not gdcm compatible:"
                   << filename << std::endl;
-        delete tested;
+        f->Delete();
         return 1;
       }
-
+      gdcm::FileHelper *tested = gdcm::FileHelper::New( f );
+     
       ////// Step 2:
       ////// Check for existence of reference baseline dicom file:
       std::cout << "2...";
@@ -436,7 +443,8 @@ int InternalTest(std::string const &filename,
                    << "      Image not Testing compatible:"
                   << filename << std::endl;
          delete reference;
-         delete tested;
+         tested->Delete();
+         f->Delete();
          return 1;
       }
 
@@ -463,7 +471,8 @@ int InternalTest(std::string const &filename,
                    << "Z: " << tested->GetFile()->GetZSize() << " # " 
                    << reference->GetZSize() << std::endl;
          delete reference;
-         delete tested;
+         tested->Delete();
+         f->Delete();
          return 1;
       }
 
@@ -476,9 +485,11 @@ int InternalTest(std::string const &filename,
                    << "        Scalar size: " << tested->GetFile()->GetPixelSize() << " # " 
                    << reference->GetScalarSize() << std::endl
                    << "        Number of scalar: " << tested->GetFile()->GetNumberOfScalarComponents() << " # " 
-                   << reference->GetNumberOfComponents() << std::endl;
+                   << reference->GetNumberOfComponents() << std::endl
+                   << "        Pixel type: " << tested->GetFile()->GetPixelType() << std::endl;
          delete reference;
-         delete tested;
+         tested->Delete();
+         f->Delete();
          return 1;
       }
 
@@ -496,8 +507,9 @@ int InternalTest(std::string const &filename,
                    << tested->GetFile()->GetYSize() << ","
                    << tested->GetFile()->GetZSize() << ")"
                    << std::endl;
-         delete tested;
+         tested->Delete();
          delete reference;
+         f->Delete();
          return 1;
       }
 
@@ -534,14 +546,16 @@ int InternalTest(std::string const &filename,
          }
          std::cout << std::endl;
 
-         delete tested;
+         tested->Delete();
          delete reference;
+         f->Delete();
          return 1;
       }
 
       //////////////// Clean up:
-      delete tested;
+      tested->Delete();
       delete reference;
+      f->Delete();
 
       std::cout << "OK." << std::endl;