]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 1 Dec 2016 16:28:16 +0000 (11:28 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 1 Dec 2016 16:28:16 +0000 (11:28 -0500)
plugins/ITKGenericFilters/RegionOfInterestImageFilter.h [deleted file]
plugins/ITKImageGenericFilters_1/ITKImageGenericFilters_1.i
plugins/ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.cxx [new file with mode: 0644]
plugins/ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.h [new file with mode: 0644]
plugins/ITKImageGenericFilters_1/RegionOfInterestImageFilter.cxx [moved from plugins/ITKGenericFilters/RegionOfInterestImageFilter.cxx with 85% similarity]
plugins/ITKImageGenericFilters_1/RegionOfInterestImageFilter.h [new file with mode: 0644]

diff --git a/plugins/ITKGenericFilters/RegionOfInterestImageFilter.h b/plugins/ITKGenericFilters/RegionOfInterestImageFilter.h
deleted file mode 100644 (file)
index 7e98556..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __cpPluginsITKGenericFilters__RegionOfInterestImageFilter__h__
-#define __cpPluginsITKGenericFilters__RegionOfInterestImageFilter__h__
-
-#include <cpPluginsITKGenericFilters_Export.h>
-#include <cpPlugins/BaseObjects/ProcessObject.h>
-
-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$
index 2fa060e6f49de1ac850b9941fd3c6fb6504e4fd5..8c6283029d91e687f5c5d38c0401f645675ca6cc 100644 (file)
@@ -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 (file)
index 0000000..a93ba35
--- /dev/null
@@ -0,0 +1,61 @@
+#include <ITKImageGenericFilters_1/ImageToBoundingBoxFromThreshold.h>
+#include <cpInstances/Image.h>
+#include <cpInstances/BoundingBox.h>
+
+#include <itkImage.h>
+#include <cpExtensions/Algorithms/ImageToBoundingBoxFromThreshold.h>
+
+// -------------------------------------------------------------------------
+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 (file)
index 0000000..ad78b5c
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __cpPluginsITKImageGenericFilters_1__ImageToBoundingBoxFromThreshold__h__
+#define __cpPluginsITKImageGenericFilters_1__ImageToBoundingBoxFromThreshold__h__
+
+#include <cpPluginsITKImageGenericFilters_1_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+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$
similarity index 85%
rename from plugins/ITKGenericFilters/RegionOfInterestImageFilter.cxx
rename to plugins/ITKImageGenericFilters_1/RegionOfInterestImageFilter.cxx
index 547798638e97af8081e05c1955a86410a96c5b7e..9254bf4d83aa5a0c7f461938bf106b0e88aa71dd 100644 (file)
@@ -1,4 +1,4 @@
-#include <ITKGenericFilters/RegionOfInterestImageFilter.h>
+#include <ITKImageGenericFilters_1/RegionOfInterestImageFilter.h>
 #include <cpInstances/Image.h>
 #include <cpInstances/BoundingBox.h>
 #include <cpInstances/Image_Demanglers.h>
@@ -8,7 +8,7 @@
 #include <itkRegionOfInterestImageFilter.h>
 
 // -------------------------------------------------------------------------
-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 (file)
index 0000000..39c800e
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef __cpPluginsITKImageGenericFilters_1__RegionOfInterestImageFilter__h__
+#define __cpPluginsITKImageGenericFilters_1__RegionOfInterestImageFilter__h__
+
+#include <cpPluginsITKImageGenericFilters_1_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+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$