1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
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
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.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef CLITKIMAGECONVERT_CXX
19 #define CLITKIMAGECONVERT_CXX
21 -------------------------------------------------
22 * @file clitkImageConvert.cxx
23 * @author David Sarrut <david.sarrut@creatis.insa-lyon.fr>
24 * @date 03 Jul 2006 10:28:32
25 -------------------------------------------------*/
28 #include "clitkImageConvert_ggo.h"
30 #include "clitkImageCommon.h"
31 #include "clitkImageConvertGenericFilter.h"
33 //-------------------------------------------------------------------=
34 int main(int argc, char * argv[])
38 GGO(clitkImageConvert, args_info);
41 // Get list of filenames
42 std::vector<std::string> l;
43 unsigned int nCmdLineInputs = args_info.inputs_num;
45 if(args_info.output_given)
46 output = args_info.output_arg;
47 else if(nCmdLineInputs--)
48 output = args_info.inputs[nCmdLineInputs];
50 std::cerr << "Error, you should give the --output option or one image filename on the commande line." << std::endl;
54 if(args_info.input_given) {
55 l.push_back(args_info.input_arg);
57 if(nCmdLineInputs==1) {
58 l.push_back(args_info.inputs[0]);
61 std::cerr << "Error, you should give the --input option or one image filename on the commande line." << std::endl;
66 clitk::ImageConvertGenericFilter::Pointer filter = clitk::ImageConvertGenericFilter::New();
67 filter->SetInputFilenames(l);
68 filter->SetIOVerbose(args_info.verbose_flag);
69 filter->SetOutputFilename(output);
70 filter->SetVV(args_info.vv_flag);
71 filter->EnableWriteCompression(args_info.compression_flag);
72 if (args_info.type_given) filter->SetOutputPixelType(args_info.type_arg);
75 CLITK_TRY_CATCH_EXIT(filter->Update());
77 // this is the end my friend
80 //-------------------------------------------------------------------=
82 #endif /* end #define CLITKIMAGECONVERT_CXX */