From 4f533087471493716b70fe26976fe476b0d9d51d Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Fri, 3 Feb 2012 07:57:12 +0100 Subject: [PATCH] Crop label image like input before stat --- tools/clitkImageStatisticsGenericFilter.txx | 23 ++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tools/clitkImageStatisticsGenericFilter.txx b/tools/clitkImageStatisticsGenericFilter.txx index 7b9c78b..f5c8235 100644 --- a/tools/clitkImageStatisticsGenericFilter.txx +++ b/tools/clitkImageStatisticsGenericFilter.txx @@ -50,15 +50,7 @@ namespace clitk if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl; UpdateWithDimAndPixelType(); } - -// else if (PixelType == "unsigned_int"){ -// if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and unsigned_int..." << std::endl; -// UpdateWithDimAndPixelType(); -// } - // else if (PixelType == "char"){ - // if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl; - // UpdateWithDimAndPixelType(); - // } + else if(PixelType == "double"){ if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and double..." << std::endl; UpdateWithDimAndPixelType(); @@ -148,12 +140,19 @@ namespace clitk typename ResamplerType::Pointer resampler = ResamplerType::New(); resampler->SetInput(labelImage); resampler->SetOutputSpacing(input->GetSpacing()); + resampler->SetGaussianFilteringEnabled(false); resampler->Update(); labelImage = resampler->GetOutput(); + //writeImage(labelImage, "test1.mha"); + + typedef clitk::CropLikeImageFilter FilterType; + typename FilterType::Pointer crop = FilterType::New(); + crop->SetInput(labelImage); + crop->SetCropLikeImage(input); + crop->Update(); + labelImage = crop->GetOutput(); + //writeImage(labelImage, "test2.mha"); - typename itk::ImageBase::RegionType reg - = input->GetLargestPossibleRegion(); - labelImage = ResizeImageLike(labelImage, ®, 0); } else { std::cerr << "Mask image has a different size/spacing than input. Abort" << std::endl; -- 2.47.1