From 3eb36afc11862f059b33b0711b24addfc2fceafb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Wed, 2 Nov 2016 17:33:21 -0500 Subject: [PATCH] ... --- plugins/IO/ImageJSkeletonWriter.cxx | 6 --- .../ImageBooleanFilters/ImageBooleanFilters.i | 3 ++ .../InvertIntensityImageFilter.cxx | 49 +++++++++++++++++++ .../InvertIntensityImageFilter.h | 29 +++++++++++ 4 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 plugins/ImageBooleanFilters/InvertIntensityImageFilter.cxx create mode 100644 plugins/ImageBooleanFilters/InvertIntensityImageFilter.h diff --git a/plugins/IO/ImageJSkeletonWriter.cxx b/plugins/IO/ImageJSkeletonWriter.cxx index 1077242..b6c279d 100644 --- a/plugins/IO/ImageJSkeletonWriter.cxx +++ b/plugins/IO/ImageJSkeletonWriter.cxx @@ -67,15 +67,9 @@ _GD0( _TSkeleton* skeleton ) auto mIt = skeleton->BeginEdgesRows( ); for( ; mIt != skeleton->EndEdgesRows( ); ++mIt ) { - /* TODO - mIt->first; --> this is the row index. <-- - */ auto rIt = mIt->second.begin( ); for( ; rIt != mIt->second.end( ); ++rIt ) { - /* TODO - rIt->first; --> this is the column index. - */ auto eIt = rIt->second.begin( ); for( ; eIt != rIt->second.end( ); ++eIt ) { diff --git a/plugins/ImageBooleanFilters/ImageBooleanFilters.i b/plugins/ImageBooleanFilters/ImageBooleanFilters.i index c185fbd..99f27cb 100644 --- a/plugins/ImageBooleanFilters/ImageBooleanFilters.i +++ b/plugins/ImageBooleanFilters/ImageBooleanFilters.i @@ -6,10 +6,13 @@ define all_ints=#int_types#;unsigned #int_types# tinclude itkBinaryFunctorImageFilter:h|hxx tinclude itkUnaryFunctorImageFilter:h|hxx +tinclude itkInvertIntensityImageFilter:h|hxx cinclude itk#filters#ImageFilter.h instances itk::BinaryFunctorImageFilter< itk::Image< #all_ints#, #process_dims# >, itk::Image< #all_ints#, #process_dims# >, itk::Image< #all_ints#, #process_dims# >, itk::Functor::#functors#< #all_ints#, #all_ints#, #all_ints# > > instances itk::UnaryFunctorImageFilter< itk::Image< #all_ints#, #process_dims# >, itk::Image< #all_ints#, #process_dims# >, itk::Functor::NOT< #all_ints#, #all_ints# > > +instances itk::InvertIntensityImageFilter< itk::Image< #scalar_pixels#, #process_dims# > > + ** eof - $RCSfile$ diff --git a/plugins/ImageBooleanFilters/InvertIntensityImageFilter.cxx b/plugins/ImageBooleanFilters/InvertIntensityImageFilter.cxx new file mode 100644 index 0000000..33e2ae8 --- /dev/null +++ b/plugins/ImageBooleanFilters/InvertIntensityImageFilter.cxx @@ -0,0 +1,49 @@ +#include +#include +#include + +#include + +// ------------------------------------------------------------------------- +cpPluginsImageBooleanFilters::InvertIntensityImageFilter:: +InvertIntensityImageFilter( ) + : Superclass( ) +{ + typedef cpPlugins::DataObjects::Image _TImage; + + this->_ConfigureInput< _TImage >( "Input", true, false ); + this->_ConfigureOutput< _TImage >( "Output" ); + this->m_Parameters.ConfigureAsUint( "Maximum", 1 ); +} + +// ------------------------------------------------------------------------- +cpPluginsImageBooleanFilters::InvertIntensityImageFilter:: +~InvertIntensityImageFilter( ) +{ +} + +// ------------------------------------------------------------------------- +void cpPluginsImageBooleanFilters::InvertIntensityImageFilter:: +_GenerateData( ) +{ + auto o = this->GetInputData( "Input" ); + cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) + this->_Error( "Invalid input image." ); +} + +// ------------------------------------------------------------------------- +template< class _TImage > +void cpPluginsImageBooleanFilters::InvertIntensityImageFilter:: +_GD0( _TImage* image ) +{ + typedef itk::InvertIntensityImageFilter< _TImage > _TFilter; + + // Configure filter + auto filter = this->_CreateITK< _TFilter >( ); + filter->SetInput( image ); + filter->SetMaximum( this->m_Parameters.GetUint( "Maximum" ) ); + filter->Update( ); + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); +} + +// eof - $RCSfile$ diff --git a/plugins/ImageBooleanFilters/InvertIntensityImageFilter.h b/plugins/ImageBooleanFilters/InvertIntensityImageFilter.h new file mode 100644 index 0000000..c6422bb --- /dev/null +++ b/plugins/ImageBooleanFilters/InvertIntensityImageFilter.h @@ -0,0 +1,29 @@ +#ifndef __cpPluginsImageBooleanFilters__InvertIntensityImageFilter__h__ +#define __cpPluginsImageBooleanFilters__InvertIntensityImageFilter__h__ + +#include +#include + +namespace cpPluginsImageBooleanFilters +{ + /** + */ + class cpPluginsImageBooleanFilters_EXPORT InvertIntensityImageFilter + : public cpPlugins::BaseObjects::ProcessObject + { + cpPluginsObject( + InvertIntensityImageFilter, + cpPlugins::BaseObjects::ProcessObject, + ImageBooleanFilters + ); + + protected: + template< class _TImage > + inline void _GD0( _TImage* image ); + }; + +} // ecapseman + +#endif // __cpPluginsImageBooleanFilters__InvertIntensityImageFilter__h__ + +// eof - $RCSfile$ -- 2.47.1