X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=tools%2FclitkImageLaplacianGenericFilter.txx;h=4ff1ef342f5855614946406c75c8fdb97a7cd5aa;hb=b8e5890d37dfd64409b9694f73c0be164a089e64;hp=2ffa43b246edcf43c3cbca279eef5c21889cea24;hpb=c993ae170e42e6cd193abb3240af1765263fed13;p=clitk.git diff --git a/tools/clitkImageLaplacianGenericFilter.txx b/tools/clitkImageLaplacianGenericFilter.txx index 2ffa43b..4ff1ef3 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" @@ -101,7 +102,7 @@ ImageLaplacianGenericFilter::UpdateWithInputImageType() castFilter->SetInput(input); castFilter->Update(); - typename MaskImageType::Pointer mask = NULL; + typename MaskImageType::Pointer mask = ITK_NULLPTR; if(mArgsInfo.mask_given) { mask = this->template GetInput(1); } @@ -127,13 +128,27 @@ 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(); + //std::cout<<"sigma value="<GetSigma()<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 +161,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;