From c44f6f7ea754689035de9e8f781f71a8d933b44e Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Tue, 31 Jan 2012 19:50:43 +0100 Subject: [PATCH] Moved from repository clitk to clitk.private/deprecated --- registration/clitkBSplinePyramid.cxx | 51 - registration/clitkBSplinePyramid.ggo | 15 - .../clitkBSplinePyramidGenericFilter.cxx | 72 -- .../clitkBSplinePyramidGenericFilter.h | 120 --- .../clitkBSplinePyramidGenericFilter.txx | 398 -------- registration/clitkConvertPointList.cxx | 81 -- registration/clitkConvertPointList.ggo | 15 - registration/clitkMultiResolutionPyramid.cxx | 51 - registration/clitkMultiResolutionPyramid.ggo | 18 - ...itkMultiResolutionPyramidGenericFilter.cxx | 72 -- ...clitkMultiResolutionPyramidGenericFilter.h | 117 --- ...itkMultiResolutionPyramidGenericFilter.txx | 162 --- registration/clitkPointTrajectory.cxx | 51 - registration/clitkPointTrajectory.ggo | 26 - .../clitkPointTrajectoryGenericFilter.cxx | 380 ------- .../clitkPointTrajectoryGenericFilter.h | 110 --- ...litkResampleBSplineDeformableTransform.cxx | 51 - ...litkResampleBSplineDeformableTransform.ggo | 22 - ...SplineDeformableTransformGenericFilter.cxx | 71 -- ...eBSplineDeformableTransformGenericFilter.h | 116 --- ...SplineDeformableTransformGenericFilter.txx | 158 --- registration/clitkSelectPoints.cxx | 51 - registration/clitkSelectPoints.ggo | 24 - .../clitkSelectPointsGenericFilter.cxx | 141 --- registration/clitkSelectPointsGenericFilter.h | 103 -- .../clitkShapedBLUTSpatioTemporalDIR.cxx | 51 - .../clitkShapedBLUTSpatioTemporalDIR.ggo | 90 -- ...apedBLUTSpatioTemporalDIRGenericFilter.cxx | 70 -- ...ShapedBLUTSpatioTemporalDIRGenericFilter.h | 131 --- ...apedBLUTSpatioTemporalDIRGenericFilter.txx | 933 ------------------ segmentation/clitkCalculateDistanceMap.cxx | 51 - segmentation/clitkCalculateDistanceMap.ggo | 13 - ...clitkCalculateDistanceMapGenericFilter.cxx | 69 -- .../clitkCalculateDistanceMapGenericFilter.h | 113 --- ...clitkCalculateDistanceMapGenericFilter.txx | 117 --- segmentation/clitkFillImageRegion.cxx | 51 - segmentation/clitkFillImageRegion.ggo | 17 - .../clitkFillImageRegionGenericFilter.cxx | 72 -- .../clitkFillImageRegionGenericFilter.h | 117 --- .../clitkFillImageRegionGenericFilter.txx | 197 ---- segmentation/clitkFillMask.cxx | 57 -- segmentation/clitkFillMask.ggo | 13 - segmentation/clitkFillMaskGenericFilter.cxx | 95 -- segmentation/clitkFillMaskGenericFilter.h | 68 -- segmentation/clitkFillMaskGenericFilter.txx | 88 -- segmentation/clitkLevelSetSegmentation.cxx | 51 - segmentation/clitkLevelSetSegmentation.ggo | 44 - ...clitkLevelSetSegmentationGenericFilter.cxx | 70 -- .../clitkLevelSetSegmentationGenericFilter.h | 117 --- ...clitkLevelSetSegmentationGenericFilter.txx | 234 ----- segmentation/clitkMorphoReconstruction.cxx | 51 - segmentation/clitkMorphoReconstruction.ggo | 21 - ...clitkMorphoReconstructionGenericFilter.cxx | 72 -- .../clitkMorphoReconstructionGenericFilter.h | 121 --- ...clitkMorphoReconstructionGenericFilter.txx | 199 ---- tools/clitkAverageTemporalDimension.cxx | 53 - tools/clitkAverageTemporalDimension.ggo | 12 - ...kAverageTemporalDimensionGenericFilter.cxx | 41 - ...itkAverageTemporalDimensionGenericFilter.h | 114 --- ...kAverageTemporalDimensionGenericFilter.txx | 234 ----- tools/clitkBSplineCoefficientsToValues.cxx | 51 - tools/clitkBSplineCoefficientsToValues.ggo | 21 - ...plineCoefficientsToValuesGenericFilter.cxx | 72 -- ...BSplineCoefficientsToValuesGenericFilter.h | 125 --- ...plineCoefficientsToValuesGenericFilter.txx | 327 ------ tools/clitkChangeImageOrientation.cxx | 51 - tools/clitkChangeImageOrientation.ggo | 12 - ...itkChangeImageOrientationGenericFilter.cxx | 72 -- ...clitkChangeImageOrientationGenericFilter.h | 117 --- ...itkChangeImageOrientationGenericFilter.txx | 109 -- tools/clitkCombineImage.cxx | 51 - tools/clitkCombineImage.ggo | 14 - tools/clitkCombineImageFilter.h | 113 --- tools/clitkCombineImageFilter.txx | 87 -- tools/clitkCombineImageGenericFilter.cxx | 72 -- tools/clitkCombineImageGenericFilter.h | 116 --- tools/clitkCombineImageGenericFilter.txx | 130 --- tools/clitkConeBeamProjectImage.cxx | 72 -- tools/clitkConeBeamProjectImage.ggo | 38 - tools/clitkConeBeamProjectImageFilter.h | 260 ----- tools/clitkConeBeamProjectImageFilter.txx | 258 ----- ...clitkConeBeamProjectImageGenericFilter.cxx | 201 ---- .../clitkConeBeamProjectImageGenericFilter.h | 92 -- tools/clitkDicomRTStructInfo.cxx | 36 - tools/clitkDicomRTStructInfo.ggo | 11 - tools/clitkFilter.cxx | 51 - tools/clitkFilter.ggo | 30 - tools/clitkFilterGenericFilter.cxx | 72 -- tools/clitkFilterGenericFilter.h | 132 --- tools/clitkFilterGenericFilter.txx | 304 ------ tools/clitkGetDirection.cxx | 51 - tools/clitkGetDirection.ggo | 11 - tools/clitkGetDirectionGenericFilter.cxx | 72 -- tools/clitkGetDirectionGenericFilter.h | 115 --- tools/clitkGetDirectionGenericFilter.txx | 103 -- tools/clitkGetOrigin.cxx | 51 - tools/clitkGetOrigin.ggo | 12 - tools/clitkGetOriginGenericFilter.cxx | 72 -- tools/clitkGetOriginGenericFilter.h | 115 --- tools/clitkGetOriginGenericFilter.txx | 102 -- tools/clitkGetSize.cxx | 51 - tools/clitkGetSize.ggo | 12 - tools/clitkGetSizeGenericFilter.cxx | 72 -- tools/clitkGetSizeGenericFilter.h | 115 --- tools/clitkGetSizeGenericFilter.txx | 103 -- tools/clitkGetSpacing.cxx | 51 - tools/clitkGetSpacing.ggo | 12 - tools/clitkGetSpacingGenericFilter.cxx | 61 -- tools/clitkGetSpacingGenericFilter.h | 115 --- tools/clitkGetSpacingGenericFilter.txx | 101 -- tools/clitkGuerreroVentilation.cxx | 54 - tools/clitkGuerreroVentilation.ggo | 13 - .../clitkGuerreroVentilationGenericFilter.cxx | 80 -- tools/clitkGuerreroVentilationGenericFilter.h | 78 -- tools/clitkImageExtractLine.cxx | 216 ---- tools/clitkImageExtractLine.ggo | 19 - tools/clitkImageLog.cxx | 89 -- tools/clitkImageLog.ggo | 9 - tools/clitkLineProfile.cxx | 38 - tools/clitkLineProfile.ggo | 12 - tools/clitkLineProfileGenericFilter.cxx | 44 - tools/clitkLineProfileGenericFilter.h | 104 -- tools/clitkLineProfileGenericFilter.txx | 134 --- tools/clitkPermuteAxes.cxx | 51 - tools/clitkPermuteAxes.ggo | 13 - tools/clitkPermuteAxesGenericFilter.cxx | 72 -- tools/clitkPermuteAxesGenericFilter.h | 116 --- tools/clitkPermuteAxesGenericFilter.txx | 119 --- tools/clitkSetDirection.cxx | 51 - tools/clitkSetDirection.ggo | 12 - tools/clitkSetDirectionGenericFilter.cxx | 72 -- tools/clitkSetDirectionGenericFilter.h | 115 --- tools/clitkSetDirectionGenericFilter.txx | 108 -- tools/clitkSetOrigin.cxx | 51 - tools/clitkSetOrigin.ggo | 12 - tools/clitkSetOriginGenericFilter.cxx | 72 -- tools/clitkSetOriginGenericFilter.h | 115 --- tools/clitkSetOriginGenericFilter.txx | 136 --- tools/clitkSetSpacing.cxx | 51 - tools/clitkSetSpacing.ggo | 14 - tools/clitkSetSpacingGenericFilter.cxx | 72 -- tools/clitkSetSpacingGenericFilter.h | 114 --- tools/clitkSetSpacingGenericFilter.txx | 136 --- tools/clitkVFMerge.cxx | 146 --- tools/clitkVFMerge.ggo | 14 - tools/clitkValuesToBSplineCoefficients.cxx | 51 - tools/clitkValuesToBSplineCoefficients.ggo | 12 - ...luesToBSplineCoefficientsGenericFilter.cxx | 72 -- ...ValuesToBSplineCoefficientsGenericFilter.h | 118 --- ...luesToBSplineCoefficientsGenericFilter.txx | 155 --- 150 files changed, 13777 deletions(-) delete mode 100644 registration/clitkBSplinePyramid.cxx delete mode 100644 registration/clitkBSplinePyramid.ggo delete mode 100644 registration/clitkBSplinePyramidGenericFilter.cxx delete mode 100644 registration/clitkBSplinePyramidGenericFilter.h delete mode 100644 registration/clitkBSplinePyramidGenericFilter.txx delete mode 100644 registration/clitkConvertPointList.cxx delete mode 100644 registration/clitkConvertPointList.ggo delete mode 100644 registration/clitkMultiResolutionPyramid.cxx delete mode 100644 registration/clitkMultiResolutionPyramid.ggo delete mode 100644 registration/clitkMultiResolutionPyramidGenericFilter.cxx delete mode 100644 registration/clitkMultiResolutionPyramidGenericFilter.h delete mode 100644 registration/clitkMultiResolutionPyramidGenericFilter.txx delete mode 100644 registration/clitkPointTrajectory.cxx delete mode 100644 registration/clitkPointTrajectory.ggo delete mode 100644 registration/clitkPointTrajectoryGenericFilter.cxx delete mode 100644 registration/clitkPointTrajectoryGenericFilter.h delete mode 100644 registration/clitkResampleBSplineDeformableTransform.cxx delete mode 100644 registration/clitkResampleBSplineDeformableTransform.ggo delete mode 100644 registration/clitkResampleBSplineDeformableTransformGenericFilter.cxx delete mode 100644 registration/clitkResampleBSplineDeformableTransformGenericFilter.h delete mode 100644 registration/clitkResampleBSplineDeformableTransformGenericFilter.txx delete mode 100644 registration/clitkSelectPoints.cxx delete mode 100644 registration/clitkSelectPoints.ggo delete mode 100644 registration/clitkSelectPointsGenericFilter.cxx delete mode 100644 registration/clitkSelectPointsGenericFilter.h delete mode 100644 registration/clitkShapedBLUTSpatioTemporalDIR.cxx delete mode 100644 registration/clitkShapedBLUTSpatioTemporalDIR.ggo delete mode 100644 registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.cxx delete mode 100644 registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.h delete mode 100644 registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx delete mode 100644 segmentation/clitkCalculateDistanceMap.cxx delete mode 100644 segmentation/clitkCalculateDistanceMap.ggo delete mode 100644 segmentation/clitkCalculateDistanceMapGenericFilter.cxx delete mode 100644 segmentation/clitkCalculateDistanceMapGenericFilter.h delete mode 100644 segmentation/clitkCalculateDistanceMapGenericFilter.txx delete mode 100644 segmentation/clitkFillImageRegion.cxx delete mode 100644 segmentation/clitkFillImageRegion.ggo delete mode 100644 segmentation/clitkFillImageRegionGenericFilter.cxx delete mode 100644 segmentation/clitkFillImageRegionGenericFilter.h delete mode 100644 segmentation/clitkFillImageRegionGenericFilter.txx delete mode 100644 segmentation/clitkFillMask.cxx delete mode 100644 segmentation/clitkFillMask.ggo delete mode 100644 segmentation/clitkFillMaskGenericFilter.cxx delete mode 100644 segmentation/clitkFillMaskGenericFilter.h delete mode 100644 segmentation/clitkFillMaskGenericFilter.txx delete mode 100644 segmentation/clitkLevelSetSegmentation.cxx delete mode 100644 segmentation/clitkLevelSetSegmentation.ggo delete mode 100644 segmentation/clitkLevelSetSegmentationGenericFilter.cxx delete mode 100644 segmentation/clitkLevelSetSegmentationGenericFilter.h delete mode 100644 segmentation/clitkLevelSetSegmentationGenericFilter.txx delete mode 100644 segmentation/clitkMorphoReconstruction.cxx delete mode 100644 segmentation/clitkMorphoReconstruction.ggo delete mode 100644 segmentation/clitkMorphoReconstructionGenericFilter.cxx delete mode 100644 segmentation/clitkMorphoReconstructionGenericFilter.h delete mode 100644 segmentation/clitkMorphoReconstructionGenericFilter.txx delete mode 100644 tools/clitkAverageTemporalDimension.cxx delete mode 100644 tools/clitkAverageTemporalDimension.ggo delete mode 100644 tools/clitkAverageTemporalDimensionGenericFilter.cxx delete mode 100644 tools/clitkAverageTemporalDimensionGenericFilter.h delete mode 100644 tools/clitkAverageTemporalDimensionGenericFilter.txx delete mode 100644 tools/clitkBSplineCoefficientsToValues.cxx delete mode 100644 tools/clitkBSplineCoefficientsToValues.ggo delete mode 100644 tools/clitkBSplineCoefficientsToValuesGenericFilter.cxx delete mode 100644 tools/clitkBSplineCoefficientsToValuesGenericFilter.h delete mode 100644 tools/clitkBSplineCoefficientsToValuesGenericFilter.txx delete mode 100644 tools/clitkChangeImageOrientation.cxx delete mode 100644 tools/clitkChangeImageOrientation.ggo delete mode 100644 tools/clitkChangeImageOrientationGenericFilter.cxx delete mode 100644 tools/clitkChangeImageOrientationGenericFilter.h delete mode 100644 tools/clitkChangeImageOrientationGenericFilter.txx delete mode 100644 tools/clitkCombineImage.cxx delete mode 100644 tools/clitkCombineImage.ggo delete mode 100644 tools/clitkCombineImageFilter.h delete mode 100644 tools/clitkCombineImageFilter.txx delete mode 100644 tools/clitkCombineImageGenericFilter.cxx delete mode 100644 tools/clitkCombineImageGenericFilter.h delete mode 100644 tools/clitkCombineImageGenericFilter.txx delete mode 100644 tools/clitkConeBeamProjectImage.cxx delete mode 100644 tools/clitkConeBeamProjectImage.ggo delete mode 100644 tools/clitkConeBeamProjectImageFilter.h delete mode 100644 tools/clitkConeBeamProjectImageFilter.txx delete mode 100644 tools/clitkConeBeamProjectImageGenericFilter.cxx delete mode 100644 tools/clitkConeBeamProjectImageGenericFilter.h delete mode 100644 tools/clitkDicomRTStructInfo.cxx delete mode 100644 tools/clitkDicomRTStructInfo.ggo delete mode 100644 tools/clitkFilter.cxx delete mode 100644 tools/clitkFilter.ggo delete mode 100644 tools/clitkFilterGenericFilter.cxx delete mode 100644 tools/clitkFilterGenericFilter.h delete mode 100644 tools/clitkFilterGenericFilter.txx delete mode 100644 tools/clitkGetDirection.cxx delete mode 100644 tools/clitkGetDirection.ggo delete mode 100644 tools/clitkGetDirectionGenericFilter.cxx delete mode 100644 tools/clitkGetDirectionGenericFilter.h delete mode 100644 tools/clitkGetDirectionGenericFilter.txx delete mode 100644 tools/clitkGetOrigin.cxx delete mode 100644 tools/clitkGetOrigin.ggo delete mode 100644 tools/clitkGetOriginGenericFilter.cxx delete mode 100644 tools/clitkGetOriginGenericFilter.h delete mode 100644 tools/clitkGetOriginGenericFilter.txx delete mode 100644 tools/clitkGetSize.cxx delete mode 100644 tools/clitkGetSize.ggo delete mode 100644 tools/clitkGetSizeGenericFilter.cxx delete mode 100644 tools/clitkGetSizeGenericFilter.h delete mode 100644 tools/clitkGetSizeGenericFilter.txx delete mode 100644 tools/clitkGetSpacing.cxx delete mode 100644 tools/clitkGetSpacing.ggo delete mode 100644 tools/clitkGetSpacingGenericFilter.cxx delete mode 100644 tools/clitkGetSpacingGenericFilter.h delete mode 100644 tools/clitkGetSpacingGenericFilter.txx delete mode 100644 tools/clitkGuerreroVentilation.cxx delete mode 100644 tools/clitkGuerreroVentilation.ggo delete mode 100644 tools/clitkGuerreroVentilationGenericFilter.cxx delete mode 100644 tools/clitkGuerreroVentilationGenericFilter.h delete mode 100644 tools/clitkImageExtractLine.cxx delete mode 100644 tools/clitkImageExtractLine.ggo delete mode 100644 tools/clitkImageLog.cxx delete mode 100644 tools/clitkImageLog.ggo delete mode 100644 tools/clitkLineProfile.cxx delete mode 100644 tools/clitkLineProfile.ggo delete mode 100644 tools/clitkLineProfileGenericFilter.cxx delete mode 100644 tools/clitkLineProfileGenericFilter.h delete mode 100644 tools/clitkLineProfileGenericFilter.txx delete mode 100644 tools/clitkPermuteAxes.cxx delete mode 100644 tools/clitkPermuteAxes.ggo delete mode 100644 tools/clitkPermuteAxesGenericFilter.cxx delete mode 100644 tools/clitkPermuteAxesGenericFilter.h delete mode 100644 tools/clitkPermuteAxesGenericFilter.txx delete mode 100644 tools/clitkSetDirection.cxx delete mode 100644 tools/clitkSetDirection.ggo delete mode 100644 tools/clitkSetDirectionGenericFilter.cxx delete mode 100644 tools/clitkSetDirectionGenericFilter.h delete mode 100644 tools/clitkSetDirectionGenericFilter.txx delete mode 100644 tools/clitkSetOrigin.cxx delete mode 100644 tools/clitkSetOrigin.ggo delete mode 100644 tools/clitkSetOriginGenericFilter.cxx delete mode 100644 tools/clitkSetOriginGenericFilter.h delete mode 100644 tools/clitkSetOriginGenericFilter.txx delete mode 100644 tools/clitkSetSpacing.cxx delete mode 100644 tools/clitkSetSpacing.ggo delete mode 100644 tools/clitkSetSpacingGenericFilter.cxx delete mode 100644 tools/clitkSetSpacingGenericFilter.h delete mode 100644 tools/clitkSetSpacingGenericFilter.txx delete mode 100644 tools/clitkVFMerge.cxx delete mode 100644 tools/clitkVFMerge.ggo delete mode 100644 tools/clitkValuesToBSplineCoefficients.cxx delete mode 100644 tools/clitkValuesToBSplineCoefficients.ggo delete mode 100644 tools/clitkValuesToBSplineCoefficientsGenericFilter.cxx delete mode 100644 tools/clitkValuesToBSplineCoefficientsGenericFilter.h delete mode 100644 tools/clitkValuesToBSplineCoefficientsGenericFilter.txx diff --git a/registration/clitkBSplinePyramid.cxx b/registration/clitkBSplinePyramid.cxx deleted file mode 100644 index 0c38f83..0000000 --- a/registration/clitkBSplinePyramid.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkBSplinePyramid.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkBSplinePyramid_ggo.h" -#include "clitkIO.h" -#include "clitkBSplinePyramidGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkBSplinePyramid, args_info); - CLITK_INIT; - - // Filter - clitk::BSplinePyramidGenericFilter::Pointer genericFilter=clitk::BSplinePyramidGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/registration/clitkBSplinePyramid.ggo b/registration/clitkBSplinePyramid.ggo deleted file mode 100644 index b907900..0000000 --- a/registration/clitkBSplinePyramid.ggo +++ /dev/null @@ -1,15 +0,0 @@ -#File clitkBSplinePyramid.ggo -package "clitkBSplinePyramid" -version "1.0" -purpose "Down (or Up) sample with a factor 2 using Bspline pyramids. BSplineDownsampleImageFilter is BUGGED! See the ITK post of jvdmb@hotmail.com." - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes - - -option "up" u "Upsample instead of downsample" flag off -option "resamplerType" t "The type of B-spline resampler used: 0=resampler, 1=L2, 2=centered, 3=L2 centered" int no default="0" -option "splineOrder" - "Spline order" int no default="3" diff --git a/registration/clitkBSplinePyramidGenericFilter.cxx b/registration/clitkBSplinePyramidGenericFilter.cxx deleted file mode 100644 index b484a8c..0000000 --- a/registration/clitkBSplinePyramidGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkBSplinePyramidGenericFilter_cxx -#define clitkBSplinePyramidGenericFilter_cxx - -/* ================================================= - * @file clitkBSplinePyramidGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkBSplinePyramidGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - BSplinePyramidGenericFilter::BSplinePyramidGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void BSplinePyramidGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension, Components; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components); - - - // 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!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( BSplinePyramidGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkBSplinePyramid & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - BSplinePyramidGenericFilter(); - ~BSplinePyramidGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType, unsigned int Components); - template void UpdateWithDimAndPixelType(); - template void UpdateWithDimAndVectorType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkBSplinePyramid m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkBSplinePyramidGenericFilter.txx" -#endif - -#endif // #define clitkBSplinePyramidGenericFilter_h diff --git a/registration/clitkBSplinePyramidGenericFilter.txx b/registration/clitkBSplinePyramidGenericFilter.txx deleted file mode 100644 index 8af6364..0000000 --- a/registration/clitkBSplinePyramidGenericFilter.txx +++ /dev/null @@ -1,398 +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 clitkBSplinePyramidGenericFilter_txx -#define clitkBSplinePyramidGenericFilter_txx - -/* ================================================= - * @file clitkBSplinePyramidGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - BSplinePyramidGenericFilter::UpdateWithDim(std::string PixelType, unsigned int Components) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - else if (Components==3) - { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - UpdateWithDimAndVectorType >(); - } - else std::cerr<<"Number of components is "< - void - BSplinePyramidGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Resampler Types - typedef itk::BSplineResampleImageFilterBase ResamplerType; - typedef itk::BSplineCenteredResampleImageFilterBase CenteredResamplerType; - typedef itk::BSplineL2ResampleImageFilterBase L2ResamplerType; - typedef itk::BSplineCenteredL2ResampleImageFilterBase CenteredL2ResamplerType; - - // Filter - typedef itk::ImageToImageFilter< InputImageType, InputImageType > ImageToImageFilterType; - typename ImageToImageFilterType::Pointer filter; - - if (!m_ArgsInfo.up_flag) - { - switch (m_ArgsInfo.resamplerType_arg) - { - - // Resampler - case 0: { - typename itk::BSplineDownsampleImageFilter< InputImageType,InputImageType, ResamplerType >::Pointer df - = itk::BSplineDownsampleImageFilter< InputImageType,InputImageType, ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with standard Resampler"<::Pointer df - = itk::BSplineDownsampleImageFilter< InputImageType,InputImageType, CenteredResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with centered Resampler"<::Pointer df - = itk::BSplineDownsampleImageFilter< InputImageType,InputImageType,L2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with L2 Resampler"<::Pointer df - = itk::BSplineDownsampleImageFilter< InputImageType,InputImageType,CenteredL2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with L2 centered Resampler"<::Pointer df - = itk::BSplineUpsampleImageFilter< InputImageType,InputImageType, ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline upsample image filter with standard Resampler"<::Pointer df - = itk::BSplineUpsampleImageFilter< InputImageType,InputImageType, CenteredResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline upsample image filter with centered Resampler"<::Pointer df - = itk::BSplineUpsampleImageFilter< InputImageType,InputImageType,L2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline upsample image filter with L2 Resampler"<::Pointer df - = itk::BSplineUpsampleImageFilter< InputImageType,InputImageType,CenteredL2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline upsample image filter with L2 centered Resampler"<SetInput(input); - filter->Update(); - typename OutputImageType::Pointer output=filter->GetOutput(); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - BSplinePyramidGenericFilter::UpdateWithDimAndVectorType() - { - - // ImageTypes - typedef typename VectorType::ValueType PixelType; - typedef itk::Image VectorInputImageType; - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typedef itk::Image VectorOutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename VectorInputImageType::Pointer vectorInput= reader->GetOutput(); - - // Process components separetely and gather afterwards - std::vector components; - - for (unsigned int i=0; i<3;i++) - { - // Extract component - typedef clitk::VectorImageToImageFilter FilterType; - typename FilterType::Pointer dfilter=FilterType::New(); - dfilter->SetInput(vectorInput); - dfilter->SetComponentIndex(i); - dfilter->Update(); - typename InputImageType::Pointer input=dfilter->GetOutput(); - - //============================================================================================ - // Resampler Types - typedef itk::BSplineResampleImageFilterBase ResamplerType; - typedef itk::BSplineCenteredResampleImageFilterBase CenteredResamplerType; - typedef itk::BSplineL2ResampleImageFilterBase L2ResamplerType; - typedef itk::BSplineCenteredL2ResampleImageFilterBase CenteredL2ResamplerType; - - // Filter - typedef itk::ImageToImageFilter< InputImageType, InputImageType > ImageToImageFilterType; - typename ImageToImageFilterType::Pointer filter; - - if (!m_ArgsInfo.up_flag) - { - switch (m_ArgsInfo.resamplerType_arg) - { - - // Resampler - case 0: { - typename itk::BSplineDownsampleImageFilter< InputImageType,InputImageType, ResamplerType >::Pointer df - = itk::BSplineDownsampleImageFilter< InputImageType,InputImageType, ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with standard Resampler"<::Pointer df - = itk::BSplineDownsampleImageFilter< InputImageType,InputImageType, CenteredResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with centered Resampler"<::Pointer df - = itk::BSplineDownsampleImageFilter< InputImageType,InputImageType,L2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with L2 Resampler"<::Pointer df - = itk::BSplineDownsampleImageFilter< InputImageType,InputImageType,CenteredL2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with L2 centered Resampler"<::Pointer df - = itk::BSplineUpsampleImageFilter< InputImageType,InputImageType, ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline upsample image filter with standard Resampler"<::Pointer df - = itk::BSplineUpsampleImageFilter< InputImageType,InputImageType, CenteredResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline upsample image filter with centered Resampler"<::Pointer df - = itk::BSplineUpsampleImageFilter< InputImageType,InputImageType,L2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline upsample image filter with L2 Resampler"<::Pointer df - = itk::BSplineUpsampleImageFilter< InputImageType,InputImageType,CenteredL2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline upsample image filter with L2 centered Resampler"<SetInput(input); - filter->Update(); - typename OutputImageType::Pointer output=filter->GetOutput(); - - //=============================================================================== - // keep component - components.push_back(output); - } - - // Join - typedef itk::Compose3DVectorImageFilter ComposeFilterType; - typename ComposeFilterType::Pointer composeFilter=ComposeFilterType::New(); - for (unsigned int i=0; i<3;i++) - composeFilter->SetInput(i,components[i]); - composeFilter->Update(); - typename VectorOutputImageType::Pointer vectorOutput = composeFilter->GetOutput(); - - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(vectorOutput); - writer->Update(); - - } - -}//end clitk - -#endif //#define clitkBSplinePyramidGenericFilter_txx diff --git a/registration/clitkConvertPointList.cxx b/registration/clitkConvertPointList.cxx deleted file mode 100644 index 2f18310..0000000 --- a/registration/clitkConvertPointList.cxx +++ /dev/null @@ -1,81 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkConvertPointList.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkConvertPointList_ggo.h" -#include "clitkIO.h" -#include "clitkImageCommon.h" -#include "clitkList.h" -#include "clitkLists.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkConvertPointList, args_info); - CLITK_INIT; - - // List - typedef itk::Point PointType; - typedef clitk::List ListType; - typedef clitk::Lists ListsType; - ListType refList; - ListsType targetLists; - - // Image - typedef itk::Image ImageType; - ImageType::Pointer referenceImage=clitk::readImage(args_info.refIm_arg, args_info.verbose_flag); - - // Filenames - std::vector< std::string> fileNames; - for(unsigned int i=0; i< args_info.lists_given; i++) - { - fileNames.push_back(args_info.lists_arg[i]); - if (args_info.verbose_flag) std::cout<<"Adding input point list "< oFileNames; - for(unsigned int i=0; i< args_info.targets_given; i++) - oFileNames.push_back(args_info.targets_arg[i]); - targetLists.Write(oFileNames, args_info.verbose_flag); - } - - return EXIT_SUCCESS; - -}// end main - -//-------------------------------------------------------------------- diff --git a/registration/clitkConvertPointList.ggo b/registration/clitkConvertPointList.ggo deleted file mode 100644 index fe45050..0000000 --- a/registration/clitkConvertPointList.ggo +++ /dev/null @@ -1,15 +0,0 @@ -#File clitkConvertPointList.ggo -package "clitkConvertPointList" -version "1.0" -purpose "Convert IX point pair lists (generated using the software described in Murphy2008,MICCAI) to a vv point pair lists" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -section "I/O" - -option "lists" l "Input IX lists filenames" string yes multiple -option "refIm" i "Input reference image filename" string yes -option "ref" r "Output reference list filename" string yes -option "targets" c "Output target lists filenames" string yes multiple - diff --git a/registration/clitkMultiResolutionPyramid.cxx b/registration/clitkMultiResolutionPyramid.cxx deleted file mode 100644 index 7d7d71e..0000000 --- a/registration/clitkMultiResolutionPyramid.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkMultiResolutionPyramid.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkMultiResolutionPyramid_ggo.h" -#include "clitkIO.h" -#include "clitkMultiResolutionPyramidGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkMultiResolutionPyramid, args_info); - CLITK_INIT; - - // Filter - clitk::MultiResolutionPyramidGenericFilter::Pointer genericFilter=clitk::MultiResolutionPyramidGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/registration/clitkMultiResolutionPyramid.ggo b/registration/clitkMultiResolutionPyramid.ggo deleted file mode 100644 index 28952ac..0000000 --- a/registration/clitkMultiResolutionPyramid.ggo +++ /dev/null @@ -1,18 +0,0 @@ -#File clitkMultiResolutionPyramid.ggo -package "clitkMultiResolutionPyramid" -version "1.0" -purpose "Compute the multi-resolution (MR) image pyramid. The conventional filter will also modify the image at the original resolution, the recursive not. The spatio-temporal filters leave the last dimension untouched." - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -section "IO" -option "input" i "Input image filename" string yes -option "output" o "Output image (level) filenames" string yes multiple - -section "Pyramid" -option "type" t "0=MR, 1= recursive MR, 2=spatio-temporal MR, 3 recursive spatio-temporal MR" int no default="0" -option "levels" l "Number of resolution levels" int no default="2" - - - diff --git a/registration/clitkMultiResolutionPyramidGenericFilter.cxx b/registration/clitkMultiResolutionPyramidGenericFilter.cxx deleted file mode 100644 index c6f0aae..0000000 --- a/registration/clitkMultiResolutionPyramidGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkMultiResolutionPyramidGenericFilter_cxx -#define clitkMultiResolutionPyramidGenericFilter_cxx - -/* ================================================= - * @file clitkMultiResolutionPyramidGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkMultiResolutionPyramidGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - MultiResolutionPyramidGenericFilter::MultiResolutionPyramidGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void MultiResolutionPyramidGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2,3 or 4 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( MultiResolutionPyramidGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkMultiResolutionPyramid & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - MultiResolutionPyramidGenericFilter(); - ~MultiResolutionPyramidGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkMultiResolutionPyramid m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkMultiResolutionPyramidGenericFilter.txx" -#endif - -#endif // #define clitkMultiResolutionPyramidGenericFilter_h diff --git a/registration/clitkMultiResolutionPyramidGenericFilter.txx b/registration/clitkMultiResolutionPyramidGenericFilter.txx deleted file mode 100644 index 147ca99..0000000 --- a/registration/clitkMultiResolutionPyramidGenericFilter.txx +++ /dev/null @@ -1,162 +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 clitkMultiResolutionPyramidGenericFilter_txx -#define clitkMultiResolutionPyramidGenericFilter_txx - -/* ================================================= - * @file clitkMultiResolutionPyramidGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - MultiResolutionPyramidGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - MultiResolutionPyramidGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typedef itk::ImageToImageFilter FilterType; - typename FilterType::Pointer filter; - switch(m_ArgsInfo.type_arg) - { - case 0: - { - typedef itk::MultiResolutionPyramidImageFilter MRFilterType; - typename MRFilterType::Pointer rmFilter =MRFilterType::New(); - if (m_Verbose) std::cout<<"Using the multi-resolution filter..."<SetNumberOfLevels(m_ArgsInfo.levels_arg); - filter=rmFilter; - break; - } - case 1: - { - typedef itk::RecursiveMultiResolutionPyramidImageFilter RecursiveFilterType; - typename RecursiveFilterType::Pointer rFilter=RecursiveFilterType::New(); - if (m_Verbose) std::cout<<"Using the recursive multi-resolution filter..."<SetNumberOfLevels(m_ArgsInfo.levels_arg); - rFilter->SetUseShrinkImageFilter(false); - filter=rFilter; - break; - } - case 2: - { - typedef clitk::SpatioTemporalMultiResolutionPyramidImageFilter SpatioTemporalFilterType; - typename SpatioTemporalFilterType::Pointer spFilter=SpatioTemporalFilterType::New(); - if (m_Verbose) std::cout<<"Using the spatio-temporal multi-resolution filter..."<SetNumberOfLevels(m_ArgsInfo.levels_arg); - filter=spFilter; - break; - } - case 3: - { - typedef clitk::RecursiveSpatioTemporalMultiResolutionPyramidImageFilter RecursiveSpatioTemporalFilterType; - typename RecursiveSpatioTemporalFilterType::Pointer rspFilter=RecursiveSpatioTemporalFilterType::New(); - if (m_Verbose) std::cout<<"Using the recursive spatio-temporal multi-resolution filter..."<SetNumberOfLevels(m_ArgsInfo.levels_arg); - rspFilter->SetUseShrinkImageFilter(false); - filter=rspFilter; - break; - } - } - - // Common - filter->SetInput(input); - try - { - filter->Update(); - } - catch (itk::ExceptionObject) - { - std::cerr<<"Exception thrown during update() of the multi-resolution pyramid filter!"<GetOutput(i); - - // Write - writeImage(output,m_ArgsInfo.output_arg[i], m_Verbose); -// typedef itk::ImageFileWriter WriterType; -// typename WriterType::Pointer writer = WriterType::New(); -// writer->SetFileName(m_ArgsInfo.output_arg[i]); -// writer->SetInput(output); -// writer->Update(); - } - } - - -}//end clitk - -#endif //#define clitkMultiResolutionPyramidGenericFilter_txx diff --git a/registration/clitkPointTrajectory.cxx b/registration/clitkPointTrajectory.cxx deleted file mode 100644 index a1dc422..0000000 --- a/registration/clitkPointTrajectory.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkPointTrajectory.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkPointTrajectory_ggo.h" -#include "clitkIO.h" -#include "clitkPointTrajectoryGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkPointTrajectory, args_info); - CLITK_INIT; - - // Filter - clitk::PointTrajectoryGenericFilter::Pointer genericFilter=clitk::PointTrajectoryGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/registration/clitkPointTrajectory.ggo b/registration/clitkPointTrajectory.ggo deleted file mode 100644 index 559d598..0000000 --- a/registration/clitkPointTrajectory.ggo +++ /dev/null @@ -1,26 +0,0 @@ -#File clitkPointTrajectory.ggo -package "clitkPointTrajectory" -version "1.0" -purpose "Compute the cyclic trajectory of a point based input transform. The transform can be given by N lists of (manually identified) landmarks, a 4DDVF or a ST transform. Interpolation is performed between " - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -section "IO" - -option "ref" r "Reference point list" string no -option "phaseIncrement" p "Phase step size for the trajectory [0,10)" double no default="0.1" -option "trajectory" o "Base filename for the trajectory files(+pointNumber) " string yes - - -section "Transform: either given n lists of points; a 4DVF or the coefficient image of a spatiotemporal transform" -option "transform" t "Transform type: 0=points, 1=4DVF, 2=coeff" int no default="0" -option "points" - "0:Lists of points" string no multiple -option "input" i "1,2: 4DVF or coeff image" string no -option "interpVF" - "0,1: Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT" int no default="1" -option "interpVFOrder" - "0,1: Order if BLUT or BSpline (0-5)" int no default="3" -option "interpVFSF" - "0,1: Sampling factor if BLUT" int no default="20" -option "order" - "2: Spline order" int multiple no -option "mask" m "2: Mask image filename" string no -option "spacing" - "2: Spacing of the ref image for the sampling factor" double no default="2" -option "shape" - "2: Shape of the transform: 0=egg, 1=diamond" int no default="0" diff --git a/registration/clitkPointTrajectoryGenericFilter.cxx b/registration/clitkPointTrajectoryGenericFilter.cxx deleted file mode 100644 index cc6b0cf..0000000 --- a/registration/clitkPointTrajectoryGenericFilter.cxx +++ /dev/null @@ -1,380 +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 clitkPointTrajectoryGenericFilter_cxx -#define clitkPointTrajectoryGenericFilter_cxx - -/* ================================================= - * @file clitkPointTrajectoryGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkPointTrajectoryGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - PointTrajectoryGenericFilter::PointTrajectoryGenericFilter() - { - m_Verbose=false; - // m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void PointTrajectoryGenericFilter::Update() - { - // ImageTypes - const unsigned int ImageDimension=4; - const unsigned int SpaceDimension=3; - typedef itk::Vector CoefficientPixelType; - typedef itk::Vector VectorPixelType; - typedef itk::Image CoefficientImageType; - typedef itk::Image VectorFieldType; - - - // ----------------------------------------------- - // Reference Point List 3D - // ----------------------------------------------- - typedef itk::Point SpacePointType; - typedef clitk::List PointListType; - PointListType referencePointList; - if (m_Verbose) std::cout<<"Reference point list:"< TransformType; - TransformType::Pointer transform; - switch (m_ArgsInfo.transform_arg) - { - // ========================== - // List of points - // ========================== - case 0: - { - //----------------------------- - // Input point lists - //----------------------------- - typedef itk::Point PointType; - typedef clitk::List PointListType; - typedef clitk::Lists PointListsType; - PointListsType inputPointLists, sortedPointLists; - - // Read the lists - for (unsigned int i=0; i PointListTransformType; - PointListTransformType::Pointer pointListTransform=PointListTransformType::New(); - pointListTransform->SetPointLists(sortedPointLists); - - // Vector Interpolator - typedef PointListTransformType::PointListImageType PointListImageType; - typedef clitk::GenericVectorInterpolator GenericVectorInterpolatorType; - GenericVectorInterpolatorType::Pointer genericInterpolator=GenericVectorInterpolatorType::New(); - genericInterpolator->SetArgsInfo(m_ArgsInfo); - typedef itk::VectorInterpolateImageFunction InterpolatorType; - InterpolatorType::Pointer interpolator=genericInterpolator->GetInterpolatorPointer(); - pointListTransform->SetInterpolator(interpolator); - transform=pointListTransform; - - break; - } - - // ========================== - // 4D vector field - // ========================== - case 1: - { - // Deformation field transform - typedef clitk::DeformationFieldTransform DeformationFieldTransformType; - DeformationFieldTransformType::Pointer deformationFieldTransform=DeformationFieldTransformType::New(); - - // The deformation field - typedef DeformationFieldTransformType::DeformationFieldType DeformationFieldType; - typedef itk::ImageFileReader InputReaderType; - InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_ArgsInfo.input_arg); - reader->Update(); - DeformationFieldType::Pointer input= reader->GetOutput(); - deformationFieldTransform->SetDeformationField(input); - - // Vector Interpolator - typedef clitk::GenericVectorInterpolator GenericVectorInterpolatorType; - GenericVectorInterpolatorType::Pointer genericInterpolator=GenericVectorInterpolatorType::New(); - genericInterpolator->SetArgsInfo(m_ArgsInfo); - typedef itk::VectorInterpolateImageFunction InterpolatorType; - InterpolatorType::Pointer interpolator=genericInterpolator->GetInterpolatorPointer(); - deformationFieldTransform->SetInterpolator(interpolator); - transform=deformationFieldTransform; - - break; - } - - // ========================== - // Spatio-Temporal transform - // ========================== - case 2: - { - // S-T transform - typedef clitk::ShapedBLUTSpatioTemporalDeformableTransform< double, ImageDimension, ImageDimension > TransformType; - TransformType::Pointer spatioTemporalTransform = TransformType::New(); - - - // Spline orders: Default is cubic splines - CoefficientImageType::RegionType::SizeType splineOrders ; - splineOrders.Fill(3); - if (m_ArgsInfo.order_given) - for(unsigned int i=0; i InputReaderType; - InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_ArgsInfo.input_arg); - reader->Update(); - CoefficientImageType::Pointer input= reader->GetOutput(); - // itk::Vector vector; - // vector.Fill(0.); - // vector[2]=100; - // input->FillBuffer(vector); - - // Mask - typedef itk::ImageMaskSpatialObject< ImageDimension > MaskType; - MaskType::Pointer spatialObjectMask=NULL; - if (m_ArgsInfo.mask_given) - { - typedef itk::Image< unsigned char, ImageDimension > ImageMaskType; - typedef itk::ImageFileReader< ImageMaskType > MaskReaderType; - MaskReaderType::Pointer maskReader = MaskReaderType::New(); - maskReader->SetFileName(m_ArgsInfo.mask_arg); - - try - { - maskReader->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught while reading mask !" << std::endl; - std::cerr << err << std::endl; - return; - } - if (m_Verbose)std::cout <<"Mask was read..." <SetImage( maskReader->GetOutput() ); - } - - // Samplingfactors - CoefficientImageType::SizeType samplingFactors; - for (unsigned int i=0; i< ImageDimension-1; i++) - { - samplingFactors[i]= (int) ( input->GetSpacing()[i]/ m_ArgsInfo.spacing_arg); - if (m_Verbose) std::cout<<"Setting sampling factor "<GetSpacing()[ImageDimension-1]/ m_ArgsInfo.phaseIncrement_arg); - if (m_Verbose) std::cout<<"Setting sampling factor "<SetTransformShape(m_ArgsInfo.shape_arg); - spatioTemporalTransform->SetSplineOrders(splineOrders); - spatioTemporalTransform->SetMask(spatialObjectMask); - spatioTemporalTransform->SetLUTSamplingFactors(samplingFactors); - spatioTemporalTransform->SetCoefficientImage(input); - transform=spatioTemporalTransform; - - break; - } - -// // ========================== -// // Spatio-Temporal transform -// // ========================== -// case 3: -// { -// // S-T transform -// typedef clitk::BSplineSpatioTemporalDeformableTransform< double, ImageDimension, ImageDimension > TransformType; -// TransformType::Pointer spatioTemporalTransform = TransformType::New(); - - -// // Spline orders: Default is cubic splines -// CoefficientImageType::RegionType::SizeType splineOrders ; -// splineOrders.Fill(3); -// if (m_ArgsInfo.order_given) -// for(unsigned int i=0; i InputReaderType; -// InputReaderType::Pointer reader = InputReaderType::New(); -// reader->SetFileName( m_ArgsInfo.input_arg); -// reader->Update(); -// CoefficientImageType::Pointer input= reader->GetOutput(); -// // itk::Vector vector; -// // vector.Fill(0.); -// // vector[2]=100; -// // input->FillBuffer(vector); - -// // Mask -// typedef itk::ImageMaskSpatialObject< ImageDimension > MaskType; -// MaskType::Pointer spatialObjectMask=NULL; -// if (m_ArgsInfo.mask_given) -// { -// typedef itk::Image< unsigned char, ImageDimension > ImageMaskType; -// typedef itk::ImageFileReader< ImageMaskType > MaskReaderType; -// MaskReaderType::Pointer maskReader = MaskReaderType::New(); -// maskReader->SetFileName(m_ArgsInfo.mask_arg); - -// try -// { -// maskReader->Update(); -// } -// catch( itk::ExceptionObject & err ) -// { -// std::cerr << "ExceptionObject caught while reading mask !" << std::endl; -// std::cerr << err << std::endl; -// return; -// } -// if (m_Verbose)std::cout <<"Mask was read..." <SetImage( maskReader->GetOutput() ); -// } - -// // Samplingfactors -// CoefficientImageType::SizeType samplingFactors; -// for (unsigned int i=0; i< ImageDimension-1; i++) -// { -// samplingFactors[i]= (int) ( input->GetSpacing()[i]/ m_ArgsInfo.spacing_arg); -// if (m_Verbose) std::cout<<"Setting sampling factor "<GetSpacing()[ImageDimension-1]/ m_ArgsInfo.phaseIncrement_arg); -// if (m_Verbose) std::cout<<"Setting sampling factor "<SetTransformShape(m_ArgsInfo.shape_arg); -// spatioTemporalTransform->SetSplineOrders(splineOrders); -// spatioTemporalTransform->SetMask(spatialObjectMask); -// spatioTemporalTransform->SetLUTSamplingFactors(samplingFactors); -// spatioTemporalTransform->SetCoefficientImage(input); -// transform=spatioTemporalTransform; - -// break; -// } - } - - - // ----------------------------------------------- - // Construct Spatio-Temporal Point lists 4D - // ----------------------------------------------- - typedef itk::Point SpaceTimePointType; - typedef clitk::Lists PointListsType; - PointListsType pointLists(referencePointList.size()); - SpaceTimePointType spaceTimePoint; - double phase; - for (unsigned int i=0; i VectorType; - typedef clitk::List VectorListType; - typedef clitk::Lists VectorListsType; - VectorListsType displacementLists(pointLists.size()); - VectorType displacement; - for (unsigned int i=0; iTransformPoint(pointLists[i][j]); - if (m_Verbose) std::cout<<"Transformed point "< filenames; - for (unsigned int i=0;i Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( PointTrajectoryGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkPointTrajectory & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - PointTrajectoryGenericFilter(); - ~PointTrajectoryGenericFilter() {}; - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkPointTrajectory m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - - -#endif // #define clitkPointTrajectoryGenericFilter_h diff --git a/registration/clitkResampleBSplineDeformableTransform.cxx b/registration/clitkResampleBSplineDeformableTransform.cxx deleted file mode 100644 index ae3e858..0000000 --- a/registration/clitkResampleBSplineDeformableTransform.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkResampleBSplineDeformableTransform.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkResampleBSplineDeformableTransform_ggo.h" -#include "clitkIO.h" -#include "clitkResampleBSplineDeformableTransformGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkResampleBSplineDeformableTransform, args_info); - CLITK_INIT; - - // Filter - clitk::ResampleBSplineDeformableTransformGenericFilter::Pointer genericFilter=clitk::ResampleBSplineDeformableTransformGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/registration/clitkResampleBSplineDeformableTransform.ggo b/registration/clitkResampleBSplineDeformableTransform.ggo deleted file mode 100644 index 1317332..0000000 --- a/registration/clitkResampleBSplineDeformableTransform.ggo +++ /dev/null @@ -1,22 +0,0 @@ -#File clitkResampleBSplineDeformableTransform.ggo -package "clitkResampleBSplineDeformableTransform" -version "1.0" -purpose "Resample the B-spline control point grid to given properties. Coefficients are resampled to values with the desired properties and reconverted to coefficients " - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "like" - "Resample output like this image" string no - - -section "Output Image Properties" - -option "origin" - "Origin for the output image" double multiple no -option "size" - "Size for the output image" int multiple no -option "spacing" - "Spacing for the output image" double multiple no - - - - diff --git a/registration/clitkResampleBSplineDeformableTransformGenericFilter.cxx b/registration/clitkResampleBSplineDeformableTransformGenericFilter.cxx deleted file mode 100644 index 4402f9a..0000000 --- a/registration/clitkResampleBSplineDeformableTransformGenericFilter.cxx +++ /dev/null @@ -1,71 +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 clitkResampleBSplineDeformableTransformGenericFilter_cxx -#define clitkResampleBSplineDeformableTransformGenericFilter_cxx - -/* ================================================= - * @file clitkResampleBSplineDeformableTransformGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkResampleBSplineDeformableTransformGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - ResampleBSplineDeformableTransformGenericFilter::ResampleBSplineDeformableTransformGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void ResampleBSplineDeformableTransformGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension, Components; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components); - - - // 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!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( ResampleBSplineDeformableTransformGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkResampleBSplineDeformableTransform & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - ResampleBSplineDeformableTransformGenericFilter(); - ~ResampleBSplineDeformableTransformGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType, int Components); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkResampleBSplineDeformableTransform m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkResampleBSplineDeformableTransformGenericFilter.txx" -#endif - -#endif // #define clitkResampleBSplineDeformableTransformGenericFilter_h diff --git a/registration/clitkResampleBSplineDeformableTransformGenericFilter.txx b/registration/clitkResampleBSplineDeformableTransformGenericFilter.txx deleted file mode 100644 index 593f2b3..0000000 --- a/registration/clitkResampleBSplineDeformableTransformGenericFilter.txx +++ /dev/null @@ -1,158 +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 clitkResampleBSplineDeformableTransformGenericFilter_txx -#define clitkResampleBSplineDeformableTransformGenericFilter_txx - -/* ================================================= - * @file clitkResampleBSplineDeformableTransformGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - ResampleBSplineDeformableTransformGenericFilter::UpdateWithDim(std::string PixelType, int Components) - { - if (m_Verbose) std::cout << "Image was detected to be "< >(); - } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 2D float..." << std::endl; - UpdateWithDimAndPixelType >(); - } - } - else if (Components==3) - { - if(PixelType == "double"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 3D double..." << std::endl; - UpdateWithDimAndPixelType >(); - } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 3D float..." << std::endl; - UpdateWithDimAndPixelType >(); - } - } - else std::cerr<<"Number of components is "< - void - ResampleBSplineDeformableTransformGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typedef clitk::ResampleBSplineDeformableTransformImageFilter ResampleFilterType; - typename ResampleFilterType::Pointer filter=ResampleFilterType::New(); - filter->SetInput(input); - - // Output image info - if (m_ArgsInfo.like_given) - { - typename InputReaderType::Pointer likeReader=InputReaderType::New(); - likeReader->SetFileName(m_ArgsInfo.like_arg); - likeReader->Update(); - filter->SetOutputParametersFromImage(likeReader->GetOutput()); - } - else - { - // Size - typename OutputImageType::SizeType outputSize; - if (m_ArgsInfo.size_given) - { - for(unsigned int i=0; i< Dimension; i++) - outputSize[i]=m_ArgsInfo.size_arg[i]; - } - else outputSize=input->GetLargestPossibleRegion().GetSize(); - if (m_Verbose) std::cout<<"Setting the size to "<GetSpacing(); - if (m_Verbose) std::cout<<"Setting the spacing to "<GetOrigin(); - if (m_Verbose) std::cout<<"Setting the origin to "<SetSize( outputSize ); - filter->SetOutputSpacing( outputSpacing ); - filter->SetOutputOrigin( outputOrigin ); - - } - - // Go - filter->Update(); - - // Get the output - typename OutputImageType::Pointer output=filter->GetOutput(); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkResampleBSplineDeformableTransformGenericFilter_txx diff --git a/registration/clitkSelectPoints.cxx b/registration/clitkSelectPoints.cxx deleted file mode 100644 index e7b88e8..0000000 --- a/registration/clitkSelectPoints.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkSelectPoints.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkSelectPoints_ggo.h" -#include "clitkIO.h" -#include "clitkSelectPointsGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkSelectPoints, args_info); - CLITK_INIT; - - // Filter - clitk::SelectPointsGenericFilter::Pointer genericFilter=clitk::SelectPointsGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/registration/clitkSelectPoints.ggo b/registration/clitkSelectPoints.ggo deleted file mode 100644 index 692c878..0000000 --- a/registration/clitkSelectPoints.ggo +++ /dev/null @@ -1,24 +0,0 @@ -#File clitkSelectPoints.ggo -package "clitkSelectPoints" -version "1.0" -purpose "Perform a selection of points on the reference and target lists of points, based on criteria applied to the reference list." - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -section "Input" - -option "ref" r "List of points in reference" string yes -option "input" i "Lists of points in targets" string multiple yes - - -section "Output" - -option "sRef" - "List of points selected in reference" string yes -option "sInput" o "Lists of points selected in targets" string multiple yes - -section "Selection: Provide lower and upper coordinate bounds for as much as components as provided" - -option "component" c "Component index [0,2]" int multiple yes -option "lower" l "Lower bound" double multiple yes -option "upper" u "Upper bound" double multiple yes diff --git a/registration/clitkSelectPointsGenericFilter.cxx b/registration/clitkSelectPointsGenericFilter.cxx deleted file mode 100644 index 02f8224..0000000 --- a/registration/clitkSelectPointsGenericFilter.cxx +++ /dev/null @@ -1,141 +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 clitkSelectPointsGenericFilter_cxx -#define clitkSelectPointsGenericFilter_cxx - -/* ================================================= - * @file clitkSelectPointsGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkSelectPointsGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - SelectPointsGenericFilter::SelectPointsGenericFilter() - { - m_Verbose=false; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void SelectPointsGenericFilter::Update() - { - //----------------------------- - // Typedefs - //----------------------------- - typedef double ValueType; - typedef std::vector MeasureListType; - - typedef itk::Point PointType; - typedef clitk::List PointListType; - typedef clitk::Lists PointListsType; - - - //----------------------------- - // Input point lists - //----------------------------- - PointListsType pointLists; - unsigned int numberOfPoints=0; - unsigned int numberOfLists=m_ArgsInfo.input_given; - for (unsigned int i=0; i= m_ArgsInfo.lower_arg[component]) - && (referencePointList[number][m_ArgsInfo.component_arg[component]] <= m_ArgsInfo.upper_arg[component]) ) - { - if(m_Verbose) std::cout<<"Selecting point "< filenames; - for (unsigned int i=0;i Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( SelectPointsGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkSelectPoints & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - SelectPointsGenericFilter(); - ~SelectPointsGenericFilter() {}; - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkSelectPoints m_ArgsInfo; - bool m_Verbose; - - }; - - -} // end namespace clitk - - -#endif // #define clitkSelectPointsGenericFilter_h diff --git a/registration/clitkShapedBLUTSpatioTemporalDIR.cxx b/registration/clitkShapedBLUTSpatioTemporalDIR.cxx deleted file mode 100644 index 2daf443..0000000 --- a/registration/clitkShapedBLUTSpatioTemporalDIR.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkShapedBLUTSpatioTemporalDIR.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkShapedBLUTSpatioTemporalDIR_ggo.h" -#include "clitkIO.h" -#include "clitkShapedBLUTSpatioTemporalDIRGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkShapedBLUTSpatioTemporalDIR, args_info); - CLITK_INIT; - - // Filter - clitk::ShapedBLUTSpatioTemporalDIRGenericFilter::Pointer genericFilter=clitk::ShapedBLUTSpatioTemporalDIRGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/registration/clitkShapedBLUTSpatioTemporalDIR.ggo b/registration/clitkShapedBLUTSpatioTemporalDIR.ggo deleted file mode 100644 index f97c833..0000000 --- a/registration/clitkShapedBLUTSpatioTemporalDIR.ggo +++ /dev/null @@ -1,90 +0,0 @@ -#File clitkShapedBLUTSpatioTemporalDIR.ggo -#Author: Jef Vandemeulebroucke -#Date : Tue 15 Jan 2009 10.35 - -package "clitk" -version "Deform a volume to match a temporal sequence using a spatio-temporal deformation model. By setting the shape of the model, you modify the temporal constraints applied to the cyclic trajectory model." - -option "config" - "Config file" string no - - -section "Run Time" - -option "verbose" v "Verbose" flag off -option "threads" - "Number of threads to use (default=min(#cores,8))" int no - - -section "Input" - -option "reference" r "Input reference 3D image (float)" string yes -option "target" t "Input target 2D image (float)" string yes -option "referenceMask" m "Mask to placed over the reference image" string no -option "targetMask" - "Mask to placed over the target image" string no - - -section "Output" - -option "vf" - "Result DVF" string yes -option "coeff" - "Result coefficient images" string no -option "padCoeff" - "Result padded coefficient images" string no -option "output" o "Deformed target image" string yes -option "before" - "Difference image before (but after rigid transform)" string no -option "after" - "Difference image after " string no -option "current" - "Write the current coefficient image every N evaluations" int no -option "intermediate" - "Write the coefficient image at resolution levels (provide N filenames)" string no multiple - - -section "Transform (Note that only one of --control, --spacing is required. The other will be adjusted to fit the region and allow exact representation. SamplingFactor will be set accordingly" - -option "shape" - "Even=4 internal CP, Odd 5 internal CP: 0,1=egg; 2,3= rabbit; 4,5=sputnik; 6,7=diamond" int no default="3" -option "initCoeff" - "Initial coefficient image (without borders)" string no -option "initPadCoeff" - "Initial padded coefficient image (with borders)" string no -option "rigid" - "Prior rigid transform matrix from reference to target space" string no -option "order" - "Spline Order FFD" int no multiple default="3" -option "control" - "Internal control points for each dimension" int no multiple -option "spacing" - "Control point spacing for each dimension (mm)" double no multiple -option "samplingFactor" - "LUT sampling factor" int no multiple - - -section "Interpolator" - -option "interp" - "Interpolation: 0=NN, 1=Linear, 2=BSpline, 3=BLUT" int no default="1" -option "interpOrder" - "Order if BLUT or BSpline (0-5)" int no default="3" -option "interpSF" - "Sampling factor if BLUT" int no default="20" - - -section "Metric (optimized, threaded versions are available for *, compile ITK with REVIEW and OPT_REGISTRATION enabled. Further optimized versions ** for BLUT FFD optimizing a !3D! vector field)" - -option "metric" - "Type: 0=SSD*, 1=Normalized CC*, 2=Histogram CC, 3=Gradient-Difference, 4=Viola-Wells MI, 5=Histogram MI, 6=Mattes' MI*, 7=Normalized MI, 8=CR, 9=SSD for BLUT FFD**, 10=CC for BLUT FFD**, 11=Mattes' MI for BLUT FFD**" int no default="0" -option "samples" - "Specify fraction [0, 1] of samples of the reference image used for the metric (* only). Use high fraction for detailed images (eg. 0.2, 0.5), for smooth images 0.01 might be enough." float no default="1" -option "intThreshold" - "Fixed image samples intensity threshold (* only)" float no -option "subtractMean" - "1: Subtract mean for NCC calculation (narrows optimal)" flag on -option "bins" - "2,5-8: Number of histogram bins" int no default="50" -option "random" - "4,6: Samples should be taken randomly, otherwise uniformly" flag off -option "stdDev" - "4: specify the standard deviation in mm of the gaussian kernels for both PDF estimations" float no default="0.4" -option "explicitPDFDerivatives" - "6: Calculate PDF derivatives explicitly (rigid=true; FFD=false)" flag off - - -section "Optimizer" - -option "optimizer" - "0=Simplex, 1=Powell, 2=FRPR, 3=Regular Step GD, 4=VersorRigid3D, 5=Conjugated Gradient, 6=L-BFGS, 7=L-BFGS-B" int no default="7" -option "delta" - "0: Initial delta, otherwise automatic" double no -option "step" - "1,2,3,4: Initial stepsize (to be multiplied with the gradient)" double no default="2.0" -option "relax" - "3,4: Relaxation of the stepsize (multiplied each time the gradient changes sign)" double no default="0.7" -option "valueTol" - "0,1,2: Tolerance on the function" double no default="0.01" -option "stepTol" - "0,1,3,4: Tolerance on the step size" double no default="0.1" -option "gradTol" - "3,4,6,7: Tolerance on the (projected) gradient magnitude (7: 1=low->1e-10=high precision)" double no default="1e-5" -option "lineAcc" - "6: Line accuracy (eg: high=0.1, low=0.9)" double no default="0.9" -option "convFactor" - "7: Convergence factor: terminate if factor*machine_precision>reduction in cost (1e+12 low -> 1e+1 high precision) " double no default="1e+7" -option "maxIt" - "0-7: Maximum number of iterations" int no default="500" -option "maxLineIt" - "1,2: Maximum number of line iterations" int no default="50" -option "maxEval" - "6,7: Maximum number of evaluations" int no default="500" -option "maxCorr" - "7: Maximum number of corrections" int no default="5" -option "selectBound" - "7: Select the type of bound: 0=none, 1=u, 2=u&l, 3=l" int no default="0" -option "lowerBound" - "7: The lower bound" double no default="0.0" -option "upperBound" - "7: The upper bound" double no default="0.0" - - -section "Registration" - -option "levels" - "Number of resolution levels" int no default="1" diff --git a/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.cxx b/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.cxx deleted file mode 100644 index 6e7b2db..0000000 --- a/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.cxx +++ /dev/null @@ -1,70 +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 clitkShapedBLUTSpatioTemporalDIRGenericFilter_cxx -#define clitkShapedBLUTSpatioTemporalDIRGenericFilter_cxx - -/* ================================================= - * @file clitkShapedBLUTSpatioTemporalDIRGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkShapedBLUTSpatioTemporalDIRGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - ShapedBLUTSpatioTemporalDIRGenericFilter::ShapedBLUTSpatioTemporalDIRGenericFilter() - { - m_Verbose=false; - m_ReferenceFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void ShapedBLUTSpatioTemporalDIRGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_ReferenceFileName, Dimension, PixelType); - - //if(Dimension==3) UpdateWithDim<3>(PixelType); - //else - if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 4 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( ShapedBLUTSpatioTemporalDIRGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkShapedBLUTSpatioTemporalDIR & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_ReferenceFileName=m_ArgsInfo.reference_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - ShapedBLUTSpatioTemporalDIRGenericFilter(); - ~ShapedBLUTSpatioTemporalDIRGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkShapedBLUTSpatioTemporalDIR m_ArgsInfo; - bool m_Verbose; - std::string m_ReferenceFileName; - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx" -#endif - -#endif // #define clitkShapedBLUTSpatioTemporalDIRGenericFilter_h diff --git a/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx b/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx deleted file mode 100644 index 0ef06ab..0000000 --- a/registration/clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx +++ /dev/null @@ -1,933 +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 clitkShapedBLUTSpatioTemporalDIRGenericFilter_txx -#define clitkShapedBLUTSpatioTemporalDIRGenericFilter_txx - -/* ================================================= - * @file clitkShapedBLUTSpatioTemporalDIRGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkShapedBLUTSpatioTemporalDIRGenericFilter.h" - -namespace clitk -{ - - //============================================================================== - // Creating an observer class that allows output at each iteration - //============================================================================== - template - class CommandIterationUpdate : public itk::Command - { - public: - typedef CommandIterationUpdate Self; - typedef itk::Command Superclass; - typedef itk::SmartPointer Pointer; - itkNewMacro( Self ); - - // Registration - typedef TRegistration RegistrationType; - typedef RegistrationType * RegistrationPointer; - - // Transform - typedef typename RegistrationType::FixedImageType FixedImageType; - typedef typename FixedImageType::RegionType RegionType; - itkStaticConstMacro(ImageDimension, unsigned int,FixedImageType::ImageDimension); - typedef clitk::ShapedBLUTSpatioTemporalDeformableTransform TransformType; - typedef clitk::ShapedBLUTSpatioTemporalDeformableTransformInitializer InitializerType; - typedef typename InitializerType::CoefficientImageType CoefficientImageType; - typedef itk::CastImageFilter CastImageFilterType; - typedef typename TransformType::ParametersType ParametersType; - typedef typename InitializerType::Pointer InitializerPointer; - - protected: - CommandIterationUpdate() { m_IterationCounter=0;} - public: - typedef clitk::GenericOptimizer OptimizerType; - typedef const OptimizerType * OptimizerPointer; - - // Execute - void Execute(itk::Object *caller, const itk::EventObject & event) - { - Execute( (const itk::Object *)caller, event); - } - - void Execute(const itk::Object * object, const itk::EventObject & event) - { - if( !(itk::IterationEvent().CheckEvent( &event )) ) - { - return; - } - - // Output - m_Optimizer->OutputIterationInfo(); - m_IterationCounter++; - - // Write intermediate result - if (m_ArgsInfo.current_given && (m_IterationCounter> m_ArgsInfo.current_arg) ) - { - // Write && Reset - writeImage(m_Initializer->GetTransform()->GetCoefficientImage(), m_ArgsInfo.coeff_arg, m_ArgsInfo.verbose_flag ); - m_IterationCounter=0; - } - } - - // Members - void SetOptimizer(OptimizerPointer o){m_Optimizer=o;} - OptimizerPointer m_Optimizer; - - void SetInitializer(InitializerPointer i){m_Initializer=i;} - InitializerPointer m_Initializer; - - void SetArgsInfo(args_info_clitkShapedBLUTSpatioTemporalDIR a){m_ArgsInfo=a;} - args_info_clitkShapedBLUTSpatioTemporalDIR m_ArgsInfo; - - int m_IterationCounter; - }; - - - //============================================================================== - //Creating an observer class that allows us to change parameters at subsequent levels - //============================================================================== - template - class RegistrationInterfaceCommand : public itk::Command - { - public: - typedef RegistrationInterfaceCommand Self; - typedef itk::Command Superclass; - typedef itk::SmartPointer Pointer; - itkNewMacro( Self ); - protected: - RegistrationInterfaceCommand() {}; - public: - - // Registration - typedef TRegistration RegistrationType; - typedef RegistrationType * RegistrationPointer; - - // Transform - typedef typename RegistrationType::FixedImageType FixedImageType; - typedef typename FixedImageType::RegionType RegionType; - itkStaticConstMacro(ImageDimension, unsigned int,FixedImageType::ImageDimension); - typedef clitk::ShapedBLUTSpatioTemporalDeformableTransform TransformType; - typedef clitk::ShapedBLUTSpatioTemporalDeformableTransformInitializer InitializerType; - typedef typename InitializerType::CoefficientImageType CoefficientImageType; - typedef itk::CastImageFilter CastImageFilterType; - typedef typename TransformType::ParametersType ParametersType; - typedef typename InitializerType::Pointer InitializerPointer; - typedef typename CommandIterationUpdate< TRegistration, args_info_clitkShapedBLUTSpatioTemporalDIR>::Pointer CommandIterationUpdatePointer; - - // Optimizer - typedef clitk::GenericOptimizer GenericOptimizerType; - typedef typename GenericOptimizerType::Pointer GenericOptimizerPointer; - - // Metric - typedef typename RegistrationType::FixedImageType InternalImageType; - typedef clitk::GenericMetric GenericMetricType; - typedef typename GenericMetricType::Pointer GenericMetricPointer; - - // Two arguments are passed to the Execute() method: the first - // is the pointer to the object which invoked the event and the - // second is the event that was invoked. - void Execute(itk::Object * object, const itk::EventObject & event) - { - if( !(itk::IterationEvent().CheckEvent( &event )) ) - { - return; - } - - // Get the levels - RegistrationPointer registration = dynamic_cast( object ); - unsigned int numberOfLevels=registration->GetNumberOfLevels(); - unsigned int currentLevel=registration->GetCurrentLevel()+1; - - // Output the levels - std::cout<1) - { - // fixed image region pyramid - typedef clitk::MultiResolutionPyramidRegionFilter FixedImageRegionPyramidType; - typename FixedImageRegionPyramidType::Pointer fixedImageRegionPyramid=FixedImageRegionPyramidType::New(); - fixedImageRegionPyramid->SetRegion(m_MetricRegion); - fixedImageRegionPyramid->SetSchedule(registration->GetFixedImagePyramid()->GetSchedule()); - - // Reinitialize the metric (!= number of samples) - m_GenericMetric= GenericMetricType::New(); - m_GenericMetric->SetArgsInfo(m_ArgsInfo); - m_GenericMetric->SetFixedImage(registration->GetFixedImagePyramid()->GetOutput(registration->GetCurrentLevel())); - if (m_ArgsInfo.referenceMask_given) m_GenericMetric->SetFixedImageMask(registration->GetMetric()->GetFixedImageMask()); - m_GenericMetric->SetFixedImageRegion(fixedImageRegionPyramid->GetOutput(registration->GetCurrentLevel())); - typedef itk::ImageToImageMetric< InternalImageType, InternalImageType > MetricType; - typename MetricType::Pointer metric=m_GenericMetric->GetMetricPointer(); - registration->SetMetric(metric); - - // Get the current coefficient image and make a COPY - typename itk::ImageDuplicator::Pointer caster=itk::ImageDuplicator::New(); - caster->SetInputImage(m_Initializer->GetTransform()->GetCoefficientImage()); - caster->Update(); - typename CoefficientImageType::Pointer currentCoefficientImage=caster->GetOutput(); - - // Write the intermediate result? - if (m_ArgsInfo.intermediate_given>=numberOfLevels) - writeImage(currentCoefficientImage, m_ArgsInfo.intermediate_arg[currentLevel-2], m_ArgsInfo.verbose_flag); - - // Set the new transform properties - m_Initializer->SetImage(registration->GetFixedImagePyramid()->GetOutput(currentLevel-1)); - if( m_Initializer->m_ControlPointSpacingIsGiven) - m_Initializer->SetControlPointSpacing(m_Initializer->m_ControlPointSpacingArray[registration->GetCurrentLevel()]); - if( m_Initializer->m_NumberOfControlPointsIsGiven) - m_Initializer->SetNumberOfControlPointsInsideTheImage(m_Initializer->m_NumberOfControlPointsInsideTheImageArray[registration->GetCurrentLevel()]); - - // Reinitialize the transform - if (m_ArgsInfo.verbose_flag) std::cout<<"Initializing transform for level "<InitializeTransform(); - ParametersType* newParameters= new typename TransformType::ParametersType(m_Initializer->GetTransform()->GetNumberOfParameters()); - - // Reinitialize an Optimizer (!= number of parameters) - m_GenericOptimizer = GenericOptimizerType::New(); - m_GenericOptimizer->SetArgsInfo(m_ArgsInfo); - m_GenericOptimizer->SetMaximize(m_Maximize); - m_GenericOptimizer->SetNumberOfParameters(m_Initializer->GetTransform()->GetNumberOfParameters()); - typedef itk::SingleValuedNonLinearOptimizer OptimizerType; - OptimizerType::Pointer optimizer = m_GenericOptimizer->GetOptimizerPointer(); - optimizer->AddObserver( itk::IterationEvent(), m_CommandIterationUpdate); - registration->SetOptimizer(optimizer); - m_CommandIterationUpdate->SetOptimizer(m_GenericOptimizer); - - // Set the previous transform parameters to the registration - // if(m_Initializer->m_Parameters!=NULL )delete m_Initializer->m_Parameters; - m_Initializer->SetInitialParameters(currentCoefficientImage,*newParameters); - registration->SetInitialTransformParametersOfNextLevel(*newParameters); - } - } - - void Execute(const itk::Object * , const itk::EventObject & ) - { return; } - - - // Members - void SetInitializer(InitializerPointer i){m_Initializer=i;} - InitializerPointer m_Initializer; - - void SetArgsInfo(args_info_clitkShapedBLUTSpatioTemporalDIR a){m_ArgsInfo=a;} - args_info_clitkShapedBLUTSpatioTemporalDIR m_ArgsInfo; - - void SetCommandIterationUpdate(CommandIterationUpdatePointer c){m_CommandIterationUpdate=c;}; - CommandIterationUpdatePointer m_CommandIterationUpdate; - - GenericOptimizerPointer m_GenericOptimizer; - void SetMaximize(bool b){m_Maximize=b;} - bool m_Maximize; - - GenericMetricPointer m_GenericMetric; - void SetMetricRegion(RegionType i){m_MetricRegion=i;} - RegionType m_MetricRegion; - - - }; - - - //============================================================================== - // Update with the number of dimensions - //============================================================================== - template - void - ShapedBLUTSpatioTemporalDIRGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - // else if (PixelType == "unsigned_char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //============================================================================== - // Update with the number of dimensions and pixeltype - //============================================================================== - template - void - ShapedBLUTSpatioTemporalDIRGenericFilter::UpdateWithDimAndPixelType() - { - - - //============================================================================= - //Input - //============================================================================= - bool threadsGiven=m_ArgsInfo.threads_given; - int threads=m_ArgsInfo.threads_arg; - - typedef itk::Image< PixelType, ImageDimension > FixedImageType; - typedef itk::Image< PixelType, ImageDimension > MovingImageType; - const unsigned int SpaceDimension = ImageDimension-1; - typedef double TCoordRep; - - - //======================================================= - //Input - //======================================================= - typedef itk::ImageFileReader< FixedImageType > FixedImageReaderType; - typedef itk::ImageFileReader< MovingImageType > MovingImageReaderType; - - typename FixedImageReaderType::Pointer fixedImageReader = FixedImageReaderType::New(); - typename MovingImageReaderType::Pointer movingImageReader = MovingImageReaderType::New(); - - fixedImageReader->SetFileName( m_ArgsInfo.reference_arg ); - movingImageReader->SetFileName( m_ArgsInfo.target_arg ); - if (m_Verbose) std::cout<<"Reading images..."<Update(); - movingImageReader->Update(); - - typename FixedImageType::Pointer fixedImage = fixedImageReader->GetOutput(); - typename MovingImageType::Pointer movingImage =movingImageReader->GetOutput(); - typename FixedImageType::Pointer croppedFixedImage=fixedImage; - - - //======================================================= - // Regions - //======================================================= - - // The original input region - typename FixedImageType::RegionType fixedImageRegion = fixedImage->GetLargestPossibleRegion(); - - // The transform region with respect to the input region: - // where should the transform be DEFINED (depends on mask) - typename FixedImageType::RegionType transformRegion = fixedImage->GetLargestPossibleRegion(); - typename FixedImageType::RegionType::SizeType transformRegionSize=transformRegion.GetSize(); - typename FixedImageType::RegionType::IndexType transformRegionIndex=transformRegion.GetIndex(); - typename FixedImageType::PointType transformRegionOrigin=fixedImage->GetOrigin(); - - // The metric region with respect to the extracted transform region: - // where should the metric be CALCULATED (depends on transform) - typename FixedImageType::RegionType metricRegion = fixedImage->GetLargestPossibleRegion(); - typename FixedImageType::RegionType::SizeType metricRegionSize=metricRegion.GetSize(); - typename FixedImageType::RegionType::IndexType metricRegionIndex=metricRegion.GetIndex(); - typename FixedImageType::PointType metricRegionOrigin=fixedImage->GetOrigin(); - - //=========================================================================== - // If given, we connect a mask to reference or target - //============================================================================ - typedef itk::ImageMaskSpatialObject< ImageDimension > MaskType; - typename MaskType::Pointer fixedMask=NULL; - if (m_ArgsInfo.referenceMask_given) - { - fixedMask= MaskType::New(); - typedef itk::Image< unsigned char, ImageDimension > ImageMaskType; - typedef itk::ImageFileReader< ImageMaskType > MaskReaderType; - typename MaskReaderType::Pointer maskReader = MaskReaderType::New(); - maskReader->SetFileName(m_ArgsInfo.referenceMask_arg); - try - { - maskReader->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught while reading mask !" << std::endl; - std::cerr << err << std::endl; - return; - } - if (m_Verbose)std::cout <<"Reference image mask was read..." <SetImage( maskReader->GetOutput() ); - - // Find the bounding box of the "inside" label - typedef itk::LabelStatisticsImageFilter StatisticsImageFilterType; - typename StatisticsImageFilterType::Pointer statisticsImageFilter=StatisticsImageFilterType::New(); - statisticsImageFilter->SetInput(maskReader->GetOutput()); - statisticsImageFilter->SetLabelInput(maskReader->GetOutput()); - statisticsImageFilter->Update(); - typename StatisticsImageFilterType::BoundingBoxType boundingBox = statisticsImageFilter->GetBoundingBox(1); - - // Limit the transform region to the mask - for (unsigned int i=0; iTransformIndexToPhysicalPoint(transformRegion.GetIndex(), transformRegionOrigin); - - // Crop the fixedImage to the bounding box to facilitate multi-resolution - typedef itk::ExtractImageFilter ExtractImageFilterType; - typename ExtractImageFilterType::Pointer extractImageFilter=ExtractImageFilterType::New(); - extractImageFilter->SetInput(fixedImage); - extractImageFilter->SetExtractionRegion(transformRegion); - extractImageFilter->Update(); - croppedFixedImage=extractImageFilter->GetOutput(); - - // Update the metric region - metricRegion = croppedFixedImage->GetLargestPossibleRegion(); - metricRegionIndex=metricRegion.GetIndex(); - metricRegionSize=metricRegion.GetSize(); - croppedFixedImage->TransformIndexToPhysicalPoint(metricRegionIndex, metricRegionOrigin); - - // Set start index to zero (with respect to croppedFixedImage/transform region) - metricRegionIndex.Fill(0); - metricRegion.SetIndex(metricRegionIndex); - croppedFixedImage->SetRegions(metricRegion); - croppedFixedImage->SetOrigin(metricRegionOrigin); - - } - - typedef itk::ImageMaskSpatialObject< ImageDimension > MaskType; - typename MaskType::Pointer movingMask=NULL; - if (m_ArgsInfo.targetMask_given) - { - movingMask= MaskType::New(); - typedef itk::Image< unsigned char, ImageDimension > ImageMaskType; - typedef itk::ImageFileReader< ImageMaskType > MaskReaderType; - typename MaskReaderType::Pointer maskReader = MaskReaderType::New(); - maskReader->SetFileName(m_ArgsInfo.targetMask_arg); - try - { - maskReader->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught !" << std::endl; - std::cerr << err << std::endl; - } - if (m_Verbose)std::cout <<"Target image mask was read..." <SetImage( maskReader->GetOutput() ); - } - - - //======================================================= - // Output Regions - //======================================================= - - if (m_Verbose) - { - // Fixed image region - std::cout<<"The fixed image has its origin at "<GetOrigin()< FixedImagePyramidType; - typedef clitk::RecursiveSpatioTemporalMultiResolutionPyramidImageFilter< MovingImageType, MovingImageType> MovingImagePyramidType; - typename FixedImagePyramidType::Pointer fixedImagePyramid = FixedImagePyramidType::New(); - typename MovingImagePyramidType::Pointer movingImagePyramid = MovingImagePyramidType::New(); - fixedImagePyramid->SetUseShrinkImageFilter(false); - fixedImagePyramid->SetInput(croppedFixedImage); - fixedImagePyramid->SetNumberOfLevels(m_ArgsInfo.levels_arg); - movingImagePyramid->SetUseShrinkImageFilter(false); - movingImagePyramid->SetInput(movingImage); - movingImagePyramid->SetNumberOfLevels(m_ArgsInfo.levels_arg); - if (m_Verbose) std::cout<<"Creating the image pyramid..."<Update(); - movingImagePyramid->Update(); - typedef clitk::MultiResolutionPyramidRegionFilter FixedImageRegionPyramidType; - typename FixedImageRegionPyramidType::Pointer fixedImageRegionPyramid=FixedImageRegionPyramidType::New(); - fixedImageRegionPyramid->SetRegion(metricRegion); - fixedImageRegionPyramid->SetSchedule(fixedImagePyramid->GetSchedule()); - - - - - // //======================================================= - // // Rigid Transform - // //======================================================= - // typedef itk::Euler3DTransform RigidTransformType; - // RigidTransformType::Pointer rigidTransform; - // if (m_ArgsInfo.rigid_given) - // { - // rigidTransform=RigidTransformType::New(); - // itk::Matrix rigidTransformMatrix=clitk::ReadMatrix3D(m_ArgsInfo.rigid_arg); - - // //Set the rotation - // itk::Matrix finalRotation = clitk::GetRotationalPartMatrix3D(rigidTransformMatrix); - // rigidTransform->SetMatrix(finalRotation); - - // //Set the translation - // itk::Vector finalTranslation = clitk::GetTranslationPartMatrix3D(rigidTransformMatrix); - // rigidTransform->SetTranslation(finalTranslation); - - // } - - - //======================================================= - // ShapedBSplineSpatioTemporal Transform - //======================================================= - typedef clitk::ShapedBLUTSpatioTemporalDeformableTransform TransformType; - typename TransformType::Pointer transform= TransformType::New(); - transform->SetTransformShape(m_ArgsInfo.shape_arg); - if (fixedMask) transform->SetMask( fixedMask ); - // if (rigidTransform) transform->SetBulkTransform( rigidTransform ); - - //------------------------------------------------------------------------- - // The transform initializer - //------------------------------------------------------------------------- - typedef clitk::ShapedBLUTSpatioTemporalDeformableTransformInitializer< TransformType,FixedImageType> InitializerType; - typename InitializerType::Pointer initializer = InitializerType::New(); - initializer->SetVerbose(m_Verbose); - initializer->SetImage(fixedImagePyramid->GetOutput(0)); - initializer->SetTransform(transform); - - //------------------------------------------------------------------------- - // Order - //------------------------------------------------------------------------- - typename FixedImageType::RegionType::SizeType splineOrders ; - splineOrders.Fill(3); - if (m_ArgsInfo.order_given) - for(unsigned int i=0; iSetSplineOrders(splineOrders); - - //------------------------------------------------------------------------- - // Levels - //------------------------------------------------------------------------- - - // Spacing - if (m_ArgsInfo.spacing_given) - { - initializer->m_ControlPointSpacingArray.resize(m_ArgsInfo.levels_arg); - initializer->SetControlPointSpacing(m_ArgsInfo.spacing_arg); - initializer->m_ControlPointSpacingArray[m_ArgsInfo.levels_arg-1]=initializer->m_ControlPointSpacing; - if (m_Verbose) std::cout<<"Using a control point spacing of "<m_ControlPointSpacingArray[m_ArgsInfo.levels_arg-1] - <<" at level "<m_ControlPointSpacingArray[m_ArgsInfo.levels_arg-1-i]=initializer->m_ControlPointSpacingArray[m_ArgsInfo.levels_arg-i]*2; - initializer->m_ControlPointSpacingArray[m_ArgsInfo.levels_arg-1-i][ImageDimension-1]=2; - if (m_Verbose) std::cout<<"Using a control point spacing of "<m_ControlPointSpacingArray[m_ArgsInfo.levels_arg-1-i] - <<" at level "<m_NumberOfControlPointsInsideTheImageArray.resize(m_ArgsInfo.levels_arg); - initializer->SetNumberOfControlPointsInsideTheImage(m_ArgsInfo.control_arg); - initializer->m_NumberOfControlPointsInsideTheImageArray[m_ArgsInfo.levels_arg-1]=initializer->m_NumberOfControlPointsInsideTheImage; - if (m_Verbose) std::cout<<"Using "<< initializer->m_NumberOfControlPointsInsideTheImageArray[m_ArgsInfo.levels_arg-1]<<"control points inside the image" - <<" at level "<m_NumberOfControlPointsInsideTheImageArray[m_ArgsInfo.levels_arg-1-i][j]=ceil ((double)initializer->m_NumberOfControlPointsInsideTheImageArray[m_ArgsInfo.levels_arg-i][j]/2.); - // initializer->m_NumberOfControlPointsInsideTheImageArray[m_ArgsInfo.levels_arg-1-i]=ceil ((double)initializer->m_NumberOfControlPointsInsideTheImageArray[m_ArgsInfo.levels_arg-i]/2.); - if (m_Verbose) std::cout<<"Using "<< initializer->m_NumberOfControlPointsInsideTheImageArray[m_ArgsInfo.levels_arg-1-i]<<"control points inside the image" - <<" at level "<SetControlPointSpacing( initializer->m_ControlPointSpacingArray[0]); - if (m_ArgsInfo.control_given) initializer->SetNumberOfControlPointsInsideTheImage(initializer->m_NumberOfControlPointsInsideTheImageArray[0]); - if (m_ArgsInfo.samplingFactor_given) initializer->SetSamplingFactors(m_ArgsInfo.samplingFactor_arg); - - // Initialize - initializer->InitializeTransform(); - - //------------------------------------------------------------------------- - // Initial parameters (passed by reference) - //------------------------------------------------------------------------- - typedef typename TransformType::ParametersType ParametersType; - const unsigned int numberOfParameters = transform->GetNumberOfParameters(); - ParametersType parameters(numberOfParameters); - parameters.Fill( 0.0 ); - transform->SetParameters( parameters ); - if (m_ArgsInfo.initCoeff_given) initializer->SetInitialParameters(m_ArgsInfo.initCoeff_arg, parameters); - - - //======================================================= - // Interpolator - //======================================================= - typedef clitk::GenericInterpolator GenericInterpolatorType; - typename GenericInterpolatorType::Pointer genericInterpolator=GenericInterpolatorType::New(); - genericInterpolator->SetArgsInfo(m_ArgsInfo); - typedef itk::InterpolateImageFunction< FixedImageType, TCoordRep > InterpolatorType; - typename InterpolatorType::Pointer interpolator=genericInterpolator->GetInterpolatorPointer(); - - - //======================================================= - // Metric - //======================================================= - typedef clitk::GenericMetric< args_info_clitkShapedBLUTSpatioTemporalDIR, FixedImageType,MovingImageType > GenericMetricType; - typename GenericMetricType::Pointer genericMetric=GenericMetricType::New(); - genericMetric->SetArgsInfo(m_ArgsInfo); - genericMetric->SetFixedImage(fixedImagePyramid->GetOutput(0)); - if (fixedMask) genericMetric->SetFixedImageMask(fixedMask); - genericMetric->SetFixedImageRegion(fixedImageRegionPyramid->GetOutput(0)); - typedef itk::ImageToImageMetric< FixedImageType, MovingImageType > MetricType; - typename MetricType::Pointer metric=genericMetric->GetMetricPointer(); - if (movingMask) metric->SetMovingImageMask(movingMask); - -#if defined(ITK_USE_OPTIMIZED_REGISTRATION_METHODS) || ITK_VERSION_MAJOR >= 4 - if (threadsGiven) metric->SetNumberOfThreads( threads ); -#else - if (m_Verbose) std::cout<<"Not setting the number of threads (not compiled with USE_OPTIMIZED_REGISTRATION_METHODS)..."< GenericOptimizerType; - GenericOptimizerType::Pointer genericOptimizer = GenericOptimizerType::New(); - genericOptimizer->SetArgsInfo(m_ArgsInfo); - genericOptimizer->SetMaximize(genericMetric->GetMaximize()); - genericOptimizer->SetNumberOfParameters(transform->GetNumberOfParameters()); - typedef itk::SingleValuedNonLinearOptimizer OptimizerType; - OptimizerType::Pointer optimizer = genericOptimizer->GetOptimizerPointer(); - - - //======================================================= - // Registration - //======================================================= - typedef clitk::SpatioTemporalMultiResolutionImageRegistrationMethod< FixedImageType, MovingImageType > RegistrationType; - typename RegistrationType::Pointer registration = RegistrationType::New(); - registration->SetMetric( metric ); - registration->SetOptimizer( optimizer ); - registration->SetInterpolator( interpolator ); - registration->SetTransform (transform); - if(threadsGiven) registration->SetNumberOfThreads(threads); - registration->SetFixedImage( croppedFixedImage ); - registration->SetMovingImage( movingImage ); - registration->SetFixedImageRegion( metricRegion ); - registration->SetFixedImagePyramid( fixedImagePyramid ); - registration->SetMovingImagePyramid( movingImagePyramid ); - registration->SetInitialTransformParameters( transform->GetParameters() ); - registration->SetNumberOfLevels( m_ArgsInfo.levels_arg ); - if (m_Verbose) std::cout<<"Setting the number of resolution levels to "< CommandIterationUpdateType; - typename CommandIterationUpdateType::Pointer observer = CommandIterationUpdateType::New(); - observer->SetInitializer(initializer); - observer->SetArgsInfo(m_ArgsInfo); - observer->SetOptimizer(genericOptimizer); - optimizer->AddObserver( itk::IterationEvent(), observer ); - - // Output level info - typedef RegistrationInterfaceCommand CommandType; - typename CommandType::Pointer command = CommandType::New(); - command->SetInitializer(initializer); - command->SetArgsInfo(m_ArgsInfo); - command->SetCommandIterationUpdate(observer); - command->SetMaximize(genericMetric->GetMaximize()); - command->SetMetricRegion(metricRegion); - registration->AddObserver( itk::IterationEvent(), command ); - } - - - //======================================================= - // Let's go - //======================================================= - if (m_Verbose) std::cout << std::endl << "Starting Registration" << std::endl; - - try - { - registration->StartRegistration(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught while registering!" << std::endl; - std::cerr << err << std::endl; - return; - } - - - //======================================================= - // Get the result - //======================================================= - OptimizerType::ParametersType finalParameters = registration->GetLastTransformParameters(); - transform->SetParameters( finalParameters ); - if (m_Verbose) - { - std::cout<<"Stop condition description: " - <GetOptimizer()->GetStopConditionDescription()<GetCoefficientImage(); - typedef itk::ImageFileWriter CoeffWriterType; - typename CoeffWriterType::Pointer coeffWriter=CoeffWriterType::New(); - coeffWriter->SetInput(coefficientImage); - coeffWriter->SetFileName(m_ArgsInfo.coeff_arg); - coeffWriter->Update(); - - } - if (m_ArgsInfo.padCoeff_given) - { - typedef itk::Image, ImageDimension> CoefficientImageType; - typename CoefficientImageType::Pointer coefficientImage =transform->GetPaddedCoefficientImage(); - typedef itk::ImageFileWriter CoeffWriterType; - typename CoeffWriterType::Pointer coeffWriter=CoeffWriterType::New(); - coeffWriter->SetInput(coefficientImage); - coeffWriter->SetFileName(m_ArgsInfo.padCoeff_arg); - coeffWriter->Update(); - } - - - //======================================================= - // Generate the DVF (4D with 3 comps and 4D with 4 comps) - //======================================================= - typedef itk::Vector< float, SpaceDimension > DisplacementType; - typedef itk::Vector< float, ImageDimension > Displacement4DType; - typedef itk::Image< DisplacementType, ImageDimension > DeformationFieldType; - typedef itk::Image< Displacement4DType, ImageDimension > DeformationField4DType; - - typename DeformationFieldType::Pointer field = DeformationFieldType::New(); - typename DeformationField4DType::Pointer field4D = DeformationField4DType::New(); - field->SetRegions( fixedImageRegion ); - field->SetOrigin( fixedImage->GetOrigin() ); - field->SetSpacing( fixedImage->GetSpacing() ); - field->SetDirection( fixedImage->GetDirection() ); - field->Allocate(); - field4D->SetRegions( fixedImageRegion ); - field4D->SetOrigin( fixedImage->GetOrigin() ); - field4D->SetSpacing( fixedImage->GetSpacing() ); - field4D->SetDirection( fixedImage->GetDirection() ); - field4D->Allocate(); - - typedef itk::ImageRegionIteratorWithIndex< DeformationFieldType > FieldIterator; - typedef itk::ImageRegionIteratorWithIndex< DeformationField4DType > Field4DIterator; - FieldIterator fi( field, fixedImageRegion ); - Field4DIterator fi4D( field4D, fixedImageRegion ); - fi.GoToBegin(); - fi4D.GoToBegin(); - - typename TransformType::InputPointType fixedPoint; - typename TransformType::OutputPointType movingPoint; - typename DeformationFieldType::IndexType index; - - DisplacementType displacement; - Displacement4DType displacement4D; - displacement4D[ImageDimension-1]=0; - while( ! fi.IsAtEnd() ) - { - index = fi.GetIndex(); - field->TransformIndexToPhysicalPoint( index, fixedPoint ); - movingPoint = transform->TransformPoint( fixedPoint ); - for (unsigned int i=0; i FieldWriterType; - typename FieldWriterType::Pointer fieldWriter = FieldWriterType::New(); - fieldWriter->SetFileName( m_ArgsInfo.vf_arg ); - fieldWriter->SetInput( field ); - try - { - fieldWriter->Update(); - } - catch( itk::ExceptionObject & excp ) - { - std::cerr << "Exception thrown writing the DVF" << std::endl; - std::cerr << excp << std::endl; - return; - } - - - //======================================================= - // Resample the moving image - //======================================================= - typedef itk::WarpImageFilter< MovingImageType, FixedImageType, DeformationField4DType > WarpFilterType; - typename WarpFilterType::Pointer warp = WarpFilterType::New(); - -#if ITK_VERSION_MAJOR >= 4 - warp->SetDisplacementField( field4D ); -#else - warp->SetDeformationField( field4D ); -#endif - warp->SetInput( movingImageReader->GetOutput() ); - warp->SetOutputOrigin( fixedImage->GetOrigin() ); - warp->SetOutputSpacing( fixedImage->GetSpacing() ); - warp->SetOutputDirection( fixedImage->GetDirection() ); - warp->SetEdgePaddingValue( 0.0 ); - warp->Update(); - - - //======================================================= - // Write the warped image - //======================================================= - typedef itk::ImageFileWriter< FixedImageType > WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName( m_ArgsInfo.output_arg ); - writer->SetInput( warp->GetOutput() ); - - try - { - writer->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught !" << std::endl; - std::cerr << err << std::endl; - return; - } - - - //======================================================= - // Calculate the difference after the deformable transform - //======================================================= - typedef clitk::DifferenceImageFilter< FixedImageType, FixedImageType> DifferenceFilterType; - if (m_ArgsInfo.after_given) - { - typename DifferenceFilterType::Pointer difference = DifferenceFilterType::New(); - difference->SetValidInput( fixedImage ); - difference->SetTestInput( warp->GetOutput() ); - - try - { - difference->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught calculating the difference !" << std::endl; - std::cerr << err << std::endl; - return; - } - - typename WriterType::Pointer differenceWriter=WriterType::New(); - differenceWriter->SetInput(difference->GetOutput()); - differenceWriter->SetFileName(m_ArgsInfo.after_arg); - differenceWriter->Update(); - - } - - - //======================================================= - // Calculate the difference before the deformable transform - //======================================================= - if( m_ArgsInfo.before_given ) - { - - typename FixedImageType::Pointer moving=FixedImageType::New(); - if (m_ArgsInfo.rigid_given) - { - typedef itk::ResampleImageFilter ResamplerType; - typename ResamplerType::Pointer resampler=ResamplerType::New(); - resampler->SetInput(movingImage); - resampler->SetOutputOrigin(fixedImage->GetOrigin()); - resampler->SetSize(fixedImage->GetLargestPossibleRegion().GetSize()); - resampler->SetOutputSpacing(fixedImage->GetSpacing()); - resampler->SetDefaultPixelValue( 0. ); - //resampler->SetTransform(rigidTransform); - resampler->Update(); - moving=resampler->GetOutput(); - } - else - moving=movingImage; - - typename DifferenceFilterType::Pointer difference = DifferenceFilterType::New(); - difference->SetValidInput( fixedImage ); - difference->SetTestInput( moving ); - - try - { - difference->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught calculating the difference !" << std::endl; - std::cerr << err << std::endl; - return; - } - - typename WriterType::Pointer differenceWriter=WriterType::New(); - writer->SetFileName( m_ArgsInfo.before_arg ); - writer->SetInput( difference->GetOutput() ); - writer->Update( ); - } - - return; - - } -}//end clitk - -#endif //#define clitkShapedBLUTSpatioTemporalDIRGenericFilter_txx diff --git a/segmentation/clitkCalculateDistanceMap.cxx b/segmentation/clitkCalculateDistanceMap.cxx deleted file mode 100644 index b533249..0000000 --- a/segmentation/clitkCalculateDistanceMap.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkCalculateDistanceMapGenericFilter.txx - * @author Jef Vandemeulebroucke - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkCalculateDistanceMap_ggo.h" -#include "clitkIO.h" -#include "clitkCalculateDistanceMapGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkCalculateDistanceMap, args_info); - CLITK_INIT; - - // Filter - clitk::CalculateDistanceMapGenericFilter::Pointer genericFilter=clitk::CalculateDistanceMapGenericFilter::New(); - genericFilter->SetArgsInfo(args_info); - - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/segmentation/clitkCalculateDistanceMap.ggo b/segmentation/clitkCalculateDistanceMap.ggo deleted file mode 100644 index cf9ddac..0000000 --- a/segmentation/clitkCalculateDistanceMap.ggo +++ /dev/null @@ -1,13 +0,0 @@ -#File clitkCalculateDistanceMap.ggo -package "clitkCalculateDistanceMap" -version "1.0" -purpose "Calculate the distance map(float) of a binary image: Signed Danielsson Distance Map filter or Fast Marching filter" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "invert" - "Set inside instead of outside to positive" flag off -option "fastMarching" - "Use the fast marching filter" flag off - diff --git a/segmentation/clitkCalculateDistanceMapGenericFilter.cxx b/segmentation/clitkCalculateDistanceMapGenericFilter.cxx deleted file mode 100644 index e904c8b..0000000 --- a/segmentation/clitkCalculateDistanceMapGenericFilter.cxx +++ /dev/null @@ -1,69 +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 clitkCalculateDistanceMapGenericFilter_cxx -#define clitkCalculateDistanceMapGenericFilter_cxx - -/* ================================================= - * @file clitkCalculateDistanceMapGenericFilter.cxx - * @author Jef Vandemeulebroucke - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkCalculateDistanceMapGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - CalculateDistanceMapGenericFilter::CalculateDistanceMapGenericFilter() - { - m_Verbose=false; - } - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void CalculateDistanceMapGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_ArgsInfo.input_arg, Dimension, PixelType); - - // Call UpdateWithDim() - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - // else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2 or 3 Dimensions!!!"< - * @date - * - * @brief - * - ===================================================*/ - - -// clitk include -#include "clitkCommon.h" -#include "clitkImageCommon.h" -#include "clitkCalculateDistanceMap_ggo.h" - -//itk include -#include "itkLightObject.h" -#include "itkSignedDanielssonDistanceMapImageFilter.h" - -namespace clitk -{ - - - class ITK_EXPORT CalculateDistanceMapGenericFilter : public itk::LightObject - { - public: - //---------------------------------------- - // ITK - //---------------------------------------- - typedef CalculateDistanceMapGenericFilter Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( CalculateDistanceMapGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkCalculateDistanceMap & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - CalculateDistanceMapGenericFilter(); - ~CalculateDistanceMapGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - bool m_Verbose; - args_info_clitkCalculateDistanceMap m_ArgsInfo; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkCalculateDistanceMapGenericFilter.txx" -#endif - -#endif // #define clitkCalculateDistanceMapGenericFilter_h diff --git a/segmentation/clitkCalculateDistanceMapGenericFilter.txx b/segmentation/clitkCalculateDistanceMapGenericFilter.txx deleted file mode 100644 index 08b14e5..0000000 --- a/segmentation/clitkCalculateDistanceMapGenericFilter.txx +++ /dev/null @@ -1,117 +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 clitkCalculateDistanceMapGenericFilter_txx -#define clitkCalculateDistanceMapGenericFilter_txx - -/* ================================================= - * @file clitkCalculateDistanceMapGenericFilter.txx - * @author Jef Vandemeulebroucke - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - CalculateDistanceMapGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - CalculateDistanceMapGenericFilter::UpdateWithDimAndPixelType() - { - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; //needs to be floating point - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_ArgsInfo.input_arg); - typename InputImageType::Pointer input= reader->GetOutput(); - - // The fastMarching filter - typename OutputImageType::Pointer output; - if (m_ArgsInfo.fastMarching_flag) - { -// typedef itk::FastMarchingImageFilter< OutputImageType, OutputImageType > FastMarchingFilterType; -// FastMarchingFilterType::Pointer fastMarchingFilter=FastMarchingFilterType::New(); -// fastMarchingFilter-> - } - - // The signed Distance map filter - else - { - typedef itk::SignedDanielssonDistanceMapImageFilter DistanceMapImageFilterType; - typename DistanceMapImageFilterType::Pointer distanceMapImageFilter = DistanceMapImageFilterType::New(); - distanceMapImageFilter->SetInput(input); - distanceMapImageFilter->SetInsideIsPositive(m_ArgsInfo.invert_flag); - distanceMapImageFilter->Update(); - output=distanceMapImageFilter->GetOutput(); - } - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkCalculateDistanceMapGenericFilter_txx diff --git a/segmentation/clitkFillImageRegion.cxx b/segmentation/clitkFillImageRegion.cxx deleted file mode 100644 index 01bcce7..0000000 --- a/segmentation/clitkFillImageRegion.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkFillImageRegion.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkFillImageRegion_ggo.h" -#include "clitkIO.h" -#include "clitkFillImageRegionGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkFillImageRegion, args_info); - CLITK_INIT; - - // Filter - clitk::FillImageRegionGenericFilter::Pointer genericFilter=clitk::FillImageRegionGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/segmentation/clitkFillImageRegion.ggo b/segmentation/clitkFillImageRegion.ggo deleted file mode 100644 index 469df5b..0000000 --- a/segmentation/clitkFillImageRegion.ggo +++ /dev/null @@ -1,17 +0,0 @@ -#File clitkFillImageRegion.ggo -package "clitkFillImageRegion" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "shape" s "Region shape: 0=rectangular, 1=ellipsoide" int no default="0" -option "size" - "Rectangular: size of the region (voxels)" int no multiple default="10" -option "index" - "Rectangular: start index of the region (voxels)" int no multiple default="0" -option "center" c "Ellipsoide: center of the ellips (mm, defaults to the middle of the image)" double no multiple -option "offset" - "Ellipsoide: offset of the middle of the ellips wrt center (mm)" double no multiple -option "axes" a "Half axes of ellips (mm)" double no multiple default="10.0" -option "value" p "Padding value for the region" double no default="0.0" diff --git a/segmentation/clitkFillImageRegionGenericFilter.cxx b/segmentation/clitkFillImageRegionGenericFilter.cxx deleted file mode 100644 index 6ce4290..0000000 --- a/segmentation/clitkFillImageRegionGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkFillImageRegionGenericFilter_cxx -#define clitkFillImageRegionGenericFilter_cxx - -/* ================================================= - * @file clitkFillImageRegionGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkFillImageRegionGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - FillImageRegionGenericFilter::FillImageRegionGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void FillImageRegionGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - // else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2 or 3 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( FillImageRegionGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkFillImageRegion & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - FillImageRegionGenericFilter(); - ~FillImageRegionGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkFillImageRegion m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkFillImageRegionGenericFilter.txx" -#endif - -#endif // #define clitkFillImageRegionGenericFilter_h diff --git a/segmentation/clitkFillImageRegionGenericFilter.txx b/segmentation/clitkFillImageRegionGenericFilter.txx deleted file mode 100644 index 5b88503..0000000 --- a/segmentation/clitkFillImageRegionGenericFilter.txx +++ /dev/null @@ -1,197 +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 clitkFillImageRegionGenericFilter_txx -#define clitkFillImageRegionGenericFilter_txx - -/* ================================================= - * @file clitkFillImageRegionGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - FillImageRegionGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - FillImageRegionGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Processing - switch(m_ArgsInfo.shape_arg) - { - //rectangular - case 0: - { - // Get Size and index of the region - typename InputImageType::SizeType size; - if (m_ArgsInfo.size_given) - for(unsigned int i=0; i IteratorType; - IteratorType it(input, region); - it.GoToBegin(); - while (!it.IsAtEnd()) { - it.Set(m_ArgsInfo.value_arg); - ++it; - } - - break; - } - - //ellipsoide - case 1: - { - - //Get the center - typename InputImageType::PointType center; - if (m_ArgsInfo.center_given) - for(unsigned int i=0; iGetLargestPossibleRegion().GetSize(); - typename InputImageType::SpacingType spacing= input->GetSpacing(); - typename InputImageType::PointType origin= input->GetOrigin(); - for (unsigned int i=0; i offset; - for (unsigned int i=0; i axes; - if (m_ArgsInfo.axes_given) - for(unsigned int i=0; i IteratorType; - IteratorType it(input, input->GetLargestPossibleRegion()); - it.GoToBegin(); - - typename InputImageType::PointType point; - typename InputImageType::IndexType index; - double distance; - - while (!it.IsAtEnd()) - { - index=it.GetIndex(); - input->TransformIndexToPhysicalPoint(index, point); - distance=0.0; - for(unsigned int i=0; i WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(input); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkFillImageRegionGenericFilter_txx diff --git a/segmentation/clitkFillMask.cxx b/segmentation/clitkFillMask.cxx deleted file mode 100644 index 231586d..0000000 --- a/segmentation/clitkFillMask.cxx +++ /dev/null @@ -1,57 +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 -===========================================================================*/ -/*------------------------------------------------------------------------ - - Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de - l'Image). All rights reserved. See Doc/License.txt or - http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - - ------------------------------------------------------------------------*/ - -// clitk -#include "clitkFillMask_ggo.h" -#include "clitkIO.h" -#include "clitkCommon.h" -#include "clitkFillMaskGenericFilter.h" - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkFillMask,args_info); - CLITK_INIT; - - // Filter - typedef clitk::FillMaskGenericFilter FilterType; - FilterType::Pointer filter = FilterType::New(); - - filter->SetArgsInfo(args_info); - - try { - filter->Update(); - } catch(std::runtime_error e) { - std::cerr << e.what() << std::endl; - } - - return EXIT_SUCCESS; -} // This is the end, my friend -//-------------------------------------------------------------------- diff --git a/segmentation/clitkFillMask.ggo b/segmentation/clitkFillMask.ggo deleted file mode 100644 index 60e80e7..0000000 --- a/segmentation/clitkFillMask.ggo +++ /dev/null @@ -1,13 +0,0 @@ -#File clitkFillMask.ggo -package "clitkFillMask" -version "1.0" -purpose "Fill in holes (bg=0) in an object (fg=1) of a binary image, by running over the slices and retaining only one connected component bg." - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "dir" d "Directions (axes) to perform filling (defaults to 2,1,0)" int multiple no - - diff --git a/segmentation/clitkFillMaskGenericFilter.cxx b/segmentation/clitkFillMaskGenericFilter.cxx deleted file mode 100644 index cdf9f72..0000000 --- a/segmentation/clitkFillMaskGenericFilter.cxx +++ /dev/null @@ -1,95 +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 clitkFillMaskGenericFilter_cxx -#define clitkFillMaskGenericFilter_cxx - -/* ================================================= - * @file clitkFillMaskGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkFillMaskGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - FillMaskGenericFilter::FillMaskGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void FillMaskGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithPixelType - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithPixelType(); - // } - - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithPixelType(); - } - } - - -} //end clitk - -#endif //#define clitkFillMaskGenericFilter_cxx diff --git a/segmentation/clitkFillMaskGenericFilter.h b/segmentation/clitkFillMaskGenericFilter.h deleted file mode 100644 index f87aeaf..0000000 --- a/segmentation/clitkFillMaskGenericFilter.h +++ /dev/null @@ -1,68 +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 CLITKFILLMASKGENERICFILTER_H -#define CLITKFILLMASKGENERICFILTER_H - -// clitk -#include "clitkImageToImageGenericFilter.h" -#include "clitkFillMaskFilter.h" - -//-------------------------------------------------------------------- -namespace clitk -{ - - template - class ITK_EXPORT FillMaskGenericFilter : - public ImageToImageGenericFilter > - { - public: - //-------------------------------------------------------------------- - FillMaskGenericFilter(); - - //-------------------------------------------------------------------- - typedef FillMaskGenericFilter Self; - typedef ImageToImageGenericFilter Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - //-------------------------------------------------------------------- - itkNewMacro(Self); - itkTypeMacro(FillMaskGenericFilter, LightObject); - - //-------------------------------------------------------------------- - void SetArgsInfo(const ArgsInfoType & a); - - //-------------------------------------------------------------------- - // Main function called each time the filter is updated - template - void UpdateWithInputImageType(); - - protected: - template void InitializeImageType(); - ArgsInfoType mArgsInfo; - }; // end class - //-------------------------------------------------------------------- - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkFillMaskGenericFilter.txx" -#endif - -#endif // #define CLITKFILLMASKGENERICFILTER_H diff --git a/segmentation/clitkFillMaskGenericFilter.txx b/segmentation/clitkFillMaskGenericFilter.txx deleted file mode 100644 index 70d2442..0000000 --- a/segmentation/clitkFillMaskGenericFilter.txx +++ /dev/null @@ -1,88 +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 CLITKFILLMASKGENERICFILTER_TXX -#define CLITKFILLMASKGENERICFILTER_TXX - -#include "clitkImageCommon.h" - -//-------------------------------------------------------------------- -template -clitk::FillMaskGenericFilter::FillMaskGenericFilter(): - ImageToImageGenericFilter("FillMask") -{ - this->SetFilterBase(NULL); - InitializeImageType<3>(); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -template -template -void clitk::FillMaskGenericFilter::InitializeImageType() -{ - ADD_IMAGE_TYPE(Dim, uchar); - ADD_IMAGE_TYPE(Dim, short); - // ADD_IMAGE_TYPE(Dim, int); - // ADD_IMAGE_TYPE(Dim, float); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -template -void clitk::FillMaskGenericFilter::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::FillMaskGenericFilter::UpdateWithInputImageType() -{ - // Reading input - typename ImageType::Pointer input = this->template GetInput(0); - - // Create filter - typedef clitk::FillMaskFilter FilterType; - typename FilterType::Pointer filter = FilterType::New(); - - // Set Options - filter->SetInput(input); - filter->SetOptionsFromArgsInfo(mArgsInfo); - - // Go ! - filter->Update(); - - // Write/Save results - typename ImageType::Pointer output = filter->GetOutput(); - this->template SetNextOutput(output); -} -//-------------------------------------------------------------------- - -#endif //#define CLITKFILLMASKGENERICFILTER_TXX diff --git a/segmentation/clitkLevelSetSegmentation.cxx b/segmentation/clitkLevelSetSegmentation.cxx deleted file mode 100644 index 0ccadc6..0000000 --- a/segmentation/clitkLevelSetSegmentation.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkLevelSetSegmentationGenericFilter.txx - * @author Jef Vandemeulebroucke - * @date 25 June 2009 - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkLevelSetSegmentation_ggo.h" -#include "clitkIO.h" -#include "clitkLevelSetSegmentationGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkLevelSetSegmentation, args_info); - CLITK_INIT; - - // Filter - clitk::LevelSetSegmentationGenericFilter::Pointer genericFilter=clitk::LevelSetSegmentationGenericFilter::New(); - genericFilter->SetArgsInfo(args_info); - - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/segmentation/clitkLevelSetSegmentation.ggo b/segmentation/clitkLevelSetSegmentation.ggo deleted file mode 100644 index 42048e9..0000000 --- a/segmentation/clitkLevelSetSegmentation.ggo +++ /dev/null @@ -1,44 +0,0 @@ -#File clitkLevelSetSegmentation.ggo -package "clitkLevelSetSegmentation" -version "1.0" -purpose "Perform a levelset segmentation. Standard preprocessing is available to create the feature image." - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -section "Input/Output" - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "feature" - "Feature image (speed image: 0 at borders)" string no - - -section "Monitoring" - -option "monitorIt" - "Write an image every x iterations" int no default="50" -option "monitorIm" - "Name of the monitoring image" string no - - -section "Levelset parameter" - -option "GAC" - "Use Geodesic Active Contours (default)" flag off -option "levelSet" - "Output the level set image (unthresholded)" string no -option "propScale" - "Propagation scale" double no default="1.0" -option "curveScale" - "Curve scale" double no default="1.0" -option "advectionScale" - "Advection scale" double no default="1.0" -option "maxRMS" - "Max RMS error" double no default="0.01" -option "iter" - "Max number of iterations" int no default="10" - - -section "Feature preprocessing" - -option "smooth" - "Smooth feature image (Curvature Anisotropic Diffusion)" flag off -option "timeStep" - "Smoothing: time step" double no default="0.125" -option "cond" - "Smoothing: conduction" double no default="5" -option "iterSmooth" - "Smoothing: iterations" int no default="9" -option "gradMag" - "Calculate gradient magnitude" flag off -option "gradMagGauss" - "Calculate gradient magnitude using recursive gaussian filter" flag off -option "sigma" - "Sigma for gaussian" double no default="1.0" -option "sigmoid" - "Sigmoid function" flag off -option "alpha" - "Sigmoid: (A+B)/2 (A to be mapped to 0, B to 1)" double no default="1.0" -option "beta" - "Sigmoid: (B-A)/6<0 (A to be mapped to 0, B to 1)" double no default="0.0" diff --git a/segmentation/clitkLevelSetSegmentationGenericFilter.cxx b/segmentation/clitkLevelSetSegmentationGenericFilter.cxx deleted file mode 100644 index 5541d2b..0000000 --- a/segmentation/clitkLevelSetSegmentationGenericFilter.cxx +++ /dev/null @@ -1,70 +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 clitkLevelSetSegmentationGenericFilter_cxx -#define clitkLevelSetSegmentationGenericFilter_cxx - -/* ================================================= - * @file clitkLevelSetSegmentationGenericFilter.cxx - * @author Jef Vandemeulebroucke - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkLevelSetSegmentationGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - LevelSetSegmentationGenericFilter::LevelSetSegmentationGenericFilter() - { - m_Verbose=false; - } - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void LevelSetSegmentationGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_ArgsInfo.input_arg, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - // else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2 or 3 Dimensions!!!"< - * @date - * - * @brief - * - ===================================================*/ - - -// clitk include -#include "clitkIO.h" -#include "clitkCommon.h" -#include "clitkImageCommon.h" -#include "clitkLevelSetSegmentation_ggo.h" - -//itk include -#include "itkLightObject.h" -#include "itkGeodesicActiveContourLevelSetImageFilter.h" -#include "itkBinaryThresholdImageFilter.h" -#include "itkCurvatureAnisotropicDiffusionImageFilter.h" -#include "itkGradientMagnitudeRecursiveGaussianImageFilter.h" -#include "itkGradientMagnitudeImageFilter.h" -#include "itkSigmoidImageFilter.h" - -namespace clitk -{ - - - class ITK_EXPORT LevelSetSegmentationGenericFilter : public itk::LightObject - { - public: - //---------------------------------------- - // ITK - //---------------------------------------- - typedef LevelSetSegmentationGenericFilter Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( LevelSetSegmentationGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(args_info_clitkLevelSetSegmentation a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - } - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - LevelSetSegmentationGenericFilter(); - ~LevelSetSegmentationGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - bool m_Verbose; - args_info_clitkLevelSetSegmentation m_ArgsInfo; - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkLevelSetSegmentationGenericFilter.txx" -#endif - -#endif // #define clitkLevelSetSegmentationGenericFilter_h diff --git a/segmentation/clitkLevelSetSegmentationGenericFilter.txx b/segmentation/clitkLevelSetSegmentationGenericFilter.txx deleted file mode 100644 index d5878f7..0000000 --- a/segmentation/clitkLevelSetSegmentationGenericFilter.txx +++ /dev/null @@ -1,234 +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 clitkLevelSetSegmentationGenericFilter_txx -#define clitkLevelSetSegmentationGenericFilter_txx - -/* ================================================= - * @file clitkLevelSetSegmentationGenericFilter.txx - * @author Jef Vandemeulebroucke - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - LevelSetSegmentationGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - // } - - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - // else if (PixelType == "unsigned_char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - //else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - // } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - LevelSetSegmentationGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image FeatureImageType; - typedef itk::Image OutputImageType; - - // Read the input (initial level set) - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_ArgsInfo.input_arg); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Feature image - typename FeatureImageType::Pointer featureImage; - if( m_ArgsInfo.feature_given) - { - // Read it - typedef itk::ImageFileReader FeatureReaderType; - typename FeatureReaderType::Pointer featureReader = FeatureReaderType::New(); - featureReader->SetFileName(m_ArgsInfo.feature_arg); - featureReader->Update(); - featureImage=featureReader->GetOutput(); - - // Edge preserving smoothing - if (m_ArgsInfo.smooth_flag) - { - typedef itk::CurvatureAnisotropicDiffusionImageFilter SmoothingFilterType; - typename SmoothingFilterType::Pointer smoothingFilter = SmoothingFilterType::New(); - smoothingFilter->SetInput(featureImage); - smoothingFilter->SetTimeStep( m_ArgsInfo.timeStep_arg ); - smoothingFilter->SetNumberOfIterations( m_ArgsInfo.iterSmooth_arg ); - smoothingFilter->SetConductanceParameter( m_ArgsInfo.cond_arg ); - smoothingFilter->Update(); - featureImage=smoothingFilter->GetOutput(); - - } - - // Recursive gaussian gradient magnitude - if (m_ArgsInfo.gradMag_flag) - { - typedef itk::GradientMagnitudeImageFilter< FeatureImageType,FeatureImageType> GradientFilterType; - typename GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New(); - gradientMagnitude->SetInput(featureImage); - gradientMagnitude->Update(); - featureImage=gradientMagnitude->GetOutput(); - - } - - // Recursive gaussian gradient magnitude - if (m_ArgsInfo.gradMagGauss_flag) - { - typedef itk::GradientMagnitudeRecursiveGaussianImageFilter< FeatureImageType,FeatureImageType> GradientFilterType; - typename GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New(); - gradientMagnitude->SetInput(featureImage); - gradientMagnitude->SetSigma( m_ArgsInfo.sigma_arg ); - gradientMagnitude->Update(); - featureImage=gradientMagnitude->GetOutput(); - } - - // Sigmoid - if (m_ArgsInfo.sigmoid_flag) - { - typedef itk::SigmoidImageFilter SigmoidFilterType; - typename SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New(); - sigmoid->SetInput(featureImage); - sigmoid->SetAlpha( m_ArgsInfo.alpha_arg ); - sigmoid->SetBeta( m_ArgsInfo.beta_arg ); - sigmoid->Update(); - featureImage=sigmoid->GetOutput(); - } - - } - - // Filter - typename FeatureImageType::Pointer output; - if (m_ArgsInfo.GAC_flag) - { - - // Create the filter - typedef itk::GeodesicActiveContourLevelSetImageFilter< InputImageType, FeatureImageType > GeodesicActiveContourFilterType; - typename GeodesicActiveContourFilterType::Pointer geodesicActiveContour = GeodesicActiveContourFilterType::New(); - - geodesicActiveContour->SetPropagationScaling( m_ArgsInfo.propScale_arg ); - geodesicActiveContour->SetCurvatureScaling( m_ArgsInfo.curveScale_arg ); - geodesicActiveContour->SetAdvectionScaling( m_ArgsInfo.advectionScale_arg ); - geodesicActiveContour->SetMaximumRMSError( m_ArgsInfo.maxRMS_arg ); - geodesicActiveContour->SetInput( input ); - geodesicActiveContour->SetFeatureImage( featureImage ); - geodesicActiveContour->SetUseImageSpacing(true); - - // Monitor - unsigned int totalNumberOfIterations=0; - if(m_ArgsInfo.monitorIm_given) - { - geodesicActiveContour->SetNumberOfIterations( m_ArgsInfo.monitorIt_arg ); - while (true) - { - geodesicActiveContour->Update(); - totalNumberOfIterations+=geodesicActiveContour->GetElapsedIterations(); - if(m_Verbose) std::cout <<"Writing image after "<< totalNumberOfIterations<<"..."<(geodesicActiveContour->GetOutput(), m_ArgsInfo.monitorIm_arg); - geodesicActiveContour->SetInput(geodesicActiveContour->GetOutput()); - geodesicActiveContour->SetNumberOfIterations( std::min( (m_ArgsInfo.iter_arg-totalNumberOfIterations) ,(unsigned int) m_ArgsInfo.monitorIt_arg ) ); - if (totalNumberOfIterations> (unsigned int) m_ArgsInfo.iter_arg) break; - } - } - else - { - geodesicActiveContour->SetNumberOfIterations( m_ArgsInfo.iter_arg ); - geodesicActiveContour->Update(); - totalNumberOfIterations=geodesicActiveContour->GetElapsedIterations(); - } - - - // Print - std::cout << std::endl; - std::cout << "Max. no. iterations: " << m_ArgsInfo.iter_arg << std::endl; - std::cout << "Max. RMS error: " << geodesicActiveContour->GetMaximumRMSError() << std::endl; - std::cout << std::endl; - std::cout << "No. elpased iterations: " << totalNumberOfIterations << std::endl; - std::cout << "RMS change: " << geodesicActiveContour->GetRMSChange() << std::endl; - - output = geodesicActiveContour->GetOutput(); - } - - // Write levelset - if (m_ArgsInfo.levelSet_given) - { - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.levelSet_arg); - writer->SetInput(output); - writer->Update(); - } - - // Threshold - typedef itk::BinaryThresholdImageFilter< FeatureImageType,FeatureImageType > ThresholdingFilterType; - typename ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New(); - thresholder->SetLowerThreshold( -1000.0 ); - thresholder->SetUpperThreshold( 0.0 ); - thresholder->SetOutsideValue( 0 ); - thresholder->SetInsideValue( 1 ); - thresholder->SetInput( output ); - thresholder->Update(); - output=thresholder->GetOutput(); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkLevelSetSegmentationGenericFilter_txx diff --git a/segmentation/clitkMorphoReconstruction.cxx b/segmentation/clitkMorphoReconstruction.cxx deleted file mode 100644 index 64a9b29..0000000 --- a/segmentation/clitkMorphoReconstruction.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkMorphoReconstruction.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkMorphoReconstruction_ggo.h" -#include "clitkIO.h" -#include "clitkMorphoReconstructionGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkMorphoReconstruction, args_info); - CLITK_INIT; - - // Filter - clitk::MorphoReconstructionGenericFilter::Pointer genericFilter=clitk::MorphoReconstructionGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/segmentation/clitkMorphoReconstruction.ggo b/segmentation/clitkMorphoReconstruction.ggo deleted file mode 100644 index fbcb78d..0000000 --- a/segmentation/clitkMorphoReconstruction.ggo +++ /dev/null @@ -1,21 +0,0 @@ -#File clitkMorphoReconstruction.ggo -package "clitkMorphoReconstruction" -version "1.0" -purpose "Morphological reconstruction: restore a marker image by preserving regions and using a mask image. For opening and closing, the mask is the original image." - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -section "I/O" - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes - - -section "Morpho parameters" - -option "type" t "0=Erode, 1=Dilate, 2=Close (erode(dilate(x))), 3=Open (dilate(erode(x)))" int no default="0" -option "mask" m "0-1: Mask image filename" string no -option "full" - "2-3: Use full connectivity" flag off -option "int" - "2-3: Preserve intensities" flag off -option "radius" r "2-3: Preserve intensities" double no default="1.0" diff --git a/segmentation/clitkMorphoReconstructionGenericFilter.cxx b/segmentation/clitkMorphoReconstructionGenericFilter.cxx deleted file mode 100644 index 5511a8c..0000000 --- a/segmentation/clitkMorphoReconstructionGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkMorphoReconstructionGenericFilter_cxx -#define clitkMorphoReconstructionGenericFilter_cxx - -/* ================================================= - * @file clitkMorphoReconstructionGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkMorphoReconstructionGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - MorphoReconstructionGenericFilter::MorphoReconstructionGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void MorphoReconstructionGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - // else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2 or 3 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( MorphoReconstructionGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkMorphoReconstruction & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - MorphoReconstructionGenericFilter(); - ~MorphoReconstructionGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkMorphoReconstruction m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkMorphoReconstructionGenericFilter.txx" -#endif - -#endif // #define clitkMorphoReconstructionGenericFilter_h diff --git a/segmentation/clitkMorphoReconstructionGenericFilter.txx b/segmentation/clitkMorphoReconstructionGenericFilter.txx deleted file mode 100644 index 6858406..0000000 --- a/segmentation/clitkMorphoReconstructionGenericFilter.txx +++ /dev/null @@ -1,199 +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 clitkMorphoReconstructionGenericFilter_txx -#define clitkMorphoReconstructionGenericFilter_txx - -/* ================================================= - * @file clitkMorphoReconstructionGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - MorphoReconstructionGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - MorphoReconstructionGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Read the mask - typename InputImageType::Pointer mask; - if (m_ArgsInfo.mask_given) - { - typename InputReaderType::Pointer maskReader=InputReaderType::New(); - maskReader->SetFileName(m_ArgsInfo.mask_arg); - maskReader->Update(); - mask=maskReader->GetOutput(); - } - - - //--------------------------------- - // Find the type of action - //--------------------------------- - typedef itk::ImageToImageFilter ImageFilterType; - typename ImageFilterType::Pointer filter; - - typedef itk::BinaryBallStructuringElement KernelType; - KernelType structuringElement; - structuringElement.SetRadius(m_ArgsInfo.radius_arg); - structuringElement.CreateStructuringElement(); - - - switch(m_ArgsInfo.type_arg) - { - - case 0: - { - typedef itk::ReconstructionByErosionImageFilter FilterType; - typename FilterType::Pointer m = FilterType::New(); - m->SetMarkerImage(input); - m->SetMaskImage(mask); - - filter=m; - if(m_Verbose) std::cout<<"Using the reconstruction by erosion filter..."< FilterType; - typename FilterType::Pointer m = FilterType::New(); - m->SetMarkerImage(input); - m->SetMaskImage(mask); - - filter=m; - if(m_Verbose) std::cout<<"Using the reconstruction by dilation filter..."< FilterType; - typename FilterType::Pointer m = FilterType::New(); - m->SetInput(input); - m->SetKernel(structuringElement); - m->SetFullyConnected(m_ArgsInfo.full_flag); - m->SetPreserveIntensities(m_ArgsInfo.int_flag); - - filter=m; - if(m_Verbose) std::cout<<"Using the closing by reconstruction filter..."< FilterType; - typename FilterType::Pointer m = FilterType::New(); - m->SetInput(input); - m->SetKernel(structuringElement); - m->SetFullyConnected(m_ArgsInfo.full_flag); - m->SetPreserveIntensities(m_ArgsInfo.int_flag); - - filter=m; - if(m_Verbose) std::cout<<"Using the opening by reconstruction filter..."<SetInput(input); - try - { - filter->Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught executing the filter!" << std::endl; - std::cerr << err << std::endl; - return; - } - typename OutputImageType::Pointer output=filter->GetOutput(); - - - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkMorphoReconstructionGenericFilter_txx diff --git a/tools/clitkAverageTemporalDimension.cxx b/tools/clitkAverageTemporalDimension.cxx deleted file mode 100644 index 6304aed..0000000 --- a/tools/clitkAverageTemporalDimension.cxx +++ /dev/null @@ -1,53 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkAverageTemporalDimension.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkAverageTemporalDimension_ggo.h" -#include "clitkIO.h" -#include "clitkCommon.h" -#include "clitkAverageTemporalDimensionGenericFilter.h" - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) -{ - - // Init command line - GGO(clitkAverageTemporalDimension, args_info); - CLITK_INIT; - - // Filter - typedef clitk::AverageTemporalDimensionGenericFilter FilterType; - FilterType::Pointer genericFilter = FilterType::New(); - - genericFilter->SetArgsInfo(args_info); - CLITK_TRY_CATCH_EXIT(genericFilter->Update()); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkAverageTemporalDimension.ggo b/tools/clitkAverageTemporalDimension.ggo deleted file mode 100644 index 1e2d917..0000000 --- a/tools/clitkAverageTemporalDimension.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkAverageTemporalDimension.ggo -package "clitkAverageTemporalDimension" -version "1.0" -purpose "Average the last dimension to an (n-1)D image. Input is either nD or multiple (n-1)D image or DVF" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes multiple -option "output" o "Output image filename" string yes - - diff --git a/tools/clitkAverageTemporalDimensionGenericFilter.cxx b/tools/clitkAverageTemporalDimensionGenericFilter.cxx deleted file mode 100644 index 936d24a..0000000 --- a/tools/clitkAverageTemporalDimensionGenericFilter.cxx +++ /dev/null @@ -1,41 +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 clitkAverageTemporalDimensionGenericFilter_cxx -#define clitkAverageTemporalDimensionGenericFilter_cxx - -/* ================================================= - * @file clitkAverageTemporalDimensionGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkAverageTemporalDimensionGenericFilter.h" - - -namespace clitk -{ - - - - -} //end clitk - -#endif //#define clitkAverageTemporalDimensionGenericFilter_cxx diff --git a/tools/clitkAverageTemporalDimensionGenericFilter.h b/tools/clitkAverageTemporalDimensionGenericFilter.h deleted file mode 100644 index d2387a0..0000000 --- a/tools/clitkAverageTemporalDimensionGenericFilter.h +++ /dev/null @@ -1,114 +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 clitkAverageTemporalDimensionGenericFilter_h -#define clitkAverageTemporalDimensionGenericFilter_h - -/* ================================================= - * @file clitkAverageTemporalDimensionGenericFilter.h - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk include -#include "clitkIO.h" -#include "clitkImageCommon.h" -#include "clitkAverageTemporalDimension_ggo.h" - -//itk include -#include "itkLightObject.h" - -namespace clitk -{ - - template - class ITK_EXPORT AverageTemporalDimensionGenericFilter : public itk::LightObject - { - public: - //---------------------------------------- - // ITK - //---------------------------------------- - typedef AverageTemporalDimensionGenericFilter Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( AverageTemporalDimensionGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_type & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg[0]; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - AverageTemporalDimensionGenericFilter(); - ~AverageTemporalDimensionGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(const std::string PixelType, const int Components); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_type m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkAverageTemporalDimensionGenericFilter.txx" -#endif - -#endif // #define clitkAverageTemporalDimensionGenericFilter_h diff --git a/tools/clitkAverageTemporalDimensionGenericFilter.txx b/tools/clitkAverageTemporalDimensionGenericFilter.txx deleted file mode 100644 index acfb238..0000000 --- a/tools/clitkAverageTemporalDimensionGenericFilter.txx +++ /dev/null @@ -1,234 +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 clitkAverageTemporalDimensionGenericFilter_txx -#define clitkAverageTemporalDimensionGenericFilter_txx - -/* ================================================= - * @file clitkAverageTemporalDimensionGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - -//----------------------------------------------------------- -// Constructor -//----------------------------------------------------------- -template -AverageTemporalDimensionGenericFilter::AverageTemporalDimensionGenericFilter() -{ - m_Verbose=false; - m_InputFileName=""; -} - - -//----------------------------------------------------------- -// Update -//----------------------------------------------------------- -template -void AverageTemporalDimensionGenericFilter::Update() -{ - // Read the Dimension and PixelType - int Dimension, Components; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components); - - - // Call UpdateWithDim - if (m_ArgsInfo.input_given>1) Dimension+=1; - 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 4D!!!"< -template -void -AverageTemporalDimensionGenericFilter::UpdateWithDim(const std::string PixelType, const int Components) -{ - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char") { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - // else if (Components==2) - // { - // if (m_Verbose) std::cout << "Launching transform in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - // UpdateWithDimAndPixelType >(); - // } - - else if (Components==3) { - if (m_Verbose) std::cout << "Launching transform in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - UpdateWithDimAndPixelType >(); - } - - // else if (Components==4) - // { - // if (m_Verbose) std::cout << "Launching transform in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - // UpdateWithDimAndPixelType >(); - // } - else std::cerr<<"Number of components is "< -template -void -AverageTemporalDimensionGenericFilter::UpdateWithDimAndPixelType() -{ - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - typename InputImageType::Pointer input; - - if (m_ArgsInfo.input_given ==1 ) { - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - input= reader->GetOutput(); - } - - else { - // Read and join multiple inputs - if (m_Verbose) std::cout< filenames; - for(unsigned int i=0; i ImageReaderType; - typename ImageReaderType::Pointer reader= ImageReaderType::New(); - reader->SetFileNames(filenames); - reader->Update(); - input =reader->GetOutput(); - } - - - // Output properties - typename OutputImageType::RegionType region; - typename OutputImageType::RegionType::SizeType size; - typename OutputImageType::IndexType index; - typename OutputImageType::SpacingType spacing; - typename OutputImageType::PointType origin; - typename InputImageType::RegionType region4D=input->GetLargestPossibleRegion(); - typename InputImageType::RegionType::SizeType size4D=region4D.GetSize(); - typename InputImageType::IndexType index4D=region4D.GetIndex(); - typename InputImageType::SpacingType spacing4D=input->GetSpacing(); - typename InputImageType::PointType origin4D=input->GetOrigin(); - - for (unsigned int i=0; i< Dimension-1; i++) { - size[i]=size4D[i]; - index[i]=index4D[i]; - spacing[i]=spacing4D[i]; - origin[i]=origin4D[i]; - } - region.SetSize(size); - region.SetIndex(index); - typename OutputImageType::Pointer output= OutputImageType::New(); - output->SetRegions(region); - output->SetSpacing(spacing); - output->SetOrigin(origin); - output->Allocate(); - - - // Region iterators - typedef itk::ImageRegionIterator IteratorType; - std::vector iterators(size4D[Dimension-1]); - for (unsigned int i=0; i< size4D[Dimension-1]; i++) { - typename InputImageType::RegionType regionIt=region4D; - typename InputImageType::RegionType::SizeType sizeIt=regionIt.GetSize(); - sizeIt[Dimension-1]=1; - regionIt.SetSize(sizeIt); - typename InputImageType::IndexType indexIt=regionIt.GetIndex(); - indexIt[Dimension-1]=i; - regionIt.SetIndex(indexIt); - iterators[i]=IteratorType(input, regionIt); - } - - typedef itk::ImageRegionIterator OutputIteratorType; - OutputIteratorType avIt(output, output->GetLargestPossibleRegion()); - - // Average - PixelType vector; - PixelType zeroVector=itk::NumericTraits::Zero; - //zeroVector.Fill(0.0); - while (!(iterators[0]).IsAtEnd()) { - vector=zeroVector; - for (unsigned int i=0; i WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - -} - - -}//end clitk - -#endif //#define clitkAverageTemporalDimensionGenericFilter_txx diff --git a/tools/clitkBSplineCoefficientsToValues.cxx b/tools/clitkBSplineCoefficientsToValues.cxx deleted file mode 100644 index a7cc9ea..0000000 --- a/tools/clitkBSplineCoefficientsToValues.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkBSplineCoefficientsToValues.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkBSplineCoefficientsToValues_ggo.h" -#include "clitkIO.h" -#include "clitkBSplineCoefficientsToValuesGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkBSplineCoefficientsToValues, args_info); - CLITK_INIT; - - // Filter - clitk::BSplineCoefficientsToValuesGenericFilter::Pointer genericFilter=clitk::BSplineCoefficientsToValuesGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkBSplineCoefficientsToValues.ggo b/tools/clitkBSplineCoefficientsToValues.ggo deleted file mode 100644 index 69d303b..0000000 --- a/tools/clitkBSplineCoefficientsToValues.ggo +++ /dev/null @@ -1,21 +0,0 @@ -#File clitkBSplineCoefficientsToValues.ggo -package "clitkBSplineCoefficientsToValues" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -section "I/O" -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "matrix" m "Matrix transform to add" string no - -section "Options" -option "like" l "Resample output this image (size, spacing,origin)" string no -option "size" - "New output size if different from input" int no multiple -option "spacing" - "New output spacing if different from input" double no multiple -option "origin" - "New output origin if different from input" double no multiple -option "pad" - "Edge padding value" double no default="0.0" -option "order" - "Spline order of the coefficient image" int no default="3" - diff --git a/tools/clitkBSplineCoefficientsToValuesGenericFilter.cxx b/tools/clitkBSplineCoefficientsToValuesGenericFilter.cxx deleted file mode 100644 index 58e2a06..0000000 --- a/tools/clitkBSplineCoefficientsToValuesGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkBSplineCoefficientsToValuesGenericFilter_cxx -#define clitkBSplineCoefficientsToValuesGenericFilter_cxx - -/* ================================================= - * @file clitkBSplineCoefficientsToValuesGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkBSplineCoefficientsToValuesGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - BSplineCoefficientsToValuesGenericFilter::BSplineCoefficientsToValuesGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void BSplineCoefficientsToValuesGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension, Components; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components); - - - // Call UpdateWithDim - // if(Dimension==2) UpdateWithDim<2>(PixelType, Components); - 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!!!"<= 4 - #include "itkTransformToDisplacementFieldSource.h" -#else - #include "itkTransformToDeformationFieldSource.h" -#endif - -namespace clitk -{ - - - class ITK_EXPORT BSplineCoefficientsToValuesGenericFilter : public itk::LightObject - { - public: - //---------------------------------------- - // ITK - //---------------------------------------- - typedef BSplineCoefficientsToValuesGenericFilter Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( BSplineCoefficientsToValuesGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkBSplineCoefficientsToValues & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - BSplineCoefficientsToValuesGenericFilter(); - ~BSplineCoefficientsToValuesGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType, unsigned int Components); - template void UpdateWithDimAndPixelType(); - template void UpdateWithDimAndVectorType(); - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkBSplineCoefficientsToValues m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkBSplineCoefficientsToValuesGenericFilter.txx" -#endif - -#endif // #define clitkBSplineCoefficientsToValuesGenericFilter_h diff --git a/tools/clitkBSplineCoefficientsToValuesGenericFilter.txx b/tools/clitkBSplineCoefficientsToValuesGenericFilter.txx deleted file mode 100644 index 0111db2..0000000 --- a/tools/clitkBSplineCoefficientsToValuesGenericFilter.txx +++ /dev/null @@ -1,327 +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 clitkBSplineCoefficientsToValuesGenericFilter_txx -#define clitkBSplineCoefficientsToValuesGenericFilter_txx -#include - -/* ================================================= - * @file clitkBSplineCoefficientsToValuesGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - BSplineCoefficientsToValuesGenericFilter::UpdateWithDim(std::string PixelType, unsigned int Components) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - // } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - // else if (PixelType == "unsigned_char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - // else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - // } - } - - else - if (Components==3) - { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - UpdateWithDimAndVectorType >(); - } - - else std::cerr<<"Number of components is "< - void - BSplineCoefficientsToValuesGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - //Filter - typedef itk::ResampleImageFilter< InputImageType,OutputImageType > ResampleFilterType; - typename ResampleFilterType::Pointer resampler = ResampleFilterType::New(); - - // Properties - if (m_ArgsInfo.like_given) - { - typename InputReaderType::Pointer likeReader=InputReaderType::New(); - likeReader->SetFileName(m_ArgsInfo.like_arg); - likeReader->Update(); - resampler->SetOutputParametersFromImage(likeReader->GetOutput()); - if (m_Verbose)std::cout<<"Resampling output like "<GetLargestPossibleRegion().GetSize(); - if (m_Verbose)std::cout<<"Setting the size to "<GetSpacing(); - if (m_Verbose)std::cout<<"Setting the spacing to "<GetOrigin(); - if (m_Verbose)std::cout<<"Setting the origin to "<SetSize( outputSize ); - resampler->SetOutputSpacing( outputSpacing ); - resampler->SetOutputOrigin( outputOrigin ); - - } - - // Interp : coeff - typedef itk::BSplineResampleImageFunction InterpolatorType; - typename InterpolatorType::Pointer interpolator=InterpolatorType::New(); - interpolator->SetSplineOrder(m_ArgsInfo.order_arg); - - // Set - resampler->SetInterpolator( interpolator); - resampler->SetDefaultPixelValue( static_cast(m_ArgsInfo.pad_arg) ); - resampler->SetInput( input ); - - // Update - try - { - resampler->Update(); - } - catch(itk::ExceptionObject) - { - std::cerr<<"Error resampling the image"<GetOutput(); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the Vectortype - //------------------------------------------------------------------- - template - void - BSplineCoefficientsToValuesGenericFilter::UpdateWithDimAndVectorType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - //Filter - typedef itk::VectorResampleImageFilter< InputImageType,OutputImageType > ResampleFilterType; - typename ResampleFilterType::Pointer resampler = ResampleFilterType::New(); - - // Properties - if (m_ArgsInfo.like_given) - { - typename InputReaderType::Pointer likeReader=InputReaderType::New(); - likeReader->SetFileName(m_ArgsInfo.like_arg); - likeReader->Update(); - - // Set - resampler->SetSize( likeReader->GetOutput()->GetLargestPossibleRegion().GetSize() ); - resampler->SetOutputSpacing(likeReader->GetOutput()->GetSpacing() ); - resampler->SetOutputOrigin( likeReader->GetOutput()->GetOrigin() ); - if (m_Verbose)std::cout<<"Resampling output like "<GetLargestPossibleRegion().GetSize(); - if (m_Verbose)std::cout<<"Setting the size to "<GetSpacing(); - if (m_Verbose)std::cout<<"Setting the spacing to "<GetOrigin(); - if (m_Verbose)std::cout<<"Setting the origin to "<SetSize( outputSize ); - resampler->SetOutputSpacing( outputSpacing ); - resampler->SetOutputOrigin( outputOrigin ); - - } - - // Interp : coeff - typedef clitk::VectorBSplineResampleImageFunction InterpolatorType; - typename InterpolatorType::Pointer interpolator=InterpolatorType::New(); - interpolator->SetSplineOrder(m_ArgsInfo.order_arg); - - - // Set - resampler->SetInterpolator( interpolator); - resampler->SetDefaultPixelValue( static_cast(m_ArgsInfo.pad_arg) ); - resampler->SetInput( input ); - - // Update - try - { - resampler->Update(); - } - catch(itk::ExceptionObject) - { - std::cerr<<"Error resampling the image"<GetOutput(); - //writeImage(output, "/home/jef/tmp/output1.mhd", true); - - - // Matrix Transform - if(m_ArgsInfo.matrix_given) - { -#if ITK_VERSION_MAJOR >= 4 - typedef itk::TransformToDisplacementFieldSource ConvertorType; -#else - typedef itk::TransformToDeformationFieldSource ConvertorType; -#endif - typename ConvertorType::Pointer filter= ConvertorType::New(); - filter->SetOutputParametersFromImage(output); - - typedef itk::AffineTransform TransformType; - typename TransformType::Pointer transform =TransformType::New(); - itk::Matrix homMatrix= ReadMatrix( m_ArgsInfo.matrix_arg); - itk::Matrix matrix =GetRotationalPartMatrix( homMatrix); - itk::Vector offset= GetTranslationPartMatrix( homMatrix); - transform->SetMatrix(matrix); - transform->SetOffset(offset); - filter->SetTransform(transform); - filter->Update(); - typename OutputImageType::Pointer output2=filter->GetOutput(); - //writeImage(output2, "/home/jef/tmp/output2.mhd", true); - - // Add - typedef itk::AddImageFilter< OutputImageType, OutputImageType, OutputImageType > AddType; - typename AddType::Pointer adder= AddType::New(); - adder->SetInput(output); - adder->SetInput(1,output2); - adder->Update(); - output=adder->GetOutput(); - } - - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - } - -}//end clitk - -#endif //#define clitkBSplineCoefficientsToValuesGenericFilter_txx diff --git a/tools/clitkChangeImageOrientation.cxx b/tools/clitkChangeImageOrientation.cxx deleted file mode 100644 index 70d6147..0000000 --- a/tools/clitkChangeImageOrientation.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkChangeImageOrientation.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkChangeImageOrientation_ggo.h" -#include "clitkIO.h" -#include "clitkChangeImageOrientationGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkChangeImageOrientation, args_info); - CLITK_INIT; - - // Filter - clitk::ChangeImageOrientationGenericFilter::Pointer genericFilter=clitk::ChangeImageOrientationGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkChangeImageOrientation.ggo b/tools/clitkChangeImageOrientation.ggo deleted file mode 100644 index ebda22c..0000000 --- a/tools/clitkChangeImageOrientation.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkChangeImageOrientation.ggo -package "clitkChangeImageOrientation" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes - - diff --git a/tools/clitkChangeImageOrientationGenericFilter.cxx b/tools/clitkChangeImageOrientationGenericFilter.cxx deleted file mode 100644 index 3d34c69..0000000 --- a/tools/clitkChangeImageOrientationGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkChangeImageOrientationGenericFilter_cxx -#define clitkChangeImageOrientationGenericFilter_cxx - -/* ================================================= - * @file clitkChangeImageOrientationGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkChangeImageOrientationGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - ChangeImageOrientationGenericFilter::ChangeImageOrientationGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void ChangeImageOrientationGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - // if(Dimension==2) UpdateWithDim<2>(PixelType); - if(Dimension==3) UpdateWithDim<3>(PixelType); - // else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 3 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( ChangeImageOrientationGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkChangeImageOrientation & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - ChangeImageOrientationGenericFilter(); - ~ChangeImageOrientationGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkChangeImageOrientation m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkChangeImageOrientationGenericFilter.txx" -#endif - -#endif // #define clitkChangeImageOrientationGenericFilter_h diff --git a/tools/clitkChangeImageOrientationGenericFilter.txx b/tools/clitkChangeImageOrientationGenericFilter.txx deleted file mode 100644 index e298a95..0000000 --- a/tools/clitkChangeImageOrientationGenericFilter.txx +++ /dev/null @@ -1,109 +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 clitkChangeImageOrientationGenericFilter_txx -#define clitkChangeImageOrientationGenericFilter_txx - -/* ================================================= - * @file clitkChangeImageOrientationGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - ChangeImageOrientationGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - ChangeImageOrientationGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typedef itk::OrientImageFilter OrientFilterType; - typename OrientFilterType::Pointer orienter = itk::OrientImageFilter::New(); - orienter->UseImageDirectionOn(); - orienter->SetDesiredCoordinateOrientation(itk::SpatialOrientation::ITK_COORDINATE_ORIENTATION_RIP); - orienter->SetInput(input); - orienter->Update(); - typename OutputImageType::Pointer output=orienter->GetOutput(); - - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkChangeImageOrientationGenericFilter_txx diff --git a/tools/clitkCombineImage.cxx b/tools/clitkCombineImage.cxx deleted file mode 100644 index ee8de0d..0000000 --- a/tools/clitkCombineImage.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkCombineImage.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkCombineImage_ggo.h" -#include "clitkIO.h" -#include "clitkCombineImageGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkCombineImage, args_info); - CLITK_INIT; - - // Filter - clitk::CombineImageGenericFilter::Pointer genericFilter=clitk::CombineImageGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - CLITK_TRY_CATCH_EXIT(genericFilter->Update()); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkCombineImage.ggo b/tools/clitkCombineImage.ggo deleted file mode 100644 index a8e7c17..0000000 --- a/tools/clitkCombineImage.ggo +++ /dev/null @@ -1,14 +0,0 @@ -#File clitkCombineImage.ggo -package "clitkCombineImage" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "input2" j "Input image filename" string yes -option "mask" m "Binary image: if(mask) input1,else input2" string yes -option "output" o "Output image filename" string yes - - diff --git a/tools/clitkCombineImageFilter.h b/tools/clitkCombineImageFilter.h deleted file mode 100644 index 024b5c6..0000000 --- a/tools/clitkCombineImageFilter.h +++ /dev/null @@ -1,113 +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 clitkCombineImageFilter_h -#define clitkCombineImageFilter_h - -/* ================================================= - * @file clitkCombineImageFilter.h - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk include -#include "clitkIO.h" -#include "clitkCommon.h" - -//itk include -#include "itkImageToImageFilter.h" - -namespace clitk -{ - - template - class ITK_EXPORT CombineImageFilter : - public itk::ImageToImageFilter - { - public: - //---------------------------------------- - // ITK - //---------------------------------------- - typedef CombineImageFilter Self; - typedef itk::ImageToImageFilter Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( CombineImageFilter, ImageToImageFilter ); - - /** Dimension of the domain space. */ - itkStaticConstMacro(InputImageDimension, unsigned int, Superclass::InputImageDimension); - itkStaticConstMacro(OutputImageDimension, unsigned int, Superclass::OutputImageDimension); - typedef itk::Image MaskImageType; - - //---------------------------------------- - // Typedefs - //---------------------------------------- - typedef typename InputImageType::RegionType OutputImageRegionType; - - //---------------------------------------- - // Set & Get - //---------------------------------------- - itkBooleanMacro(Verbose); - itkSetMacro( Verbose, bool); - itkGetConstReferenceMacro( Verbose, bool); - - void SetMask(typename MaskImageType::Pointer m){m_Mask=m;} - typename MaskImageType::Pointer GetMask(void){return m_Mask;} - - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - CombineImageFilter(); - ~CombineImageFilter() {}; - - //---------------------------------------- - // Update - //---------------------------------------- - // Generate Data - void ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, int threadId); - - //---------------------------------------- - // Data members - //---------------------------------------- - bool m_Verbose; - typename MaskImageType::Pointer m_Mask; - - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkCombineImageFilter.txx" -#endif - -#endif // #define clitkCombineImageFilter_h - - diff --git a/tools/clitkCombineImageFilter.txx b/tools/clitkCombineImageFilter.txx deleted file mode 100644 index 8a4f051..0000000 --- a/tools/clitkCombineImageFilter.txx +++ /dev/null @@ -1,87 +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 clitkCombineImageFilter_txx -#define clitkCombineImageFilter_txx - -/* ================================================= - * @file clitkCombineImageFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - CombineImageFilter::CombineImageFilter() - { - m_Verbose=false; - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - CombineImageFilter::ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, int threadId) - { - typename InputImageType::ConstPointer input1=this->GetInput(0); - typename InputImageType::ConstPointer input2=this->GetInput(1); - typename InputImageType::Pointer output=this->GetOutput(); - - typedef itk::ImageRegionIterator IteratorType; - typedef itk::ImageRegionConstIterator ConstIteratorType; - typedef itk::ImageRegionConstIterator MaskIteratorType; - - ConstIteratorType it1(input1, outputRegionForThread); - ConstIteratorType it2(input2, outputRegionForThread); - MaskIteratorType itM(m_Mask, outputRegionForThread); - IteratorType itO(output, outputRegionForThread); - - it1.GoToBegin(); - it2.GoToBegin(); - itM.GoToBegin(); - itO.GoToBegin(); - - while(! itO.IsAtEnd()) - { - if(itM.Get()) - itO.Set(it1.Get()); - else - itO.Set(it2.Get()); - - ++it1; - ++it2; - ++itM; - ++itO; - } - - } - - -}//end clitk - -#endif //#define clitkCombineImageFilter_txx diff --git a/tools/clitkCombineImageGenericFilter.cxx b/tools/clitkCombineImageGenericFilter.cxx deleted file mode 100644 index 51e363e..0000000 --- a/tools/clitkCombineImageGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkCombineImageGenericFilter_cxx -#define clitkCombineImageGenericFilter_cxx - -/* ================================================= - * @file clitkCombineImageGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkCombineImageGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - CombineImageGenericFilter::CombineImageGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void CombineImageGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension, Components; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components); - - - // 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!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( CombineImageGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkCombineImage & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - CombineImageGenericFilter(); - ~CombineImageGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType, int Components); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkCombineImage m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkCombineImageGenericFilter.txx" -#endif - -#endif // #define clitkCombineImageGenericFilter_h diff --git a/tools/clitkCombineImageGenericFilter.txx b/tools/clitkCombineImageGenericFilter.txx deleted file mode 100644 index d472134..0000000 --- a/tools/clitkCombineImageGenericFilter.txx +++ /dev/null @@ -1,130 +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 clitkCombineImageGenericFilter_txx -#define clitkCombineImageGenericFilter_txx - -/* ================================================= - * @file clitkCombineImageGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - CombineImageGenericFilter::UpdateWithDim(std::string PixelType, int Components) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - else if (Components==3) - { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - UpdateWithDimAndPixelType >(); - } - else std::cerr<<"Number of components is "< - void - CombineImageGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image MaskImageType; - typedef itk::Image OutputImageType; - - // Read the inputs - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input1= reader->GetOutput(); - typename InputReaderType::Pointer reader2 = InputReaderType::New(); - reader2->SetFileName( m_ArgsInfo.input2_arg); - reader2->Update(); - typename InputImageType::Pointer input2= reader2->GetOutput(); - - // Read the mask - typedef itk::ImageFileReader MaskReaderType; - typename MaskReaderType::Pointer mReader = MaskReaderType::New(); - mReader->SetFileName( m_ArgsInfo.mask_arg); - mReader->Update(); - typename MaskImageType::Pointer mask= mReader->GetOutput(); - - // Filter - typedef CombineImageFilter CombineImageFilterType; - typename CombineImageFilterType::Pointer filter=CombineImageFilterType::New(); - filter->SetInput( input1 ); - filter->SetInput(1, input2 ); - filter->SetMask( mask ); - filter->Update(); - typename OutputImageType::Pointer output=filter->GetOutput(); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkCombineImageGenericFilter_txx diff --git a/tools/clitkConeBeamProjectImage.cxx b/tools/clitkConeBeamProjectImage.cxx deleted file mode 100644 index 03fa3ad..0000000 --- a/tools/clitkConeBeamProjectImage.cxx +++ /dev/null @@ -1,72 +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 CLITKCONEBEAMPROJECTIMAGE_CXX -#define CLITKCONEBEAMPROJECTIMAGE_CXX -/** - ================================================= - * @file clitkConeBeamProjectImage.cxx - * @author Jef Vandemeulebroucke - * @date 30 April 2008 - * - * @brief "Project a 3D image using a Cone-Beam geometry" - =================================================*/ - -// clitk include -#include "clitkConeBeamProjectImage_ggo.h" -#include "clitkConeBeamProjectImageGenericFilter.h" -#include "clitkIO.h" -#include "clitkImageCommon.h" -#include "clitkTransformUtilities.h" - -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkConeBeamProjectImage, args_info); - CLITK_INIT; - - // Creation of a generic filter - clitk::ConeBeamProjectImageGenericFilter::Pointer genericFilter = clitk::ConeBeamProjectImageGenericFilter::New(); - - //Passing the arguments to the generic filter - genericFilter->SetArgsInfo(args_info); - - // //Passing the arguments to the generic filter - // genericFilter->SetVerbose(args_info.verbose_flag); - // genericFilter->SetInput(args_info.input_arg); - // genericFilter->SetOutput(args_info.output_arg); - // //genericFilter->SetMask(args_info.mask_arg); - - // //set the three components of the isocenter - // std::vector iso(3); - // for (unsigned int i=0 ; i<3 ; i++) iso[i]=args_info.iso_arg[i]; - // genericFilter->SetIsoCenter(iso); - // genericFilter->SetSourceToScreen(args_info.screen_arg); - // genericFilter->SetSourceToAxis(args_info.axis_arg); - // genericFilter->SetProjectionAngle(args_info.angle_arg); - // if (args_info.matrix_given) genericFilter->SetRigidTransformMatrix(clitk::ReadMatrix3D(args_info.matrix_arg)); - // genericFilter->SetEdgePaddingValue(args_info.pad_arg); - - //update - genericFilter->Update(); - - return 0; -} - -#endif - - diff --git a/tools/clitkConeBeamProjectImage.ggo b/tools/clitkConeBeamProjectImage.ggo deleted file mode 100644 index 4e80707..0000000 --- a/tools/clitkConeBeamProjectImage.ggo +++ /dev/null @@ -1,38 +0,0 @@ -#File clitkConeBeamProjectImage.ggo -package "clitk" -version "Project a 3D image with cone-beam geometry" - -option "config" - "Config file" string no - -section "Run Time" - -option "verbose" v "Verbose" flag off -option "threads" - "Number of threads to use (default=min(cores,8))" int no - - -section "Input" - -option "input" i "Input grid filename" string yes -option "output" o "Output grid filename" string yes -option "mask" m "2D Mask in which the filter should be applied (not supported yet;-)" string no - - -section "Projection Parameters" - -option "iso" - "The isocenter" double no multiple default="0.0" -option "screen" - "Specify the source to screen distance in mm" double no default="1536.0" -option "axis" - "Specify the source to axis distance in mm" double no default="1000.0" -option "angle" - "Specify the projection angle" double no default="0.0" -option "matrix" - "Rigid tranform prior to projection (4x4)" string no -option "pad" - "Padding value" float no default="0.0" - - -section "Output Image" - -option "like" - "Make output like this image" string no -option "origin" - "Origin for the output image" double multiple no default="0.0" -option "size" - "Size for the output image" int multiple no default="512" -option "spacing" - "Spacing for the output image" double multiple no default="0.8" - -option "panel_position" - "Approximate position of the panel: small, medium or large" string no default="small" -option "panel_shift" - "Precise position of the panel in mm" double multiple no diff --git a/tools/clitkConeBeamProjectImageFilter.h b/tools/clitkConeBeamProjectImageFilter.h deleted file mode 100644 index 2363a5f..0000000 --- a/tools/clitkConeBeamProjectImageFilter.h +++ /dev/null @@ -1,260 +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 __clitkConeBeamProjectImageFilter_h -#define __clitkConeBeamProjectImageFilter_h -#include "clitkImageCommon.h" -#include "clitkImageCommon.h" -#include "clitkTransformUtilities.h" -#include "clitkExtractImageFilter.h" -#include "itkRayCastInterpolateImageFunctionWithOrigin.h" - -//ITK include -#include "itkLightObject.h" -#include "itkResampleImageFilter.h" -#include "itkEuler3DTransform.h" -#include "itkExtractImageFilter.h" -#include "itkFlipImageFilter.h" - -namespace clitk -{ - - template - class ITK_EXPORT ConeBeamProjectImageFilter : public itk::LightObject - - { - public: - - typedef ConeBeamProjectImageFilter Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Determine the image dimension. */ - itkStaticConstMacro(InputImageDimension, unsigned int, - InputImageType::ImageDimension ); - - itkStaticConstMacro(OutputImageDimension, unsigned int, - OutputImageType::ImageDimension ); - - - //======================================================================================== - //Typedefs - typedef typename InputImageType::Pointer InputImagePointer; - typedef typename InputImageType::ConstPointer InputImageConstPointer; - typedef typename InputImageType::PixelType InputPixelType; - typedef typename InputImageType::SizeType InputSizeType; - typedef typename InputImageType::SpacingType InputSpacingType; - typedef typename InputImageType::DirectionType InputDirectionType; - typedef typename InputImageType::IndexType InputIndexType; - typedef typename InputImageType::PointType InputPointType; - - typedef typename OutputImageType::Pointer OutputImagePointer; - typedef typename OutputImageType::ConstPointer OutputImageConstPointer; - typedef typename OutputImageType::PixelType OutputPixelType; - typedef typename OutputImageType::SizeType OutputSizeType; - typedef typename OutputImageType::SpacingType OutputSpacingType; - typedef typename OutputImageType::DirectionType OutputDirectionType; - typedef typename OutputImageType::IndexType OutputIndexType; - typedef typename OutputImageType::PointType OutputPointType; - - typedef itk::Image InternalImageType; - - //Pipeline - typedef itk::Euler3DTransform TransformType; - typedef itk::ResampleImageFilter ResampleImageFilterType; - typedef itk::RayCastInterpolateImageFunctionWithOrigin InterpolatorType; - typedef clitk::ExtractImageFilter ExtractImageFilterType; - typedef itk::FlipImageFilter FlipImageFilterType; - typedef itk::Matrix MatrixType; - - //======================================================================================== - //Set Methods - //======================================================================================== - // Run-time - void SetVerbose(const bool m){m_Verbose=m;} - void SetNumberOfThreads(const unsigned int v) - { - m_NumberOfThreadsIsGiven=true; - m_NumberOfThreads=v; - } - - void SetInput(const InputImagePointer m) {m_Input=m;} //no reinitialize - - //================================================================================= - //Geometry (reinitialize) - void SetIsoCenter( const InputPointType & i ) - { - if( m_IsoCenter!=i) - { - m_IsoCenter=i; - m_IsInitialized=false; - } - } - - void SetSourceToScreen(const double& s) - { - if( m_SourceToScreen!=s) - { - m_SourceToScreen=s; - m_IsInitialized=false; - } - } - - void SetSourceToAxis( const double& s) - { - if( m_SourceToAxis!=s) - { - m_SourceToAxis=s; - m_IsInitialized=false; - } - } - - void SetProjectionAngle( const double& s) - { - if( m_SourceToScreen!=s) - { - m_ProjectionAngle=s; - m_IsInitialized=false; - } - } - - void SetRigidTransformMatrix(const MatrixType& m) - { - if(m_RigidTransformMatrix != m) - { - m_RigidTransformMatrix=m; - m_IsInitialized=false; - } - } - - void SetEdgePaddingValue(const OutputPixelType& p) - { - if (m_EdgePaddingValue!=p) - { - m_EdgePaddingValue=p; - m_IsInitialized=false; - } - } - - - //======================================================================================== - //Output image properties - /** Get the size of the output image. */ - void SetOutputSize(const OutputSizeType& p) - { - if (m_OutputSize!=p) - { - m_OutputSize=p; - m_IsInitialized=false; - } - } - - /** Set the output image spacing. */ - void SetOutputSpacing(const OutputSpacingType& p) - { - if (m_OutputSpacing!=p) - { - m_OutputSpacing=p; - m_IsInitialized=false; - } - } - - /** Set the output image origin. */ - void SetOutputOrigin(const OutputPointType& p) - { - if (m_OutputOrigin!=p) - { - m_OutputOrigin=p; - m_IsInitialized=false; - } - } - - /** Set the panelshift. */ - void SetPanelShift(double x, double y) - { - if (m_PanelShift[0] != x) - { - m_PanelShift[0] = x; - m_IsInitialized=false; - } - if (m_PanelShift[1] != y) - { - m_PanelShift[1] = y; - m_IsInitialized=false; - } - } - - /** Helper method to set the output parameters based on this image */ - void SetOutputParametersFromImage( const OutputImagePointer image ); - - /** Helper method to set the output parameters based on this image */ - void SetOutputParametersFromImage( const OutputImageConstPointer image ); - - //======================================================================================== - //Update - void Initialize(void)throw (itk::ExceptionObject); - void Update(void); - OutputImagePointer GetOutput(void); - - protected: - ConeBeamProjectImageFilter(); - ~ConeBeamProjectImageFilter() {}; - - // Run time - bool m_Verbose; - bool m_NumberOfThreadsIsGiven; - unsigned int m_NumberOfThreads; - bool m_IsInitialized; - //std::string m_Mask; - - // Data - InputImageConstPointer m_Input; - OutputImagePointer m_Output; - - // Geometry - InputPointType m_IsoCenter; - double m_SourceToScreen; - double m_SourceToAxis; - double m_ProjectionAngle; - double m_PanelShift[2]; - MatrixType m_RigidTransformMatrix; - OutputPixelType m_EdgePaddingValue; - - // Pipe - TransformType::Pointer m_Transform; - typename ResampleImageFilterType::Pointer m_Resampler; - typename InterpolatorType::Pointer m_Interpolator; - typename ExtractImageFilterType::Pointer m_ExtractImageFilter; - typename FlipImageFilterType::Pointer m_FlipImageFilter; - - // Output image info - OutputSizeType m_OutputSize; // Size of the output image - OutputSpacingType m_OutputSpacing; // output image spacing - OutputPointType m_OutputOrigin; // output image origin - }; - - -} // end namespace clitk -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkConeBeamProjectImageFilter.txx" -#endif - -#endif // #define __clitkConeBeamProjectImageFilter_h diff --git a/tools/clitkConeBeamProjectImageFilter.txx b/tools/clitkConeBeamProjectImageFilter.txx deleted file mode 100644 index 798fbd1..0000000 --- a/tools/clitkConeBeamProjectImageFilter.txx +++ /dev/null @@ -1,258 +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 __clitkConeBeamProjectImageFilter_txx -#define __clitkConeBeamProjectImageFilter_txx -namespace clitk -{ - - - //========================================================================================================================= - //Constructor - template - ConeBeamProjectImageFilter:: - ConeBeamProjectImageFilter() - { - // Initialize with the default values (Elekta Synergie) - m_Verbose=false; - m_IsInitialized=false; - m_NumberOfThreadsIsGiven=false; - - // Geometry - m_IsoCenter.Fill(0.0); - m_SourceToScreen=1536.; - m_SourceToAxis=1000.; - m_PanelShift[0] = 0.; - m_PanelShift[1] = 0.; - m_ProjectionAngle=0.; - m_RigidTransformMatrix.SetIdentity(); - m_EdgePaddingValue=itk::NumericTraits::Zero;//density images - - // Pipe - m_Transform=TransformType::New(); - m_Resampler=ResampleImageFilterType::New(); - m_Interpolator= InterpolatorType::New(); - m_ExtractImageFilter=ExtractImageFilterType::New(); - m_FlipImageFilter=FlipImageFilterType::New(); - - // Parameters for output - this->m_OutputSpacing.Fill(0.8); - this->m_OutputOrigin.Fill(0.0); - this->m_OutputSize.Fill( 512 ); - - } - - - //----------------------------------------------------------------------- - // Set output info from image - //----------------------------------------------------------------------- - template - void - ConeBeamProjectImageFilter - ::SetOutputParametersFromImage ( OutputImagePointer image ) - { - this->SetOutputOrigin( image->GetOrigin() ); - this->SetOutputSpacing( image->GetSpacing() ); - this->SetOutputSize( image->GetLargestPossibleRegion().GetSize() ); - } - - - //----------------------------------------------------------------------- - // Set output info from image - //----------------------------------------------------------------------- - template - void - ConeBeamProjectImageFilter - ::SetOutputParametersFromImage ( OutputImageConstPointer image ) - { - this->SetOutputOrigin( image->GetOrigin() ); - this->SetOutputSpacing( image->GetSpacing() ); - this->SetOutputSize( image->GetLargestPossibleRegion().GetSize() ); - } - - - //========================================================================================================================= - // Initialize - template - void - ConeBeamProjectImageFilter - ::Initialize(void) throw (itk::ExceptionObject) - { - - //==================================================================== - // Define the transform: composition of rigid transfo around origin and a centered rotation - // The center of rotation should be placed at the isocenter! - - if (m_Verbose) std::cout<<"The isocenter is at "<< m_IsoCenter <<"..." < rotationParameters(3); - const double dtr = ( atan(1.0) * 4.0 ) / 180.0; //constant for converting degrees into radians - if (m_Verbose)std::cout<<"The projection angle is "<< m_ProjectionAngle <<"° (0° being lateral left)..."<< std::endl; - rotationParameters[0]= 0.; - rotationParameters[1]= 0.; - rotationParameters[2]= -dtr*(double) m_ProjectionAngle; - - // We first perform rigid transform (of source and panel), then a centered rotation around the transformed center - itk::Matrix rigidRotation = GetRotationalPartMatrix3D(m_RigidTransformMatrix); - itk::Vector rigidTranslation = GetTranslationPartMatrix3D(m_RigidTransformMatrix); - typename InputImageType::PointType transformedCenter = rigidRotation * m_IsoCenter + rigidTranslation; - - // Calculate the centered rotation matrix - itk::Matrix centeredRotationMatrix = GetCenteredRotationMatrix3D(rotationParameters,transformedCenter); - - // Compose this rotation with the rigid transform matrix - itk::Matrix finalTransform = m_RigidTransformMatrix * centeredRotationMatrix ; - - // Set the rotation - itk::Matrix finalRotation = GetRotationalPartMatrix3D(finalTransform); - m_Transform->SetMatrix(finalRotation); - if (m_Verbose)std::cout<<"The final rotation is "< finalTranslation = GetTranslationPartMatrix3D(finalTransform); - m_Transform->SetTranslation(finalTranslation); - if (m_Verbose)std::cout<<"The final translation is "<SetNumberOfThreads(m_NumberOfThreads); - m_Resampler->SetDefaultPixelValue(m_EdgePaddingValue); - if (m_Verbose)std::cout<<"The edge padding value is "<SetTransform(m_Transform); - m_Interpolator->SetThreshold(0.); - - // Focalpoint: we presume that for an angle of 0° the kV is lateral left (for the patient on his back), or on the positive X-axis. - typename InterpolatorType::InputPointType focalpoint; - focalpoint[0]= m_IsoCenter[0] + m_SourceToAxis; - focalpoint[1]= m_IsoCenter[1]; - focalpoint[2]= m_IsoCenter[2]; - m_Interpolator->SetFocalPoint(focalpoint); - if (m_Verbose)std::cout<<"The focalpoint is at "<< focalpoint <<"..."<< std::endl; - - // Connect the interpolator and the transform with the m_Resampler - m_Resampler->SetInterpolator( m_Interpolator ); - m_Resampler->SetTransform( m_Transform ); - - // Describe the output projection image - typename InputImageType::SizeType sizeOuput; - sizeOuput[0] = 1; // number of pixels along X of the 2D DRR image - sizeOuput[1] = m_OutputSize[0]; // number of pixels along Y of the 2D DRR image - sizeOuput[2] = m_OutputSize[1]; // number of pixels along Z of the 2D DRR image - m_Resampler->SetSize( sizeOuput ); - if (m_Verbose)std::cout<<"The output size is "<< m_OutputSize <<"..."<< std::endl; - - typename InputImageType::SpacingType spacingOutput; - spacingOutput[0] = 1; // pixel spacing along X of the 2D DRR image [mm] - spacingOutput[1] = m_OutputSpacing[0]; // pixel spacing along Y of the 2D DRR image [mm] - spacingOutput[2] = m_OutputSpacing[1]; // pixel spacing along Y of the 2D DRR image [mm] - m_Resampler->SetOutputSpacing( spacingOutput ); - if (m_Verbose)std::cout<<"The output spacing is "<< m_OutputSpacing <<"..."<< std::endl; - - // The position of the DRR is specified, we presume that for an angle of 0° the flatpanel is located at the negative x-axis - // JV -1 seems to correspond better with shearwarp of Simon Rit - typename InterpolatorType::InputPointType originOutput; - originOutput[0] = m_IsoCenter[0]- (m_SourceToScreen - m_SourceToAxis); - DD(m_PanelShift); - originOutput[1] = m_IsoCenter[1]-static_cast(sizeOuput[1]-1)*spacingOutput[1]/2.0 - m_PanelShift[0]; - originOutput[2] = m_IsoCenter[2]-static_cast(sizeOuput[2]-1)*spacingOutput[2]/2.0 - m_PanelShift[1]; - m_Resampler->SetOutputOrigin( originOutput ); - if (m_Verbose)std::cout<<"The origin of the flat panel is at "<< originOutput <<",..."<< std::endl; - - // We define the region to be extracted. Projection was in the YZ plane, X should be set to zero - typename InternalImageType::RegionType::SizeType sizeTemp=sizeOuput; - sizeTemp[0]=0; - typename InternalImageType::IndexType startTemp; //=temp->GetLargestPossibleRegion().GetIndex(); - startTemp.Fill(0); - - typename InternalImageType::RegionType desiredRegion; - desiredRegion.SetSize( sizeTemp ); - desiredRegion.SetIndex( startTemp ); - m_ExtractImageFilter->SetExtractionRegion( desiredRegion ); - - // Prepare the Flip Image filter - typename FlipImageFilterType::FlipAxesArrayType flipArray; - flipArray[0] = 0; - flipArray[1] = 1; - m_FlipImageFilter->SetFlipAxes( flipArray ); - - // Initialization complete - m_IsInitialized=true; - - } - - //========================================================================================================================= - // Update - template - void - ConeBeamProjectImageFilter - ::Update(void) - { - - //================================================================== - // If geometry changed reinitialize - if (! m_IsInitialized) this->Initialize(); - - // Input - m_Resampler->SetInput( m_Input ); - - //================================================================== - // Execute the filter - if (m_Verbose)std::cout<<"Starting the projection..."<Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught! Projection failed!" << std::endl; - std::cerr << err << std::endl; - } - - //================================================================== - // Make a 2D image out of it - typename InternalImageType::Pointer temp=m_Resampler->GetOutput(); - m_ExtractImageFilter->SetInput(temp); - - // We should flip the Y axis - m_FlipImageFilter->SetInput(m_ExtractImageFilter->GetOutput()); - m_FlipImageFilter->Update(); - - // Get output - m_Output= m_FlipImageFilter->GetOutput(); - m_Output->Update(); - m_Output->SetOrigin(m_OutputOrigin); - } - - //========================================================================================================================= - // GetOutput - template - typename OutputImageType::Pointer - ConeBeamProjectImageFilter - ::GetOutput(void) - { - //JV it is not safe to repeatedly call getoutput/ always call Update first - return m_Output; - } - -} - - -#endif diff --git a/tools/clitkConeBeamProjectImageGenericFilter.cxx b/tools/clitkConeBeamProjectImageGenericFilter.cxx deleted file mode 100644 index e36b7d1..0000000 --- a/tools/clitkConeBeamProjectImageGenericFilter.cxx +++ /dev/null @@ -1,201 +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 CLITKCONEBEAMPROJECTIMAGEGENERICFILTER_CXX -#define CLITKCONEBEAMPROJECTIMAGEGENERICFILTER_CXX - -/** - * @file clitkConeBeamProjectImageGenericFilter.cxx - * @author Jef Vandemeulebroucke - * @date Wed April 30 13:47:57 2008 - * - * @brief - * - * - */ - -#include "clitkConeBeamProjectImageGenericFilter.h" - -namespace clitk -{ - - //==================================================================== - // Constructor - ConeBeamProjectImageGenericFilter::ConeBeamProjectImageGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - //==================================================================== - // Update - void ConeBeamProjectImageGenericFilter::Update() - { - //Read the PixelType and dimension of the input image - int Dimension; - std::string PixelType; - clitk::ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - if (Dimension == 3) - { - if (m_Verbose) std::cout << "Input was detected to be "<< Dimension << "D and " << PixelType << "..." << std::endl; - - if(PixelType == "short"){ - if (m_Verbose) std::cout << "Launching Projection in signed short..." << std::endl; - UpdateWithPixelType(); - } - -// else if(PixelType == "unsigned_short"){ -// if (m_Verbose) std::cout << "Launching Projection in unsigned_short..." << std::endl; -// UpdateWithPixelType(); -// } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching Projection in unsigned_char..." << std::endl; - UpdateWithPixelType(); - } - -// else if (PixelType == "char"){ -// if (m_Verbose) std::cout << "Launching Projection in signed_char..." << std::endl; -// UpdateWithPixelType(); -// } - else { - if (m_Verbose) std::cout << "Launching Projection in float..." << std::endl; - UpdateWithPixelType(); - } - } - - else {itkExceptionMacro(<< "Input Image dimension is " << Dimension - << " but I can only work on 3D images."); - } - } - - //================================================================================ - template void ConeBeamProjectImageGenericFilter::UpdateWithPixelType() - { - - //=================================================================== - // Read the input image - const unsigned int InputImageDimension=3; - typedef itk::Image InputImageType; - typedef itk::ImageFileReader ImageReaderType; - typename ImageReaderType::Pointer reader = ImageReaderType::New(); - reader->SetFileName(m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input = reader->GetOutput(); - - // Define the output type - //JV always float? - typedef float OutputPixelType; - const unsigned int OutputImageDimension=2; - typedef itk::Image OutputImageType; - - // Create the ConeBeamProjectImageFilter - typedef clitk::ConeBeamProjectImageFilter ConeBeamProjectImageFilterType; - typename ConeBeamProjectImageFilterType::Pointer filter=ConeBeamProjectImageFilterType::New(); - - // Pass all the necessary parameters - filter->SetInput(input); - filter->SetVerbose(m_Verbose); - if (m_ArgsInfo.threads_given) filter->SetNumberOfThreads(m_ArgsInfo.threads_arg); - - // Projection parameters - typename InputImageType::PointType iso; - unsigned int i; - if (m_ArgsInfo.iso_given) - for(i=0;iSetIsoCenter(iso); - } - filter->SetSourceToScreen(m_ArgsInfo.screen_arg); - filter->SetSourceToAxis(m_ArgsInfo.axis_arg); - filter->SetProjectionAngle(m_ArgsInfo.angle_arg); - if (m_ArgsInfo.matrix_given) - { - itk::Matrix rt =ReadMatrix3D(m_ArgsInfo.matrix_arg); - filter->SetRigidTransformMatrix(rt); - } - filter->SetEdgePaddingValue(static_cast(m_ArgsInfo.pad_arg)); - - DD(m_ArgsInfo.panel_position_arg); - if (m_ArgsInfo.panel_shift_given) // one should read the specific values for each angle in Frame.dbf - filter->SetPanelShift(m_ArgsInfo.panel_shift_arg[0], m_ArgsInfo.panel_shift_arg[1]); - else { // approximate panel positions hard coded values for the elekta synergy - if (strcmp(m_ArgsInfo.panel_position_arg,"small") ==0) - filter->SetPanelShift(0., 0.); - else if (strcmp(m_ArgsInfo.panel_position_arg,"medium") ==0) - filter->SetPanelShift(114.84, 0.); // VD : 120 , 0 ? - else if (strcmp(m_ArgsInfo.panel_position_arg,"large") ==0) - filter->SetPanelShift(190., 0.); - else assert(false); //Unsupported panel position - } - // Output image info - if (m_ArgsInfo.like_given) - { - typedef itk::ImageFileReader ReaderType; - ReaderType::Pointer reader2=ReaderType::New(); - reader2->SetFileName(m_ArgsInfo.like_arg); - reader2->Update(); - - OutputImageType::Pointer image=reader2->GetOutput(); - filter->SetOutputParametersFromImage(image); - } - else - { - if (m_ArgsInfo.origin_given) - { - OutputImageType::PointType origin; - for(i=0;iSetOutputOrigin(origin); - } - if (m_ArgsInfo.spacing_given) - { - OutputImageType::SpacingType spacing; - for(i=0;iSetOutputSpacing(spacing); - } - if (m_ArgsInfo.size_given) - { - OutputImageType::SizeType size; - for(i=0;iSetOutputSize(size); - } - } - - //Go - filter->Update(); - - //Get the output - OutputImageType::Pointer output=filter->GetOutput(); - - //Write the output - typedef itk::ImageFileWriter OutputWriterType; - OutputWriterType::Pointer outputWriter = OutputWriterType::New(); - outputWriter->SetInput(output); - outputWriter->SetFileName(m_ArgsInfo.output_arg); - if (m_Verbose)std::cout<<"Writing projected image..."<Update(); - } - - - //==================================================================== - -} -#endif //#define CLITKCONEBEAMPROJECTIMAGEGENERICFILTER_CXX diff --git a/tools/clitkConeBeamProjectImageGenericFilter.h b/tools/clitkConeBeamProjectImageGenericFilter.h deleted file mode 100644 index 8ad2488..0000000 --- a/tools/clitkConeBeamProjectImageGenericFilter.h +++ /dev/null @@ -1,92 +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 CLITKCONEBEAMPROJECTIMAGEGENERICFILTER__H -#define CLITKCONEBEAMPROJECTIMAGEGENERICFILTER__H -/** - ================================================= - * @file clitkConeBeamProjectImageGenericFilter.h - * @author Jef Vandemeulebroucke - * @date 30 April 2008 - * - * @brief Project a 3D image using a ConeBeam geometry - * - =================================================*/ - -// clitk include -#include "clitkIO.h" -#include "clitkImageCommon.h" -#include "clitkImageCommon.h" -#include "clitkConeBeamProjectImageFilter.h" -#include "clitkConeBeamProjectImage_ggo.h" - -// itk include -#include "itkLightObject.h" - - -namespace clitk { - - //==================================================================== - class ConeBeamProjectImageGenericFilter: public itk::LightObject - { - public: - - //Typedefs ITK================================================ - typedef ConeBeamProjectImageGenericFilter Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - //ITK Method for object creation================================================ - itkNewMacro(Self); - - - //==================================================================== - // Set methods - void SetArgsInfo(const args_info_clitkConeBeamProjectImage a) - { - m_ArgsInfo=a; - m_InputFileName=m_ArgsInfo.input_arg; - m_Verbose=m_ArgsInfo.verbose_flag; - } - - - //==================================================================== - // Update - virtual void Update(); - - protected: - const char * GetNameOfClass() const { return "ConeBeamProjectImageGenericFilter"; } - - //==================================================================== - // Constructor & Destructor - ConeBeamProjectImageGenericFilter(); - ~ConeBeamProjectImageGenericFilter(){;} - - //==================================================================== - //Protected member functions - template void UpdateWithPixelType(); - - bool m_Verbose; - std::string m_InputFileName; - args_info_clitkConeBeamProjectImage m_ArgsInfo; - - }; - -} // end namespace clitk - -#endif //#define CLITKCONEBEAMPROJECTIMAGEGENERICFILTER__H diff --git a/tools/clitkDicomRTStructInfo.cxx b/tools/clitkDicomRTStructInfo.cxx deleted file mode 100644 index 43d660e..0000000 --- a/tools/clitkDicomRTStructInfo.cxx +++ /dev/null @@ -1,36 +0,0 @@ -/*========================================================================= - Program: vv http://www.creatis.insa-lyon.fr/rio/vv - Main authors : XX XX XX - - Authors belongs 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 http://www.opensource.org/licenses/bsd-license.php - - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html - - =========================================================================*/ - -#include "clitkDicomRT_StructureSet.h" -#include "clitkDicomRTStructInfo_ggo.h" - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkDicomRTStructInfo, args_info); - - // Read and display information - clitk::DicomRT_StructureSet s; - s.Read(args_info.input_arg); - s.Print(std::cout); - - // This is the end my friend - return 0; -} diff --git a/tools/clitkDicomRTStructInfo.ggo b/tools/clitkDicomRTStructInfo.ggo deleted file mode 100644 index 4d4021a..0000000 --- a/tools/clitkDicomRTStructInfo.ggo +++ /dev/null @@ -1,11 +0,0 @@ -# file clitkDicomRTStructInfo.ggo -package "clitk" -version "Read and print DICOM RT Structure set file (contours)" - -option "config" - "Config file" string no -option "input" i "Input Dicom file" string yes - -#option "roi" r "ROI to print (ID)" int no -#option "contour" c "contour to print (ID)" int no -#option "offset" o "to display points as image offsets" flag off - diff --git a/tools/clitkFilter.cxx b/tools/clitkFilter.cxx deleted file mode 100644 index 144a811..0000000 --- a/tools/clitkFilter.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkFilter_ggo.h" -#include "clitkIO.h" -#include "clitkFilterGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkFilter, args_info); - CLITK_INIT; - - // Filter - clitk::FilterGenericFilter::Pointer genericFilter=clitk::FilterGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkFilter.ggo b/tools/clitkFilter.ggo deleted file mode 100644 index 2eb2bc8..0000000 --- a/tools/clitkFilter.ggo +++ /dev/null @@ -1,30 +0,0 @@ -#File clitkFilter.ggo -package "clitkFilter" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "mask" m "Mask in which the filter should be applied" string no - -option "float" - "Convert to float first " flag off - -section "Filter" - -option "type" t "Type of filter: 0=derivative, 1= gradient magnitude, 2= projection, 3= intensity windowing, 4=BSplineDownsampling with factor 2, 5=normalize intensities (mean=0 ,SD=1), 6=anisotropic diffusion, 7=gradient anisotropic diffusion, 8=curvature anisotropic diffusion, 9= curvature flow" int no default="0" -option "order" - "0: what order" int no default="1" -option "direction" - "0-2: what direction" int no default="0" -option "projection" - "2: what accumulation (0=sum, 1=max, 2=min) " int no default="0" -option "inputMin" - "3: set window minimum" float no default="0" -option "inputMax" - "3: set window maximum" float no default="100" -option "outputMin" - "3: set output minimum" float no default="0" -option "outputMax" - "3: set output maximum" float no default="255" -option "resamplerType" - "4: Resampler type to use for the downsampling (0=Standard, 1=Centered, 2=L2, 3=L2Centered) " int no default="0" -option "splineOrder" - "4: SplineOrder to use for the downsampling (0-5, some resamplers only odd) " int no default="3" -option "cond" - "6-8: conductance parameter" double no default="3.0" -option "time" - "6-9: Time step (6,7: 0.25 for 2D and 0.125 for 3D; 8,9:0.125 for 2D and 0.0625 for 3D)" double no default="0.125" -option "iter" - "6-9: Iterations (6-8=5; 9=10)" double no default="5" -option "radius" - "9: radius" double no default="1" diff --git a/tools/clitkFilterGenericFilter.cxx b/tools/clitkFilterGenericFilter.cxx deleted file mode 100644 index 9ba58af..0000000 --- a/tools/clitkFilterGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkFilterGenericFilter_cxx -#define clitkFilterGenericFilter_cxx - -/* ================================================= - * @file clitkFilterGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkFilterGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - FilterGenericFilter::FilterGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void FilterGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2 or 3 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( FilterGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkFilter & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - FilterGenericFilter(); - ~FilterGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkFilter m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkFilterGenericFilter.txx" -#endif - -#endif // #define clitkFilterGenericFilter_h diff --git a/tools/clitkFilterGenericFilter.txx b/tools/clitkFilterGenericFilter.txx deleted file mode 100644 index 49f9d04..0000000 --- a/tools/clitkFilterGenericFilter.txx +++ /dev/null @@ -1,304 +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 clitkFilterGenericFilter_txx -#define clitkFilterGenericFilter_txx - -/* ================================================= - * @file clitkFilterGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - FilterGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); -// } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - -// else if (PixelType == "unsigned_char"){ -// if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; -// UpdateWithDimAndPixelType(); -// } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - // else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); -// } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - FilterGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image InternalImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - - // Filter - typedef itk::ImageToImageFilter< InternalImageType, InternalImageType > ImageToImageFilterType; - typename ImageToImageFilterType::Pointer filter; - - switch ( m_ArgsInfo.type_arg ){ - - case 0:{ - typename itk::DerivativeImageFilter< InternalImageType,InternalImageType >::Pointer df = itk::DerivativeImageFilter::New(); - - //Set parameters - df->SetDirection(m_ArgsInfo.direction_arg); - df->SetOrder(m_ArgsInfo.order_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the derivative image filter with order "<::Pointer gf = itk::GradientMagnitudeImageFilter::New(); - - //Set parameters - gf->SetUseImageSpacingOn(); - - filter=gf; - if (m_Verbose) std::cout<<"Using the gradient magnitude image filter... "<< std::endl; - break; - } - case 2:{ - - switch ( m_ArgsInfo.projection_arg ){ - - case 0:{ - //Sum - typename itk::SumProjectionImageFilter< InternalImageType,InternalImageType >::Pointer pf = itk::SumProjectionImageFilter::New(); - //Set parameters - pf->SetProjectionDimension(m_ArgsInfo.direction_arg); - - filter=pf; - if (m_Verbose) std::cout<<"Using the Sum projection image filter on the dimension "<< m_ArgsInfo.direction_arg << "..."<::Pointer pf = itk::MaximumProjectionImageFilter::New(); - //Set parameters - pf->SetProjectionDimension(m_ArgsInfo.direction_arg); - - filter=pf; - if (m_Verbose) std::cout<<"Using the maximum intensity projection image filter on the dimension "<< m_ArgsInfo.direction_arg << "..."<::Pointer pf = itk::MinimumProjectionImageFilter::New(); - //Set parameters - pf->SetProjectionDimension(m_ArgsInfo.direction_arg); - - filter=pf; - if (m_Verbose) std::cout<<"Using the minimum intensity projection image filter on the dimension "<< m_ArgsInfo.direction_arg << "..."<::Pointer pf - = itk::IntensityWindowingImageFilter::New(); - //Set parameters - pf->SetWindowMinimum((InternalPixelType) m_ArgsInfo.inputMin_arg); - pf->SetWindowMaximum((InternalPixelType) m_ArgsInfo.inputMax_arg); - pf->SetOutputMinimum((InternalPixelType) m_ArgsInfo.outputMin_arg); - pf->SetOutputMaximum((InternalPixelType) m_ArgsInfo.outputMax_arg); - - filter=pf; - if (m_Verbose) std::cout<<"Using the window intensity image filter with the window min and max being " - << m_ArgsInfo.inputMin_arg << " and "<< m_ArgsInfo.inputMax_arg - <<" and the output min and max being "< ResamplerType; - typedef itk::BSplineCenteredResampleImageFilterBase CenteredResamplerType; - typedef itk::BSplineL2ResampleImageFilterBase L2ResamplerType; - typedef itk::BSplineCenteredL2ResampleImageFilterBase CenteredL2ResamplerType; - - //ResamplerType - if(m_ArgsInfo.resamplerType_arg==0) - { - typename itk::BSplineDownsampleImageFilter< InternalImageType,InternalImageType, ResamplerType >::Pointer df - = itk::BSplineDownsampleImageFilter< InternalImageType,InternalImageType, ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with Standard Resampler"<::Pointer df - = itk::BSplineDownsampleImageFilter< InternalImageType,InternalImageType, CenteredResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with Centered Resampler"<::Pointer df - = itk::BSplineDownsampleImageFilter< InternalImageType,InternalImageType,L2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with L2 Resampler"<::Pointer df - = itk::BSplineDownsampleImageFilter< InternalImageType,InternalImageType,CenteredL2ResamplerType >::New(); - df->SetSplineOrder(m_ArgsInfo.splineOrder_arg); - filter=df; - if (m_Verbose) std::cout<<"Using the BSpline downsample image filter with L2 Centered Resampler"< NormalizeFilterType; - typename NormalizeFilterType::Pointer df = NormalizeFilterType::New(); - filter=df; - if (m_Verbose) std::cout << "Normalizing image intensities to a zero mean and 1 SD (float!)..." << std::endl; - break; - } -// case 6: { -// typedef itk::AnisotropicDiffusionImageFilter FilterType; -// typename FilterType::Pointer df = FilterType::New(); -// df->SetConductanceParameter(m_ArgsInfo.cond_arg); -// df->SetNumberOfIterations(m_ArgsInfo.iter_arg); -// df->SetTimeStep(m_ArgsInfo.time_arg); -// df->SetUseImageSpacing(true); - -// filter=df; -// if (m_Verbose) std::cout << "Using the anisotropic diffusion image filter..." << std::endl; -// break; -// } - - case 7: { - typedef itk::GradientAnisotropicDiffusionImageFilter FilterType; - typename FilterType::Pointer df = FilterType::New(); - df->SetConductanceParameter(m_ArgsInfo.cond_arg); - df->SetNumberOfIterations(m_ArgsInfo.iter_arg); - df->SetTimeStep(m_ArgsInfo.time_arg); - df->SetUseImageSpacing(true); - - filter=df; - if (m_Verbose) std::cout << "Using the gradient anisotropic diffusion image filter..." << std::endl; - break; - } - - case 8: { - typedef itk::CurvatureAnisotropicDiffusionImageFilter FilterType; - typename FilterType::Pointer df = FilterType::New(); - df->SetConductanceParameter(m_ArgsInfo.cond_arg); - df->SetNumberOfIterations(m_ArgsInfo.iter_arg); - df->SetTimeStep(m_ArgsInfo.time_arg); - df->SetUseImageSpacing(true); - - filter=df; - if (m_Verbose) std::cout << "Using the Curvature anisotropic diffusion image filter..." << std::endl; - break; - } - - case 9: { - typedef itk::CurvatureFlowImageFilter FilterType; - typename FilterType::Pointer df = FilterType::New(); - df->SetTimeStep(m_ArgsInfo.time_arg); - df->SetUseImageSpacing(true); - df->SetNumberOfIterations(m_ArgsInfo.iter_arg); - filter=df; - if (m_Verbose) std::cout << "Using the curvature flow image filter......" << std::endl; - break; - } - - - }//end switch filterType - - - //================================================================== - //execute the filter - filter->SetInput(input); - - - if (m_Verbose)std::cout<<"Starting filter..."<Update(); - } - catch( itk::ExceptionObject & err ) - { - std::cerr << "ExceptionObject caught! Filter failed!" << std::endl; - std::cerr << err << std::endl; - return; - } - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(filter->GetOutput()); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkFilterGenericFilter_txx diff --git a/tools/clitkGetDirection.cxx b/tools/clitkGetDirection.cxx deleted file mode 100644 index 2a4cf12..0000000 --- a/tools/clitkGetDirection.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkGetDirection.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkGetDirection_ggo.h" -#include "clitkIO.h" -#include "clitkGetDirectionGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkGetDirection, args_info); - CLITK_INIT; - - // Filter - clitk::GetDirectionGenericFilter::Pointer genericFilter=clitk::GetDirectionGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkGetDirection.ggo b/tools/clitkGetDirection.ggo deleted file mode 100644 index 9179799..0000000 --- a/tools/clitkGetDirection.ggo +++ /dev/null @@ -1,11 +0,0 @@ -#File clitkGetDirection.ggo -package "clitkGetDirection" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes - - diff --git a/tools/clitkGetDirectionGenericFilter.cxx b/tools/clitkGetDirectionGenericFilter.cxx deleted file mode 100644 index 6e8dfa9..0000000 --- a/tools/clitkGetDirectionGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkGetDirectionGenericFilter_cxx -#define clitkGetDirectionGenericFilter_cxx - -/* ================================================= - * @file clitkGetDirectionGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkGetDirectionGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - GetDirectionGenericFilter::GetDirectionGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void GetDirectionGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2,3 or 4 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( GetDirectionGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkGetDirection & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - GetDirectionGenericFilter(); - ~GetDirectionGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkGetDirection m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkGetDirectionGenericFilter.txx" -#endif - -#endif // #define clitkGetDirectionGenericFilter_h diff --git a/tools/clitkGetDirectionGenericFilter.txx b/tools/clitkGetDirectionGenericFilter.txx deleted file mode 100644 index 8d4b2dc..0000000 --- a/tools/clitkGetDirectionGenericFilter.txx +++ /dev/null @@ -1,103 +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 clitkGetDirectionGenericFilter_txx -#define clitkGetDirectionGenericFilter_txx - -/* ================================================= - * @file clitkGetDirectionGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - GetDirectionGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - GetDirectionGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typename InputImageType::DirectionType direction=input->GetDirection(); - for (unsigned int i=0;iSetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkGetOrigin.ggo b/tools/clitkGetOrigin.ggo deleted file mode 100644 index 4af7499..0000000 --- a/tools/clitkGetOrigin.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkGetOrigin.ggo -package "clitkGetOrigin" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "comma" o "Output comma separated values" flag off - - diff --git a/tools/clitkGetOriginGenericFilter.cxx b/tools/clitkGetOriginGenericFilter.cxx deleted file mode 100644 index 438fd63..0000000 --- a/tools/clitkGetOriginGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkGetOriginGenericFilter_cxx -#define clitkGetOriginGenericFilter_cxx - -/* ================================================= - * @file clitkGetOriginGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkGetOriginGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - GetOriginGenericFilter::GetOriginGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void GetOriginGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2 or 3 or 4 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( GetOriginGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkGetOrigin & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - GetOriginGenericFilter(); - ~GetOriginGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkGetOrigin m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkGetOriginGenericFilter.txx" -#endif - -#endif // #define clitkGetOriginGenericFilter_h diff --git a/tools/clitkGetOriginGenericFilter.txx b/tools/clitkGetOriginGenericFilter.txx deleted file mode 100644 index 0606fe8..0000000 --- a/tools/clitkGetOriginGenericFilter.txx +++ /dev/null @@ -1,102 +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 clitkGetOriginGenericFilter_txx -#define clitkGetOriginGenericFilter_txx - -/* ================================================= - * @file clitkGetOriginGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - GetOriginGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - GetOriginGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - //Get Origin - typename InputImageType::PointType origin=input->GetOrigin(); - for(unsigned int i=0; iSetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkGetSize.ggo b/tools/clitkGetSize.ggo deleted file mode 100644 index 2fbb51b..0000000 --- a/tools/clitkGetSize.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkGetSize.ggo -package "clitkGetSize" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "comma" c "Output comma separated values" flag off - - diff --git a/tools/clitkGetSizeGenericFilter.cxx b/tools/clitkGetSizeGenericFilter.cxx deleted file mode 100644 index db780b9..0000000 --- a/tools/clitkGetSizeGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkGetSizeGenericFilter_cxx -#define clitkGetSizeGenericFilter_cxx - -/* ================================================= - * @file clitkGetSizeGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkGetSizeGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - GetSizeGenericFilter::GetSizeGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void GetSizeGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2 or 3 or 4 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( GetSizeGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkGetSize & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - GetSizeGenericFilter(); - ~GetSizeGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkGetSize m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkGetSizeGenericFilter.txx" -#endif - -#endif // #define clitkGetSizeGenericFilter_h diff --git a/tools/clitkGetSizeGenericFilter.txx b/tools/clitkGetSizeGenericFilter.txx deleted file mode 100644 index f1c1501..0000000 --- a/tools/clitkGetSizeGenericFilter.txx +++ /dev/null @@ -1,103 +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 clitkGetSizeGenericFilter_txx -#define clitkGetSizeGenericFilter_txx - -/* ================================================= - * @file clitkGetSizeGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - GetSizeGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - // } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - //else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - //} - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - // else { - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - GetSizeGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typename InputImageType::SizeType size=input->GetLargestPossibleRegion().GetSize(); - for(unsigned int i=0; iSetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkGetSpacing.ggo b/tools/clitkGetSpacing.ggo deleted file mode 100644 index 9cdb225..0000000 --- a/tools/clitkGetSpacing.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkGetSpacing.ggo -package "clitkGetSpacing" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "comma" o "Output comma separated values" flag off - - diff --git a/tools/clitkGetSpacingGenericFilter.cxx b/tools/clitkGetSpacingGenericFilter.cxx deleted file mode 100644 index 57c607a..0000000 --- a/tools/clitkGetSpacingGenericFilter.cxx +++ /dev/null @@ -1,61 +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 clitkGetSpacingGenericFilter_cxx -#define clitkGetSpacingGenericFilter_cxx - -#include "clitkGetSpacingGenericFilter.h" - -namespace clitk -{ - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - GetSpacingGenericFilter::GetSpacingGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void GetSpacingGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2 or 3 or 4 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( GetSpacingGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkGetSpacing & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - GetSpacingGenericFilter(); - ~GetSpacingGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkGetSpacing m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkGetSpacingGenericFilter.txx" -#endif - -#endif // #define clitkGetSpacingGenericFilter_h diff --git a/tools/clitkGetSpacingGenericFilter.txx b/tools/clitkGetSpacingGenericFilter.txx deleted file mode 100644 index 39edcc4..0000000 --- a/tools/clitkGetSpacingGenericFilter.txx +++ /dev/null @@ -1,101 +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 clitkGetSpacingGenericFilter_txx -#define clitkGetSpacingGenericFilter_txx - -/* ================================================= - * @file clitkGetSpacingGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - GetSpacingGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - // } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - // else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - // } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - // else { - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - GetSpacingGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typename InputImageType::SpacingType spacing=input->GetSpacing(); - for(unsigned int i=0; iGetNumberOfDimensions(); - - // Check parameters - // Main filter - clitk::GuerreroVentilationGenericFilter filter; - filter.SetInputFilename(args_info.input_arg); - filter.AddInputFilename(args_info.ref_arg); - filter.SetOutputFilename(args_info.output_arg); - filter.SetBloodCorrectionFactor(args_info.factor_arg); - filter.SetUseCorrectFormula(args_info.correct_flag); - filter.Update(); - - // this is the end my friend - return 0; -} // end main diff --git a/tools/clitkGuerreroVentilation.ggo b/tools/clitkGuerreroVentilation.ggo deleted file mode 100644 index 9dfdbda..0000000 --- a/tools/clitkGuerreroVentilation.ggo +++ /dev/null @@ -1,13 +0,0 @@ -#File clitkGuerreroVentilation.ggo -package "clitkGuerreroVentilation" -version "1.0" -purpose "Compute the ventilation image from a motion compensated image and the reference (end-expiration) image" - - -option "config" - "Config file" string no -option "input" i "Input image filename" string yes -option "ref" r "Reference image filename" string yes -option "output" o "Output image base filename" string yes -option "factor" f "Blood mass correction factor" double yes -option "verbose" v "Verbose" flag off -option "correct" c "Use the correct formula instead of the original one" flag off diff --git a/tools/clitkGuerreroVentilationGenericFilter.cxx b/tools/clitkGuerreroVentilationGenericFilter.cxx deleted file mode 100644 index 95ea669..0000000 --- a/tools/clitkGuerreroVentilationGenericFilter.cxx +++ /dev/null @@ -1,80 +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 -===========================================================================**/ -/** - ------------------------------------------------------------------- - * @file clitkGuerreroVentilationGenericFilter.cxx - * @author Joël Schaerer - * @date 20 April 2009 - - * @brief - -------------------------------------------------------------------*/ - -#include "clitkGuerreroVentilationGenericFilter.h" -#include -#include -#include - -//-------------------------------------------------------------------- -clitk::GuerreroVentilationGenericFilter::GuerreroVentilationGenericFilter() - :ImageToImageGenericFilter("GuerreroVentilationGenericFilter") -{ - blood_mass_factor=1.; - InitializeImageType<2>(); - InitializeImageType<3>(); -} -//-------------------------------------------------------------------- - -//-------------------------------------------------------------------- -template -void clitk::GuerreroVentilationGenericFilter::InitializeImageType() -{ - ADD_IMAGE_TYPE(Dim, short); -} -//-------------------------------------------------------------------- - - -//-------------------------------------------------------------------- -template -void clitk::GuerreroVentilationGenericFilter::UpdateWithInputImageType() -{ - - // Input should be 2 - assert(m_InputFilenames.size() == 2); - - // Reading input - typedef ImageType InputImageType; - typename InputImageType::Pointer input = this->template GetInput(0); - typename InputImageType::Pointer ref = this->template GetInput(1); - - typedef itk::Image OutputImageType; - // typename ImageType::Pointer input = clitk::readImage(mInputFilenames[0], mIOVerbose); - //typename ImageType::Pointer ref = clitk::readImage(mInputFilenames[1], mIOVerbose); - - typedef itk::BinaryGuerreroFilter GFilterType; - typename GFilterType::Pointer filter = GFilterType::New(); - filter->SetInput1(ref); - filter->SetInput2(input); - filter->SetBloodCorrectionFactor(blood_mass_factor); - filter->SetUseCorrectFormula(use_correct_formula); - filter->Update(); - - this->SetNextOutput(filter->GetOutput()); - //clitk::writeImage(filter->GetOutput(), mOutputFilename, mIOVerbose); - //std::cout << "Warning: removed " << filter->GetFunctor().aberant_voxels << " aberant voxels from the ventilation image" - //<< std::endl; -} diff --git a/tools/clitkGuerreroVentilationGenericFilter.h b/tools/clitkGuerreroVentilationGenericFilter.h deleted file mode 100644 index c0b7aa8..0000000 --- a/tools/clitkGuerreroVentilationGenericFilter.h +++ /dev/null @@ -1,78 +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 clitkGuerreroVentilationGenericFilter_H -#define clitkGuerreroVentilationGenericFilter_H -/** - ------------------------------------------------------------------- - * @file clitkGuerreroVentilationGenericFilter.h - * @author David Sarrut - * @date 23 Feb 2008 - -------------------------------------------------------------------*/ - -// clitk include -#include "clitkImageToImageGenericFilter.h" - -// itk include -#include "itkImage.h" -#include "itkImageIOBase.h" -#include "itkImageRegionIterator.h" -#include "itkImageRegionConstIterator.h" - -namespace clitk { - - //-------------------------------------------------------------------- - class GuerreroVentilationGenericFilter : - public ImageToImageGenericFilter { - public: - - // Constructor - GuerreroVentilationGenericFilter(); - virtual ~GuerreroVentilationGenericFilter() {} - - // Types - typedef GuerreroVentilationGenericFilter Self; - typedef ImageToImageGenericFilterBase Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - // New - itkNewMacro(Self); - - // Set methods - void SetBloodCorrectionFactor(double f) {blood_mass_factor=f;} - void SetUseCorrectFormula(bool u) {use_correct_formula=u;} - - //-------------------------------------------------------------------- - // Main function called each time the filter is updated - template - void UpdateWithInputImageType(); - - protected: - template void InitializeImageType(); - //Parameters - double blood_mass_factor; - bool use_correct_formula; - - }; // end class GuerreroVentilationGenericFilter -//-------------------------------------------------------------------- - -} // end namespace -//-------------------------------------------------------------------- - -#endif //#define clitkGuerreroVentilationGenericFilter_H - diff --git a/tools/clitkImageExtractLine.cxx b/tools/clitkImageExtractLine.cxx deleted file mode 100644 index 3d59bf5..0000000 --- a/tools/clitkImageExtractLine.cxx +++ /dev/null @@ -1,216 +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 CLITKIMAGEEXTRACTLINE_CXX -#define CLITKIMAGEEXTRACTLINE_CXX -/** - ------------------------------------------------- - * @file clitkImageExtractLine.cxx - * @author David Sarrut - * @date 23 Feb 2008 08:37:53 - * @modified by Loïc Grevillot - * @date 10 March 2011 - * Option -I added, in order to integrate plans perpendicular to a line - - -------------------------------------------------*/ - -// clitk include -#include "clitkImageExtractLine_ggo.h" -#include "clitkIO.h" -#include "clitkImageCommon.h" -#include "clitkCommon.h" -#include - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) -{ - - // Init command line - GGO(clitkImageExtractLine, args_info); - CLITK_INIT; - - // Declare main types - typedef float PixelType; - const unsigned int Dimension=3; - typedef itk::Image ImageType; - typedef itk::Size SizeType; - - // Check options - if (args_info.firstIndex_given != Dimension) { - std::cerr << "Please give " << Dimension << "values to --firstIndex option" << std::endl; - exit(0); - } - if (args_info.lastIndex_given != Dimension) { - std::cerr << "Please give " << Dimension << "values to --lastIndex option" << std::endl; - exit(0); - } - - // Read image - ImageType::Pointer input = clitk::readImage(args_info.input_arg, args_info.verbose_flag); - - // Get first and last index - typedef ImageType::IndexType IndexType; - IndexType firstIndex; - IndexType lastIndex; - ImageType::SpacingType spacing = input->GetSpacing(); - double length = 0.0; - for(unsigned int i=0; i depth; -// std::vector values; -// itk::LineConstIterator iter(input, firstIndex, lastIndex); -// iter.GoToBegin(); -// while (!iter.IsAtEnd()) { -// values.push_back(iter.Get()); -// ++iter; -// } -// double step = length/values.size(); - - std::vector depth; - std::vector values; - itk::LineConstIterator iter(input, firstIndex, lastIndex); - int direction=0; - - // args_info.integral_arg=0, so, it does not compute the integral - if (args_info.integral_arg==0){ - iter.GoToBegin(); - while (!iter.IsAtEnd()) { - values.push_back(iter.Get()); - ++iter; - } - } - // args_info.integral_arg=1, so, it computes the integral - if (args_info.integral_arg!=0){ - int a=0, b=0, c=0; - if (args_info.integralAxis_arg==0){ - a=1; - b=0; - c=2; - } - else if (args_info.integralAxis_arg==1){ - a=0; - b=1; - c=2; - } - else if (args_info.integralAxis_arg==2){ - a=2; - b=0; - c=1; - } - else {std::cout<<"Wrong axis"<GetLargestPossibleRegion().GetSize(); - DD(dim); - DD(direction); - - std::vector val(dim[b]); - for (size_t i=0; i iter(input, firstIndex, lastIndex); - iter.GoToBegin(); - // std::cout<<"B"< - * @date 04 April 2008 15:28:32 - * - * @brief - * - * Take an inverse normalized log of the image intensity - =================================================*/ - -// clitk include -#include "clitkImageLog_ggo.h" -#include "clitkIO.h" -#include "clitkCommon.h" - -// itk include -#include "itkImageFileReader.h" -#include "itkImageFileWriter.h" -#include "itkImageRegionIterator.h" - -int main(int argc, char * argv[]) { - - // init command line - GGO(clitkImageLog, args_info); - CLITK_INIT; - - typedef float PixelType; - const unsigned int Dimension=3; - typedef itk::Image ImageType; - typedef itk::ImageFileReader ImageReaderType; - typedef itk::ImageFileWriter ImageWriterType; - typedef itk::ImageRegionIterator IteratorType; - - //Read input - ImageReaderType::Pointer reader= ImageReaderType::New(); - reader->SetFileName(args_info.input_arg); - reader->Update(); - ImageType::Pointer input = reader->GetOutput(); - - //Create iterators - IteratorType pi (input, input->GetLargestPossibleRegion()); - pi.GoToBegin(); - - PixelType max=std::numeric_limits::max(); - - //Create output - while(!pi.IsAtEnd()) - { - if (pi.Get()< 0) - { - pi.Set(0.); - } - else - { - pi.Set(-log((PixelType)(max-pi.Get()+1)/(PixelType)max)); - } - ++pi; - } - - ImageWriterType::Pointer writer= ImageWriterType::New(); - writer->SetFileName(args_info.output_arg); - writer->SetInput(input); - writer->Update(); - return 0; -} - - - -#endif /* end #define CLITKIMAGELOG_CXX */ diff --git a/tools/clitkImageLog.ggo b/tools/clitkImageLog.ggo deleted file mode 100644 index 0f40682..0000000 --- a/tools/clitkImageLog.ggo +++ /dev/null @@ -1,9 +0,0 @@ -# file clitkImageLog.ggo -package "clitk" -version "Perform a inverse normalized log on the image" - -option "config" - "Config file" string no -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "verbose" v "Verbose" flag off - diff --git a/tools/clitkLineProfile.cxx b/tools/clitkLineProfile.cxx deleted file mode 100644 index a81ffbb..0000000 --- a/tools/clitkLineProfile.cxx +++ /dev/null @@ -1,38 +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 -===========================================================================*/ -#include "clitkLineProfile_ggo.h" -#include "clitkLineProfileGenericFilter.h" - - -bool verbose = false; - -template -void run(const args_info_clitkLineProfile& argsInfo); - -int main(int argc, char** argv) -{ - GGO(clitkLineProfile, args_info); - - clitk::LineProfileGenericFilter::Pointer filter = clitk::LineProfileGenericFilter::New(); - filter->SetArgsInfo(args_info); - filter->Update(); - - return EXIT_SUCCESS; -} - - diff --git a/tools/clitkLineProfile.ggo b/tools/clitkLineProfile.ggo deleted file mode 100644 index b61caa2..0000000 --- a/tools/clitkLineProfile.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkLineProfile.ggo -package "clitkLineProfile" -version "1.0" -purpose "Get the HU profile along the given line. Output to stdout." - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image" string yes -option "p0" - "First point of the line" int no multiple default="0" -option "p1" - "Second point of the line" int no multiple default="0" -#option "output" o "Output file containing formated line points and values" string yes diff --git a/tools/clitkLineProfileGenericFilter.cxx b/tools/clitkLineProfileGenericFilter.cxx deleted file mode 100644 index 5f775c2..0000000 --- a/tools/clitkLineProfileGenericFilter.cxx +++ /dev/null @@ -1,44 +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 -===========================================================================*/ -#include "clitkLineProfileGenericFilter.h" - -namespace clitk -{ - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - LineProfileGenericFilter::LineProfileGenericFilter() - : ImageToImageGenericFilter("Resample") - { - m_Verbose=false; - - InitializeImageType<2>(); - InitializeImageType<3>(); - //InitializeImageType<4>(); - } - //-------------------------------------------------------------------- - //-------------------------------------------------------------------- - template - void LineProfileGenericFilter::InitializeImageType() - { - ADD_DEFAULT_IMAGE_TYPES(Dim); - //ADD_IMAGE_TYPE(Dim, short); - } - //-------------------------------------------------------------------- - -} \ No newline at end of file diff --git a/tools/clitkLineProfileGenericFilter.h b/tools/clitkLineProfileGenericFilter.h deleted file mode 100644 index 132b807..0000000 --- a/tools/clitkLineProfileGenericFilter.h +++ /dev/null @@ -1,104 +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 clitkLineProfileGenericFilter_h -#define clitkLineProfileGenericFilter_h - -/* ================================================= - * @file clitkLineProfileGenericFilter.h - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkImageToImageGenericFilter.h" -#include "clitkLineProfile_ggo.h" - - -namespace clitk -{ - - class ITK_EXPORT LineProfileGenericFilter: - public ImageToImageGenericFilter - { - public: - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - LineProfileGenericFilter(); - ~LineProfileGenericFilter() {}; - - - //---------------------------------------- - // ITK - //---------------------------------------- - typedef LineProfileGenericFilter Self; - typedef itk::LightObject Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( SetSpacingGenericFilter, LightObject ); - - //---------------------------------------- - // Typedefs - //---------------------------------------- - typedef args_info_clitkLineProfile ArgsInfoType; - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const ArgsInfoType & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - SetIOVerbose(m_Verbose); - SetInputFilename(m_ArgsInfo.input_arg); - } - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithInputImageType(); - - protected: - - //---------------------------------------- - // Templated members - //---------------------------------------- - //template void UpdateWithDim(std::string PixelType, unsigned int Components); - template void InitializeImageType(); - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkLineProfile m_ArgsInfo; - bool m_Verbose; - - }; -} - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkLineProfileGenericFilter.txx" -#endif - -#endif // clitkLineProfileGenericFilter_h \ No newline at end of file diff --git a/tools/clitkLineProfileGenericFilter.txx b/tools/clitkLineProfileGenericFilter.txx deleted file mode 100644 index e6caa2b..0000000 --- a/tools/clitkLineProfileGenericFilter.txx +++ /dev/null @@ -1,134 +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 clitkLineProfileGenericFilter_cxx -#define clitkLineProfileGenericFilter_cxx - -/* ================================================= - * @file clitkLineProfileGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "itkBresenhamLine.h" - -namespace clitk -{ - -//----------------------------------------------------------- - // Update - //----------------------------------------------------------- - template - void LineProfileGenericFilter::UpdateWithInputImageType() - { - typedef InputImageType ImageType; - - if (m_Verbose) - std::cout << "LineProfileGenericFilter::UpdateWithInputImageType" << std::endl; - - // type checks - if (m_ArgsInfo.p0_given != ImageType::ImageDimension || - m_ArgsInfo.p1_given != ImageType::ImageDimension) - throw std::logic_error("Dimension of input points and image do not match."); - - typename ImageType::Pointer image = this->template GetInput(0); - typename ImageType::RegionType region = image->GetLargestPossibleRegion(); - - typedef typename ImageType::PointType PointType; - PointType p0, p1; - for (unsigned int i = 0; i < ImageType::ImageDimension; i++) { - p0[i] = m_ArgsInfo.p0_arg[i]; - p1[i] = m_ArgsInfo.p1_arg[i]; - } - - // compute params of line between p0 and p1 - // length (magnitude) must be an integer value, so it's - // the max distance along one the axes plus one to account - // for the last point. - typedef itk::BresenhamLine LineType; - typename LineType::LType direction = p1 - p0; - typename LineType::LType::RealValueType mag = 0; - for (unsigned int i = 0; i < ImageType::ImageDimension; i++) { - if (direction[i] > mag) - mag = direction[i]; - } - mag++; - - if (m_Verbose) - std::cout << "Building line with direction = " << direction << " and length = " << mag << "..." << std::endl; - - // build the line itself - LineType line; - typename LineType::OffsetArray offsets; - offsets = line.BuildLine(direction, mag); - - if (m_Verbose) - std::cout << "Line has " << offsets.size() << " points" << std::endl; - - // fill the output vectors - typedef typename ImageType::PixelType PixelType; - typedef typename ImageType::OffsetType OffsetType; - typedef typename ImageType::IndexType IndexType; - typedef std::vector IndexArrayType; - typedef std::vector ValueArrayType; - - IndexType index0, index1; - for (unsigned int i = 0; i < ImageType::ImageDimension; i++) { - index0[i] = m_ArgsInfo.p0_arg[i]; - index1[i] = m_ArgsInfo.p1_arg[i]; - } - - if (m_Verbose) - std::cout << "Getting profile along line..." << std::endl; - - IndexType index; - IndexArrayType line_indices; - ValueArrayType line_values; - for (size_t i = 0; i < offsets.size(); i++) - { - index = index0 + offsets[i]; - if (m_Verbose) { - std::cout << "index " << i << " = " << index << std::endl; - } - - if (region.IsInside(index)) { - if (m_Verbose) - std::cout << "value " << i << " = " << image->GetPixel(index) << std::endl; - - line_indices.push_back(index); - line_values.push_back(image->GetPixel(index)); - } - else if (m_Verbose) - std::cout << "index outside image" << std::endl; - } - - if (m_Verbose) { - std::cout << "I bring to you The Computed Points!" << std::endl; - } - - for (size_t i = 0; i < line_indices.size(); i++) { - std::cout << line_indices[i] << " " << line_values[i] << std::endl; - } - } - - -} //end clitk - -#endif //#define clitkLineProfileGenericFilter_cxx diff --git a/tools/clitkPermuteAxes.cxx b/tools/clitkPermuteAxes.cxx deleted file mode 100644 index 87d3c57..0000000 --- a/tools/clitkPermuteAxes.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkPermuteAxes.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkPermuteAxes_ggo.h" -#include "clitkIO.h" -#include "clitkPermuteAxesGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkPermuteAxes, args_info); - CLITK_INIT; - - // Filter - clitk::PermuteAxesGenericFilter::Pointer genericFilter=clitk::PermuteAxesGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkPermuteAxes.ggo b/tools/clitkPermuteAxes.ggo deleted file mode 100644 index 7962ac4..0000000 --- a/tools/clitkPermuteAxes.ggo +++ /dev/null @@ -1,13 +0,0 @@ -#File clitkPermuteAxes.ggo -package "clitkPermuteAxes" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "order" - "The new order of the axes (n comma separated values [o,N])" int multiple yes - - diff --git a/tools/clitkPermuteAxesGenericFilter.cxx b/tools/clitkPermuteAxesGenericFilter.cxx deleted file mode 100644 index 1adf01f..0000000 --- a/tools/clitkPermuteAxesGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkPermuteAxesGenericFilter_cxx -#define clitkPermuteAxesGenericFilter_cxx - -/* ================================================= - * @file clitkPermuteAxesGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkPermuteAxesGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - PermuteAxesGenericFilter::PermuteAxesGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void PermuteAxesGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2, 3 or 4 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( PermuteAxesGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkPermuteAxes & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - PermuteAxesGenericFilter(); - ~PermuteAxesGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkPermuteAxes m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkPermuteAxesGenericFilter.txx" -#endif - -#endif // #define clitkPermuteAxesGenericFilter_h diff --git a/tools/clitkPermuteAxesGenericFilter.txx b/tools/clitkPermuteAxesGenericFilter.txx deleted file mode 100644 index 992ab5f..0000000 --- a/tools/clitkPermuteAxesGenericFilter.txx +++ /dev/null @@ -1,119 +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 clitkPermuteAxesGenericFilter_txx -#define clitkPermuteAxesGenericFilter_txx - -/* ================================================= - * @file clitkPermuteAxesGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - PermuteAxesGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - PermuteAxesGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typedef itk::PermuteAxesImageFilter PermuteFilterType; - typename PermuteFilterType::Pointer permuteFilter=PermuteFilterType::New(); - permuteFilter->SetInput(input); - typename PermuteFilterType::PermuteOrderArrayType order; - - if(m_ArgsInfo.order_given != Dimension) - { - std::cerr<<"Error: Number of order parameters is different from image dimension!"<SetOrder(order); - permuteFilter->Update(); - typename OutputImageType::Pointer output =permuteFilter->GetOutput(); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkPermuteAxesGenericFilter_txx diff --git a/tools/clitkSetDirection.cxx b/tools/clitkSetDirection.cxx deleted file mode 100644 index ec984c3..0000000 --- a/tools/clitkSetDirection.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkSetDirection.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkSetDirection_ggo.h" -#include "clitkIO.h" -#include "clitkSetDirectionGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkSetDirection, args_info); - CLITK_INIT; - - // Filter - clitk::SetDirectionGenericFilter::Pointer genericFilter=clitk::SetDirectionGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkSetDirection.ggo b/tools/clitkSetDirection.ggo deleted file mode 100644 index f79a4f1..0000000 --- a/tools/clitkSetDirection.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkSetDirection.ggo -package "clitkSetDirection" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "direction" d "Direction cosine matrix (defaults to identity)" double multiple no - diff --git a/tools/clitkSetDirectionGenericFilter.cxx b/tools/clitkSetDirectionGenericFilter.cxx deleted file mode 100644 index 7899607..0000000 --- a/tools/clitkSetDirectionGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkSetDirectionGenericFilter_cxx -#define clitkSetDirectionGenericFilter_cxx - -/* ================================================= - * @file clitkSetDirectionGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkSetDirectionGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - SetDirectionGenericFilter::SetDirectionGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void SetDirectionGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType); - - - // Call UpdateWithDim - if(Dimension==2) UpdateWithDim<2>(PixelType); - else if(Dimension==3) UpdateWithDim<3>(PixelType); - else if (Dimension==4)UpdateWithDim<4>(PixelType); - else - { - std::cout<<"Error, Only for 2,3 or 4 Dimensions!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( SetDirectionGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkSetDirection & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - SetDirectionGenericFilter(); - ~SetDirectionGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkSetDirection m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkSetDirectionGenericFilter.txx" -#endif - -#endif // #define clitkSetDirectionGenericFilter_h diff --git a/tools/clitkSetDirectionGenericFilter.txx b/tools/clitkSetDirectionGenericFilter.txx deleted file mode 100644 index ad16c84..0000000 --- a/tools/clitkSetDirectionGenericFilter.txx +++ /dev/null @@ -1,108 +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 clitkSetDirectionGenericFilter_txx -#define clitkSetDirectionGenericFilter_txx - -/* ================================================= - * @file clitkSetDirectionGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - SetDirectionGenericFilter::UpdateWithDim(std::string PixelType) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the pixeltype - //------------------------------------------------------------------- - template - void - SetDirectionGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typename InputImageType::DirectionType direction; - direction.SetIdentity(); - if(m_ArgsInfo.direction_given==Dimension*Dimension) - for (unsigned int i=0;iSetDirection(direction); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(input); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkSetDirectionGenericFilter_txx diff --git a/tools/clitkSetOrigin.cxx b/tools/clitkSetOrigin.cxx deleted file mode 100644 index de77e5e..0000000 --- a/tools/clitkSetOrigin.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkSetOrigin.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkSetOrigin_ggo.h" -#include "clitkIO.h" -#include "clitkSetOriginGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkSetOrigin, args_info); - CLITK_INIT; - - // Filter - clitk::SetOriginGenericFilter::Pointer genericFilter=clitk::SetOriginGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkSetOrigin.ggo b/tools/clitkSetOrigin.ggo deleted file mode 100644 index a2c3392..0000000 --- a/tools/clitkSetOrigin.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkSetOrigin.ggo -package "clitkSetOrigin" -version "1.0" -purpose "Set the origin field of a generic image" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "like" l "Like image filename" string no -option "origin" - "Origin" double multiple no default="0" diff --git a/tools/clitkSetOriginGenericFilter.cxx b/tools/clitkSetOriginGenericFilter.cxx deleted file mode 100644 index ef596a4..0000000 --- a/tools/clitkSetOriginGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkSetOriginGenericFilter_cxx -#define clitkSetOriginGenericFilter_cxx - -/* ================================================= - * @file clitkSetOriginGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkSetOriginGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - SetOriginGenericFilter::SetOriginGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void SetOriginGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension, Components; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components); - - - // 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!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( SetOriginGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkSetOrigin & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - SetOriginGenericFilter(); - ~SetOriginGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType, int Components); - template void UpdateWithDimAndPixelType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkSetOrigin m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkSetOriginGenericFilter.txx" -#endif - -#endif // #define clitkSetOriginGenericFilter_h diff --git a/tools/clitkSetOriginGenericFilter.txx b/tools/clitkSetOriginGenericFilter.txx deleted file mode 100644 index 86617bf..0000000 --- a/tools/clitkSetOriginGenericFilter.txx +++ /dev/null @@ -1,136 +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 clitkSetOriginGenericFilter_txx -#define clitkSetOriginGenericFilter_txx - -/* ================================================= - * @file clitkSetOriginGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - SetOriginGenericFilter::UpdateWithDim(std::string PixelType, int Components) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - else if (Components==3) - { - if (m_Verbose) std::cout << "Launching transform in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - UpdateWithDimAndPixelType >(); - } - - else std::cerr<<"Number of components is "< - void - SetOriginGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Origin - typename InputImageType::PointType origin; - origin.Fill(0.0); - - // Like? - if (m_ArgsInfo.like_given) - { - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer likeReader = InputReaderType::New(); - likeReader->SetFileName( m_ArgsInfo.like_arg); - likeReader->Update(); - typename InputImageType::Pointer like= likeReader->GetOutput(); - origin=like->GetOrigin(); - } - else - { - if (m_ArgsInfo.origin_given==Dimension) - for(unsigned int i=0; iSetOrigin(origin); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(input); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkSetOriginGenericFilter_txx diff --git a/tools/clitkSetSpacing.cxx b/tools/clitkSetSpacing.cxx deleted file mode 100644 index bc30189..0000000 --- a/tools/clitkSetSpacing.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkSetSpacing.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkSetSpacing_ggo.h" -#include "clitkIO.h" -#include "clitkSetSpacingGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkSetSpacing, args_info); - CLITK_INIT; - - // Filter - clitk::SetSpacingGenericFilter::Pointer genericFilter=clitk::SetSpacingGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkSetSpacing.ggo b/tools/clitkSetSpacing.ggo deleted file mode 100644 index 5df5888..0000000 --- a/tools/clitkSetSpacing.ggo +++ /dev/null @@ -1,14 +0,0 @@ -#File clitkSetSpacing.ggo -package "clitkSetSpacing" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes -option "like" l "Like image filename" string no -option "spacing" s "Spacing" double no multiple default="1" - - diff --git a/tools/clitkSetSpacingGenericFilter.cxx b/tools/clitkSetSpacingGenericFilter.cxx deleted file mode 100644 index 6b3b88e..0000000 --- a/tools/clitkSetSpacingGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkSetSpacingGenericFilter_cxx -#define clitkSetSpacingGenericFilter_cxx - -/* ================================================= - * @file clitkSetSpacingGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkSetSpacingGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - SetSpacingGenericFilter::SetSpacingGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void SetSpacingGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension, Components; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components); - - - // 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!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( SetSpacingGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkSetSpacing & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - SetSpacingGenericFilter(); - ~SetSpacingGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType, unsigned int Components); - template void UpdateWithDimAndPixelType(); - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkSetSpacing m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkSetSpacingGenericFilter.txx" -#endif - -#endif // #define clitkSetSpacingGenericFilter_h diff --git a/tools/clitkSetSpacingGenericFilter.txx b/tools/clitkSetSpacingGenericFilter.txx deleted file mode 100644 index a6682f4..0000000 --- a/tools/clitkSetSpacingGenericFilter.txx +++ /dev/null @@ -1,136 +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 clitkSetSpacingGenericFilter_txx -#define clitkSetSpacingGenericFilter_txx - -/* ================================================= - * @file clitkSetSpacingGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - SetSpacingGenericFilter::UpdateWithDim(std::string PixelType , unsigned int Components) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - else if (Components==3) - { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - UpdateWithDimAndPixelType >(); - } - - else std::cerr<<"Number of components is "< - void - SetSpacingGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typename InputImageType::SpacingType spacing; - spacing.Fill(1.0); - - // Like? - if (m_ArgsInfo.like_given) - { - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer likeReader = InputReaderType::New(); - likeReader->SetFileName( m_ArgsInfo.like_arg); - likeReader->Update(); - typename InputImageType::Pointer like= likeReader->GetOutput(); - spacing=like->GetSpacing(); - } - else - { - if (m_ArgsInfo.spacing_given==Dimension) - for(unsigned int i=0; iSetSpacing(spacing); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(input); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkSetSpacingGenericFilter_txx diff --git a/tools/clitkVFMerge.cxx b/tools/clitkVFMerge.cxx deleted file mode 100644 index b056ba4..0000000 --- a/tools/clitkVFMerge.cxx +++ /dev/null @@ -1,146 +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 CLITKVFMERGE_CXX -#define CLITKVFMERGE_CXX - -/** - * @file clitkVFMerge.cxx - * @author Jef Vandemeulebroucke - * @date June 15 10:14:53 2007 - * - * @brief Read in one VF (ex mhd, vf) and write to another. Transforming from mm to voxels needed for the vf format is implemented in clitkVfImageIO.cxx . - * - * - */ - -// clitk include -#include "clitkVFMerge_ggo.h" -#include "clitkIO.h" -#include "clitkImageCommon.h" -#include "clitkCommon.h" - -// itk include -#include "itkImageFileWriter.h" -#include -#include "itkImageFileReader.h" - -int main( int argc, char *argv[] ) -{ - - // Init command line - GGO(clitkVFMerge, args_info); - CLITK_INIT; - - const unsigned int SpaceDimension = 3; - const unsigned int ModelDimension = 4; - typedef itk::Vector< float, SpaceDimension > Displacement; - typedef itk::Image< Displacement, SpaceDimension > DeformationFieldType; - typedef itk::Image< Displacement, ModelDimension > DynamicDeformationFieldType; - typedef itk::ImageFileReader< DeformationFieldType > DeformationFieldReaderType; - typedef itk::ImageFileWriter< DynamicDeformationFieldType > DynamicDeformationFieldWriterType; - - -//declare the dynamic - DynamicDeformationFieldType::Pointer dynamicDeformationField=DynamicDeformationFieldType::New(); - - -//declare their iterators - typedef itk::ImageRegionIterator< DynamicDeformationFieldType> DynamicDeformationFieldIteratorType; - DynamicDeformationFieldIteratorType *dynamicIteratorPointer= new DynamicDeformationFieldIteratorType; - - for (unsigned int i=0 ; i< args_info.inputs_num ; i ++) { - //read in the deformation field i - DeformationFieldReaderType::Pointer deformationFieldReader = DeformationFieldReaderType::New(); - deformationFieldReader->SetFileName( args_info.inputs[i]); - if (args_info.verbose_flag) std::cout<<"Reading VF number "<< i+1 << std::endl; - deformationFieldReader->Update(); - DeformationFieldType::Pointer currentDeformationField = deformationFieldReader->GetOutput(); - - //create an iterator for the current deformation field - typedef itk::ImageRegionIterator FieldIteratorType; - FieldIteratorType fieldIterator(currentDeformationField, currentDeformationField->GetLargestPossibleRegion()); - - //Allocate memory for the dynamic components - if (i==0) { - DynamicDeformationFieldType::RegionType dynamicDeformationFieldRegion; - DynamicDeformationFieldType::RegionType::SizeType dynamicDeformationFieldSize; - DeformationFieldType::RegionType::SizeType deformationFieldSize; - deformationFieldSize= currentDeformationField->GetLargestPossibleRegion().GetSize(); - dynamicDeformationFieldSize[0]=deformationFieldSize[0]; - dynamicDeformationFieldSize[1]=deformationFieldSize[1]; - dynamicDeformationFieldSize[2]=deformationFieldSize[2]; - dynamicDeformationFieldSize[3]=args_info.inputs_num; - dynamicDeformationFieldRegion.SetSize(dynamicDeformationFieldSize); - DynamicDeformationFieldType::IndexType start; - start.Fill(0); - dynamicDeformationFieldRegion.SetIndex(start); - dynamicDeformationField->SetRegions(dynamicDeformationFieldRegion); - dynamicDeformationField->Allocate(); - - - //Set the spacing - DeformationFieldType::SpacingType spacing= currentDeformationField->GetSpacing(); - DynamicDeformationFieldType::SpacingType dynamicSpacing; - dynamicSpacing[0]=spacing[0]; - dynamicSpacing[1]=spacing[1]; - dynamicSpacing[2]=spacing[2]; - dynamicSpacing[3]=args_info.spacing_arg; //JV par exemple - dynamicDeformationField->SetSpacing(dynamicSpacing); - DynamicDeformationFieldType::PointType origin; - origin[0]=args_info.xorigin_arg; - origin[1]=args_info.yorigin_arg; - origin[2]=args_info.zorigin_arg; - origin[3]=0; //temporal origin is always 0 - dynamicDeformationField->SetOrigin(origin); - - // Creating iterators for the currentDeformationField and the DynamicDeformationField - DynamicDeformationFieldIteratorType *dynamicIterator= new DynamicDeformationFieldIteratorType(dynamicDeformationField, dynamicDeformationField->GetLargestPossibleRegion()); - dynamicIteratorPointer=dynamicIterator; - dynamicIteratorPointer->GoToBegin(); - } - if (args_info.verbose_flag) std::cout<<"Merging VF number "<< i+1 << std::endl; - //Copy the current component of the input into dynamicDeformationFieldComponent - fieldIterator.GoToBegin(); - while(!fieldIterator.IsAtEnd()) { - dynamicIteratorPointer->Set(fieldIterator.Get()); - ++fieldIterator; - ++(*dynamicIteratorPointer); - } - } - - -//Write the vector field - DynamicDeformationFieldWriterType::Pointer writer = DynamicDeformationFieldWriterType::New(); - writer->SetInput( dynamicDeformationField ); - writer->SetFileName( args_info.output_arg ); - if (args_info.verbose_flag) std::cout<<"Writing the dynamic VF"<< std::endl; - - - try { - - writer->Update( ); - } catch( itk::ExceptionObject & excp ) { - std::cerr << "Problem writing the output file" << std::endl; - std::cerr << excp << std::endl; - return EXIT_FAILURE; - } - return EXIT_SUCCESS; -} -#endif - - diff --git a/tools/clitkVFMerge.ggo b/tools/clitkVFMerge.ggo deleted file mode 100644 index 2e425d8..0000000 --- a/tools/clitkVFMerge.ggo +++ /dev/null @@ -1,14 +0,0 @@ -#File clitkVFMerge.ggo -#Author: Jef Vandemeulebroucke -#Date : Tue 15 June 16.35 - -package "clitk" -version "Read a bunch of vector fields (.mhd, .vf, ..) and turn them into a higher dimension vector field (.mhd, ...)" - -option "config" - "Config file" string no -option "output" o "Output VF filename" string yes -option "spacing" s "Spacing for the fourth dimension" float no default="1" -option "verbose" v "Verbose" flag off -option "xorigin" x "Set the x origin of the output vf" float default="0." -option "yorigin" y "Set the y origin of the output vf" float default="0." -option "zorigin" z "Set the z origin of the output vf" float default="0." diff --git a/tools/clitkValuesToBSplineCoefficients.cxx b/tools/clitkValuesToBSplineCoefficients.cxx deleted file mode 100644 index 705900e..0000000 --- a/tools/clitkValuesToBSplineCoefficients.cxx +++ /dev/null @@ -1,51 +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 -===========================================================================**/ - -/* ================================================= - * @file clitkValuesToBSplineCoefficients.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -// clitk -#include "clitkValuesToBSplineCoefficients_ggo.h" -#include "clitkIO.h" -#include "clitkValuesToBSplineCoefficientsGenericFilter.h" - - -//-------------------------------------------------------------------- -int main(int argc, char * argv[]) { - - // Init command line - GGO(clitkValuesToBSplineCoefficients, args_info); - CLITK_INIT; - - // Filter - clitk::ValuesToBSplineCoefficientsGenericFilter::Pointer genericFilter=clitk::ValuesToBSplineCoefficientsGenericFilter::New(); - - genericFilter->SetArgsInfo(args_info); - genericFilter->Update(); - - return EXIT_SUCCESS; -}// end main - -//-------------------------------------------------------------------- diff --git a/tools/clitkValuesToBSplineCoefficients.ggo b/tools/clitkValuesToBSplineCoefficients.ggo deleted file mode 100644 index f059073..0000000 --- a/tools/clitkValuesToBSplineCoefficients.ggo +++ /dev/null @@ -1,12 +0,0 @@ -#File clitkValuesToBSplineCoefficients.ggo -package "clitkValuesToBSplineCoefficients" -version "1.0" -purpose "" - -option "config" - "Config file" string no -option "verbose" v "Verbose" flag off - -option "input" i "Input image filename" string yes -option "output" o "Output image filename" string yes - -option "order" - "Order of the BSpline coefficients" int no default="3" diff --git a/tools/clitkValuesToBSplineCoefficientsGenericFilter.cxx b/tools/clitkValuesToBSplineCoefficientsGenericFilter.cxx deleted file mode 100644 index f4cf646..0000000 --- a/tools/clitkValuesToBSplineCoefficientsGenericFilter.cxx +++ /dev/null @@ -1,72 +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 clitkValuesToBSplineCoefficientsGenericFilter_cxx -#define clitkValuesToBSplineCoefficientsGenericFilter_cxx - -/* ================================================= - * @file clitkValuesToBSplineCoefficientsGenericFilter.cxx - * @author - * @date - * - * @brief - * - ===================================================*/ - -#include "clitkValuesToBSplineCoefficientsGenericFilter.h" - - -namespace clitk -{ - - - //----------------------------------------------------------- - // Constructor - //----------------------------------------------------------- - ValuesToBSplineCoefficientsGenericFilter::ValuesToBSplineCoefficientsGenericFilter() - { - m_Verbose=false; - m_InputFileName=""; - } - - - //----------------------------------------------------------- - // Update - //----------------------------------------------------------- - void ValuesToBSplineCoefficientsGenericFilter::Update() - { - // Read the Dimension and PixelType - int Dimension, Components; - std::string PixelType; - ReadImageDimensionAndPixelType(m_InputFileName, Dimension, PixelType, Components); - - - // 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!!!"< Pointer; - typedef itk::SmartPointer ConstPointer; - - // Method for creation through the object factory - itkNewMacro(Self); - - // Run-time type information (and related methods) - itkTypeMacro( ValuesToBSplineCoefficientsGenericFilter, LightObject ); - - - //---------------------------------------- - // Typedefs - //---------------------------------------- - - - //---------------------------------------- - // Set & Get - //---------------------------------------- - void SetArgsInfo(const args_info_clitkValuesToBSplineCoefficients & a) - { - m_ArgsInfo=a; - m_Verbose=m_ArgsInfo.verbose_flag; - m_InputFileName=m_ArgsInfo.input_arg; - } - - - //---------------------------------------- - // Update - //---------------------------------------- - void Update(); - - protected: - - //---------------------------------------- - // Constructor & Destructor - //---------------------------------------- - ValuesToBSplineCoefficientsGenericFilter(); - ~ValuesToBSplineCoefficientsGenericFilter() {}; - - - //---------------------------------------- - // Templated members - //---------------------------------------- - template void UpdateWithDim(std::string PixelType, unsigned int Components); - template void UpdateWithDimAndPixelType(); - template void UpdateWithDimAndVectorType(); - - - //---------------------------------------- - // Data members - //---------------------------------------- - args_info_clitkValuesToBSplineCoefficients m_ArgsInfo; - bool m_Verbose; - std::string m_InputFileName; - - }; - - -} // end namespace clitk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "clitkValuesToBSplineCoefficientsGenericFilter.txx" -#endif - -#endif // #define clitkValuesToBSplineCoefficientsGenericFilter_h diff --git a/tools/clitkValuesToBSplineCoefficientsGenericFilter.txx b/tools/clitkValuesToBSplineCoefficientsGenericFilter.txx deleted file mode 100644 index 74f37d8..0000000 --- a/tools/clitkValuesToBSplineCoefficientsGenericFilter.txx +++ /dev/null @@ -1,155 +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 clitkValuesToBSplineCoefficientsGenericFilter_txx -#define clitkValuesToBSplineCoefficientsGenericFilter_txx - -/* ================================================= - * @file clitkValuesToBSplineCoefficientsGenericFilter.txx - * @author - * @date - * - * @brief - * - ===================================================*/ - - -namespace clitk -{ - - //------------------------------------------------------------------- - // Update with the number of dimensions - //------------------------------------------------------------------- - template - void - ValuesToBSplineCoefficientsGenericFilter::UpdateWithDim(std::string PixelType, unsigned int Components) - { - if (m_Verbose) std::cout << "Image was detected to be "<(); - } - // else if(PixelType == "unsigned_short"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_short..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - - else if (PixelType == "unsigned_char"){ - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; - UpdateWithDimAndPixelType(); - } - - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } - else { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and float..." << std::endl; - UpdateWithDimAndPixelType(); - } - } - - else if (Components==3) - { - if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and 3D float (DVF)" << std::endl; - UpdateWithDimAndVectorType >(); - } - - else std::cerr<<"Number of components is "< - void - ValuesToBSplineCoefficientsGenericFilter::UpdateWithDimAndPixelType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typedef itk::BSplineDecompositionImageFilter FilterType; - typename FilterType::Pointer filter=FilterType::New(); - filter->SetInput(input); - filter->SetSplineOrder(m_ArgsInfo.order_arg); - filter->Update(); - typename OutputImageType::Pointer output=filter->GetOutput(); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - - //------------------------------------------------------------------- - // Update with the number of dimensions and the Vectortype - //------------------------------------------------------------------- - template - void - ValuesToBSplineCoefficientsGenericFilter::UpdateWithDimAndVectorType() - { - - // ImageTypes - typedef itk::Image InputImageType; - typedef itk::Image OutputImageType; - - // Read the input - typedef itk::ImageFileReader InputReaderType; - typename InputReaderType::Pointer reader = InputReaderType::New(); - reader->SetFileName( m_InputFileName); - reader->Update(); - typename InputImageType::Pointer input= reader->GetOutput(); - - // Filter - typedef clitk::VectorBSplineDecompositionImageFilter FilterType; - typename FilterType::Pointer filter=FilterType::New(); - filter->SetInput(input); - filter->SetSplineOrder(m_ArgsInfo.order_arg); - filter->Update(); - typename OutputImageType::Pointer output=filter->GetOutput(); - - // Output - typedef itk::ImageFileWriter WriterType; - typename WriterType::Pointer writer = WriterType::New(); - writer->SetFileName(m_ArgsInfo.output_arg); - writer->SetInput(output); - writer->Update(); - - } - - -}//end clitk - -#endif //#define clitkValuesToBSplineCoefficientsGenericFilter_txx -- 2.47.1