From: David Sarrut Date: Tue, 20 Mar 2012 13:21:49 +0000 (+0100) Subject: Add dice with ref measure X-Git-Tag: v1.3.0~52^2~43 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a3398f04a3b80b28f577ac3f0678f36f2f80ec75;p=clitk.git Add dice with ref measure --- 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(); + } + } } //--------------------------------------------------------------------