From: Leonardo Flórez-Valencia Date: Thu, 1 Dec 2016 16:28:16 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~28 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=56ab4d443e31a686cec29e293f03f605eb004f44;p=cpPlugins.git ... --- diff --git a/plugins/ITKGenericFilters/RegionOfInterestImageFilter.h b/plugins/ITKGenericFilters/RegionOfInterestImageFilter.h deleted file mode 100644 index 7e98556..0000000 --- a/plugins/ITKGenericFilters/RegionOfInterestImageFilter.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __cpPluginsITKGenericFilters__RegionOfInterestImageFilter__h__ -#define __cpPluginsITKGenericFilters__RegionOfInterestImageFilter__h__ - -#include -#include - -namespace cpPluginsITKGenericFilters -{ - /** - */ - class cpPluginsITKGenericFilters_EXPORT RegionOfInterestImageFilter - : public cpPlugins::BaseObjects::ProcessObject - { - cpPluginsObject( - RegionOfInterestImageFilter, - cpPlugins::BaseObjects::ProcessObject, - ImageFilters - ); - - protected: - template< class _TImage > - inline void _GD0( _TImage* input ); - }; - -} // ecapseman - -#endif // __cpPluginsITKGenericFilters__RegionOfInterestImageFilter__h__ - -// eof - $RCSfile$ diff --git a/plugins/ITKImageGenericFilters_1/ITKImageGenericFilters_1.i b/plugins/ITKImageGenericFilters_1/ITKImageGenericFilters_1.i index 2fa060e..8c62830 100644 --- a/plugins/ITKImageGenericFilters_1/ITKImageGenericFilters_1.i +++ b/plugins/ITKImageGenericFilters_1/ITKImageGenericFilters_1.i @@ -9,7 +9,13 @@ define o_scalars=#scalar_types# tinclude itk#filters_1#:h|hxx instances itk::#filters_1#< itk::Image< #i_scalars#, #pdims# >, itk::Image< #o_scalars#, #pdims# > > +tinclude itkRegionOfInterestImageFilter:h|hxx +instances itk::RegionOfInterestImageFilter< itk::Image< #scalar_types#, #pdims# >, itk::Image< #scalar_types#, #pdims# > > + tinclude itkMinimumMaximumImageCalculator:h|hxx instances itk::MinimumMaximumImageCalculator< itk::Image< #scalar_types#, #pdims# > > +tinclude cpExtensions/Algorithms/ImageToBoundingBoxFromThreshold:h|hxx +instances cpExtensions::Algorithms::ImageToBoundingBoxFromThreshold< itk::Image< #scalar_types#, #pdims# > > + ** eof - $RCSfile$ diff --git a/plugins/ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.cxx b/plugins/ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.cxx new file mode 100644 index 0000000..a93ba35 --- /dev/null +++ b/plugins/ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.cxx @@ -0,0 +1,61 @@ +#include +#include +#include + +#include +#include + +// ------------------------------------------------------------------------- +cpPluginsITKImageGenericFilters_1::ImageToBoundingBoxFromThreshold:: +ImageToBoundingBoxFromThreshold( ) + : Superclass( ) +{ + this->_ConfigureInput< cpInstances::Image >( "Input", true, false ); + this->_ConfigureOutput< cpInstances::BoundingBox >( "Output" ); + + this->m_Parameters.ConfigureAsReal( "LowerThreshold", 0 ); + this->m_Parameters.ConfigureAsReal( "UpperThreshold", 1 ); +} + +// ------------------------------------------------------------------------- +cpPluginsITKImageGenericFilters_1::ImageToBoundingBoxFromThreshold:: +~ImageToBoundingBoxFromThreshold( ) +{ +} + +// ------------------------------------------------------------------------- +void cpPluginsITKImageGenericFilters_1::ImageToBoundingBoxFromThreshold:: +_GenerateData( ) +{ + auto o = this->GetInputData( "Input" ); + cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) + this->_Error( "Invalid input image." ); +} + +// ------------------------------------------------------------------------- +template< class _TImage > +void cpPluginsITKImageGenericFilters_1::ImageToBoundingBoxFromThreshold:: +_GD0( _TImage* image ) +{ + 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( ); + + // Create output + auto reg = filter->GetRegion( ); + auto bb = this->GetOutput< cpInstances::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/ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.h b/plugins/ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.h new file mode 100644 index 0000000..ad78b5c --- /dev/null +++ b/plugins/ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.h @@ -0,0 +1,29 @@ +#ifndef __cpPluginsITKImageGenericFilters_1__ImageToBoundingBoxFromThreshold__h__ +#define __cpPluginsITKImageGenericFilters_1__ImageToBoundingBoxFromThreshold__h__ + +#include +#include + +namespace cpPluginsITKImageGenericFilters_1 +{ + /** + */ + class cpPluginsITKImageGenericFilters_1_EXPORT ImageToBoundingBoxFromThreshold + : public cpPlugins::BaseObjects::ProcessObject + { + cpPluginsObject( + ImageToBoundingBoxFromThreshold, + cpPlugins::BaseObjects::ProcessObject, + ImageFeatures + ); + + protected: + template< class _TImage > + inline void _GD0( _TImage* image ); + }; + +} // ecapseman + +#endif // __cpPluginsITKImageGenericFilters_1__ImageToBoundingBoxFromThreshold__h__ + +// eof - $RCSfile$ diff --git a/plugins/ITKGenericFilters/RegionOfInterestImageFilter.cxx b/plugins/ITKImageGenericFilters_1/RegionOfInterestImageFilter.cxx similarity index 85% rename from plugins/ITKGenericFilters/RegionOfInterestImageFilter.cxx rename to plugins/ITKImageGenericFilters_1/RegionOfInterestImageFilter.cxx index 5477986..9254bf4 100644 --- a/plugins/ITKGenericFilters/RegionOfInterestImageFilter.cxx +++ b/plugins/ITKImageGenericFilters_1/RegionOfInterestImageFilter.cxx @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -8,7 +8,7 @@ #include // ------------------------------------------------------------------------- -cpPluginsITKGenericFilters::RegionOfInterestImageFilter:: +cpPluginsITKImageGenericFilters_1::RegionOfInterestImageFilter:: RegionOfInterestImageFilter( ) : Superclass( ) { @@ -20,13 +20,13 @@ RegionOfInterestImageFilter( ) } // ------------------------------------------------------------------------- -cpPluginsITKGenericFilters::RegionOfInterestImageFilter:: +cpPluginsITKImageGenericFilters_1::RegionOfInterestImageFilter:: ~RegionOfInterestImageFilter( ) { } // ------------------------------------------------------------------------- -void cpPluginsITKGenericFilters::RegionOfInterestImageFilter:: +void cpPluginsITKImageGenericFilters_1::RegionOfInterestImageFilter:: _GenerateData( ) { auto o = this->GetInputData( "Input" ); @@ -36,7 +36,7 @@ _GenerateData( ) // ------------------------------------------------------------------------- template< class _TImage > -void cpPluginsITKGenericFilters::RegionOfInterestImageFilter:: +void cpPluginsITKImageGenericFilters_1::RegionOfInterestImageFilter:: _GD0( _TImage* input ) { typedef cpInstances::BoundingBox _TBBox; diff --git a/plugins/ITKImageGenericFilters_1/RegionOfInterestImageFilter.h b/plugins/ITKImageGenericFilters_1/RegionOfInterestImageFilter.h new file mode 100644 index 0000000..39c800e --- /dev/null +++ b/plugins/ITKImageGenericFilters_1/RegionOfInterestImageFilter.h @@ -0,0 +1,29 @@ +#ifndef __cpPluginsITKImageGenericFilters_1__RegionOfInterestImageFilter__h__ +#define __cpPluginsITKImageGenericFilters_1__RegionOfInterestImageFilter__h__ + +#include +#include + +namespace cpPluginsITKImageGenericFilters_1 +{ + /** + */ + class cpPluginsITKImageGenericFilters_1_EXPORT RegionOfInterestImageFilter + : public cpPlugins::BaseObjects::ProcessObject + { + cpPluginsObject( + RegionOfInterestImageFilter, + cpPlugins::BaseObjects::ProcessObject, + ImageFilters + ); + + protected: + template< class _TImage > + inline void _GD0( _TImage* input ); + }; + +} // ecapseman + +#endif // __cpPluginsITKImageGenericFilters_1__RegionOfInterestImageFilter__h__ + +// eof - $RCSfile$