]> Creatis software - clitk.git/blob - tests/tools/clitkWriteDicomSeriesTest.cxx
changes in license header
[clitk.git] / tests / tools / clitkWriteDicomSeriesTest.cxx
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to:
5   - University of LYON              http://www.universite-lyon.fr/
6   - Léon Bérard cancer center       http://www.centreleonberard.fr
7   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
8
9   This software is distributed WITHOUT ANY WARRANTY; without even
10   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11   PURPOSE.  See the copyright notices for more information.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================*/
18 #include <cstdlib>
19 #include <cstdio>
20
21 #include <iostream>
22 #include <sstream>
23 #include <cassert>
24
25 #include <itksys/SystemTools.hxx>
26
27 const size_t NUMTESTS=1;
28
29 const char mhd_files[NUMTESTS][128] = {
30   CLITK_DATA_PATH"/3d/mhd/00.mhd"
31 };
32
33 const char dcm_dirs[NUMTESTS][128] = {
34   CLITK_DATA_PATH"/3d/dcm/1.2.840.113704.1.111.536.1248695032.26"
35 };
36
37 int main(int argc, char** argv)
38 {
39   bool failed = false;
40   for (size_t i = 0; i < NUMTESTS; i++) {
41     std::ostringstream cmd_line;
42     cmd_line << "clitkWriteDicomSeries -i " << mhd_files[i] << " -d " << dcm_dirs[i] << " -o dcm --verbose";
43
44     std::cout << "Executing " << cmd_line.str() << std::endl;
45     int err = system(cmd_line.str().c_str());
46     if (err != 0)
47     {
48       failed = true;
49       std::cout << "FAILED (errno = " << err << ")" << std::endl;
50     }
51     else
52     {
53       itksys::SystemTools::RemoveADirectory("dcm");
54       std::cout << "PASSED" << std::endl;
55     }
56   }
57   return failed ? -1 : 0;
58 }