From a3398f04a3b80b28f577ac3f0678f36f2f80ec75 Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Tue, 20 Mar 2012 14:21:49 +0100 Subject: [PATCH] Add dice with ref measure --- segmentation/clitkRelativePositionList.h | 7 +++++++ segmentation/clitkRelativePositionList.txx | 24 +++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/segmentation/clitkRelativePositionList.h b/segmentation/clitkRelativePositionList.h index 20c6b77..9628b40 100644 --- a/segmentation/clitkRelativePositionList.h +++ b/segmentation/clitkRelativePositionList.h @@ -76,8 +76,13 @@ namespace clitk { itkSetMacro(InputName, std::string); itkGetConstMacro(InputName, std::string); + itkGetConstMacro(ComputeOverlapFlag, bool); + itkSetMacro(ComputeOverlapFlag, bool); + itkBooleanMacro(ComputeOverlapFlag); + void Read(std::string filename); void SetFilterOptions(typename RelPosFilterType::Pointer filter, ArgsInfoType & options); + void SetReferenceImageForOverlapMeasure(ImagePointer ref); protected: RelativePositionList(); @@ -97,6 +102,8 @@ namespace clitk { typename SliceRelPosFilterType::Pointer mFilter; std::vector mArgsInfoList; ImagePointer m_working_input; + ImagePointer m_reference; + bool m_ComputeOverlapFlag; }; // end class //-------------------------------------------------------------------- diff --git a/segmentation/clitkRelativePositionList.txx b/segmentation/clitkRelativePositionList.txx index 973f79f..39cc272 100644 --- a/segmentation/clitkRelativePositionList.txx +++ b/segmentation/clitkRelativePositionList.txx @@ -16,11 +16,24 @@ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html ======================================================================-====*/ +#include "clitkLabelImageOverlapMeasureFilter.h" //-------------------------------------------------------------------- template clitk::RelativePositionList:: RelativePositionList() { + ComputeOverlapFlagOff(); +} +//-------------------------------------------------------------------- + + +//-------------------------------------------------------------------- +template +void +clitk::RelativePositionList:: +SetReferenceImageForOverlapMeasure(ImagePointer ref) { + m_reference = ref; + ComputeOverlapFlagOn(); } //-------------------------------------------------------------------- @@ -191,7 +204,16 @@ GenerateOutputInformation() { relPosFilter->Update(); m_working_input = relPosFilter->GetOutput(); StopCurrentStep(m_working_input); - // clitk::PrintMemory(true, "End"); + + // Compute overlap with reference if needed + if (GetComputeOverlapFlag()) { + typedef clitk::LabelImageOverlapMeasureFilter FilterType; + typename FilterType::Pointer filter = FilterType::New(); + filter->SetInput(0, m_working_input); + filter->SetInput(1, m_reference); + filter->Update(); + } + } } //-------------------------------------------------------------------- -- 2.47.1