X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FTestFileAccessors.cxx;h=6da538a2c30bf4ded65d93d0c6d0bb7b90398038;hb=7cd88a1f47eccb99922d30d19cda56a5fee5f697;hp=3ace1920d4b89f6ddb3adcaf8d7feef3b6e60629;hpb=6b51b22366f878e1050c75a6ebb755bd2ff365c7;p=gdcm.git diff --git a/Testing/TestFileAccessors.cxx b/Testing/TestFileAccessors.cxx index 3ace1920..6da538a2 100644 --- a/Testing/TestFileAccessors.cxx +++ b/Testing/TestFileAccessors.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestFileAccessors.cxx,v $ Language: C++ - Date: $Date: 2005/10/25 14:52:31 $ - Version: $Revision: 1.5 $ + Date: $Date: 2006/11/15 16:00:34 $ + Version: $Revision: 1.10 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -37,32 +37,57 @@ //Generated file: #include "gdcmDataImages.h" -#define TestMethodMacro(mode,obj,name) \ - try \ - { \ - std::cout << " " << #name << "() : " << mode << obj->name() << std::endl; \ - } \ - catch(...) \ - { \ - std::cout << " --> Can't access to the '" << #name << "' method !" << std::endl; \ - f->Delete(); \ - return 1; \ +#define TestMethodMacro(mode,obj,name) \ + try \ + { \ + std::cout <<" "<< #name << "() : " \ + << std::endl; \ + std::cout << " " \ + << mode << obj->name() << std::endl; \ + } \ + catch(...) \ + { \ + std::cout << " --> Can't access to the '" \ + << #name << "' method !" << std::endl;\ + f->Delete(); \ + return 1; \ } - -int TestFileAccessors(int, char *[]) +int TestFileAccessors(int argc, char *argv[]) { int i = 0; float iop[6]; + float ipp[3]; + // gdcm::Debug::DebugOn(); + while( gdcmDataImages[i] != 0 ) { - std::string filename = GDCM_DATA_ROOT; - filename += "/"; //doh! - filename += gdcmDataImages[i]; + + // Keep the comment to be able to track a bug on a given image + // for all the OS. + + // if (gdcmDataImages[i] == "00191113.dcm" ) + // gdcm::Debug::DebugOn(); + // else + // gdcm::Debug::DebugOff(); + + std::string filename; + if (argc ==2) + { + filename = argv[1]; + } + else + { + filename = GDCM_DATA_ROOT; + filename += "/"; //doh! + filename += gdcmDataImages[i]; + } - std::cout << "Begin with " << filename << std::endl; + std::cout << " ----------------------------------------------" + << "Begin with " << filename << std::endl; + gdcm::File *f= gdcm::File::New( ); f->SetFileName( filename ); f->Load( ); @@ -114,6 +139,11 @@ int TestFileAccessors(int, char *[]) std::cout << " Orientation:" << std::endl; for (int j=0; j<6; j++) std::cout << " iop[" << j << "] = " << iop[j] << std::endl; + + f->GetImagePositionPatient( ipp ); + std::cout << " Position:" << std::endl; + for (int j2=0; j2<3; j2++) + std::cout << " ipp[" << j2 << "] = " << ipp[j2] << std::endl; if( f->IsReadable() ) { @@ -137,9 +167,11 @@ int TestFileAccessors(int, char *[]) f->Delete(); return 1; } - f->Delete(); - std::cout << "End with " << filename << std::endl; + + if (argc ==2) + break; // user asked to check a single file. + i++; } return 0;