From: tbaudier Date: Wed, 9 Aug 2017 13:14:14 +0000 (+0200) Subject: Remove clitkResampleImage X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a7894a5ffd6848731eba30e4cdf9590cf0c0dce6;p=clitk.git Remove clitkResampleImage --- diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 1a285fa..a050ba8 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -21,9 +21,6 @@ add_library(clitkImageArithmImageLib clitkImageArithmGenericFilter.cxx ${clitkIm WRAP_GGO(clitkVectorArithm_GGO_C clitkVectorArithm.ggo) add_library(clitkVectorArithmLib clitkVectorArithmGenericFilter.cxx ${clitkVectorArithm_GGO_C}) -WRAP_GGO(clitkResampleImage_GGO_C clitkResampleImage.ggo) -add_library(clitkResampleImageLib clitkResampleImageGenericFilter.cxx ${clitkResampleImage_GGO_C}) - WRAP_GGO(clitkMIP_GGO_C clitkMIP.ggo) add_library(clitkMIPLib clitkMIPGenericFilter.cxx ${clitkMIP_GGO_C}) @@ -189,10 +186,6 @@ if(CLITK_BUILD_TOOLS) target_link_libraries(clitkMedianImageFilter clitkMedianImageFilterLib clitkCommon) set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMedianImageFilter) - add_executable(clitkResampleImage clitkResampleImage.cxx) - target_link_libraries(clitkResampleImage clitkResampleImageLib clitkCommon) - set(TOOLS_INSTALL ${TOOLS_INSTALL} clitkResampleImage) - WRAP_GGO(clitkMinMaxMask_GGO_C clitkMinMaxMask.ggo) add_executable(clitkMinMaxMask clitkMinMaxMask.cxx ${clitkMinMaxMask_GGO_C}) target_link_libraries(clitkMinMaxMask clitkCommon ) diff --git a/tools/clitkResampleImage.cxx b/tools/clitkResampleImage.cxx deleted file mode 100644 index 64be167..0000000 --- a/tools/clitkResampleImage.cxx +++ /dev/null @@ -1,43 +0,0 @@ -/*========================================================================= - Program: vv http://www.creatis.insa-lyon.fr/rio/vv - - Authors belong to: - - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://www.centreleonberard.fr - - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the copyright notices for more information. - - It is distributed under dual licence - - - BSD See included LICENSE.txt file - - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -===========================================================================**/ - -// clitk -#include "clitkResampleImage_ggo.h" -#include "clitkIO.h" -#include "clitkResampleImageGenericFilter.h" - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) -{ - - // Init command line - GGO(clitkResampleImage, args_info); - CLITK_INIT; - - // Filter - typedef clitk::ResampleImageGenericFilter FilterType; - FilterType::Pointer filter = FilterType::New(); - - filter->SetArgsInfo(args_info); - CLITK_TRY_CATCH_EXIT(filter->Update()); - - // this is the end my friend - return EXIT_SUCCESS; - -}// end main -//-------------------------------------------------------------------- diff --git a/tools/clitkResampleImage.ggo b/tools/clitkResampleImage.ggo deleted file mode 100644 index bee2e8e..0000000 --- a/tools/clitkResampleImage.ggo +++ /dev/null @@ -1,28 +0,0 @@ -#File clitkImageResample.ggo -package "clitkResampleImage" -version "2.0" -purpose "Resample an image. You can specify the interpolation, you can apply a Gaussian filter before (automated if downsample)." - -section "Common" -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off -option "imagetypes" - "Verbose: allowed image types" flag off -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" -option "time" t "Last Dimension Is Time -> do not resample it (auto on for 4D)" flag off - -section "Interpolation" -option "interp" - "Interpolation type: {nn, linear, bspline, blut}" string no default="nn" -option "order" b "BSpline ordre (range 0-5)" int no default="3" -option "sampling" s "BLUT sampling value" int no default="30" - -section "Gaussian filtering" -option "gauss" g "Apply Gaussian before (sigma in mm)" float no multiple default="0.0" -option "autogauss" a "Apply Gaussian with auto sigma when downsample" flag off diff --git a/tools/clitkResampleImageGenericFilter.cxx b/tools/clitkResampleImageGenericFilter.cxx deleted file mode 100644 index b33e63e..0000000 --- a/tools/clitkResampleImageGenericFilter.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/*========================================================================= - Program: vv http://www.creatis.insa-lyon.fr/rio/vv - - Authors belong to: - - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://www.centreleonberard.fr - - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the copyright notices for more information. - - It is distributed under dual licence - - - BSD See included LICENSE.txt file - - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ===========================================================================**/ - -// clitk -#include "clitkResampleImageGenericFilter.h" -#include "clitkResampleImageWithOptionsFilter.h" - -//-------------------------------------------------------------------- -clitk::ResampleImageGenericFilter::ResampleImageGenericFilter(): - ImageToImageGenericFilter("Resample") -{ - InitializeImageType<2>(); - InitializeImageType<3>(); - InitializeImageType<4>(); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -template -void clitk::ResampleImageGenericFilter::InitializeImageType() -{ - ADD_DEFAULT_IMAGE_TYPES(Dim); - ADD_IMAGE_TYPE(Dim, short); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -void clitk::ResampleImageGenericFilter::SetArgsInfo(const ArgsInfoType & a) -{ - mArgsInfo=a; - if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes(); - SetIOVerbose(mArgsInfo.verbose_flag); - if (mArgsInfo.input_given) { - SetInputFilename(mArgsInfo.input_arg); - } - if (mArgsInfo.output_given) { - SetOutputFilename(mArgsInfo.output_arg); - } -} -//-------------------------------------------------------------------- - diff --git a/tools/clitkResampleImageGenericFilter.h b/tools/clitkResampleImageGenericFilter.h deleted file mode 100644 index d598dcf..0000000 --- a/tools/clitkResampleImageGenericFilter.h +++ /dev/null @@ -1,66 +0,0 @@ -/*========================================================================= - Program: vv http://www.creatis.insa-lyon.fr/rio/vv - - Authors belong to: - - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://www.centreleonberard.fr - - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the copyright notices for more information. - - It is distributed under dual licence - - - BSD See included LICENSE.txt file - - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html -===========================================================================**/ - -#ifndef CLITKIRESAMPLEIMAGEGENERICFILTER_H -#define CLITKIRESAMPLEIMAGEGENERICFILTER_H - -// clitk include -#include "clitkResampleImage_ggo.h" -#include "clitkImageToImageGenericFilter.h" - -namespace clitk { - - //-------------------------------------------------------------------- - class ITK_EXPORT ResampleImageGenericFilter: - public ImageToImageGenericFilter { - - public: - // Constructor - ResampleImageGenericFilter(); - - // Types - typedef ResampleImageGenericFilter Self; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - typedef args_info_clitkResampleImage ArgsInfoType; - - // New - itkNewMacro(Self); - - // Args - void SetArgsInfo(const ArgsInfoType & a); - - // Main function - template void UpdateWithInputImageType(); - - protected: - ArgsInfoType mArgsInfo; - template void InitializeImageType(); - - }; // end class ResampleImageGenericFilter - //-------------------------------------------------------------------- - -} // end namespace clitk -//-------------------------------------------------------------------- - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkResampleImageGenericFilter.txx" -#endif - -#endif /* end #define CLITKIRESAMPLEIMAGEGENERICFILTER_H */ - diff --git a/tools/clitkResampleImageGenericFilter.txx b/tools/clitkResampleImageGenericFilter.txx deleted file mode 100644 index 7ecf842..0000000 --- a/tools/clitkResampleImageGenericFilter.txx +++ /dev/null @@ -1,171 +0,0 @@ -/*========================================================================= - Program: vv http://www.creatis.insa-lyon.fr/rio/vv - - Authors belong to: - - University of LYON http://www.universite-lyon.fr/ - - Léon Bérard cancer center http://www.centreleonberard.fr - - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the copyright notices for more information. - - It is distributed under dual licence - - - BSD See included LICENSE.txt file - - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - ===========================================================================**/ - -#ifndef CLITKRESAMPLEIMAGEGENERICFILTER_TXX -#define CLITKRESAMPLEIMAGEGENERICFILTER_TXX - -// clitk -#include "clitkResampleImageWithOptionsFilter.h" - -//-------------------------------------------------------------------- -// Update with the number of dimensions and the pixeltype -//-------------------------------------------------------------------- -template -void -clitk::ResampleImageGenericFilter::UpdateWithInputImageType() -{ - - // Reading input - typename InputImageType::Pointer input = this->template GetInput(0); - - // Main filter - typedef typename InputImageType::PixelType PixelType; - typedef InputImageType OutputImageType; // to change to float is user ask it (?) - - // Filter - typedef clitk::ResampleImageWithOptionsFilter ResampleImageFilterType; - typename ResampleImageFilterType::Pointer filter = ResampleImageFilterType::New(); - filter->SetInput(input); - - // Set Verbose - filter->SetVerboseOptions(mArgsInfo.verbose_flag); - - // Set size / spacing - static const unsigned int dim = OutputImageType::ImageDimension; - typename OutputImageType::SpacingType spacing; - typename OutputImageType::SizeType size; - typename OutputImageType::PointType origin; - typename OutputImageType::DirectionType direction; - - if (mArgsInfo.like_given) { - itk::ImageIOBase::Pointer header = clitk::readImageHeader(mArgsInfo.like_arg); - if (header) { - for(unsigned int i=0; iGetSpacing(i); - size[i] = header->GetDimensions(i); - origin[i] = header->GetOrigin(i); - } - for(unsigned int i=0; iGetDirection(i)[j]; - } - } - filter->SetOutputSpacing(spacing); - filter->SetOutputSize(size); - filter->SetOutputOrigin(origin); - filter->SetOutputDirection(direction); - } - else { - std::cerr << "*** Warning : I could not read '" << mArgsInfo.like_arg << "' ***" << std::endl; - exit(0); - } - } - 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); - } - 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); - } - 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); - } - for(unsigned int i=0; iGetOrigin()[i]; - } - for(unsigned int i=0; iGetDirection()[i][j]; - } - } - filter->SetOutputOrigin(origin); - filter->SetOutputDirection(direction); - } - - // Set temporal dimension - filter->SetLastDimensionIsTime(mArgsInfo.time_flag); - - // Set Gauss - filter->SetGaussianFilteringEnabled(mArgsInfo.autogauss_flag); - if (mArgsInfo.gauss_given != 0) { - typename ResampleImageFilterType::GaussianSigmaType g; - for(unsigned int i=0; iSetGaussianSigma(g); - } - - // Set Interpolation - std::string interp = std::string(mArgsInfo.interp_arg); - if (interp == "nn") { - filter->SetInterpolationType(ResampleImageFilterType::NearestNeighbor); - } else { - if (interp == "linear") { - filter->SetInterpolationType(ResampleImageFilterType::Linear); - } else { - if (interp == "bspline") { - filter->SetInterpolationType(ResampleImageFilterType::BSpline); - } else { - if (interp == "blut") { - filter->SetInterpolationType(ResampleImageFilterType::B_LUT); - } else { - if (interp == "windowed sinc") { - filter->SetInterpolationType(ResampleImageFilterType::WSINC); - } else { - std::cerr << "Error. I do not know interpolation '" << mArgsInfo.interp_arg - << "'. Choose among: nn, linear, bspline, blut, windowed sinc" << std::endl; - exit(0); - } - } - } - } - } - - // Set default pixel value - filter->SetDefaultPixelValue(mArgsInfo.default_arg); - - // Set thread - if (mArgsInfo.thread_given) { - filter->SetNumberOfThreads(mArgsInfo.thread_arg); - } - - // Go ! - filter->Update(); - typename OutputImageType::Pointer outputImage = filter->GetOutput(); - this->template SetNextOutput(outputImage); -} -//-------------------------------------------------------------------- - -#endif /* end #define CLITKRESAMPLEIMAGEGENERICFILTER_TXX */ - diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index 436dfc6..b710011 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -16,7 +16,6 @@ set(vv_TOOLS vvToolCropImage vvToolBinarize vvToolImageArithm - vvToolResample vvToolMIP vvToolConvert ## with dummy vvToolConvert.ui vvToolROIManager @@ -40,7 +39,6 @@ set(vv_TOOLS set(vvToolBinarize_LIBS clitkBinarizeImageLib) set(vvToolProfile_LIBS clitkProfileImageLib) set(vvToolHistogram_LIBS clitkHistogramImageLib) -set(vvToolResample_LIBS clitkResampleImageLib) set(vvToolConvert_LIBS clitkImageConvertLib) set(vvToolExtractPatient_LIBS clitkSegmentationGgoLib) set(vvToolExtractLung_LIBS clitkSegmentationGgoLib)