From: dsarrut Date: Wed, 30 Jun 2010 06:02:07 +0000 (+0000) Subject: cosmetic X-Git-Tag: v1.2.0~591 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=69da1b08550a83abac8b0f64793ce57af6d12647;p=clitk.git cosmetic --- diff --git a/filters/clitkGuerreroVentilationGenericFilter.cxx b/filters/clitkGuerreroVentilationGenericFilter.cxx index ad3b6d9..9d1ab2d 100644 --- a/filters/clitkGuerreroVentilationGenericFilter.cxx +++ b/filters/clitkGuerreroVentilationGenericFilter.cxx @@ -54,7 +54,7 @@ void clitk::GuerreroVentilationGenericFilter::UpdateWithInputImageType() { // Input should be 2 - assert(mInputFilenames.size() == 2); + assert(m_InputFilenames.size() == 2); // Reading input typedef ImageType InputImageType; diff --git a/filters/clitkImageArithmGenericFilter.txx b/filters/clitkImageArithmGenericFilter.txx index 99f7f32..1820fb7 100644 --- a/filters/clitkImageArithmGenericFilter.txx +++ b/filters/clitkImageArithmGenericFilter.txx @@ -17,6 +17,9 @@ ======================================================================-====*/ #ifndef CLITKIMAGEARITHMGENERICFILTER_TXX #define CLITKIMAGEARITHMGENERICFILTER_TXX + +#include "clitkImageCommon.h" + namespace clitk { @@ -107,6 +110,12 @@ void ImageArithmGenericFilter::UpdateWithInputImageType() typename ImageType::Pointer input2 = this->template GetInput(1); IteratorType it2; + // Check dimension + if (!clitk::HasSameSizeAndSpacing(input1, input2)) { + std::cerr << "* ERROR * the images (input and input2) must have the same size & spacing"; + return; + } + if (mIsOperationUseASecondImage) { // Read input2 input2 = this->template GetInput(1); @@ -220,6 +229,7 @@ void ImageArithmGenericFilter::ComputeImage(Iter1 it1, Iter2 it } break; case 5: // Absolute difference + DD("AbsoluteDifff"); while (!ito.IsAtEnd()) { ito.Set(PixelTypeDownCast(fabs((double)it2.Get()-(double)it1.Get()))); ++it1; diff --git a/filters/clitkImageConvertGenericFilter.cxx b/filters/clitkImageConvertGenericFilter.cxx index 944ec8c..ca70097 100644 --- a/filters/clitkImageConvertGenericFilter.cxx +++ b/filters/clitkImageConvertGenericFilter.cxx @@ -50,16 +50,16 @@ void clitk::ImageConvertGenericFilter::UpdateWithInputImageType() { // Verbose stuff - if (mIOVerbose) { - if (mInputFilenames.size() == 1) { - std::cout << "Input image <" << mInputFilenames[0] << "> is "; - itk::ImageIOBase::Pointer header = clitk::readImageHeader(mInputFilenames[0]); + if (m_IOVerbose) { + if (m_InputFilenames.size() == 1) { + std::cout << "Input image <" << m_InputFilenames[0] << "> is "; + itk::ImageIOBase::Pointer header = clitk::readImageHeader(m_InputFilenames[0]); printImageHeader(header, std::cout); std::cout << std::endl; } else { - for(unsigned int i=0; i is "; - itk::ImageIOBase::Pointer h = clitk::readImageHeader(mInputFilenames[i]); + for(unsigned int i=0; i is "; + itk::ImageIOBase::Pointer h = clitk::readImageHeader(m_InputFilenames[i]); printImageHeader(h, std::cout); std::cout << std::endl; } @@ -67,10 +67,10 @@ void clitk::ImageConvertGenericFilter::UpdateWithInputImageType() } - if ((mPixelTypeName == mOutputPixelTypeName) || (mOutputPixelTypeName == "NotSpecified")) { - // typename InputImageType::Pointer input = clitk::readImage(mInputFilenames); + if ((m_PixelTypeName == mOutputPixelTypeName) || (mOutputPixelTypeName == "NotSpecified")) { + // typename InputImageType::Pointer input = clitk::readImage(m_InputFilenames); typename InputImageType::Pointer input = this->template GetInput(0); - //clitk::writeImage(input, mOutputFilename, mIOVerbose); + //clitk::writeImage(input, mOutputFilename, m_IOVerbose); this->SetNextOutput(input); } else { #define TRY_TYPE(TYPE) \ @@ -107,14 +107,14 @@ void clitk::ImageConvertGenericFilter::UpdateWithOutputType() std::ostringstream osstream; if (std::numeric_limits::is_signed) { if (!std::numeric_limits::is_signed) { - osstream << "Warning, input type is signed (" << mPixelTypeName << ") while output type is not (" + osstream << "Warning, input type is signed (" << m_PixelTypeName << ") while output type is not (" << mOutputPixelTypeName << "), use at your own responsability." << std::endl; mWarningOccur = true; } } if (!std::numeric_limits::is_integer) { if (std::numeric_limits::is_integer) { - osstream << "Warning, input type is not integer (" << mPixelTypeName << ") while output type is (" + osstream << "Warning, input type is not integer (" << m_PixelTypeName << ") while output type is (" << mOutputPixelTypeName << "), use at your own responsability." << std::endl; mWarningOccur = true; } @@ -123,13 +123,13 @@ void clitk::ImageConvertGenericFilter::UpdateWithOutputType() // DD(std::numeric_limits::digits10); if (!std::numeric_limits::is_integer) { if (std::numeric_limits::is_integer) { - osstream << "Warning, input type is not integer (" << mPixelTypeName << ") while output type is (" + osstream << "Warning, input type is not integer (" << m_PixelTypeName << ") while output type is (" << mOutputPixelTypeName << "), use at your own responsability." << std::endl; mWarningOccur = true; } } if (std::numeric_limits::digits10 > std::numeric_limits::digits10) { - osstream << "Warning, possible loss of precision : input type is (" << mPixelTypeName << ") while output type is (" + osstream << "Warning, possible loss of precision : input type is (" << m_PixelTypeName << ") while output type is (" << mOutputPixelTypeName << "), use at your own responsability." << std::endl; mWarningOccur = true; } @@ -148,7 +148,7 @@ void clitk::ImageConvertGenericFilter::UpdateWithOutputType() // Write SetNextOutput(filter->GetOutput()); - //clitk::writeImage(filter->GetOutput(), mOutputFilename, mIOVerbose); + //clitk::writeImage(filter->GetOutput(), mOutputFilename, m_IOVerbose); } //==================================================================== diff --git a/filters/clitkImageResampleGenericFilter.cxx b/filters/clitkImageResampleGenericFilter.cxx index aa84b8e..ab8e113 100644 --- a/filters/clitkImageResampleGenericFilter.cxx +++ b/filters/clitkImageResampleGenericFilter.cxx @@ -194,7 +194,7 @@ void clitk::ImageResampleGenericFilter::UpdateWithInputImageType() try { filter->Update(); } catch( itk::ExceptionObject & err ) { - std::cerr << "Error while filtering " << mInputFilenames[0].c_str() + std::cerr << "Error while filtering " << m_InputFilenames[0].c_str() << " " << err << std::endl; exit(0); } diff --git a/filters/clitkResampleImage.ggo b/filters/clitkResampleImage.ggo index e681ed6..491f366 100644 --- a/filters/clitkResampleImage.ggo +++ b/filters/clitkResampleImage.ggo @@ -12,6 +12,7 @@ option "thread" - "Nb of thread to use (default=max)" int no section "Input & Output options" option "input" i "Input image filename" string yes option "output" o "Output image filename" string yes +option "like" l "Resample like this image" string no option "size" - "Number of pixels of each coordonate" int no multiple default="0" option "spacing" - "Spacing in mm between pixels" float no multiple default="-1.0" option "default" d "Default pixel value" float no default = "0.0" diff --git a/filters/clitkResampleImageGenericFilter.txx b/filters/clitkResampleImageGenericFilter.txx index fb4c80d..5e08d4a 100644 --- a/filters/clitkResampleImageGenericFilter.txx +++ b/filters/clitkResampleImageGenericFilter.txx @@ -90,32 +90,39 @@ clitk::ResampleImageGenericFilter::UpdateWithInputImageType() static const unsigned int dim = OutputImageType::ImageDimension; typename OutputImageType::SpacingType spacing; typename OutputImageType::SizeType size; - 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; - 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; + if (mArgsInfo.like_given) { + DD("like"); + + } + 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; 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 == 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); } - if (mArgsInfo.spacing_given) - for(unsigned int i=0; iSetOutputSpacing(spacing); - filter->SetOutputSize(size); } } diff --git a/filters/clitkVFResampleGenericFilter.cxx b/filters/clitkVFResampleGenericFilter.cxx index 2137c3f..2cd6b7d 100644 --- a/filters/clitkVFResampleGenericFilter.cxx +++ b/filters/clitkVFResampleGenericFilter.cxx @@ -58,14 +58,14 @@ template void clitk::VFResampleGenericFilter::UpdateWithInputImageType() { - if (mNbOfComponents == 1) { + if (m_NbOfComponents == 1) { std::cerr << "Error, only one components ? Use clitkImageResample instead." << std::endl; exit(0); } typedef typename ImageType::PixelType PixelType; - if (mNbOfComponents == 2) Update_WithDimAndPixelTypeAndComponent(); - if (mNbOfComponents == 3) Update_WithDimAndPixelTypeAndComponent(); - if (mNbOfComponents == 4) Update_WithDimAndPixelTypeAndComponent(); + if (m_NbOfComponents == 2) Update_WithDimAndPixelTypeAndComponent(); + if (m_NbOfComponents == 3) Update_WithDimAndPixelTypeAndComponent(); + if (m_NbOfComponents == 4) Update_WithDimAndPixelTypeAndComponent(); } //-------------------------------------------------------------------- @@ -78,7 +78,7 @@ void clitk::VFResampleGenericFilter::Update_WithDimAndPixelTypeAndComponent() typedef itk::Vector DisplacementType; typedef itk::Image< DisplacementType, Dim > ImageType; - typename ImageType::Pointer input = clitk::readImage(mInputFilenames, mIOVerbose); + typename ImageType::Pointer input = clitk::readImage(m_InputFilenames, m_IOVerbose); // Main filter typename ImageType::Pointer outputImage = ComputeImage(input); @@ -183,7 +183,7 @@ clitk::VFResampleGenericFilter::ComputeImage(typename ImageType::Pointer inputIm try { filter->Update(); } catch( itk::ExceptionObject & err ) { - std::cerr << "Error while filtering " << mInputFilenames[0].c_str() + std::cerr << "Error while filtering " << m_InputFilenames[0].c_str() << " " << err << std::endl; exit(0); }