From: Simon Rit Date: Mon, 27 Jun 2011 11:11:47 +0000 (+0200) Subject: Fix for bug Bug #670: closing and opening do the same as successive X-Git-Tag: v1.3.0~304 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=a15f441cf98aaa378a7ae107e12a84912e9336d2;p=clitk.git Fix for bug Bug #670: closing and opening do the same as successive erosion/dilation --- diff --git a/segmentation/clitkMorphoMathFilter.txx b/segmentation/clitkMorphoMathFilter.txx index 81356df..2eb3a02 100644 --- a/segmentation/clitkMorphoMathFilter.txx +++ b/segmentation/clitkMorphoMathFilter.txx @@ -85,15 +85,9 @@ template void clitk::MorphoMathFilter:: 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); } //--------------------------------------------------------------------