1 // =========================================================================
2 // @author Leonardo Florez Valencia
3 // @email florez-l@javeriana.edu.co
4 // =========================================================================
6 #ifndef __fpa__Image__Mori__hxx__
7 #define __fpa__Image__Mori__hxx__
9 #include <itkBinaryThresholdImageFilter.h>
11 // -------------------------------------------------------------------------
12 template< class _TInputImage, class _TOutputImage >
13 typename fpa::Image::Mori< _TInputImage, _TOutputImage >::
14 TOutputImage* fpa::Image::Mori< _TInputImage, _TOutputImage >::
15 GetThresholdedOutput( )
18 dynamic_cast< TOutputImage* >(
19 this->itk::ProcessObject::GetOutput( this->m_ThresholdedOutputIdx )
24 // -------------------------------------------------------------------------
25 template< class _TInputImage, class _TOutputImage >
26 const typename fpa::Image::Mori< _TInputImage, _TOutputImage >::
27 TOutputImage* fpa::Image::Mori< _TInputImage, _TOutputImage >::
28 GetThresholdedOutput( ) const
31 dynamic_cast< const TOutputImage* >(
32 this->itk::ProcessObject::GetOutput( this->m_ThresholdedOutputIdx )
37 // -------------------------------------------------------------------------
38 template< class _TInputImage, class _TOutputImage >
39 fpa::Image::Mori< _TInputImage, _TOutputImage >::
43 this->m_ThresholdedOutputIdx = this->GetNumberOfRequiredOutputs( );
44 this->itk::ProcessObject::SetNumberOfRequiredOutputs(
45 this->m_ThresholdedOutputIdx + 1
47 this->SetNthOutput( this->m_ThresholdedOutputIdx, TOutputImage::New( ) );
50 // -------------------------------------------------------------------------
51 template< class _TInputImage, class _TOutputImage >
52 fpa::Image::Mori< _TInputImage, _TOutputImage >::
57 // -------------------------------------------------------------------------
58 template< class _TInputImage, class _TOutputImage >
59 void fpa::Image::Mori< _TInputImage, _TOutputImage >::
62 typedef itk::BinaryThresholdImageFilter< TMarks, TOutputImage > _TFilter;
64 this->Superclass::_AfterGenerateData( );
66 typename _TFilter::Pointer filter = _TFilter::New( );
67 filter->SetInput( this->GetMarks( ) );
68 filter->SetInsideValue( this->GetInsideValue( ) );
69 filter->SetOutsideValue( this->GetOutsideValue( ) );
70 filter->SetLowerThreshold( 1 );
71 filter->SetUpperThreshold( this->GetNumberOfEvaluatedThresholds( ) - 1 );
73 this->GetThresholdedOutput( )->Graft( filter->GetOutput( ) );
76 #endif // __fpa__Image__Mori__hxx__