]> Creatis software - clitk.git/commitdiff
Add dice with ref measure
authorDavid Sarrut <david.sarrut@gmail.com>
Tue, 20 Mar 2012 13:21:49 +0000 (14:21 +0100)
committerDavid Sarrut <david.sarrut@gmail.com>
Tue, 20 Mar 2012 13:21:49 +0000 (14:21 +0100)
segmentation/clitkRelativePositionList.h
segmentation/clitkRelativePositionList.txx

index 20c6b777c503aa9e15b490a2e1c651bdade0de38..9628b400542cd65f1235fd50f58871a1dd6d89c4 100644 (file)
@@ -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<ArgsInfoType> mArgsInfoList;
     ImagePointer m_working_input;
+    ImagePointer m_reference;
+    bool m_ComputeOverlapFlag;
 
   }; // end class
   //--------------------------------------------------------------------
index 973f79f1f2d39c4432fd844ca0d3e6a9e961a945..39cc272cd1156253b4578efa45b30f1a0789d0b0 100644 (file)
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
   ======================================================================-====*/
 
+#include "clitkLabelImageOverlapMeasureFilter.h"
 
 //--------------------------------------------------------------------
 template <class TImageType>
 clitk::RelativePositionList<TImageType>::
 RelativePositionList() {
+  ComputeOverlapFlagOff();
+}
+//--------------------------------------------------------------------
+
+
+//--------------------------------------------------------------------
+template <class TImageType>
+void
+clitk::RelativePositionList<TImageType>::
+SetReferenceImageForOverlapMeasure(ImagePointer ref) {
+  m_reference = ref;
+  ComputeOverlapFlagOn();
 }
 //--------------------------------------------------------------------
 
@@ -191,7 +204,16 @@ GenerateOutputInformation() {
     relPosFilter->Update();
     m_working_input = relPosFilter->GetOutput();  
     StopCurrentStep<ImageType>(m_working_input);
-    // clitk::PrintMemory(true, "End"); 
+
+    // Compute overlap with reference if needed
+    if (GetComputeOverlapFlag()) {
+      typedef clitk::LabelImageOverlapMeasureFilter<ImageType> FilterType;
+      typename FilterType::Pointer filter = FilterType::New();
+      filter->SetInput(0, m_working_input);
+      filter->SetInput(1, m_reference);
+      filter->Update();
+    }
+    
   }
 }
 //--------------------------------------------------------------------