1 /*=========================================================================
4 Module: $RCSfile: TestValidate.cxx,v $
6 Date: $Date: 2007/06/21 14:59:06 $
7 Version: $Revision: 1.11 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #include "gdcmValidator.h"
21 #include "gdcmGlobal.h"
22 #include "gdcmDictSet.h"
25 #include "gdcmDataImages.h"
27 int Validate(std::string const &filename);
29 int Validate(std::string const &filename)
31 GDCM_NAME_SPACE::File *input = GDCM_NAME_SPACE::File::New( );
32 input->SetFileName(filename);
34 GDCM_NAME_SPACE::Validator *v = GDCM_NAME_SPACE::Validator::New();
38 return 1; // allways true (we don't want to break the test suite)
42 int TestValidate(int argc, char *argv[])
46 // The test is specified a specific filename, use it instead of looping
48 const std::string input = argv[1];
49 return Validate( input );
51 else if ( argc > 2 || argc == 2 )
53 std::cout << " Usage: " << argv[0]
54 << " (no arguments needed)." << std::endl;
55 std::cout << "or Usage: " << argv[0]
56 << " filename.dcm " << std::endl;
61 int retVal = 0; //by default : *no* error
62 while( gdcmDataImages[i] != 0 )
64 std::string filename = GDCM_DATA_ROOT;
65 filename += "/"; //doh!
66 filename += gdcmDataImages[i];
67 std::cout << filename << std::endl;
68 if( Validate( filename ) != 0 )
75 retVal = 0; // Never break test suite