X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkMorphoMathFilter.txx;h=2eb3a0261c280da9193d39e270d1746f6a478944;hb=e3dfdd2305abb337638468aaca3d9b20718b5026;hp=81356df1c808a66cebda79e307746c6710258524;hpb=08d1fd56ac1d08bd228d9e557f5472a395e9b708;p=clitk.git 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); } //--------------------------------------------------------------------