From: BenoƮt Presles Date: Tue, 29 Oct 2013 17:56:40 +0000 (+0100) Subject: added the possibility to compute the Laplacian of Gaussian (LoG) of an image X-Git-Tag: v1.4.0~150^2~5 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a722c4a8807004f88add4554b400e608ec65c92c;p=clitk.git added the possibility to compute the Laplacian of Gaussian (LoG) of an image --- diff --git a/tools/clitkImageLaplacian.ggo b/tools/clitkImageLaplacian.ggo index 2066df9..f97ef9b 100644 --- a/tools/clitkImageLaplacian.ggo +++ b/tools/clitkImageLaplacian.ggo @@ -12,3 +12,4 @@ option "input" i "Input image filename" string required 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 on diff --git a/tools/clitkImageLaplacianGenericFilter.txx b/tools/clitkImageLaplacianGenericFilter.txx index 2ffa43b..940e9fc 100644 --- a/tools/clitkImageLaplacianGenericFilter.txx +++ b/tools/clitkImageLaplacianGenericFilter.txx @@ -30,6 +30,7 @@ // itk include #include "itkCastImageFilter.h" #include "itkLaplacianImageFilter.h" +#include "itkLaplacianRecursiveGaussianImageFilter.h" #include "itkLabelStatisticsImageFilter.h" #include "itkMaskImageFilter.h" #include "itkMaskNegatedImageFilter.h" @@ -127,13 +128,26 @@ ImageLaplacianGenericFilter::UpdateWithInputImageType() IteratorOutputType ito = IteratorOutputType(outputImage, outputImage->GetLargestPossibleRegion()); // Filter - typedef itk::LaplacianImageFilter LaplacianImageFilterType; - typename LaplacianImageFilterType::Pointer laplacianFilter=LaplacianImageFilterType::New(); - laplacianFilter->SetInput(castFilter->GetOutput()); - laplacianFilter->Update(); + typename FloatImageType::Pointer outputLaplacianFilter; + if (mArgsInfo.gaussian_filter_flag == 0) { + //std::cout<<"gaussian filter flag == 0"< LaplacianImageFilterType; + typename LaplacianImageFilterType::Pointer laplacianFilter=LaplacianImageFilterType::New(); + laplacianFilter->SetInput(castFilter->GetOutput()); + laplacianFilter->Update(); + outputLaplacianFilter = laplacianFilter->GetOutput(); + } + else { + //std::cout<<"gaussian filter flag == 1"< LaplacianImageFilterType; + typename LaplacianImageFilterType::Pointer laplacianFilter=LaplacianImageFilterType::New(); + laplacianFilter->SetInput(castFilter->GetOutput()); + laplacianFilter->Update(); + outputLaplacianFilter = laplacianFilter->GetOutput(); + } // Set iterator typedef itk::ImageRegionIterator IteratorType; - IteratorType it(laplacianFilter->GetOutput(), laplacianFilter->GetOutput()->GetLargestPossibleRegion()); + IteratorType it(outputLaplacianFilter, outputLaplacianFilter->GetLargestPossibleRegion()); // Set mask iterator typedef itk::ImageRegionIterator IteratorMaskType; @@ -146,7 +160,7 @@ ImageLaplacianGenericFilter::UpdateWithInputImageType() typedef itk::LabelStatisticsImageFilter< FloatImageType, MaskImageType > LabelStatisticsImageFilterType; typename LabelStatisticsImageFilterType::Pointer labelStatisticsImageFilter = LabelStatisticsImageFilterType::New(); labelStatisticsImageFilter->SetLabelInput( mask ); - labelStatisticsImageFilter->SetInput(laplacianFilter->GetOutput()); + labelStatisticsImageFilter->SetInput(outputLaplacianFilter); labelStatisticsImageFilter->Update(); //std::cout << "Number of labels: " << labelStatisticsImageFilter->GetNumberOfLabels() << std::endl;