1 #ifndef CLITKIMAGEREGIONFILL_CXX
2 #define CLITKIMAGEREGIONFILL_CXX
4 ------------------------------------------------=
5 * @file clitkImageFillRegion.cxx
6 * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
8 ------------------------------------------------=*/
11 #include "clitkImageFillRegion_ggo.h"
12 #include "clitkImageFillRegionGenericFilter.h"
15 //--------------------------------------------------------------------
16 int main(int argc, char * argv[]) {
19 GGO(clitkImageFillRegion, args_info);
22 // Read image dimension
23 itk::ImageIOBase::Pointer header = clitk::readImageHeader(args_info.input_arg);
24 unsigned int dim = header->GetNumberOfDimensions();
27 clitk::ImageFillRegionGenericFilter filter;
28 filter.SetInputFilename(args_info.input_arg);
29 filter.SetOutputFilename(args_info.output_arg);
30 filter.SetFillPixelValue(args_info.value_arg);
32 if(!args_info.ellips_flag && !args_info.rect_flag)
34 std::cerr << "ERROR : No type of region specified!"<< std::endl;
38 if(args_info.ellips_flag && args_info.rect_flag)
40 std::cerr << "ERROR : Multiple types of regions specified!"<< std::endl;
44 if(args_info.rect_flag)
46 if (args_info.size_given && args_info.start_given) {
48 if (args_info.size_given != dim) {
49 std::cerr << "ERROR : image has " << dim << "dimensions, --size should have the same number of values." << std::endl;
52 if (args_info.start_given != dim) {
53 std::cerr << "ERROR : image has " << dim << "dimensions, --size should have the same number of values." << std::endl;
56 filter.SetRegion(args_info.size_arg, args_info.start_arg);
59 std::cerr << "ERROR : both size and start should be given!"<< std::endl;
64 if(args_info.ellips_flag)
67 std::vector<double> c, a;
68 if (args_info.center_given)
70 if (args_info.center_given != dim)
72 std::cerr << "ERROR : image has " << dim << "dimensions, --center should have the same number of values." << std::endl;
75 for(unsigned int i=0; i<dim; i++)
76 c.push_back(args_info.center_arg[i]);
79 if (args_info.axes_given)
81 if (args_info.axes_given != dim)
83 std::cerr << "ERROR : image has " << dim << "dimensions, --axes should have the same number of values." << std::endl;
86 for(unsigned int i=0; i<dim; i++)
87 a.push_back(args_info.axes_arg[i]);
91 for(unsigned int i=0; i<dim; i++)
94 if ((args_info.center_given))
95 filter.SetSphericRegion(a,c);
97 filter.SetSphericRegion(a);
102 // this is the end my friend
106 #endif //define CLITKIMAGEREGIONFILL