1 #include <cpPluginsImageFilters/IsoImageSlicer.h>
2 #include <cpPlugins/Image.h>
3 #include <cpPlugins_ITKInstances/ImageFilters.h>
5 #include <cpExtensions/Algorithms/IsoImageSlicer.h>
6 #include <cpExtensions/Algorithms/IsoImageSlicer.hxx>
7 #include <itkAffineTransform.hxx>
8 #include <itkMatrixOffsetTransformBase.hxx>
9 #include <itkVariableLengthVector.hxx>
10 #include <itkDiffusionTensor3D.hxx>
11 #include <itkOptimizerParameters.hxx>
12 #include <itkExtractImageFilter.hxx>
13 #include <itkResampleImageFilter.hxx>
14 #include <itkSymmetricSecondRankTensor.hxx>
15 #include <itkLinearInterpolateImageFunction.hxx>
18 #include <itkIsoImageSlicer.h>
19 #include <itkIsoImageSlicer.hxx>
20 #include <itkUnaryFunctorImageFilter.hxx>
23 // -------------------------------------------------------------------------
24 cpPluginsImageFilters::IsoImageSlicer::
28 this->_AddInput( "Input" );
29 this->_AddOutput< cpPlugins::Image >( "Output" );
31 std::vector< std::string > choices;
32 choices.push_back( "float" );
33 choices.push_back( "double" );
34 this->m_Parameters.ConfigureAsChoices( "ScalarType", choices );
35 this->m_Parameters.SetSelectedChoice( "ScalarType", "float" );
37 this->m_Parameters.ConfigureAsReal( "LowerThresholdValue" );
38 this->m_Parameters.ConfigureAsReal( "UpperThresholdValue" );
39 this->m_Parameters.ConfigureAsUint( "InsideValue" );
40 this->m_Parameters.ConfigureAsUint( "OutsideValue" );
42 this->m_Parameters.SetReal( "LowerThresholdValue", 0 );
43 this->m_Parameters.SetReal( "UpperThresholdValue", 10000 );
44 this->m_Parameters.SetReal( "InsideValue", 1 );
45 this->m_Parameters.SetReal( "OutsideValue", 0 );
49 // -------------------------------------------------------------------------
50 cpPluginsImageFilters::IsoImageSlicer::
55 // -------------------------------------------------------------------------
56 std::string cpPluginsImageFilters::IsoImageSlicer::
59 auto image = this->GetInputData( "Input" )->GetITK< itk::DataObject >( );
60 std::string cpPlugin_Image_Demangle_Pixel_AllScalars( r, _GD0, image, 3 );
64 // -------------------------------------------------------------------------
65 template< class _TImage >
66 std::string cpPluginsImageFilters::IsoImageSlicer::
67 _GD0( _TImage* image )
71 auto choice = this->m_Parameters.GetSelectedChoice( "OutputResolution" );
72 if( choice == "float" )
73 return( this->_GD1< _TImage, float >( image ) );
74 else if( choice == "double" )
75 return( this->_GD1< _TImage, double >( image ) );
76 else return( "IsoImageSlicer: no valid scalar type." );
80 "ImageFilters::IsoImageSlicer: No valid input image."
84 // -------------------------------------------------------------------------
85 template< class _TImage, class _TScalar >
86 std::string cpPluginsImageFilters::IsoImageSlicer::
87 _GD1( _TImage* image )
90 cpExtensions::Algorithms::IsoImageSlicer< _TImage, _TScalar >
92 typedef typename _TFilter::TVector _TVector;
93 typedef typename _TFilter::TMatrix _TMatrix;
96 _TFilter* filter = this->_CreateITK< _TFilter >( );
97 filter->SetInput( image );
98 filter->SetInterpolator( NULL );
99 filter->SetTranslation( _TVector( ) );
100 filter->SetRotation( _TMatrix( ) );
101 filter->SetSize( 1 );
103 filter->SetLowerThreshold( lower_val );
104 filter->SetUpperThreshold( upper_val );
105 filter->SetInsideValue( in_val );
106 filter->SetOutsideValue( out_val );
111 this->GetOutputData( "Output" )->SetITK( filter->GetOutput( ) );
115 #include <cpExtensions/Algorithms/BezierCurveFunction.h>
116 #include <cpExtensions/Algorithms/BezierCurveFunction.hxx>
118 template class cpPluginsImageFilters_EXPORT cpExtensions::Algorithms::BezierCurveFunction< itk::Vector< float, 3 > >;
119 template class cpPluginsImageFilters_EXPORT cpExtensions::Algorithms::BezierCurveFunction< itk::Vector< double, 3 > >;