]> Creatis software - clitk.git/blobdiff - segmentation/clitkMorphoMathFilter.txx
Extraction of S1RL
[clitk.git] / segmentation / clitkMorphoMathFilter.txx
index 5d0b5022b2717af1c9b404158872429285cc984d..2eb3a0261c280da9193d39e270d1746f6a478944 100644 (file)
@@ -3,7 +3,7 @@
 
   Authors belong to: 
   - University of LYON              http://www.universite-lyon.fr/
-  - Léon Bérard cancer center       http://oncora1.lyon.fnclcc.fr
+  - Léon Bérard cancer center       http://www.centreleonberard.fr
   - CREATIS CNRS laboratory         http://www.creatis.insa-lyon.fr
 
   This software is distributed WITHOUT ANY WARRANTY; without even
@@ -14,7 +14,7 @@
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-  ======================================================================-====*/
+  ===========================================================================**/
 
 //--------------------------------------------------------------------
 template<class ImageType>
@@ -30,6 +30,7 @@ clitk::MorphoMathFilter<ImageType>::MorphoMathFilter():
   p.Fill(1);
   SetRadius(p);
   SetBoundaryToForegroundFlag(false);
+  VerboseFlagOff();
 }
 //--------------------------------------------------------------------
 
@@ -67,20 +68,26 @@ SetRadius(SizeType & p)
 //--------------------------------------------------------------------
 
 
+//--------------------------------------------------------------------
+template<class ImageType>
+void clitk::MorphoMathFilter<ImageType>::
+SetRadius(int r)
+{
+  for(uint i=0; i<ImageType::ImageDimension; i++)
+    m_Radius[i] = r;
+  SetRadius(m_Radius);
+}
+//--------------------------------------------------------------------
+
+
 //--------------------------------------------------------------------
 template<class ImageType>
 void clitk::MorphoMathFilter<ImageType>::
 SetOperationType(int type)
 {
-  switch (type) {
-  case 0: m_OperationType = Erode; return;
-  case 1: m_OperationType = Dilate; return;
-  case 2: m_OperationType = Open; return;
-  case 3: m_OperationType = Close; return;
-  case 4: m_OperationType = CondErode; return;
-  case 5: m_OperationType = CondDilate; return;
-  default: clitkExceptionMacro("Operation type must be between 0-5 (0=Erode, 1=Dilate, 2=Close (erode(dilate(x))), 3=Open (dilate(erode(x))), 4=CondErode, 5=CondDilate)");
-  }    
+  if(type<0 || type>5)
+    clitkExceptionMacro("Operation type must be between 0-5 (0=Erode, 1=Dilate, 2=Close (erode(dilate(x))), 3=Open (dilate(erode(x))), 4=CondErode, 5=CondDilate)");
+  m_OperationType = OperationTypeEnumeration(type);
 }
 //--------------------------------------------------------------------
 
@@ -276,7 +283,9 @@ GenerateData()
   typename OutputCastImageFilterType::Pointer oCaster = OutputCastImageFilterType::New();
   oCaster->SetInput(filter->GetOutput());
   oCaster->Update();
+
   this->SetNthOutput(0, oCaster->GetOutput());
+  //this->GraftOutput(oCaster->GetOutput()); // NO
 }
 //--------------------------------------------------------------------