From: srit Date: Wed, 16 Mar 2011 17:19:22 +0000 (+0000) Subject: Attempted to fix the mess of the resample fucker wrt to setting spacing and dims X-Git-Tag: v1.2.0~164 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=9d1351bcc77a1b77ec141a625aff5be8ba861e7b;p=clitk.git Attempted to fix the mess of the resample fucker wrt to setting spacing and dims --- diff --git a/tools/clitkResampleImageGenericFilter.txx b/tools/clitkResampleImageGenericFilter.txx index e05770e..823acb9 100644 --- a/tools/clitkResampleImageGenericFilter.txx +++ b/tools/clitkResampleImageGenericFilter.txx @@ -68,31 +68,28 @@ clitk::ResampleImageGenericFilter::UpdateWithInputImageType() else { if (mArgsInfo.spacing_given == 1) { filter->SetOutputIsoSpacing(mArgsInfo.spacing_arg[0]); - } else { - if ((mArgsInfo.spacing_given != 0) && (mArgsInfo.size_given != 0)) { - std::cerr << "Error: use spacing or size, not both." << std::endl; + } + else if ((mArgsInfo.spacing_given != 0) && (mArgsInfo.size_given != 0)) { + std::cerr << "Error: use spacing or size, not both." << std::endl; + exit(0); + } + else if (mArgsInfo.spacing_given) { + if ((mArgsInfo.spacing_given != 0) && (mArgsInfo.spacing_given != dim)) { + std::cerr << "Error: spacing should have one or " << dim << " values." << std::endl; exit(0); } - - if (!((mArgsInfo.spacing_given == 0) && (mArgsInfo.size_given == 0))) { - - if ((mArgsInfo.spacing_given != 0) && (mArgsInfo.spacing_given != dim)) { - std::cerr << "Error: spacing should have one or " << dim << " values." << std::endl; - exit(0); - } - if ((mArgsInfo.size_given != 0) && (mArgsInfo.size_given != dim)) { - std::cerr << "Error: size should have " << dim << " values." << std::endl; - exit(0); - } - if (mArgsInfo.spacing_given) - for(unsigned int i=0; iSetOutputSpacing(spacing); - filter->SetOutputSize(size); + for(unsigned int i=0; iSetOutputSpacing(spacing); + } + else if (mArgsInfo.size_given) { + if ((mArgsInfo.size_given != 0) && (mArgsInfo.size_given != dim)) { + std::cerr << "Error: size should have " << dim << " values." << std::endl; + exit(0); } + for(unsigned int i=0; iSetOutputSize(size); } }