1 #include <cpPluginsImageFilters/ExtractImageFilter.h>
2 #include <cpPlugins/Image.h>
3 #include <cpPlugins_ITKInstances/ImageFilters.h>
5 #include <itkExtractImageFilter.h>
6 #include <itkExtractImageFilter.hxx>
7 #include <itkImageAlgorithm.hxx>
9 // -------------------------------------------------------------------------
10 cpPluginsImageFilters::ExtractImageFilter::
14 this->_AddInput( "Input" );
15 this->_AddOutput< cpPlugins::Image >( "Output" );
16 this->m_Parameters.ConfigureAsBool( "ReduceDimension" );
17 this->m_Parameters.SetBool( "ReduceDimension", false );
20 std::vector< std::string > choices;
21 choices.push_back( "float" );
22 choices.push_back( "double" );
23 this->m_Parameters.ConfigureAsChoices( "ScalarType", choices );
24 this->m_Parameters.SetSelectedChoice( "ScalarType", "float" );
25 this->m_Parameters.ConfigureAsReal( "UpperThresholdValue" );
26 this->m_Parameters.ConfigureAsUint( "InsideValue" );
27 this->m_Parameters.ConfigureAsUint( "OutsideValue" );
29 this->m_Parameters.SetReal( "LowerThresholdValue", 0 );
30 this->m_Parameters.SetReal( "UpperThresholdValue", 10000 );
31 this->m_Parameters.SetReal( "InsideValue", 1 );
32 this->m_Parameters.SetReal( "OutsideValue", 0 );
36 // -------------------------------------------------------------------------
37 cpPluginsImageFilters::ExtractImageFilter::
38 ~ExtractImageFilter( )
42 // -------------------------------------------------------------------------
43 std::string cpPluginsImageFilters::ExtractImageFilter::
46 auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( );
47 std::string cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 3 );
51 // -------------------------------------------------------------------------
52 template< class _TImage >
53 std::string cpPluginsImageFilters::ExtractImageFilter::
54 _GD0( _TImage* image )
57 itk::Image< typename _TImage::PixelType, _TImage::ImageDimension - 1 >
59 typedef itk::ExtractImageFilter< _TImage, _TOutImage > _TFilter;
63 "ImageFilters::ExtractImageFilter: No valid input image."
68 typename _TImage::RegionType reg;
70 _TFilter* filter = this->_CreateITK< _TFilter >( );
71 filter->SetInput( image );
72 filter->SetExtractionRegion( reg );
75 this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );