TARGET_LINK_LIBRARIES(clitkImageIntensityWindowing clitkCommon )
SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkImageIntensityWindowing)
+ WRAP_GGO(clitkBlurImage_GGO_C clitkBlurImage.ggo)
+ ADD_EXECUTABLE(clitkBlurImage clitkBlurImage.cxx ${clitkBlurImage_GGO_C})
+ TARGET_LINK_LIBRARIES(clitkBlurImage clitkCommon )
+ SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkBlurImage)
#=========================================================
option(CLITK_USE_ROOT "Build experimental tools using root" OFF)
--- /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
+===========================================================================**/
+
+/* =================================================
+ * @file clitkBlurImageGenericFilter.txx
+ * @author xxx <xxx@creatis.insa-lyon.fr>
+ * @date 29 June 2029
+ *
+ * @brief BlurImage an image
+ *
+ ===================================================*/
+
+// clitk
+#include "clitkBlurImage_ggo.h"
+#include "clitkBlurImageGenericFilter.h"
+
+//--------------------------------------------------------------------
+int main(int argc, char * argv[])
+{
+
+ // Init command line
+ GGO(clitkBlurImage, args_info);
+ CLITK_INIT;
+
+ // Filter
+ typedef clitk::BlurImageGenericFilter<args_info_clitkBlurImage> FilterType;
+ FilterType::Pointer filter = FilterType::New();
+
+ filter->SetArgsInfo(args_info);
+ filter->Update();
+
+ return EXIT_SUCCESS;
+}// end main
+
+//--------------------------------------------------------------------
--- /dev/null
+#File clitkBlurImage.ggo
+package "clitkBlurImage"
+version "1.0"
+purpose "Filter the input image with a Gaussian"
+
+option "config" - "Config file" string optional
+option "verbose" v "Verbose" flag off
+
+option "imagetypes" - "Display allowed image types" flag off
+
+option "input" i "Input image filename" string required
+option "output" o "Output image filename" string required
+
+option "variance" - "value of the gaussian variance (multiple values=number of image dimension)" double required multiple
--- /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 CLITKBlurImageGENERICFILTER_H
+#define CLITKBlurImageGENERICFILTER_H
+#include "clitkIO.h"
+#include "clitkImageToImageGenericFilter.h"
+
+//--------------------------------------------------------------------
+namespace clitk
+{
+
+template<class args_info_type>
+class ITK_EXPORT BlurImageGenericFilter:
+ public ImageToImageGenericFilter<BlurImageGenericFilter<args_info_type> >
+{
+
+public:
+
+ //--------------------------------------------------------------------
+ BlurImageGenericFilter();
+
+ //--------------------------------------------------------------------
+ typedef BlurImageGenericFilter Self;
+ typedef itk::SmartPointer<Self> Pointer;
+ typedef itk::SmartPointer<const Self> ConstPointer;
+
+ //--------------------------------------------------------------------
+ // Method for creation through the object factory
+ // and Run-time type information (and related methods)
+ itkNewMacro(Self);
+ itkTypeMacro(BlurImageGenericFilter, LightObject);
+
+ //--------------------------------------------------------------------
+ void SetArgsInfo(const args_info_type & a);
+
+ //--------------------------------------------------------------------
+ // Main function called each time the filter is updated
+ template<class InputImageType>
+ void UpdateWithInputImageType();
+
+protected:
+ template<unsigned int Dim> void InitializeImageType();
+ args_info_type mArgsInfo;
+
+}; // end class
+//--------------------------------------------------------------------
+
+} // end namespace clitk
+
+#ifndef ITK_MANUAL_INSTANTIATION
+#include "clitkBlurImageGenericFilter.txx"
+#endif
+
+#endif // #define clitkBlurImageGenericFilter_h
--- /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 clitkBlurImageGenericFilter_txx
+#define clitkBlurImageGenericFilter_txx
+
+/* =================================================
+ * @file clitkBlurImageGenericFilter.txx
+ * @author Jef Vandemeulebroucke <jef@creatis.insa-lyon.fr>
+ * @date 29 june 2009
+ *
+ * @brief
+ *
+ ===================================================*/
+
+// itk include
+#include "itkDiscreteGaussianImageFilter.h"
+#include <clitkCommon.h>
+
+namespace clitk
+{
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+BlurImageGenericFilter<args_info_type>::BlurImageGenericFilter():
+ ImageToImageGenericFilter<Self>("BlurImage")
+{
+ InitializeImageType<2>();
+ InitializeImageType<3>();
+ //InitializeImageType<4>();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<unsigned int Dim>
+void BlurImageGenericFilter<args_info_type>::InitializeImageType()
+{
+ ADD_DEFAULT_IMAGE_TYPES(Dim);
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template<class args_info_type>
+void BlurImageGenericFilter<args_info_type>::SetArgsInfo(const args_info_type & a)
+{
+ mArgsInfo=a;
+ this->SetIOVerbose(mArgsInfo.verbose_flag);
+ if (mArgsInfo.imagetypes_flag) this->PrintAvailableImageTypes();
+
+ if (mArgsInfo.input_given) {
+ this->SetInputFilename(mArgsInfo.input_arg);
+ }
+ if (mArgsInfo.output_given) {
+ this->SetOutputFilename(mArgsInfo.output_arg);
+ }
+}
+//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+// Update with the number of dimensions and the pixeltype
+//--------------------------------------------------------------------
+template<class args_info_type>
+template<class InputImageType>
+void
+BlurImageGenericFilter<args_info_type>::UpdateWithInputImageType()
+{
+ const unsigned int dim = InputImageType::ImageDimension;
+ double varianceArray[dim];
+
+ //std::cout<<"mArgsInfo.variance_given"<<mArgsInfo.variance_given<<std::endl;
+
+ if (mArgsInfo.variance_given != dim) {
+ std::cerr << "The number of variance parameters must be equal to the image dimension." << std::endl;
+ return;
+ }
+
+ for (unsigned int i = 0; i < dim; i++) {
+ //std::cout<<"mArgsInfo.variance_arg[i]"<<mArgsInfo.variance_arg[i]<<std::endl;
+ varianceArray[i] = mArgsInfo.variance_arg[i];
+ }
+ // Reading input
+ typename InputImageType::Pointer input = this->template GetInput<InputImageType>(0);
+
+ // Main filter
+ typedef typename InputImageType::PixelType PixelType;
+ typedef itk::Image<float, InputImageType::ImageDimension> OutputImageType;
+
+ // Filter
+ typedef itk::DiscreteGaussianImageFilter<InputImageType, OutputImageType> DiscreteGaussianImageFilterType;
+ typename DiscreteGaussianImageFilterType::Pointer gaussianFilter=DiscreteGaussianImageFilterType::New();
+ gaussianFilter->SetInput(input);
+ gaussianFilter->SetVariance(varianceArray);
+ gaussianFilter->Update();
+
+ // Write/Save results
+ this->template SetNextOutput<OutputImageType>(gaussianFilter->GetOutput());
+}
+//--------------------------------------------------------------------
+
+
+}//end clitk
+
+#endif //#define clitkBlurImageGenericFilter_txx
#File clitkImageGradientMagnitude.ggo
package "clitkImageGradientMagnitude"
version "1.0"
-purpose ""
+purpose "Compute the gradient magnitude of the input image"
option "config" - "Config file" string optional
option "verbose" v "Verbose" flag off
option "mask" m "Mask input image filename" string optional
option "output" o "Output image filename" string required
option "normalize" n "Normalize the output image between 0 and 1" flag off
+option "gaussian_filter" g "Gaussian filtering" flag off
// itk include
#include "itkGradientMagnitudeImageFilter.h"
+#include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"
#include "itkLabelStatisticsImageFilter.h"
#include "itkMaskImageFilter.h"
#include "itkMaskNegatedImageFilter.h"
IteratorOutputType ito = IteratorOutputType(outputImage, outputImage->GetLargestPossibleRegion());
// Filter
+ typename OutputImageType::Pointer outputGradientFilter;
+ if (mArgsInfo.gaussian_filter_flag == 0) {
typedef itk::GradientMagnitudeImageFilter<InputImageType, OutputImageType> GradientMagnitudeImageFilterType;
typename GradientMagnitudeImageFilterType::Pointer gradientFilter=GradientMagnitudeImageFilterType::New();
gradientFilter->SetInput(input);
gradientFilter->Update();
+ outputGradientFilter = gradientFilter->GetOutput();
+ }
+ else {
+ typedef itk::GradientMagnitudeRecursiveGaussianImageFilter<InputImageType, OutputImageType> GradientMagnitudeImageFilterType;
+ typename GradientMagnitudeImageFilterType::Pointer gradientFilter=GradientMagnitudeImageFilterType::New();
+ gradientFilter->SetInput(input);
+ gradientFilter->Update();
+ outputGradientFilter = gradientFilter->GetOutput();
+ }
// Set iterator
typedef itk::ImageRegionIterator<OutputImageType> IteratorType;
- IteratorType it(gradientFilter->GetOutput(), gradientFilter->GetOutput()->GetLargestPossibleRegion());
+ IteratorType it(outputGradientFilter, outputGradientFilter->GetLargestPossibleRegion());
// Set mask iterator
typedef itk::ImageRegionIterator<MaskImageType> IteratorMaskType;
//typedef itk::MinimumMaximumImageCalculator <OutputImageType> ImageCalculatorFilterType;
//typename ImageCalculatorFilterType::Pointer imageCalculatorFilter = ImageCalculatorFilterType::New();
- //imageCalculatorFilter->SetImage(gradientFilter->GetOutput());
+ //imageCalculatorFilter->SetImage(outputGradientFilter);
//imageCalculatorFilter->Compute();
typedef itk::LabelStatisticsImageFilter< OutputImageType, MaskImageType > LabelStatisticsImageFilterType;
typename LabelStatisticsImageFilterType::Pointer labelStatisticsImageFilter = LabelStatisticsImageFilterType::New();
labelStatisticsImageFilter->SetLabelInput( mask );
- labelStatisticsImageFilter->SetInput(gradientFilter->GetOutput());
+ labelStatisticsImageFilter->SetInput(outputGradientFilter);
labelStatisticsImageFilter->Update();
//std::cout << "Number of labels: " << labelStatisticsImageFilter->GetNumberOfLabels() << std::endl;
++itm;
}
- //typename OutputImageType::Pointer outputImage = gradientFilter->GetOutput();
+ //typename OutputImageType::Pointer outputImage = outputGradientFilter;
this->template SetNextOutput<OutputImageType>(outputImage);
}
//--------------------------------------------------------------------
#File clitkImageLaplacian.ggo
package "clitkImageLaplacian"
version "1.0"
-purpose ""
+purpose "Compute the laplacian of the input image"
option "config" - "Config file" string optional
option "verbose" v "Verbose" flag off