]> Creatis software - gdcm.git/blobdiff - Testing/TestAllReadCompareDicom.cxx
* Remove obvious Example that don't pass on Windows
[gdcm.git] / Testing / TestAllReadCompareDicom.cxx
index 23563114b754b500921f210be3d6f65b8bc96472..bb428fd0903b006f0668f019cf88ece83c7c53fe 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestAllReadCompareDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/05/02 17:56:44 $
-  Version:   $Revision: 1.42 $
+  Date:      $Date: 2005/10/18 08:35:46 $
+  Version:   $Revision: 1.48 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -20,6 +20,7 @@
 #include "gdcmFileHelper.h"
 #include "gdcmGlobal.h"
 #include "gdcmTS.h"
+#include "gdcmDebug.h"
 
 #include <iostream>
 
@@ -395,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 = new gdcm::File();
+      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;
+        delete f;
         return 1;
       }
-
+     gdcm::FileHelper *tested = new gdcm::FileHelper( f );
+     
       ////// Step 2:
       ////// Check for existence of reference baseline dicom file:
       std::cout << "2...";
@@ -436,6 +444,7 @@ int InternalTest(std::string const &filename,
                   << filename << std::endl;
          delete reference;
          delete tested;
+         delete f;
          return 1;
       }
 
@@ -463,6 +472,7 @@ int InternalTest(std::string const &filename,
                    << reference->GetZSize() << std::endl;
          delete reference;
          delete tested;
+         delete f;
          return 1;
       }
 
@@ -475,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;
+         delete f;
          return 1;
       }
 
@@ -497,6 +509,7 @@ int InternalTest(std::string const &filename,
                    << std::endl;
          delete tested;
          delete reference;
+         delete f;
          return 1;
       }
 
@@ -535,12 +548,14 @@ int InternalTest(std::string const &filename,
 
          delete tested;
          delete reference;
+         delete f;
          return 1;
       }
 
       //////////////// Clean up:
       delete tested;
       delete reference;
+      delete f;
 
       std::cout << "OK." << std::endl;
       
@@ -549,7 +564,10 @@ int InternalTest(std::string const &filename,
 
 int TestAllReadCompareDicom(int argc, char *argv[]) 
 {
-   if ( argc == 3 )
+   if (argc == 4)
+      gdcm::Debug::DebugOn();
+
+   if ( argc >= 3 )
    {
       // The test is specified a specific filename, use it instead of looping
       // over all images
@@ -557,7 +575,7 @@ int TestAllReadCompareDicom(int argc, char *argv[])
       const std::string reference = argv[2];
       return InternalTest( input, reference );
    }
-   else if ( argc > 3 || argc == 2 )
+   else if ( argc > 4 || argc == 2 )
    {
       std::cerr << "   Usage: " << argv[0]
                 << " (no arguments needed)." << std::endl;