From: David Sarrut Date: Mon, 1 Jul 2013 10:00:00 +0000 (+0200) Subject: Seeds are now given in mm (not in pixels ; bug) X-Git-Tag: v1.4.0~175 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;ds=sidebyside;h=0a96ecce8910123da64bc9142c964d8ac3f70565;hp=f257fe5c67c61795b1ab7ea8131fa2289dceeca3;p=clitk.git Seeds are now given in mm (not in pixels ; bug) --- diff --git a/segmentation/clitkExtractLung.ggo b/segmentation/clitkExtractLung.ggo index 44b99a2..f31f718 100644 --- a/segmentation/clitkExtractLung.ggo +++ b/segmentation/clitkExtractLung.ggo @@ -36,7 +36,7 @@ option "skipslices" - "0: Number of slices to skip before sear option "upperThresholdForTrachea" - "0: Initial upper threshold for trachea" double no default="-900" option "multiplierForTrachea" - "0: Multiplier for the region growing" double no default="5" option "thresholdStepSizeForTrachea" - "0: Threshold step size" int no default="64" -option "seed" - "0,1: Index of the trachea seed point (in pixel, not in mm)" int no multiple +option "seed" - "0,1: Index of the trachea seed point (in mm NOT IN PIXELS)" float no multiple option "doNotCheckTracheaVolume" - "0,1: If set, do not check the trachea volume" flag off option "verboseRG" - "0,1: Verbose RegionGrowing" flag off option "maxElongation" - "1: Maximum allowed elongation of candidate regions for the trachea" float no default="0.5" @@ -63,7 +63,7 @@ option "opencloseRadius" - "OpenClose radius" int no section "Step 6 : fill holes" option "doNotFillHoles" - "Do not fill holes if set" flag on -option "dir" d "Directions (axes) to perform filling (defaults to 2,1,0)" int multiple no +#option "dir" d "Directions (axes) to perform filling (defaults to 2,1,0)" int multiple no section "Step 7 : lung separation (labelling)" option "doNotSeparateLungs" - "Do not separate lungs if set" flag off diff --git a/segmentation/clitkExtractLungFilter.h b/segmentation/clitkExtractLungFilter.h index 6f31cee..6c50b1c 100644 --- a/segmentation/clitkExtractLungFilter.h +++ b/segmentation/clitkExtractLungFilter.h @@ -164,7 +164,8 @@ namespace clitk { itkSetMacro(SeedPreProcessingThreshold, int); itkGetConstMacro(SeedPreProcessingThreshold, int); - void AddSeed(InternalIndexType s); + void AddSeedInPixels(InternalIndexType s); + void AddSeed(InputImagePointType s); std::vector & GetSeeds() { return m_Seeds; } itkSetMacro(TracheaVolumeMustBeCheckedFlag, bool); @@ -252,6 +253,7 @@ namespace clitk { InputImagePixelType m_ThresholdStepSizeForTrachea; double m_MultiplierForTrachea; std::vector m_Seeds; + std::vector m_SeedsInMM; int m_NumberOfSlicesToSkipBeforeSearchingSeed; bool m_TracheaVolumeMustBeCheckedFlag; bool m_VerboseRegionGrowingFlag; diff --git a/segmentation/clitkExtractLungFilter.txx b/segmentation/clitkExtractLungFilter.txx index a0acdd5..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; @@ -853,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"); @@ -907,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; diff --git a/segmentation/clitkExtractLungGenericFilter.txx b/segmentation/clitkExtractLungGenericFilter.txx index b9a94d8..01455c8 100644 --- a/segmentation/clitkExtractLungGenericFilter.txx +++ b/segmentation/clitkExtractLungGenericFilter.txx @@ -94,10 +94,10 @@ SetOptionsFromArgsInfoToFilter(FilterType * f) f->SetMaxElongation(mArgsInfo.maxElongation_arg); f->SetSeedPreProcessingThreshold(mArgsInfo.seedPreProcessingThreshold_arg); - typename FilterType::InputImageIndexType s; + typename FilterType::InputImagePointType s; if (mArgsInfo.seed_given) { ConvertOptionMacro(mArgsInfo.seed, s, 3, false); - f->AddSeed(s); + f->AddSeed(s); } f->SetMinimalComponentSize(mArgsInfo.minSize_arg);