X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkExtractLungFilter.txx;h=b76001f0491397c36648ddb86653c120ddcfb49c;hb=c74c7098e31ec54ac50aa2aff5dc1c21bc4179c8;hp=d439bc8c2a9ef1e45b1e8dc8f05e144ea99ed5fa;hpb=422c8a32638086ab332fb91dbf9eeca55f01566b;p=clitk.git diff --git a/segmentation/clitkExtractLungFilter.txx b/segmentation/clitkExtractLungFilter.txx index d439bc8..b76001f 100644 --- a/segmentation/clitkExtractLungFilter.txx +++ b/segmentation/clitkExtractLungFilter.txx @@ -90,8 +90,7 @@ ExtractLungFilter(): TracheaVolumeMustBeCheckedFlagOn(); SetNumSlices(50); SetMaxElongation(0.5); - SetSeedPreProcessingThreshold(-400); - + SetSeedPreProcessingThreshold(-400); // Step 3 default values SetNumberOfHistogramBins(500); @@ -135,7 +134,19 @@ SetInput(const ImageType * image) template void clitk::ExtractLungFilter:: -AddSeed(InternalIndexType s) +//AddSeed(InternalIndexType s) +AddSeed(InputImagePointType s) +{ + m_SeedsInMM.push_back(s); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void +clitk::ExtractLungFilter:: +AddSeedInPixels(InternalIndexType s) { m_Seeds.push_back(s); } @@ -461,7 +472,6 @@ GenerateOutputInformation() // smalest one (sometimes appends with the stomach if (initialNumberOfLabels >1) { if (GetRemoveSmallLabelBeforeSeparationFlag()) { - DD(GetRemoveSmallLabelBeforeSeparationFlag()); typedef itk::RelabelComponentImageFilter RelabelFilterType; typename RelabelFilterType::Pointer relabelFilter = RelabelFilterType::New(); relabelFilter->SetInput(working_mask); @@ -577,7 +587,7 @@ SearchForTracheaSeed(int skip) it.GoToBegin(); while (!it.IsAtEnd()) { if(it.Get() < GetUpperThresholdForTrachea() ) { - AddSeed(it.GetIndex()); + AddSeedInPixels(it.GetIndex()); // DD(it.GetIndex()); } ++it; @@ -658,6 +668,9 @@ SearchForTracheaSeed2(int numberOfSlices) opening->Update(); typename SlicerFilterType::Pointer slicer = SlicerFilterType::New(); +#if ITK_VERSION_MAJOR >= 4 + slicer->SetDirectionCollapseToIdentity(); +#endif slicer->SetInput(opening->GetOutput()); // label result @@ -839,7 +852,7 @@ TracheaRegionGrowing() f->SetUpper(GetUpperThresholdForTrachea()); f->SetMinimumLowerThreshold(-2000); // f->SetMaximumUpperThreshold(0); // MAYBE TO CHANGE ??? - f->SetMaximumUpperThreshold(-700); // MAYBE TO CHANGE ??? + f->SetMaximumUpperThreshold(-300); // MAYBE TO CHANGE ??? f->SetAdaptLowerBorder(false); f->SetAdaptUpperBorder(true); f->SetMinimumSize(5000); @@ -850,7 +863,7 @@ TracheaRegionGrowing() f->SetVerbose(GetVerboseRegionGrowingFlag()); for(unsigned int i=0; iAddSeed(m_Seeds[i]); - // DD(m_Seeds[i]); + //DD(m_Seeds[i]); } f->Update(); PrintMemory(GetVerboseMemoryFlag(), "After RG update"); @@ -904,6 +917,15 @@ SearchForTrachea() // compute trachea volume // if volume not plausible -> skip more slices and restart + // If initial seed, convert from mm to pixels + if (m_SeedsInMM.size() > 0) { + for(unsigned int i=0; iTransformPhysicalPointToIndex(m_SeedsInMM[i], index); + m_Seeds.push_back(index); + } + } + bool has_seed; bool stop = false; double volume = 0.0;