From: Leonardo Florez-Valencia Date: Fri, 28 Oct 2016 15:25:10 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~74 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=cpPlugins.git;a=commitdiff_plain;h=6bd5a267c827df95f0c1c8f8c0af0f918bf2b31c ... --- diff --git a/lib/Instances/BaseObjects.i b/lib/Instances/BaseObjects.i index 699df69..384aad5 100644 --- a/lib/Instances/BaseObjects.i +++ b/lib/Instances/BaseObjects.i @@ -7,6 +7,7 @@ tinclude itk#vectors#:h|hxx tinclude itk#matrices#:h|hxx tinclude itk#diff_tensors#:h|hxx tinclude itkSymmetricEigenAnalysis:h|hxx +tinclude itkSimpleDataObjectDecorator:h|hxx tinclude vnl/vnl_vector:h|hxx cinclude vnl/vnl_c_vector.hxx @@ -21,6 +22,8 @@ instances itk::#diff_tensors#< #real_types# > instances itk::#matrices#< #real_types#, #process_dims#, #process_dims# > instances itk::SymmetricEigenAnalysis< itk::Matrix< #real_types#, #process_dims#, #process_dims# >, itk::FixedArray< #real_types#, #process_dims# >, itk::Matrix< #real_types#, #process_dims#, #process_dims# > > +instances itk::SimpleDataObjectDecorator< #scalar_pixels# > + define my_vectors=Vector;Point minstances #_export_# std::ostream& itk::operator<< < #real_types#, #process_dims# >( std::ostream& a, itk::#my_vectors#< #real_types#, #process_dims# > const& b ) diff --git a/lib/Instances/CMakeLists.txt b/lib/Instances/CMakeLists.txt index 44e646d..aaa936e 100644 --- a/lib/Instances/CMakeLists.txt +++ b/lib/Instances/CMakeLists.txt @@ -3,6 +3,7 @@ SET( BaseObjects SimpleImages ImageIterators + ImageNeighborhoodIterators ImageFiltersBases BoundingBoxes Meshes @@ -25,6 +26,7 @@ SET( TARGET_LINK_LIBRARIES(cpInstances_BaseObjects ${ITK_LIBRARIES}) TARGET_LINK_LIBRARIES(cpInstances_SimpleImages cpInstances_BaseObjects) TARGET_LINK_LIBRARIES(cpInstances_ImageIterators cpInstances_SimpleImages) +TARGET_LINK_LIBRARIES(cpInstances_ImageNeighborhoodIterators cpInstances_SimpleImages) TARGET_LINK_LIBRARIES(cpInstances_ImageFiltersBases cpInstances_SimpleImages) TARGET_LINK_LIBRARIES(cpInstances_BoundingBoxes cpInstances_BaseObjects) TARGET_LINK_LIBRARIES(cpInstances_Meshes cpInstances_BoundingBoxes) diff --git a/lib/Instances/ImageFiltersBases.i b/lib/Instances/ImageFiltersBases.i index f7364f3..249c0a8 100644 --- a/lib/Instances/ImageFiltersBases.i +++ b/lib/Instances/ImageFiltersBases.i @@ -1,6 +1,11 @@ header #define ITK_MANUAL_INSTANTIATION +define in_scalar_pixels=#scalar_pixels# +define out_scalar_pixels=#scalar_pixels# +define filters=ImageToImageFilter;InPlaceImageFilter + tinclude itkImageSource:h|hxx +tinclude itk#filters#:h|hxx cinclude complex cinclude itk#color_pixels#.h @@ -16,4 +21,6 @@ instances itk::ImageSource< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > instances itk::ImageSource< itk::Image< itk::#matrices#< #real_types#, #process_dims#, #process_dims# >, #process_dims# > > instances itk::ImageSource< itk::Image< itk::Offset< #process_dims# >, #process_dims# > > +instances itk::#filters#< itk::Image< #in_scalar_pixels#, #process_dims# >, itk::Image< #out_scalar_pixels#, #process_dims# > > + ** eof - $RCSfile$ diff --git a/lib/Instances/ImageIterators.i b/lib/Instances/ImageIterators.i index c77e0ca..796aadf 100644 --- a/lib/Instances/ImageIterators.i +++ b/lib/Instances/ImageIterators.i @@ -1,6 +1,6 @@ header #define ITK_MANUAL_INSTANTIATION -define iter=ImageRegionConstIterator;ImageRegionIterator;ImageScanlineConstIterator;ImageScanlineIterator;ImageConstIteratorWithIndex;ImageIteratorWithIndex;ImageRegionConstIteratorWithIndex;ImageRegionIteratorWithIndex +define iter=ImageRegionConstIterator;ImageRegionIterator;ImageScanlineConstIterator;ImageScanlineIterator;ImageConstIteratorWithIndex;ImageIteratorWithIndex;ImageRegionConstIteratorWithIndex;ImageRegionIteratorWithIndex;ImageLinearConstIteratorWithIndex;ImageLinearIteratorWithIndex tinclude itk#iter#:h|hxx diff --git a/lib/Instances/ImageNeighborhoodIterators.i b/lib/Instances/ImageNeighborhoodIterators.i new file mode 100644 index 0000000..a2e692c --- /dev/null +++ b/lib/Instances/ImageNeighborhoodIterators.i @@ -0,0 +1,44 @@ +header #define ITK_MANUAL_INSTANTIATION + +define iter=ConstNeighborhoodIterator;NeighborhoodIterator +define esp_iter=ConstShapedNeighborhoodIterator;ShapedNeighborhoodIterator +define cond=ZeroFluxNeumannBoundaryCondition + +tinclude itkNeighborhood:h|hxx +tinclude itk#cond#:h|hxx +tinclude itk#iter#:h|hxx +tinclude itk#esp_iter#:h|hxx + +cinclude complex +cinclude itk#color_pixels#.h +cinclude itk#vectors#.h +cinclude itk#diff_tensors#.h +cinclude itk#matrices#.h + +instances itk::Neighborhood< #scalar_pixels#, #process_dims#, itk::NeighborhoodAllocator< #scalar_pixels# > > +instances itk::Neighborhood< std::complex< #real_types# >, #process_dims#, itk::NeighborhoodAllocator< std::complex< #real_types# > > > +instances itk::Neighborhood< itk::#color_pixels#< #scalar_pixels# >, #process_dims#, itk::NeighborhoodAllocator< itk::#color_pixels#< #scalar_pixels# > > > +instances itk::Neighborhood< itk::#vectors#< #real_types#, #process_dims# >, #process_dims#, itk::NeighborhoodAllocator< itk::#vectors#< #real_types#, #process_dims# > > > +instances itk::Neighborhood< itk::#diff_tensors#< #real_types# >, #process_dims#, itk::NeighborhoodAllocator< itk::#diff_tensors#< #real_types# > > > +instances itk::Neighborhood< itk::#matrices#< #real_types#, #process_dims#, #process_dims# >, #process_dims#, itk::NeighborhoodAllocator< itk::#matrices#< #real_types#, #process_dims#, #process_dims# > > > +instances itk::Neighborhood< itk::Offset< #process_dims# >, #process_dims#, itk::NeighborhoodAllocator< itk::Offset< #process_dims# > > > + +instances itk::#cond#< itk::Image< #scalar_pixels#, #process_dims# > > +instances itk::#cond#< itk::Image< std::complex< #real_types# >, #process_dims# > > +instances itk::#cond#< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > > +instances itk::#cond#< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > > +instances itk::#cond#< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > > +instances itk::#cond#< itk::Image< itk::#matrices#< #real_types#, #process_dims#, #process_dims# >, #process_dims# > > +instances itk::#cond#< itk::Image< itk::Offset< #process_dims# >, #process_dims# > > + +instances itk::#iter#< itk::Image< #scalar_pixels#, #process_dims# >, itk::#cond#< itk::Image< #scalar_pixels#, #process_dims# > > > +instances itk::#iter#< itk::Image< std::complex< #real_types# >, #process_dims# >, itk::#cond#< itk::Image< std::complex< #real_types# >, #process_dims# > > > +instances itk::#iter#< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# >, itk::#cond#< itk::Image< itk::#color_pixels#< #scalar_pixels# >, #process_dims# > > > +instances itk::#iter#< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# >, itk::#cond#< itk::Image< itk::#vectors#< #real_types#, #process_dims# >, #process_dims# > > > +instances itk::#iter#< itk::Image< itk::#diff_tensors#< #real_types# >, 3 >, itk::#cond#< itk::Image< itk::#diff_tensors#< #real_types# >, 3 > > > +instances itk::#iter#< itk::Image< itk::#matrices#< #real_types#, #process_dims#, #process_dims# >, #process_dims# >, itk::#cond#< itk::Image< itk::#matrices#< #real_types#, #process_dims#, #process_dims# >, #process_dims# > > > +instances itk::#iter#< itk::Image< itk::Offset< #process_dims# >, #process_dims# >, itk::#cond#< itk::Image< itk::Offset< #process_dims# >, #process_dims# > > > + +instances itk::#esp_iter#< itk::Image< #scalar_pixels#, #process_dims# >, itk::#cond#< itk::Image< #scalar_pixels#, #process_dims# > > > + +** eof - $RCSfile$ diff --git a/lib/cpPlugins/DataObjects/Image.cxx b/lib/cpPlugins/DataObjects/Image.cxx index 60ac5b3..8378b40 100644 --- a/lib/cpPlugins/DataObjects/Image.cxx +++ b/lib/cpPlugins/DataObjects/Image.cxx @@ -16,8 +16,8 @@ void cpPlugins::DataObjects::Image:: SetITK( itk::LightObject* o ) { this->Superclass::SetITK( o ); - cpPlugins_Demangle_Image_VisualDims( o, _ITK_2_VTK_0, ); - cpPlugins_Demangle_Image_DiffTensors3D( o, _ITK_2_VTK_1, ); + cpPlugins_Demangle_Image_VisualDims( o, _ITK_2_VTK_0, ) + cpPlugins_Demangle_Image_DiffTensors3D( o, _ITK_2_VTK_1, ) { this->m_VTK = NULL; this->m_ITKvVTK = NULL; @@ -43,37 +43,37 @@ SetVTK( vtkObjectBase* o ) bool success = false; auto stype = img->GetScalarType( ); -#ifdef cpPlugins_CONFIG_INTEGER_TYPES_char +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_char if( stype == VTK_CHAR ) success = this->_VTK_2_ITK_0< char >( img ); if( stype == VTK_UNSIGNED_CHAR ) success = this->_VTK_2_ITK_0< unsigned char >( img ); -#endif // cpPlugins_CONFIG_INTEGER_TYPES_char -#ifdef cpPlugins_CONFIG_INTEGER_TYPES_short +#endif // cpPlugins_CONFIG_INTEGER_TYPES_char +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_short if( stype == VTK_CHAR ) success = this->_VTK_2_ITK_0< short >( img ); if( stype == VTK_UNSIGNED_CHAR ) success = this->_VTK_2_ITK_0< unsigned short >( img ); -#endif // cpPlugins_CONFIG_INTEGER_TYPES_short -#ifdef cpPlugins_CONFIG_INTEGER_TYPES_int +#endif // cpPlugins_CONFIG_INTEGER_TYPES_short +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_int if( stype == VTK_CHAR ) success = this->_VTK_2_ITK_0< int >( img ); if( stype == VTK_UNSIGNED_CHAR ) success = this->_VTK_2_ITK_0< unsigned int >( img ); -#endif // cpPlugins_CONFIG_INTEGER_TYPES_int -#ifdef cpPlugins_CONFIG_INTEGER_TYPES_long +#endif // cpPlugins_CONFIG_INTEGER_TYPES_int +#ifdef cpPlugins_CONFIG_INTEGER_TYPES_long if( stype == VTK_CHAR ) success = this->_VTK_2_ITK_0< long >( img ); if( stype == VTK_UNSIGNED_CHAR ) success = this->_VTK_2_ITK_0< unsigned long >( img ); -#endif // cpPlugins_CONFIG_INTEGER_TYPES_long -#ifdef cpPlugins_CONFIG_REAL_TYPES_float +#endif // cpPlugins_CONFIG_INTEGER_TYPES_long +#ifdef cpPlugins_CONFIG_REAL_TYPES_float if( stype == VTK_CHAR ) success = this->_VTK_2_ITK_0< float >( img ); -#endif // cpPlugins_CONFIG_REAL_TYPES_float -#ifdef cpPlugins_CONFIG_REAL_TYPES_double +#endif // cpPlugins_CONFIG_REAL_TYPES_float +#ifdef cpPlugins_CONFIG_REAL_TYPES_double if( stype == VTK_CHAR ) success = this->_VTK_2_ITK_0< double >( img ); -#endif // cpPlugins_CONFIG_REAL_TYPES_double +#endif // cpPlugins_CONFIG_REAL_TYPES_double /* TODO - #define cpPlugins_CONFIG_COLOR_PIXELS_RGBPixel - #define cpPlugins_CONFIG_COLOR_PIXELS_RGBAPixel - #define cpPlugins_CONFIG_VECTORS_CovariantVector - #define cpPlugins_CONFIG_VECTORS_Point - #define cpPlugins_CONFIG_VECTORS_SymmetricSecondRankTensor - #define cpPlugins_CONFIG_VECTORS_Vector - #define cpPlugins_CONFIG_DIFFUSIONTENSORS_DiffusionTensor3D - #define cpPlugins_CONFIG_MATRICES_Matrix + #define cpPlugins_CONFIG_COLOR_PIXELS_RGBPixel + #define cpPlugins_CONFIG_COLOR_PIXELS_RGBAPixel + #define cpPlugins_CONFIG_VECTORS_CovariantVector + #define cpPlugins_CONFIG_VECTORS_Point + #define cpPlugins_CONFIG_VECTORS_SymmetricSecondRankTensor + #define cpPlugins_CONFIG_VECTORS_Vector + #define cpPlugins_CONFIG_DIFFUSIONTENSORS_DiffusionTensor3D + #define cpPlugins_CONFIG_MATRICES_Matrix */ if( !success ) { @@ -102,9 +102,9 @@ template< class _TImage > void cpPlugins::DataObjects::Image:: _ITK_2_VTK_0( _TImage* image ) { - cpPlugins_Demangle_Image_ScalarPixels( image, _ITK_2_VTK_1, _TImage::ImageDimension, ); - cpPlugins_Demangle_Image_ColorPixels( image, _ITK_2_VTK_1, _TImage::ImageDimension, ); - cpPlugins_Demangle_Image_VectorPixels( image, _ITK_2_VTK_1, _TImage::ImageDimension, ); + cpPlugins_Demangle_Image_ScalarPixels( image, _ITK_2_VTK_1, _TImage::ImageDimension, ) + cpPlugins_Demangle_Image_ColorPixels( image, _ITK_2_VTK_1, _TImage::ImageDimension, ) + cpPlugins_Demangle_Image_VectorPixels( image, _ITK_2_VTK_1, _TImage::ImageDimension, ) { this->m_VTK = NULL; this->m_ITKvVTK = NULL; diff --git a/lib/cpPlugins/DataObjects/Mesh.cxx b/lib/cpPlugins/DataObjects/Mesh.cxx index 4a95552..e1ce594 100644 --- a/lib/cpPlugins/DataObjects/Mesh.cxx +++ b/lib/cpPlugins/DataObjects/Mesh.cxx @@ -12,8 +12,8 @@ void cpPlugins::DataObjects::Mesh:: SetITK( itk::LightObject* o ) { this->Superclass::SetITK( o ); - cpPlugins_Demangle_Mesh_Meshes( o, _ITK_2_VTK, 2, ); - cpPlugins_Demangle_Mesh_Meshes( o, _ITK_2_VTK, 3, ); + cpPlugins_Demangle_Mesh_Meshes( o, _ITK_2_VTK, 2, ) + cpPlugins_Demangle_Mesh_Meshes( o, _ITK_2_VTK, 3, ) { this->m_VTK = NULL; @@ -167,7 +167,7 @@ _ITK_2_VTK( _TMesh* mesh ) vcells->InsertNextCell( cell->GetNumberOfPoints( ) ); for( auto k = cell->PointIdsBegin( ); k != cell->PointIdsEnd( ); ++k ) vcells->InsertCellPoint( IndexMap[ *k ] ); - + } // rof // Final assignations diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index ac367ba..c9cd7e3 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -13,7 +13,7 @@ SET( #ImageGradientFilters ImageMeshFilters ImageSources - #ImageThresholdFilters + ImageThresholdFilters IO MeshFilters MeshSources @@ -43,4 +43,9 @@ FOREACH(_dir ${_dirlist}) ) ENDFOREACH(_dir) +TARGET_LINK_LIBRARIES( + cpPluginsImageDistanceMaps + cpPluginsImageThresholdFilters + ) + ## eof - $RSCfile$ diff --git a/plugins/ImageDistanceMaps/BinaryContourImageFilter.cxx b/plugins/ImageDistanceMaps/BinaryContourImageFilter.cxx new file mode 100644 index 0000000..c6d0e16 --- /dev/null +++ b/plugins/ImageDistanceMaps/BinaryContourImageFilter.cxx @@ -0,0 +1,76 @@ +#include +#include +#include + +#include + +// ------------------------------------------------------------------------- +cpPluginsImageDistanceMaps::BinaryContourImageFilter:: +BinaryContourImageFilter( ) + : Superclass( ) +{ + typedef cpPlugins::DataObjects::Image _TImage; + + this->_ConfigureInput< _TImage >( "Input", true, false ); + this->_ConfigureOutput< _TImage >( "Output" ); + + this->m_Parameters.ConfigureAsReal( "BackgroundValue" ); + this->m_Parameters.ConfigureAsReal( "ForegroundValue" ); + this->m_Parameters.ConfigureAsBool( "FullyConnected" ); + + this->m_Parameters.SetReal( "BackgroundValue", 0 ); + this->m_Parameters.SetReal( "ForegroundValue", 1 ); + this->m_Parameters.SetBool( "FullyConnected", false ); +} + +// ------------------------------------------------------------------------- +cpPluginsImageDistanceMaps::BinaryContourImageFilter:: +~BinaryContourImageFilter( ) +{ +} + +// ------------------------------------------------------------------------- +void cpPluginsImageDistanceMaps::BinaryContourImageFilter:: +_GenerateData( ) +{ + auto o = this->GetInputData( "Input" ); + cpPlugins_Demangle_Image_VisualDims( o, _GD0, ) + this->_Error( "Invalid input image dimension." ); +} + +// ------------------------------------------------------------------------- +template< class _TImage > +void cpPluginsImageDistanceMaps::BinaryContourImageFilter:: +_GD0( _TImage* image ) +{ + cpPlugins_Demangle_Image_ScalarPixels( image, _GD1, _TImage::ImageDimension, ) + this->_Error( "Invalid input image pixel type." ); +} + +// ------------------------------------------------------------------------- +template< class _TImage > +void cpPluginsImageDistanceMaps::BinaryContourImageFilter:: +_GD1( _TImage* image ) +{ + typedef + itk::BinaryContourImageFilter< _TImage, _TImage > + _TFilter; + + // Get parameters + double b = this->m_Parameters.GetReal( "BackgroundValue" ); + double f = this->m_Parameters.GetReal( "ForegroundValue" ); + double c = this->m_Parameters.GetBool( "FullyConnected" ); + + // Configure filter + _TFilter* filter = this->_CreateITK< _TFilter >( ); + filter->SetInput( image ); + filter->SetBackgroundValue( ( typename _TImage::PixelType )( b ) ); + filter->SetForegroundValue( ( typename _TImage::PixelType )( f ) ); + filter->SetFullyConnected( c ); + filter->Update( ); + + // Connect output + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); +} + +// eof - $RCSfile$ diff --git a/plugins/ImageDistanceMaps/BinaryContourImageFilter.h b/plugins/ImageDistanceMaps/BinaryContourImageFilter.h new file mode 100644 index 0000000..569a2f2 --- /dev/null +++ b/plugins/ImageDistanceMaps/BinaryContourImageFilter.h @@ -0,0 +1,32 @@ +#ifndef __cpPluginsImageDistanceMaps__BinaryContourImageFilter__h__ +#define __cpPluginsImageDistanceMaps__BinaryContourImageFilter__h__ + +#include +#include + +namespace cpPluginsImageDistanceMaps +{ + /** + */ + class cpPluginsImageDistanceMaps_EXPORT BinaryContourImageFilter + : public cpPlugins::BaseObjects::ProcessObject + { + cpPluginsObject( + BinaryContourImageFilter, + cpPlugins::BaseObjects::ProcessObject, + ImageDistanceMaps + ); + + protected: + template< class _TImage > + inline void _GD0( _TImage* image ); + + template< class _TImage > + inline void _GD1( _TImage* image ); + }; + +} // ecapseman + +#endif // __cpPluginsImageDistanceMaps__BinaryContourImageFilter__h__ + +// eof - $RCSfile$ diff --git a/plugins/ImageDistanceMaps/ImageDistanceMaps.i b/plugins/ImageDistanceMaps/ImageDistanceMaps.i index a29aaaa..20a761c 100644 --- a/plugins/ImageDistanceMaps/ImageDistanceMaps.i +++ b/plugins/ImageDistanceMaps/ImageDistanceMaps.i @@ -1,11 +1,20 @@ header #define ITK_MANUAL_INSTANTIATION -define filters=SignedMaurerDistanceMapImageFilter +define filters=BinaryContourImageFilter +define dmaps=SignedMaurerDistanceMapImageFilter + define iter=ImageRegionConstIterator;ImageRegionIterator tinclude itk#filters#:h|hxx +tinclude itk#dmaps#:h|hxx tinclude itk#iter#:h|h +tinclude itkProgressReporter:h|h +tinclude itkImageHelper:h|h + +define in_scalar_pixels=#scalar_pixels# +define out_scalar_pixels=#scalar_pixels# -instances itk::#filters#< itk::Image< #scalar_pixels#, #process_dims# >, itk::Image< #real_types#, #process_dims# > > +instances itk::#filters#< itk::Image< #in_scalar_pixels#, #visual_dims# >, itk::Image< #out_scalar_pixels#, #visual_dims# > > +instances itk::#dmaps#< itk::Image< #scalar_pixels#, #visual_dims# >, itk::Image< #real_types#, #visual_dims# > > ** eof - $RCSfile$ diff --git a/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.cxx b/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.cxx index ad2b183..d34d1df 100644 --- a/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.cxx +++ b/plugins/ImageDistanceMaps/SignedMaurerDistanceMapImageFilter.cxx @@ -45,7 +45,7 @@ void cpPluginsImageDistanceMaps::SignedMaurerDistanceMapImageFilter:: _GenerateData( ) { auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_Image_ProcessDims( o, _GD0, ) + cpPlugins_Demangle_Image_VisualDims( o, _GD0, ) this->_Error( "Invalid input image dimension." ); } diff --git a/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.cxx b/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.cxx index b9eb3e7..1253773 100644 --- a/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.cxx +++ b/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.cxx @@ -1,17 +1,16 @@ -#include +#include #include #include -#include -#include // ------------------------------------------------------------------------- cpPluginsImageThresholdFilters::BinaryThresholdImageFilter:: BinaryThresholdImageFilter( ) : Superclass( ) { - this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false ); - this->_ConfigureOutput< cpPlugins::DataObjects::Image >( "Output" ); + typedef cpPlugins::DataObjects::Image _TImage; + this->_ConfigureInput< _TImage >( "Input", true, false ); + this->_ConfigureOutput< _TImage >( "Output" ); this->m_Parameters.ConfigureAsReal( "LowerThresholdValue" ); this->m_Parameters.ConfigureAsReal( "UpperThresholdValue" ); @@ -34,9 +33,11 @@ cpPluginsImageThresholdFilters::BinaryThresholdImageFilter:: void cpPluginsImageThresholdFilters::BinaryThresholdImageFilter:: _GenerateData( ) { - auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 ); - else this->_Error( "Invalid input image." ); + /* TODO + auto o = this->GetInputData( "Input" ); + cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 ); + else this->_Error( "Invalid input image." ); + */ } // ------------------------------------------------------------------------- @@ -44,28 +45,30 @@ template< class _TImage > void cpPluginsImageThresholdFilters::BinaryThresholdImageFilter:: _GD0( _TImage* image ) { - typedef unsigned char _TBin; - typedef itk::Image< unsigned char, _TImage::ImageDimension > _TBinImage; - typedef itk::BinaryThresholdImageFilter< _TImage, _TBinImage > _TFilter; - typedef typename _TImage::PixelType _TPixel; + /* TODO + typedef unsigned char _TBin; + typedef itk::Image< unsigned char, _TImage::ImageDimension > _TBinImage; + typedef itk::BinaryThresholdImageFilter< _TImage, _TBinImage > _TFilter; + typedef typename _TImage::PixelType _TPixel; - // Get parameters - _TPixel lt = _TPixel( this->m_Parameters.GetReal( "LowerThresholdValue" ) ); - _TPixel ut = _TPixel( this->m_Parameters.GetReal( "UpperThresholdValue" ) ); - _TBin iv = _TBin( this->m_Parameters.GetUint( "InsideValue" ) ); - _TBin ov = _TBin( this->m_Parameters.GetUint( "OutsideValue" ) ); + // Get parameters + _TPixel lt = _TPixel( this->m_Parameters.GetReal( "LowerThresholdValue" ) ); + _TPixel ut = _TPixel( this->m_Parameters.GetReal( "UpperThresholdValue" ) ); + _TBin iv = _TBin( this->m_Parameters.GetUint( "InsideValue" ) ); + _TBin ov = _TBin( this->m_Parameters.GetUint( "OutsideValue" ) ); - // Configure filter - _TFilter* filter = this->_CreateITK< _TFilter >( ); - filter->SetInput( image ); - filter->SetLowerThreshold( lt ); - filter->SetUpperThreshold( ut ); - filter->SetInsideValue( iv ); - filter->SetOutsideValue( ov ); - filter->Update( ); + // Configure filter + _TFilter* filter = this->_CreateITK< _TFilter >( ); + filter->SetInput( image ); + filter->SetLowerThreshold( lt ); + filter->SetUpperThreshold( ut ); + filter->SetInsideValue( iv ); + filter->SetOutsideValue( ov ); + filter->Update( ); - // Connect output - this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); + // Connect output + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); + */ } // eof - $RCSfile$ diff --git a/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.h b/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.h index f6c60b6..38d35b9 100644 --- a/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.h +++ b/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.h @@ -1,7 +1,7 @@ #ifndef __cpPluginsImageThresholdFilters__BinaryThresholdImageFilter__h__ #define __cpPluginsImageThresholdFilters__BinaryThresholdImageFilter__h__ -#include +#include #include namespace cpPluginsImageThresholdFilters @@ -19,7 +19,7 @@ namespace cpPluginsImageThresholdFilters protected: template< class _TImage > - inline void _GD0( _TImage* image ); + inline void _GD0( _TImage* image ); }; } // ecapseman diff --git a/plugins/ImageThresholdFilters/ImageThresholdFilters.i b/plugins/ImageThresholdFilters/ImageThresholdFilters.i new file mode 100644 index 0000000..50de8f1 --- /dev/null +++ b/plugins/ImageThresholdFilters/ImageThresholdFilters.i @@ -0,0 +1,14 @@ +header #define ITK_MANUAL_INSTANTIATION + +define filters=BinaryThresholdImageFilter + +tinclude itk#filters#:h|hxx + +cinclude itkUnaryFunctorImageFilter.hxx + +define in_scalar_pixels=#scalar_pixels# +define out_scalar_pixels=#scalar_pixels# + +instances itk::#filters#< itk::Image< #in_scalar_pixels#, #process_dims# >, itk::Image< #out_scalar_pixels#, #process_dims# > > + +** eof - $RCSfile$ diff --git a/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.cxx b/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.cxx index 6e2f15f..52082a2 100644 --- a/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.cxx +++ b/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.cxx @@ -1,17 +1,19 @@ -#include +#include #include #include #include -#include // ------------------------------------------------------------------------- cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold:: ImageToBoundingBoxFromThreshold( ) : Superclass( ) { - this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false ); - this->_ConfigureOutput< cpPlugins::DataObjects::BoundingBox >( "Output" ); + typedef cpPlugins::DataObjects::Image _TImage; + typedef cpPlugins::DataObjects::BoundingBox _TBBox; + + this->_ConfigureInput< _TImage >( "Input", true, false ); + this->_ConfigureOutput< _TBBox >( "Output" ); this->m_Parameters.ConfigureAsReal( "LowerThreshold" ); this->m_Parameters.ConfigureAsReal( "UpperThreshold" ); @@ -30,9 +32,11 @@ cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold:: void cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold:: _GenerateData( ) { - auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 ); - else this->_Error( "Invalid input image." ); + /* TODO + auto o = this->GetInputData( "Input" ); + cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 ); + else this->_Error( "Invalid input image." ); + */ } // ------------------------------------------------------------------------- @@ -40,25 +44,27 @@ template< class _TImage > void cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold:: _GD0( _TImage* image ) { - typedef - cpExtensions::Algorithms::ImageToBoundingBoxFromThreshold< _TImage > - _TFilter; + /* TODO + typedef + cpExtensions::Algorithms::ImageToBoundingBoxFromThreshold< _TImage > + _TFilter; - // Configure filter - _TFilter* filter = this->_CreateITK< _TFilter >( ); - filter->SetImage( image ); - filter->SetLowerThreshold( this->m_Parameters.GetReal( "LowerThreshold" ) ); - filter->SetUpperThreshold( this->m_Parameters.GetReal( "UpperThreshold" ) ); - filter->Compute( ); + // Configure filter + _TFilter* filter = this->_CreateITK< _TFilter >( ); + filter->SetImage( image ); + filter->SetLowerThreshold( this->m_Parameters.GetReal( "LowerThreshold" ) ); + filter->SetUpperThreshold( this->m_Parameters.GetReal( "UpperThreshold" ) ); + filter->Compute( ); - // Create output - auto reg = filter->GetRegion( ); - auto bb = this->GetOutput< cpPlugins::DataObjects::BoundingBox >( "Output" ); - typename _TImage::PointType p0, p1; - image->TransformIndexToPhysicalPoint( reg.GetIndex( ), p0 ); - image->TransformIndexToPhysicalPoint( reg.GetIndex( ) + reg.GetSize( ), p1 ); - bb->SetMinimum( p0 ); - bb->SetMaximum( p1 ); + // Create output + auto reg = filter->GetRegion( ); + auto bb = this->GetOutput< cpPlugins::DataObjects::BoundingBox >( "Output" ); + typename _TImage::PointType p0, p1; + image->TransformIndexToPhysicalPoint( reg.GetIndex( ), p0 ); + image->TransformIndexToPhysicalPoint( reg.GetIndex( ) + reg.GetSize( ), p1 ); + bb->SetMinimum( p0 ); + bb->SetMaximum( p1 ); + */ } // eof - $RCSfile$ diff --git a/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.h b/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.h index 49f5506..a791f04 100644 --- a/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.h +++ b/plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.h @@ -1,7 +1,7 @@ #ifndef __cpPluginsImageThresholdFilters__ImageToBoundingBoxFromThreshold__h__ #define __cpPluginsImageThresholdFilters__ImageToBoundingBoxFromThreshold__h__ -#include +#include #include namespace cpPluginsImageThresholdFilters diff --git a/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.cxx b/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.cxx index 97754e7..cd16ed3 100644 --- a/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.cxx +++ b/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.cxx @@ -1,17 +1,16 @@ -#include +#include #include #include -#include -#include // ------------------------------------------------------------------------- cpPluginsImageThresholdFilters::UnaryThresholdImageFilter:: UnaryThresholdImageFilter( ) : Superclass( ) { - this->_ConfigureInput< cpPlugins::DataObjects::Image >( "Input", true, false ); - this->_ConfigureOutput< cpPlugins::DataObjects::Image >( "Output" ); + typedef cpPlugins::DataObjects::Image _TImage; + this->_ConfigureInput< _TImage >( "Input", true, false ); + this->_ConfigureOutput< _TImage >( "Output" ); this->m_Parameters.ConfigureAsReal( "Threshold" ); this->m_Parameters.ConfigureAsReal( "InsideValue" ); @@ -34,9 +33,11 @@ cpPluginsImageThresholdFilters::UnaryThresholdImageFilter:: void cpPluginsImageThresholdFilters::UnaryThresholdImageFilter:: _GenerateData( ) { - auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 ); - else this->_Error( "Invalid input image." ); + /* TODO + auto o = this->GetInputData( "Input" ); + cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 ); + else this->_Error( "Invalid input image." ); + */ } // ------------------------------------------------------------------------- @@ -44,21 +45,23 @@ template< class _TImage > void cpPluginsImageThresholdFilters::UnaryThresholdImageFilter:: _GD0( _TImage* image ) { - typedef - cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage > - _TFilter; + /* TODO + typedef + cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage > + _TFilter; - // Configure filter - _TFilter* filter = this->_CreateITK< _TFilter >( ); - filter->SetInput( image ); - filter->SetThreshold( this->m_Parameters.GetReal( "Threshold" ) ); - filter->SetInsideValue( this->m_Parameters.GetReal( "InsideValue" ) ); - filter->SetOutsideValue( this->m_Parameters.GetReal( "OutsideValue" ) ); - filter->SetStrict( this->m_Parameters.GetBool( "Strict" ) ); - filter->Update( ); + // Configure filter + _TFilter* filter = this->_CreateITK< _TFilter >( ); + filter->SetInput( image ); + filter->SetThreshold( this->m_Parameters.GetReal( "Threshold" ) ); + filter->SetInsideValue( this->m_Parameters.GetReal( "InsideValue" ) ); + filter->SetOutsideValue( this->m_Parameters.GetReal( "OutsideValue" ) ); + filter->SetStrict( this->m_Parameters.GetBool( "Strict" ) ); + filter->Update( ); - // Connect output - this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); + // Connect output + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); + */ } // eof - $RCSfile$ diff --git a/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.h b/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.h index 1e07c36..3360b4d 100644 --- a/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.h +++ b/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.h @@ -1,7 +1,7 @@ #ifndef __cpPluginsImageThresholdFilters__UnaryThresholdImageFilter__h__ #define __cpPluginsImageThresholdFilters__UnaryThresholdImageFilter__h__ -#include +#include #include namespace cpPluginsImageThresholdFilters @@ -19,7 +19,7 @@ namespace cpPluginsImageThresholdFilters protected: template< class _TImage > - inline void _GD0( _TImage* image ); + inline void _GD0( _TImage* image ); }; } // ecapseman