- CLITK_INIT;
-
- // Check that we have either the 2nd image or the scalar
- if ((args_info.input2_given) && (args_info.scalar_given)) {
- std::cerr << "ERROR : you cannot provide both --scalar and --input2 option" << std::endl;
- exit(-1);
- }
- if ((!args_info.input2_given) && (!args_info.scalar_given)) {
- if (args_info.operation_arg < 5) {
- std::cerr << "Such operation need the --scalar option." << std::endl;
- exit(-1);
- }
- }
-
- // Read input image header1 to check image dimension
- itk::ImageIOBase::Pointer header1 = clitk::readImageHeader(args_info.input1_arg);
- unsigned int dim1 = header1->GetNumberOfDimensions();
- std::string pixelTypeName = header1->GetComponentTypeAsString(header1->GetComponentType());
-
- // Options for arithm operation between 2 images
- if (args_info.input2_given) {
-
- itk::ImageIOBase::Pointer header2 = clitk::readImageHeader(args_info.input2_arg);
- unsigned int dim2 = header2->GetNumberOfDimensions();
- std::string pixelTypeName2 = header2->GetComponentTypeAsString(header1->GetComponentType());
-
- // Check dimension
- if (dim1 != dim2) {
- std::cerr << "Images should have the same dimension : " <<std::endl;
- std::cerr << "Dim input1 = " << dim1 << std::endl;
- std::cerr << "Dim input2 = " << dim2 << std::endl;
- exit(-1);
- }