X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLungFilter.txx;h=e4aa902ee6cd2f81d91de731506a34b6dad6baab;hb=b24d2dc847c898f19fe694c8e05878c27d5f8011;hp=2c7be4c3546fb80629a7b25af8667981582e27e5;hpb=e008d74b0ecdc4ca2eaae8c429901a78f9ef5c31;p=clitk.git diff --git a/segmentation/clitkExtractLungFilter.txx b/segmentation/clitkExtractLungFilter.txx index 2c7be4c..e4aa902 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 @@ -38,6 +38,7 @@ ExtractLungFilter(): clitk::FilterBase(), itk::ImageToImageFilter() { + SetNumberOfSteps(10); // Default global options this->SetNumberOfRequiredInputs(2); SetPatientMaskBackgroundValue(0); @@ -154,18 +155,20 @@ GenerateOutputInformation() { input = dynamic_cast(itk::ProcessObject::GetInput(0)); Superclass::GenerateOutputInformation(); -// MaskImagePointer output = this->GetOutput(0); // Get input pointers input = dynamic_cast(itk::ProcessObject::GetInput(0)); 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; } + // Set Number of steps + SetNumberOfSteps(9); + //-------------------------------------------------------------------- //-------------------------------------------------------------------- StartNewStep("Set background to initial image"); @@ -209,6 +212,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 +223,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 +367,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); //--------------------------------------------------------------------