X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=plugins%2FImageGenericFilters%2FRegionOfInterestImageFilter.cxx;fp=plugins%2FImageGenericFilters%2FRegionOfInterestImageFilter.cxx;h=0000000000000000000000000000000000000000;hb=410a1d0bf36fb01148880c034973308e4600ffda;hp=e73ac5928a836cd709074b4ab7407ba7a3a98294;hpb=f1747c7248d5eead5ea9d7e57bda0b081bcef065;p=cpPlugins.git diff --git a/plugins/ImageGenericFilters/RegionOfInterestImageFilter.cxx b/plugins/ImageGenericFilters/RegionOfInterestImageFilter.cxx deleted file mode 100644 index e73ac59..0000000 --- a/plugins/ImageGenericFilters/RegionOfInterestImageFilter.cxx +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include - -// ------------------------------------------------------------------------- -cpPluginsImageGenericFilters::RegionOfInterestImageFilter:: -RegionOfInterestImageFilter( ) - : Superclass( ) -{ - typedef cpPlugins::DataObjects::Image _TImage; - typedef cpPlugins::DataObjects::BoundingBox _TBBox; - this->_ConfigureInput< _TImage >( "Input", true, false ); - this->_ConfigureInput< _TBBox >( "BoundingBox", true, false ); - this->_ConfigureOutput< _TImage >( "Output" ); -} - -// ------------------------------------------------------------------------- -cpPluginsImageGenericFilters::RegionOfInterestImageFilter:: -~RegionOfInterestImageFilter( ) -{ -} - -// ------------------------------------------------------------------------- -void cpPluginsImageGenericFilters::RegionOfInterestImageFilter:: -_GenerateData( ) -{ - auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) - cpPlugins_Demangle_Image_ColorPixels_AllDims_1( o, _GD0 ) - this->_Error( "Invalid input image." ); -} - -// ------------------------------------------------------------------------- -template< class _TImage > -void cpPluginsImageGenericFilters::RegionOfInterestImageFilter:: -_GD0( _TImage* input ) -{ - typedef cpPlugins::DataObjects::BoundingBox _TBBox; - typedef itk::RegionOfInterestImageFilter< _TImage, _TImage > _TFilter; - typedef typename _TImage::IndexType _TIndex; - typedef typename _TImage::PointType _TPoint; - typedef typename _TImage::RegionType _TRegion; - typedef typename _TImage::SizeType _TSize; - - auto bb = this->GetInput< _TBBox >( "BoundingBox" ); - - _TIndex i0, i1; - input->TransformPhysicalPointToIndex( bb->GetMinimum< _TPoint >( ), i0 ); - input->TransformPhysicalPointToIndex( bb->GetMaximum< _TPoint >( ), i1 ); - - _TSize size; - for( unsigned int d = 0; d < _TImage::ImageDimension; ++d ) - size[ d ] = i1[ d ] - i0[ d ] + 1; - - _TRegion region; - region.SetIndex( i0 ); - region.SetSize( size ); - - auto filter = this->_CreateITK< _TFilter >( ); - filter->SetInput( input ); - filter->SetRegionOfInterest( region ); - filter->Update( ); - this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); -} - -// eof - $RCSfile$