]> Creatis software - gdcm.git/blobdiff - Testing/TestAllReadCompareDicom.cxx
Blacklist "PET-cardio-Multiframe-Papyrus.dcm"
[gdcm.git] / Testing / TestAllReadCompareDicom.cxx
index 48e2f00bb93eddf5933fcf569803fb0f264c7e32..eea858b2d30e44499efdbcda2e3438e662fd636a 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: TestAllReadCompareDicom.cxx,v $
   Language:  C++
-  Date:      $Date: 2004/12/03 20:16:56 $
-  Version:   $Revision: 1.21 $
+  Date:      $Date: 2005/01/11 15:58:36 $
+  Version:   $Revision: 1.23 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -17,7 +17,9 @@
 =========================================================================*/
 #include "gdcmHeader.h"
 #include "gdcmFile.h"
+
 #include <iostream>
+#include <fstream>
 
 //Generated file:
 #include "gdcmDataImages.h"
@@ -43,7 +45,8 @@ int InternalTest(std::string const & filename,
       ////// Check for existence of reference baseline dicom file:
       std::cout << "2...";
 
-      FILE* testFILE = fopen( referenceFileName.c_str(), "r" );
+      //FILE* testFILE = fopen( referenceFileName.c_str(), "r" );
+      std::ifstream testFILE( referenceFileName.c_str() );
       if (! testFILE )
       {
          uint8_t* testedImageData = tested->GetImageData(); // Kludge
@@ -54,8 +57,9 @@ int InternalTest(std::string const & filename,
       }
       else
       {
-         fclose( testFILE );
+         //fclose( testFILE );
       }
+      testFILE.close();
 
       ////// Step 3a:
       ////// When reference file is not gdcm readable test is failed:
@@ -73,6 +77,8 @@ int InternalTest(std::string const & filename,
          return 1;
       }
 
+      std::string PixelType = reference->GetHeader()->GetPixelType();
+
       ////// Step 3b:
       std::cout << "3b...";
       int testedDataSize    = tested->GetImageDataSize();
@@ -103,7 +109,9 @@ int InternalTest(std::string const & filename,
       if (testedDataSize != referenceDataSize)
       {
          std::cout << " Failed" << std::endl
-                   << "        pixel areas lengths differ: "
+                   << "        pixel ("
+                   << PixelType
+                   <<") areas lengths differ: "
                    << testedDataSize << " # " << referenceDataSize
                    << std::endl;
          delete tested;
@@ -117,7 +125,9 @@ int InternalTest(std::string const & filename,
       {
          (void)res;
          std::cout << " Failed" << std::endl
-                   << "        pixel differ (as expanded in memory)."
+                   << "        pixel (" 
+                   << PixelType
+                   << ") differ (as expanded in memory)."
                    << std::endl;
          delete tested;
          delete reference;