From: BenoƮt Presles Date: Tue, 29 Oct 2013 18:00:31 +0000 (+0100) Subject: Merge branch 'master' of git.creatis.insa-lyon.fr:clitk X-Git-Tag: v1.4.0~150^2~4 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2e89c657340f556725119bbf49435652db005233;hp=66b6af0f6a1b4abcf7fef86e3cde987e8385e5dd;p=clitk.git Merge branch 'master' of git.creatis.insa-lyon.fr:clitk --- 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;