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://oncora1.lyon.fnclcc.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 CLITKIMAGEREGIONFILL_CXX
19 #define CLITKIMAGEREGIONFILL_CXX
21 ------------------------------------------------=
22 * @file clitkImageFillRegion.cxx
23 * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
25 ------------------------------------------------=*/
28 #include "clitkImageFillRegion_ggo.h"
29 #include "clitkImageFillRegionGenericFilter.h"
32 //--------------------------------------------------------------------
33 int main(int argc, char * argv[])
37 GGO(clitkImageFillRegion, args_info);
40 // Read image dimension
41 itk::ImageIOBase::Pointer header = clitk::readImageHeader(args_info.input_arg);
42 unsigned int dim = header->GetNumberOfDimensions();
45 clitk::ImageFillRegionGenericFilter filter;
46 filter.SetInputFilename(args_info.input_arg);
47 filter.SetOutputFilename(args_info.output_arg);
48 filter.SetFillPixelValue(args_info.value_arg);
50 if(!args_info.ellips_flag && !args_info.rect_flag) {
51 std::cerr << "ERROR : No type of region specified!"<< std::endl;
55 if(args_info.ellips_flag && args_info.rect_flag) {
56 std::cerr << "ERROR : Multiple types of regions specified!"<< std::endl;
60 if(args_info.rect_flag) {
61 if (args_info.size_given && args_info.start_given) {
63 if (args_info.size_given != dim) {
64 std::cerr << "ERROR : image has " << dim << "dimensions, --size should have the same number of values." << std::endl;
67 if (args_info.start_given != dim) {
68 std::cerr << "ERROR : image has " << dim << "dimensions, --size should have the same number of values." << std::endl;
71 filter.SetRegion(args_info.size_arg, args_info.start_arg);
73 std::cerr << "ERROR : both size and start should be given!"<< std::endl;
78 if(args_info.ellips_flag) {
80 std::vector<double> c, a;
81 if (args_info.center_given) {
82 if (args_info.center_given != dim) {
83 std::cerr << "ERROR : image has " << dim << "dimensions, --center should have the same number of values." << std::endl;
86 for(unsigned int i=0; i<dim; i++)
87 c.push_back(args_info.center_arg[i]);
90 if (args_info.axes_given) {
91 if (args_info.axes_given != dim) {
92 std::cerr << "ERROR : image has " << dim << "dimensions, --axes should have the same number of values." << std::endl;
95 for(unsigned int i=0; i<dim; i++)
96 a.push_back(args_info.axes_arg[i]);
99 for(unsigned int i=0; i<dim; i++)
102 if ((args_info.center_given))
103 filter.SetSphericRegion(a,c);
105 filter.SetSphericRegion(a);
110 // this is the end my friend
114 #endif //define CLITKIMAGEREGIONFILL