]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/SpatialObjectMaskImageFilter.hxx
Moved to version 1.0
[cpPlugins.git] / lib / cpExtensions / Algorithms / SpatialObjectMaskImageFilter.hxx
diff --git a/lib/cpExtensions/Algorithms/SpatialObjectMaskImageFilter.hxx b/lib/cpExtensions/Algorithms/SpatialObjectMaskImageFilter.hxx
deleted file mode 100644 (file)
index 2c3cac7..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-#ifndef __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__HXX__
-#define __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__HXX__
-
-#include <itkImageScanlineIterator.h>
-#include <itkProgressReporter.h>
-
-// -------------------------------------------------------------------------
-template< class I, class O >
-O* cpExtensions::Algorithms::SpatialObjectMaskImageFilter< I, O >::
-GetPositiveOutput( )
-{
-  return( this->GetOutput( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O >
-const O* cpExtensions::Algorithms::SpatialObjectMaskImageFilter< I, O >::
-GetPositiveOutput( ) const
-{
-  return( this->GetOutput( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O >
-O* cpExtensions::Algorithms::SpatialObjectMaskImageFilter< I, O >::
-GetNegativeOutput( )
-{
-  return( this->GetOutput( 1 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O >
-const O* cpExtensions::Algorithms::SpatialObjectMaskImageFilter< I, O >::
-GetNegativeOutput( ) const
-{
-  return( this->GetOutput( 1 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O >
-cpExtensions::Algorithms::SpatialObjectMaskImageFilter< I, O >::
-SpatialObjectMaskImageFilter( )
-  : Superclass( )
-{
-  this->SetNumberOfRequiredInputs( 1 );
-  this->SetNumberOfRequiredOutputs( 2 );
-  this->SetNthOutput( 0, O::New( ) );
-  this->SetNthOutput( 1, O::New( ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O >
-cpExtensions::Algorithms::SpatialObjectMaskImageFilter< I, O >::
-~SpatialObjectMaskImageFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O >
-void cpExtensions::Algorithms::SpatialObjectMaskImageFilter< I, O >::
-GenerateOutputInformation( )
-{
-  const I* in =
-    dynamic_cast< const I* >( this->itk::ProcessObject::GetInput( 0 ) );
-  for( unsigned int idx = 0; idx < this->GetNumberOfOutputs( ); ++idx )
-  {
-    itk::DataObject* out = this->GetOutput( idx );
-    if( out )
-      out->CopyInformation( in );
-
-  } // rof
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O >
-void cpExtensions::Algorithms::SpatialObjectMaskImageFilter< I, O >::
-ThreadedGenerateData( const TRegion& region, itk::ThreadIdType threadId )
-{
-  if( this->m_SpatialObject.IsNull( ) )
-  {
-    itkGenericExceptionMacro( << "No itk::SpatialObject given." );
-    return;
-
-  } // fi
-
-  // Get inputs
-  const I* in =
-    dynamic_cast< const I* >( this->itk::ProcessObject::GetInput( 0 ) );
-  O* pos_out = this->GetPositiveOutput( );
-  O* neg_out = this->GetNegativeOutput( );
-  const auto size0 = region.GetSize( 0 );
-  if( size0 == 0 )
-    return;
-  const auto nLines = region.GetNumberOfPixels( ) / size0;
-
-  // Create iterators
-  itk::ImageScanlineConstIterator< I > iIt( in, region );
-  itk::ImageScanlineIterator< O > pos_oIt( pos_out, region );
-  itk::ImageScanlineIterator< O > neg_oIt( neg_out, region );
-  itk::ProgressReporter progress( this, threadId, nLines );
-
-  // Main loop
-  typename TSpatialObject::PointType pnt;
-  while( !iIt.IsAtEnd( ) )
-  {
-    while( !iIt.IsAtEndOfLine( ) )
-    {
-      auto idx = iIt.GetIndex( );
-      in->TransformIndexToPhysicalPoint( idx, pnt );
-      if( this->m_SpatialObject->IsInside( pnt ) )
-      {
-        pos_oIt.Set( TOutPixel( iIt.Get( ) ) );
-        neg_oIt.Set( this->m_OutsideValue );
-      }
-      else
-      {
-        neg_oIt.Set( TOutPixel( iIt.Get( ) ) );
-        pos_oIt.Set( this->m_OutsideValue );
-
-      } // fi
-      ++iIt;
-      ++pos_oIt;
-      ++neg_oIt;
-
-    } // elihw
-    iIt.NextLine( );
-    pos_oIt.NextLine( );
-    neg_oIt.NextLine( );
-    progress.CompletedPixel( );
-
-  } // elihw
-}
-
-#endif // __CPEXTENSIONS__ALGORITHMS__SPATIALOBJECTMASKIMAGEFILTER__HXX__
-
-// eof - $RCSfile$