X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=segmentation%2FclitkMorphoMathFilter.txx;h=8b380c8c9b45f8dd414b1cdecccfc05c10924dbe;hb=HEAD;hp=03f50eab37a63571749fb0193990737e69fff21f;hpb=a360b70353c02d20482d950c96ba7b289deca184;p=clitk.git diff --git a/segmentation/clitkMorphoMathFilter.txx b/segmentation/clitkMorphoMathFilter.txx index 03f50ea..8b380c8 100644 --- a/segmentation/clitkMorphoMathFilter.txx +++ b/segmentation/clitkMorphoMathFilter.txx @@ -30,6 +30,7 @@ clitk::MorphoMathFilter::MorphoMathFilter(): p.Fill(1); SetRadius(p); SetBoundaryToForegroundFlag(false); + VerboseFlagOff(); } //-------------------------------------------------------------------- @@ -84,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); } //-------------------------------------------------------------------- @@ -122,6 +117,7 @@ GenerateOutputInformation() // Define the images //--------------------------------- ImagePointer m_input = dynamic_cast(itk::ProcessObject::GetInput(0)); + const unsigned int dim = ImageType::ImageDimension; //--------------------------------- // Cast into internalimagetype @@ -136,7 +132,7 @@ GenerateOutputInformation() // Compute the radius in pixel //--------------------------------- if (m_RadiusInMMIsSet) { - for(uint i=0; iGetSpacing()[i]); } } @@ -150,7 +146,7 @@ GenerateOutputInformation() padFilter->SetInput(input); typename ImageType::SizeType lower; typename ImageType::SizeType upper; - for(uint i=0; i<3; i++) { + for(uint i=0; iSetPadLowerBound(lower); @@ -288,7 +284,9 @@ GenerateData() typename OutputCastImageFilterType::Pointer oCaster = OutputCastImageFilterType::New(); oCaster->SetInput(filter->GetOutput()); oCaster->Update(); + this->SetNthOutput(0, oCaster->GetOutput()); + //this->GraftOutput(oCaster->GetOutput()); // NO } //--------------------------------------------------------------------