From c8d53d40ac8f5f83843193c51ac1787a8f38ee90 Mon Sep 17 00:00:00 2001 From: dsarrut Date: Wed, 7 Jul 2010 07:03:32 +0000 Subject: [PATCH] always set trachea as output --- segmentation/clitkExtractLungFilter.h | 2 +- segmentation/clitkExtractLungFilter.txx | 18 +++++++++++------- segmentation/clitkExtractLungGenericFilter.txx | 3 +-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/segmentation/clitkExtractLungFilter.h b/segmentation/clitkExtractLungFilter.h index 1f6252d..781a885 100644 --- a/segmentation/clitkExtractLungFilter.h +++ b/segmentation/clitkExtractLungFilter.h @@ -23,7 +23,7 @@ #include "clitkFilterBase.h" #include "clitkDecomposeAndReconstructImageFilter.h" #include "clitkExplosionControlledThresholdConnectedImageFilter.h" -#include "clitkSegmentationFunctions.h" +#include "clitkSegmentationUtils.h" // itk #include "itkStatisticsImageFilter.h" diff --git a/segmentation/clitkExtractLungFilter.txx b/segmentation/clitkExtractLungFilter.txx index 2c7be4c..f291739 100644 --- a/segmentation/clitkExtractLungFilter.txx +++ b/segmentation/clitkExtractLungFilter.txx @@ -22,7 +22,7 @@ // clitk #include "clitkImageCommon.h" #include "clitkSetBackgroundImageFilter.h" -#include "clitkSegmentationFunctions.h" +#include "clitkSegmentationUtils.h" #include "clitkAutoCropFilter.h" // itk @@ -161,7 +161,7 @@ GenerateOutputInformation() patient = dynamic_cast(itk::ProcessObject::GetInput(1)); // Check image - if (!HasSameSizeAndSpacing(input, patient)) { + if (!HaveSameSizeAndSpacing(input, patient)) { this->SetLastError("* ERROR * the images (input and patient mask) must have the same size & spacing"); return; } @@ -209,6 +209,7 @@ GenerateOutputInformation() //-------------------------------------------------------------------- //-------------------------------------------------------------------- StartNewStep("Find the trachea"); + //DD(m_Seeds.size()); if (m_Seeds.size() == 0) { // try to find seed // Search seed (parameters = UpperThresholdForTrachea) static const unsigned int Dim = InputImageType::ImageDimension; @@ -219,18 +220,21 @@ GenerateOutputInformation() sliceRegionSize[Dim-1]=5; sliceRegion.SetSize(sliceRegionSize); sliceRegion.SetIndex(sliceRegionIndex); - + //DD(GetUpperThresholdForTrachea()); + //DD(sliceRegion); typedef itk::ImageRegionConstIterator IteratorType; IteratorType it(working_input, sliceRegion); it.GoToBegin(); while (!it.IsAtEnd()) { if(it.Get() < GetUpperThresholdForTrachea() ) { AddSeed(it.GetIndex()); + // DD(it.GetIndex()); } ++it; } } + //DD(m_Seeds.size()); if (m_Seeds.size() != 0) { // Explosion controlled region growing typedef clitk::ExplosionControlledThresholdConnectedImageFilter ImageFilterType; @@ -360,10 +364,10 @@ GenerateOutputInformation() //-------------------------------------------------------------------- //-------------------------------------------------------------------- StartNewStep("Croping lung"); - cropFilter = CropFilterType::New(); // Needed to reset pipeline - cropFilter->SetInput(working_image); - cropFilter->Update(); - working_image = cropFilter->GetOutput(); + typename CropFilterType::Pointer cropFilter2 = CropFilterType::New(); // Needed to reset pipeline + cropFilter2->SetInput(working_image); + cropFilter2->Update(); + working_image = cropFilter2->GetOutput(); StopCurrentStep(working_image); //-------------------------------------------------------------------- diff --git a/segmentation/clitkExtractLungGenericFilter.txx b/segmentation/clitkExtractLungGenericFilter.txx index 18fc2cf..2bc8af8 100644 --- a/segmentation/clitkExtractLungGenericFilter.txx +++ b/segmentation/clitkExtractLungGenericFilter.txx @@ -97,8 +97,7 @@ void clitk::ExtractLungGenericFilter::UpdateWithInputImageType() // Write/Save results typename OutputImageType::Pointer output = filter->GetOutput(); this->template SetNextOutput(output); - if (mArgsInfo.outputTrachea_given) - this->template SetNextOutput(filter->GetTracheaImage()); + this->template SetNextOutput(filter->GetTracheaImage()); } //-------------------------------------------------------------------- -- 2.47.1