From 119a42cb1444930c78314e862e590f54c2f7678d Mon Sep 17 00:00:00 2001 From: delmon Date: Wed, 6 Apr 2011 07:48:36 +0000 Subject: [PATCH] Bug #292 + Add ggo.c files in each library used in vv and clitk. + Patch CropImageFilter in vv and clitk to remove ArgsInfoType template. --- registration/CMakeLists.txt | 18 ++- segmentation/CMakeLists.txt | 7 +- tools/CMakeLists.txt | 55 +++++---- tools/clitkCropImage.cxx | 3 +- tools/clitkCropImageGenericFilter.cxx | 138 ++++++++++++++++++---- tools/clitkCropImageGenericFilter.h | 25 ++-- tools/clitkCropImageGenericFilter.txx | 157 -------------------------- vv/CMakeLists.txt | 10 +- vv/vvToolCropImage.cxx | 2 +- 9 files changed, 177 insertions(+), 238 deletions(-) delete mode 100755 tools/clitkCropImageGenericFilter.txx diff --git a/registration/CMakeLists.txt b/registration/CMakeLists.txt index 7fe83e7..97af42a 100644 --- a/registration/CMakeLists.txt +++ b/registration/CMakeLists.txt @@ -5,22 +5,20 @@ INCLUDE(${PROJECT_SOURCE_DIR}/cmake/common.cmake) #========================================================= -#Add your ggo files to this list if they are used by vv -FOREACH(clitkTool clitkAffineRegistration) - WRAP_GGO(${clitkTool}_GGO_C ${clitkTool}.ggo) - SET(GGO_C_FILES ${GGO_C_FILES} ${${clitkTool}_GGO_C}) -ENDFOREACH(clitkTool) -ADD_LIBRARY(clitkRegistrationGgoLib ${GGO_C_FILES}) -SET_SOURCE_FILES_PROPERTIES(clitkGenericAffineTransform.cxx PROPERTIES - OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/clitkAffineRegistration_ggo.h) -ADD_LIBRARY(clitkAffineRegistrationLib clitkAffineRegistrationGenericFilter.cxx clitkLBFGSBOptimizer.cxx clitkGenericAffineTransform.cxx) +# Add Libraries used in vv and clitk to avoid recompilation +WRAP_GGO(clitkAffineRegistration_GGO_C clitkAffineRegistration.ggo) +ADD_LIBRARY(clitkAffineRegistrationLib + clitkAffineRegistrationGenericFilter.cxx + ${clitkAffineRegistration_GGO_C} + clitkLBFGSBOptimizer.cxx + clitkGenericAffineTransform.cxx) #========================================================= IF(CLITK_BUILD_REGISTRATION) ############################## registration algorithms ADD_EXECUTABLE(clitkAffineRegistration clitkAffineRegistration.cxx) - TARGET_LINK_LIBRARIES(clitkAffineRegistration clitkAffineRegistrationLib clitkRegistrationGgoLib clitkCommon ITKIO ITKNumerics ITKStatistics) + TARGET_LINK_LIBRARIES(clitkAffineRegistration clitkAffineRegistrationLib clitkCommon ITKIO ITKNumerics ITKStatistics) WRAP_GGO(clitkDemonsDeformableRegistration_GGO_C clitkDemonsDeformableRegistration.ggo) ADD_EXECUTABLE(clitkDemonsDeformableRegistration clitkDemonsDeformableRegistration.cxx ${clitkDemonsDeformableRegistration_GGO_C} clitkDemonsDeformableRegistrationGenericFilter.cxx) diff --git a/segmentation/CMakeLists.txt b/segmentation/CMakeLists.txt index 4df28a9..2659851 100644 --- a/segmentation/CMakeLists.txt +++ b/segmentation/CMakeLists.txt @@ -4,12 +4,15 @@ INCLUDE(${PROJECT_SOURCE_DIR}/cmake/common.cmake) #========================================================= -#Add your ggo files to this list if they are used by vv +# Add Libraries used in vv and clitk to avoid recompilation FOREACH(clitkTool clitkExtractLung clitkExtractPatient) WRAP_GGO(${clitkTool}_GGO_C ${clitkTool}.ggo) SET(GGO_C_FILES ${GGO_C_FILES} ${${clitkTool}_GGO_C}) ENDFOREACH(clitkTool) -ADD_LIBRARY(clitkSegmentationGgoLib clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx clitkAnatomicalFeatureDatabase.cxx ${GGO_C_FILES}) +ADD_LIBRARY(clitkSegmentationGgoLib + clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx + clitkAnatomicalFeatureDatabase.cxx + ${GGO_C_FILES}) #========================================================= diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 9d5abdc..cc77ea3 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,26 +1,25 @@ #========================================================= INCLUDE(${PROJECT_SOURCE_DIR}/cmake/common.cmake) #========================================================= -#Add your ggo files to this list if they are used by vv -FOREACH(clitkTool clitkAffineTransform clitkBinarizeImage clitkImageArithm - clitkMedianImageFilter clitkImageConvert clitkCropImage clitkResampleImage clitkMIP) - WRAP_GGO(${clitkTool}_GGO_C ${clitkTool}.ggo) - SET(GGO_C_FILES ${GGO_C_FILES} ${${clitkTool}_GGO_C}) -ENDFOREACH(clitkTool) -ADD_LIBRARY(clitkToolsGgoLib ${GGO_C_FILES}) -#========================================================= -#the libraries avoid recompilation for vv, and should be used for generic filters -#with long compilation times that are used by vv -ADD_LIBRARY(clitkImageConvertLib clitkImageConvertGenericFilter.cxx) -ADD_LIBRARY(clitkBinarizeImageLib clitkBinarizeImageGenericFilter.cxx) -ADD_LIBRARY(clitkImageArithmImageLib clitkImageArithmGenericFilter.cxx) -ADD_LIBRARY(clitkResampleImageLib clitkResampleImageGenericFilter.cxx) -SET_SOURCE_FILES_PROPERTIES(clitkResampleImageGenericFilter.cxx PROPERTIES - OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/clitkResampleImage_ggo.h) -ADD_LIBRARY(clitkMIPLib clitkMIPGenericFilter.cxx) - -TARGET_LINK_LIBRARIES(clitkBinarizeImageLib clitkToolsGgoLib) +# Add Libraries used in vv and clitk to avoid recompilation +WRAP_GGO(clitkCropImage_GGO_C clitkCropImage.ggo) +ADD_LIBRARY(clitkCropImageLib clitkCropImageGenericFilter.cxx ${clitkCropImage_GGO_C}) + +WRAP_GGO(clitkImageConvert_GGO_C clitkImageConvert.ggo) +ADD_LIBRARY(clitkImageConvertLib clitkImageConvertGenericFilter.cxx ${clitkImageConvert_GGO_C}) + +WRAP_GGO(clitkBinarizeImage_GGO_C clitkBinarizeImage.ggo) +ADD_LIBRARY(clitkBinarizeImageLib clitkBinarizeImageGenericFilter.cxx ${clitkBinarizeImage_GGO_C}) + +WRAP_GGO(clitkImageArithm_GGO_C clitkImageArithm.ggo) +ADD_LIBRARY(clitkImageArithmImageLib clitkImageArithmGenericFilter.cxx ${clitkImageArithm_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}) IF (CLITK_BUILD_TOOLS) WRAP_GGO(clitkDicomInfo_GGO_C clitkDicomInfo.ggo) @@ -35,11 +34,10 @@ IF (CLITK_BUILD_TOOLS) ADD_EXECUTABLE(clitkImageInfo clitkImageInfo.cxx ${clitkImageInfo_GGO_C}) TARGET_LINK_LIBRARIES(clitkImageInfo clitkCommon ITKIO) - ADD_EXECUTABLE(clitkImageConvert clitkImageConvert.cxx ${clitkImageConvert_GGO_C}) + ADD_EXECUTABLE(clitkImageConvert clitkImageConvert.cxx) TARGET_LINK_LIBRARIES(clitkImageConvert clitkImageConvertLib clitkCommon ITKIO) - ADD_EXECUTABLE(clitkBinarizeImage clitkBinarizeImage.cxx - ${clitkBinarizeImage_GGO_C}) + ADD_EXECUTABLE(clitkBinarizeImage clitkBinarizeImage.cxx) TARGET_LINK_LIBRARIES(clitkBinarizeImage clitkBinarizeImageLib clitkCommon ITKIO) WRAP_GGO(clitkVFResample_GGO_C clitkVFResample.ggo) @@ -87,6 +85,7 @@ IF (CLITK_BUILD_TOOLS) ADD_EXECUTABLE(clitkInvertVF clitkInvertVF.cxx ${clitkInvertVF_GGO_C}) TARGET_LINK_LIBRARIES(clitkInvertVF clitkCommon ITKIO ) + WRAP_GGO(clitkAffineTransform_GGO_C clitkAffineTransform.ggo) ADD_EXECUTABLE(clitkAffineTransform clitkAffineTransform.cxx ${clitkAffineTransform_GGO_C}) TARGET_LINK_LIBRARIES(clitkAffineTransform clitkCommon ITKIO ) @@ -102,7 +101,7 @@ IF (CLITK_BUILD_TOOLS) ADD_EXECUTABLE(clitkGammaIndex clitkGammaIndex.cxx ${clitkGammaIndex_GGO_C}) TARGET_LINK_LIBRARIES(clitkGammaIndex vtkCommon vtkFiltering vtkGraphics vtkIO vtkImaging) - ADD_EXECUTABLE(clitkImageArithm clitkImageArithm.cxx ${clitkImageArithm_GGO_C}) + ADD_EXECUTABLE(clitkImageArithm clitkImageArithm.cxx) TARGET_LINK_LIBRARIES(clitkImageArithm clitkImageArithmImageLib clitkCommon ITKIO ) WRAP_GGO(clitkUnsharpMask_GGO_C clitkUnsharpMask.ggo) @@ -113,11 +112,11 @@ IF (CLITK_BUILD_TOOLS) ADD_EXECUTABLE(clitkFooImage clitkFooImage.cxx ${clitkFooImage_GGO_C}) TARGET_LINK_LIBRARIES(clitkFooImage clitkCommon ITKIO ) + WRAP_GGO(clitkMedianImageFilter_GGO_C clitkMedianImageFilter.ggo) ADD_EXECUTABLE(clitkMedianImageFilter clitkMedianImageFilter.cxx ${clitkMedianImageFilter_GGO_C}) TARGET_LINK_LIBRARIES(clitkMedianImageFilter clitkCommon ITKIO ITKBasicFilters ) - #WRAP_GGO(clitkResampleImage_GGO_C clitkResampleImage.ggo) - ADD_EXECUTABLE(clitkResampleImage clitkResampleImage.cxx ${clitkResampleImage_GGO_C}) + ADD_EXECUTABLE(clitkResampleImage clitkResampleImage.cxx) TARGET_LINK_LIBRARIES(clitkResampleImage clitkResampleImageLib clitkCommon ITKIO) WRAP_GGO(clitkMinMaxMask_GGO_C clitkMinMaxMask.ggo) @@ -157,7 +156,7 @@ IF (CLITK_BUILD_TOOLS) TARGET_LINK_LIBRARIES(clitkBackProjectImage ITKIO clitkCommon ) ADD_EXECUTABLE(clitkCropImage clitkCropImage.cxx ${clitkCropImage_GGO_C}) - TARGET_LINK_LIBRARIES(clitkCropImage clitkCommon ITKIO) + TARGET_LINK_LIBRARIES(clitkCropImage clitkCropImageLib clitkCommon ITKIO) # WRAP_GGO(clitkExtractSlice_GGO_C clitkExtractSlice.ggo) # ADD_EXECUTABLE(clitkExtractSlice clitkExtractSlice.cxx clitkExtractSliceGenericFilter.cxx ${clitkExtractSlice_GGO_C}) @@ -239,8 +238,8 @@ IF (CLITK_BUILD_TOOLS) ADD_EXECUTABLE(clitkValuesToBSplineCoefficients clitkValuesToBSplineCoefficients.cxx clitkValuesToBSplineCoefficientsGenericFilter.cxx ${clitkValuesToBSplineCoefficients_GGO_C}) TARGET_LINK_LIBRARIES(clitkValuesToBSplineCoefficients clitkCommon ITKIO) - ADD_EXECUTABLE(clitkMIP clitkMIP.cxx clitkMIPGenericFilter.cxx ${clitkMIP_GGO_C}) - TARGET_LINK_LIBRARIES(clitkMIP clitkCommon ITKIO) + ADD_EXECUTABLE(clitkMIP clitkMIP.cxx clitkMIPGenericFilter.cxx) + TARGET_LINK_LIBRARIES(clitkMIP clitkMIPLib clitkCommon ITKIO) WRAP_GGO(clitkRelativePosition_GGO_C clitkRelativePosition.ggo) ADD_EXECUTABLE(clitkRelativePosition clitkRelativePosition.cxx ${clitkRelativePosition_GGO_C}) diff --git a/tools/clitkCropImage.cxx b/tools/clitkCropImage.cxx index b353e07..ec709ca 100755 --- a/tools/clitkCropImage.cxx +++ b/tools/clitkCropImage.cxx @@ -18,7 +18,6 @@ ======================================================================-====*/ // clitk -#include "clitkCropImage_ggo.h" #include "clitkCropImageGenericFilter.h" //-------------------------------------------------------------------- @@ -30,7 +29,7 @@ int main(int argc, char * argv[]) CLITK_INIT; // Filter - typedef clitk::CropImageGenericFilter FilterType; + typedef clitk::CropImageGenericFilter FilterType; FilterType::Pointer filter = FilterType::New(); filter->SetArgsInfo(args_info); diff --git a/tools/clitkCropImageGenericFilter.cxx b/tools/clitkCropImageGenericFilter.cxx index 7e37c1c..b8d7744 100755 --- a/tools/clitkCropImageGenericFilter.cxx +++ b/tools/clitkCropImageGenericFilter.cxx @@ -37,35 +37,131 @@ namespace clitk //----------------------------------------------------------- // Constructor //----------------------------------------------------------- - CropImageGenericFilter::CropImageGenericFilter() + CropImageGenericFilter::CropImageGenericFilter(): + ImageToImageGenericFilter("CropImage") { - m_Verbose=false; - m_InputFileName=""; + cmdline_parser_clitkCropImage_init(&mArgsInfo); + InitializeImageType<2>(); + InitializeImageType<3>(); + InitializeImageType<4>(); } - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void CropImageGenericFilter::Update() + //-------------------------------------------------------------------- + template + void clitk::CropImageGenericFilter::InitializeImageType() { - // Read the Dimension and PixelType - int Dimension, Components; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components); + ADD_DEFAULT_IMAGE_TYPES(Dim); + //ADD_IMAGE_TYPE(Dim, uchar); + //ADD_IMAGE_TYPE(Dim, short); + // ADD_IMAGE_TYPE(Dim, uint); + // ADD_IMAGE_TYPE(Dim, ulong); + // ADD_IMAGE_TYPE(Dim, int); + // ADD_IMAGE_TYPE(Dim, float); + } + //-------------------------------------------------------------------- + //-------------------------------------------------------------------- + void clitk::CropImageGenericFilter::SetArgsInfo(const args_info_type& a) + { + mArgsInfo=a; + SetIOVerbose(mArgsInfo.verbose_flag); + if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes(); + if (mArgsInfo.input_given) AddInputFilename(mArgsInfo.input_arg); + if (mArgsInfo.output_given) AddOutputFilename(mArgsInfo.output_arg); + } + //-------------------------------------------------------------------- + + //-------------------------------------------------------------------- + // Update with the number of dimensions and the pixeltype + //-------------------------------------------------------------------- + template + void clitk::CropImageGenericFilter::UpdateWithInputImageType() + { + // Reading input + typename ImageType::Pointer input = this->template GetInput(0); + + // Check options + if (mArgsInfo.BG_given && mArgsInfo.like_given) + clitkExceptionMacro("Do not use --BG and --like at the same time"); + + // Prepare output + typename ImageType::Pointer output; - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType, Components); - else if(Dimension==3) UpdateWithDim<3>(PixelType, Components); - else if (Dimension==4)UpdateWithDim<4>(PixelType, Components); - else - { - std::cout<<"Error, Only for 2, 3 or 4 Dimensions!!!"< FilterType; + typename FilterType::Pointer filter = FilterType::New(); + filter->SetInput(input); + filter->SetBackgroundValue(mArgsInfo.BG_arg); + filter->Update(); + output = filter->GetOutput(); + } + else { + // ------------------------------------------------ + if (mArgsInfo.like_given) { // CropLike filter + if (mArgsInfo.boundingBox_given) + clitkExceptionMacro("Do not use --like and --boundingBox at the same time"); + if (mArgsInfo.lower_given) + clitkExceptionMacro("Do not use --like and --lower at the same time"); + if (mArgsInfo.upper_given) + clitkExceptionMacro("Do not use --like and --upper at the same time"); + typedef clitk::CropLikeImageFilter FilterType; + typename FilterType::Pointer filter = FilterType::New(); + filter->SetInput(input); + filter->SetCropLikeFilename(mArgsInfo.like_arg); + filter->SetBackgroundValue(mArgsInfo.BGLike_arg); + filter->Update(); + output = filter->GetOutput(); } - } + else { + // ------------------------------------------------ + typename ImageType::SizeType lSize; + typename ImageType::SizeType uSize; + if (mArgsInfo.boundingBox_given) { + for(unsigned int i=0; iGetLargestPossibleRegion().GetSize()[i]-mArgsInfo.boundingBox_arg[2*i+1]-1; + } + } + else { + if (mArgsInfo.lower_given) { + for(unsigned int i=0; i(mArgsInfo.lower_arg[i]); + } + else lSize.Fill(0); + if (mArgsInfo.upper_given) { + for(unsigned int i=0; i(mArgsInfo.upper_arg[i]); + } + else uSize.Fill(0); + } + typedef itk::CropImageFilter CropImageFilterType; + typename CropImageFilterType::Pointer filter=CropImageFilterType::New(); + filter->SetInput(input); + filter->SetLowerBoundaryCropSize(lSize); + filter->SetUpperBoundaryCropSize(uSize); + filter->Update(); + output = filter->GetOutput(); + } + } + // Force origin if needed + if (mArgsInfo.origin_flag) { + typename ImageType::PointType origin; + origin.Fill(itk::NumericTraits::Zero); + output->SetOrigin(origin); + } + + // Write/Save results + this->template SetNextOutput(output); + } + //-------------------------------------------------------------------- } //end clitk diff --git a/tools/clitkCropImageGenericFilter.h b/tools/clitkCropImageGenericFilter.h index 2a16b9d..29d7d5d 100755 --- a/tools/clitkCropImageGenericFilter.h +++ b/tools/clitkCropImageGenericFilter.h @@ -1,7 +1,7 @@ /*========================================================================= Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Authors belong to: + Authors belong to: - University of LYON http://www.universite-lyon.fr/ - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr @@ -19,48 +19,49 @@ #ifndef CLITKCROPIMAGEGENERICFILTER_H #define CLITKCROPIMAGEGENERICFILTER_H -// clitk +// clitk #include "clitkIO.h" #include "clitkImageToImageGenericFilter.h" #include "clitkCropLikeImageFilter.h" #include "clitkAutoCropFilter.h" +#include "clitkCropImage_ggo.h" // itk #include //-------------------------------------------------------------------- -namespace clitk +namespace clitk { - template class ITK_EXPORT CropImageGenericFilter: - public ImageToImageGenericFilter > + public ImageToImageGenericFilter { public: //-------------------------------------------------------------------- CropImageGenericFilter(); - + //-------------------------------------------------------------------- typedef CropImageGenericFilter Self; - typedef ImageToImageGenericFilter > Superclass; + typedef ImageToImageGenericFilter Superclass; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; - + typedef args_info_clitkCropImage args_info_type; + //-------------------------------------------------------------------- - itkNewMacro(Self); + itkNewMacro(Self); itkTypeMacro( CropImageGenericFilter, LightObject ); //-------------------------------------------------------------------- - void SetArgsInfo(const ArgsInfoType & a); + void SetArgsInfo(const args_info_type& a); //-------------------------------------------------------------------- // Main function called each time the filter is updated - template + template void UpdateWithInputImageType(); protected: template void InitializeImageType(); - ArgsInfoType mArgsInfo; + args_info_type mArgsInfo; };// end class //-------------------------------------------------------------------- diff --git a/tools/clitkCropImageGenericFilter.txx b/tools/clitkCropImageGenericFilter.txx deleted file mode 100755 index b5b80ee..0000000 --- a/tools/clitkCropImageGenericFilter.txx +++ /dev/null @@ -1,157 +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://oncora1.lyon.fnclcc.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 - ======================================================================-====*/ - -#include "clitkImageCommon.h" - -//-------------------------------------------------------------------- -template -clitk::CropImageGenericFilter::CropImageGenericFilter(): - ImageToImageGenericFilter("CropImage") -{ - // Default values - cmdline_parser_clitkCropImage_init(&mArgsInfo); - InitializeImageType<2>(); - InitializeImageType<3>(); - InitializeImageType<4>(); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -template -template -void clitk::CropImageGenericFilter::InitializeImageType() -{ - ADD_DEFAULT_IMAGE_TYPES(Dim); - //ADD_IMAGE_TYPE(Dim, uchar); - //ADD_IMAGE_TYPE(Dim, short); - // ADD_IMAGE_TYPE(Dim, uint); - // ADD_IMAGE_TYPE(Dim, ulong); - // ADD_IMAGE_TYPE(Dim, int); - // ADD_IMAGE_TYPE(Dim, float); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -template -void clitk::CropImageGenericFilter::SetArgsInfo(const ArgsInfoType & a) -{ - mArgsInfo=a; - SetIOVerbose(mArgsInfo.verbose_flag); - if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes(); - if (mArgsInfo.input_given) AddInputFilename(mArgsInfo.input_arg); - if (mArgsInfo.output_given) AddOutputFilename(mArgsInfo.output_arg); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -// Update with the number of dimensions and the pixeltype -//-------------------------------------------------------------------- -template -template -void clitk::CropImageGenericFilter::UpdateWithInputImageType() -{ - // Reading input - typename ImageType::Pointer input = this->template GetInput(0); - - // Check options - if (mArgsInfo.BG_given && mArgsInfo.like_given) - clitkExceptionMacro("Do not use --BG and --like at the same time"); - - // Prepare output - typename ImageType::Pointer output; - - // ------------------------------------------------ - if (mArgsInfo.BG_given) { // AutoCrop filter - if (mArgsInfo.boundingBox_given) - clitkExceptionMacro("Do not use --BG and --boundingBox at the same time"); - if (mArgsInfo.lower_given) - clitkExceptionMacro("Do not use --BG and --lower at the same time"); - if (mArgsInfo.upper_given) - clitkExceptionMacro("Do not use --BG and --upper at the same time"); - typedef clitk::AutoCropFilter FilterType; - typename FilterType::Pointer filter = FilterType::New(); - filter->SetInput(input); - filter->SetBackgroundValue(mArgsInfo.BG_arg); - filter->Update(); - output = filter->GetOutput(); - } - else { - // ------------------------------------------------ - if (mArgsInfo.like_given) { // CropLike filter - if (mArgsInfo.boundingBox_given) - clitkExceptionMacro("Do not use --like and --boundingBox at the same time"); - if (mArgsInfo.lower_given) - clitkExceptionMacro("Do not use --like and --lower at the same time"); - if (mArgsInfo.upper_given) - clitkExceptionMacro("Do not use --like and --upper at the same time"); - typedef clitk::CropLikeImageFilter FilterType; - typename FilterType::Pointer filter = FilterType::New(); - filter->SetInput(input); - filter->SetCropLikeFilename(mArgsInfo.like_arg); - filter->SetBackgroundValue(mArgsInfo.BGLike_arg); - filter->Update(); - output = filter->GetOutput(); - } - else { - // ------------------------------------------------ - typename ImageType::SizeType lSize; - typename ImageType::SizeType uSize; - if (mArgsInfo.boundingBox_given) { - for(unsigned int i=0; iGetLargestPossibleRegion().GetSize()[i]-mArgsInfo.boundingBox_arg[2*i+1]-1; - } - } - else { - if (mArgsInfo.lower_given) { - for(unsigned int i=0; i(mArgsInfo.lower_arg[i]); - } - else lSize.Fill(0); - if (mArgsInfo.upper_given) { - for(unsigned int i=0; i(mArgsInfo.upper_arg[i]); - } - else uSize.Fill(0); - } - typedef itk::CropImageFilter CropImageFilterType; - typename CropImageFilterType::Pointer filter=CropImageFilterType::New(); - filter->SetInput(input); - filter->SetLowerBoundaryCropSize(lSize); - filter->SetUpperBoundaryCropSize(uSize); - filter->Update(); - output = filter->GetOutput(); - } - } - - // Force origin if needed - if (mArgsInfo.origin_flag) { - typename ImageType::PointType origin; - origin.Fill(itk::NumericTraits::Zero); - output->SetOrigin(origin); - } - - // Write/Save results - this->template SetNextOutput(output); -} -//-------------------------------------------------------------------- - - diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index 2161933..12e38a5 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -16,7 +16,7 @@ SET(vv_TOOLS vvToolBinarize vvToolImageArithm vvToolResample -# vvToolExtractPatient +# vvToolExtractPatient # vvToolExtractLung vvToolMIP vvToolConvert ## with dummy vvToolConvert.ui @@ -30,14 +30,14 @@ SET(vv_TOOLS # dependencies of the tools # Future issues : when tool depend on other tools ... how to manage that ? # >> add the relevant $_LIBS variable to the tool that has dependencies? -SET(vvToolRigidReg_LIBS clitkAffineRegistrationLib clitkRegistrationGgoLib) +SET(vvToolRigidReg_LIBS clitkAffineRegistrationLib) SET(vvToolBinarize_LIBS clitkBinarizeImageLib) SET(vvToolResample_LIBS clitkResampleImageLib) SET(vvToolConvert_LIBS clitkImageConvertLib) SET(vvToolExtractPatient_LIBS clitkSegmentationGgoLib) SET(vvToolExtractLung_LIBS clitkSegmentationGgoLib) -SET(vvToolCropImage_LIBS clitkToolsGgoLib) -SET(vvToolMIP_LIBS clitkMIPLib clitkToolsGgoLib) +SET(vvToolCropImage_LIBS clitkCropImageLib) +SET(vvToolMIP_LIBS clitkMIPLib) #========================================================= # List of vv source files @@ -187,7 +187,7 @@ ENDIF(WIN32) LINK_DIRECTORIES(${QT_LIBRARY_DIR}) ADD_EXECUTABLE(vv ${vv_SRCS} vv.cxx ${vv_UI_CXX} ${EXE_ICON}) -ADD_DEPENDENCIES(vv clitkToolsGgoLib clitkSegmentationGgoLib) +ADD_DEPENDENCIES(vv clitkSegmentationGgoLib) TARGET_LINK_LIBRARIES(vv clitkDicomRTStruct) #========================================================= diff --git a/vv/vvToolCropImage.cxx b/vv/vvToolCropImage.cxx index 0f3e63d..498c7fb 100644 --- a/vv/vvToolCropImage.cxx +++ b/vv/vvToolCropImage.cxx @@ -310,7 +310,7 @@ void vvToolCropImage::apply() // Typedef typedef args_info_clitkCropImage ArgsInfoType; - typedef clitk::CropImageGenericFilter CropFilterType; + typedef clitk::CropImageGenericFilter CropFilterType; // Get options ArgsInfoType mArgsInfo; -- 2.47.1