TARGET_LINK_LIBRARIES(clitkCatImage clitkCommon)
SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkCatImage)
+ WRAP_GGO(clitkAnisotropicDiffusion_GGO_C clitkAnisotropicDiffusion.ggo)
+ ADD_EXECUTABLE(clitkAnisotropicDiffusion clitkAnisotropicDiffusion.cxx
+ clitkAnisotropicDiffusionGenericFilter.cxx
+ ${clitkAnisotropicDiffusion_GGO_C})
+ TARGET_LINK_LIBRARIES(clitkAnisotropicDiffusion clitkCommon)
+ SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkAnisotropicDiffusion)
+
IF(CLITK_EXPERIMENTAL)
WRAP_GGO(clitkBinaryImageToMesh_GGO_C clitkBinaryImageToMesh.ggo)
ADD_EXECUTABLE(clitkBinaryImageToMesh clitkBinaryImageToMesh.cxx ${clitkBinaryImageToMesh_GGO_C})
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://www.centreleonberard.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================**/
+
+// clitk
+#include "clitkAnisotropicDiffusion_ggo.h"
+#include "clitkAnisotropicDiffusionGenericFilter.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+ // Init command line
+ GGO(clitkAnisotropicDiffusion, args_info);
+ CLITK_INIT;
+
+ // Filter
+ typedef clitk::AnisotropicDiffusionGenericFilter FilterType;
+ FilterType::Pointer filter = FilterType::New();
+
+ filter->SetArgsInfo(args_info);
+
+ CLITK_TRY_CATCH_EXIT(filter->Update());
+
+ return EXIT_SUCCESS;
+} // This is the end, my friend
+//--------------------------------------------------------------------
--- /dev/null
+#File clitkAnisotropicDiffusion.ggo
+package "clitkAnisotropicDiffusion"
+version "1.0"
+purpose "Performs gradient or curvature anisotropic diffusion filtering"
+
+option "config" - "Config file" string no
+option "verbose" v "Verbose" flag off
+option "imagetypes" - "Display allowed image types" flag off
+
+option "input" i "Input image filename" string yes
+option "output" o "Output image filename" string yes
+option "type" - "Type of filtering" values="Gradient","Curvature" enum no default="Gradient"
+option "niterations" n "Number of iterations" int no default="5"
+option "conductance" c "Conductance" double no default="3"
+option "timestep" t "Time step" double no default="0.01"
--- /dev/null
+/*=========================================================================
+ 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 clitkAnisotropicDiffusionGenericFilter_cxx
+#define clitkAnisotropicDiffusionGenericFilter_cxx
+
+#include "clitkAnisotropicDiffusionGenericFilter.h"
+
+// itk include
+#include <itkGradientAnisotropicDiffusionImageFilter.h>
+#include <itkCurvatureAnisotropicDiffusionImageFilter.h>
+
+//#include <clitkCommon.h>
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+AnisotropicDiffusionGenericFilter::AnisotropicDiffusionGenericFilter():
+ ImageToImageGenericFilter<Self>("AnisotropicDiffusion")
+{
+ InitializeImageType<2>();
+ InitializeImageType<3>();
+ InitializeImageType<4>();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<unsigned int Dim>
+void AnisotropicDiffusionGenericFilter::InitializeImageType()
+{
+ ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+void AnisotropicDiffusionGenericFilter::SetArgsInfo(const args_info_type & a)
+{
+ mArgsInfo=a;
+ if (mArgsInfo.verbose_given)
+ SetIOVerbose(mArgsInfo.verbose_flag);
+ if (mArgsInfo.imagetypes_given && mArgsInfo.imagetypes_flag)
+ this->PrintAvailableImageTypes();
+ if (mArgsInfo.input_given) {
+ SetInputFilename(mArgsInfo.input_arg);
+ }
+ if (mArgsInfo.output_given) {
+ SetOutputFilename(mArgsInfo.output_arg);
+ }
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+// Update with the number of dimensions and the pixeltype
+//--------------------------------------------------------------------
+template<class InputImageType>
+void
+AnisotropicDiffusionGenericFilter::UpdateWithInputImageType()
+{
+ // Reading input
+ typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
+
+ // Filter
+ typedef itk::CurvatureAnisotropicDiffusionImageFilter<InputImageType, InputImageType> CADIFType;
+ typename CADIFType::Pointer cadFilter = CADIFType::New();
+ typedef itk::GradientAnisotropicDiffusionImageFilter<InputImageType, InputImageType> GADIFType;
+ typename GADIFType::Pointer gadFilter = GADIFType::New();
+ switch(mArgsInfo.type_arg) {
+ case type_arg_Gradient:
+ gadFilter->SetInput(input);
+ gadFilter->SetNumberOfIterations(mArgsInfo.niterations_arg);
+ gadFilter->SetTimeStep(mArgsInfo.timestep_arg);
+ gadFilter->SetConductanceParameter(mArgsInfo.conductance_arg);
+ gadFilter->Update();
+ this->template SetNextOutput<InputImageType>(gadFilter->GetOutput());
+ case type_arg_Curvature:
+ cadFilter->SetInput(input);
+ cadFilter->SetNumberOfIterations(mArgsInfo.niterations_arg);
+ cadFilter->SetTimeStep(mArgsInfo.timestep_arg);
+ cadFilter->SetConductanceParameter(mArgsInfo.conductance_arg);
+ cadFilter->Update();
+ this->template SetNextOutput<InputImageType>(cadFilter->GetOutput());
+ }
+}
+//--------------------------------------------------------------------
+
+
+}//end clitk
+
+#endif //#define clitkAnisotropicDiffusionGenericFilter_cxx
--- /dev/null
+/*=========================================================================
+ 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 clitkAnisotropicDiffusionGenericFilter_h
+#define clitkAnisotropicDiffusionGenericFilter_h
+
+#include "clitkIO.h"
+#include "clitkImageToImageGenericFilter.h"
+#include "clitkAnisotropicDiffusion_ggo.h"
+
+//--------------------------------------------------------------------
+namespace clitk
+{
+
+ class ITK_EXPORT AnisotropicDiffusionGenericFilter:
+ public ImageToImageGenericFilter<AnisotropicDiffusionGenericFilter>
+ {
+
+ public:
+ //--------------------------------------------------------------------
+ typedef AnisotropicDiffusionGenericFilter Self;
+ typedef itk::SmartPointer<Self> Pointer;
+ typedef itk::SmartPointer<const Self> ConstPointer;
+ typedef args_info_clitkAnisotropicDiffusion args_info_type;
+
+ //--------------------------------------------------------------------
+ // Method for creation through the object factory
+ // and Run-time type information (and related methods)
+ itkNewMacro(Self);
+ itkTypeMacro(AnisotropicDiffusionGenericFilter, LightObject);
+
+ //--------------------------------------------------------------------
+ void SetArgsInfo(const args_info_type & a);
+
+ //--------------------------------------------------------------------
+ // Main function called each time the filter is updated
+ template<class InputImageType>
+ void UpdateWithInputImageType();
+
+ protected:
+ AnisotropicDiffusionGenericFilter();
+ template<unsigned int Dim> void InitializeImageType();
+ args_info_type mArgsInfo;
+
+ }; // end class
+ //--------------------------------------------------------------------
+
+} // end namespace clitk
+//--------------------------------------------------------------------
+
+#endif // #define clitkAnisotropicDiffusionGenericFilter_h