]> Creatis software - cpPlugins.git/blob - plugins/ImageThresholdFilters/ImageToBoundingBoxFromThreshold.cxx
...
[cpPlugins.git] / plugins / ImageThresholdFilters / ImageToBoundingBoxFromThreshold.cxx
1 #include <ImageThresholdFilters/ImageToBoundingBoxFromThreshold.h>
2 #include <cpPlugins/DataObjects/Image.h>
3 #include <cpPlugins/DataObjects/BoundingBox.h>
4
5 #include <cpExtensions/Algorithms/ImageToBoundingBoxFromThreshold.h>
6
7 // -------------------------------------------------------------------------
8 cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold::
9 ImageToBoundingBoxFromThreshold( )
10   : Superclass( )
11 {
12   typedef cpPlugins::DataObjects::Image _TImage;
13   typedef cpPlugins::DataObjects::BoundingBox _TBBox;
14
15   this->_ConfigureInput< _TImage >( "Input", true, false );
16   this->_ConfigureOutput< _TBBox >( "Output" );
17
18   this->m_Parameters.ConfigureAsReal( "LowerThreshold" );
19   this->m_Parameters.ConfigureAsReal( "UpperThreshold" );
20
21   this->m_Parameters.SetReal( "LowerThreshold", 0 );
22   this->m_Parameters.SetReal( "LowerThreshold", 0 );
23 }
24
25 // -------------------------------------------------------------------------
26 cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold::
27 ~ImageToBoundingBoxFromThreshold( )
28 {
29 }
30
31 // -------------------------------------------------------------------------
32 void cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold::
33 _GenerateData( )
34 {
35   /* TODO
36      auto o = this->GetInputData( "Input" );
37      cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 );
38      else this->_Error( "Invalid input image." );
39   */
40 }
41
42 // -------------------------------------------------------------------------
43 template< class _TImage >
44 void cpPluginsImageThresholdFilters::ImageToBoundingBoxFromThreshold::
45 _GD0( _TImage* image )
46 {
47   /* TODO
48      typedef
49      cpExtensions::Algorithms::ImageToBoundingBoxFromThreshold< _TImage >
50      _TFilter;
51
52      // Configure filter
53      _TFilter* filter = this->_CreateITK< _TFilter >( );
54      filter->SetImage( image );
55      filter->SetLowerThreshold( this->m_Parameters.GetReal( "LowerThreshold" ) );
56      filter->SetUpperThreshold( this->m_Parameters.GetReal( "UpperThreshold" ) );
57      filter->Compute( );
58
59      // Create output
60      auto reg = filter->GetRegion( );
61      auto bb = this->GetOutput< cpPlugins::DataObjects::BoundingBox >( "Output" );
62      typename _TImage::PointType p0, p1;
63      image->TransformIndexToPhysicalPoint( reg.GetIndex( ), p0 );
64      image->TransformIndexToPhysicalPoint( reg.GetIndex( ) + reg.GetSize( ), p1 );
65      bb->SetMinimum( p0 );
66      bb->SetMaximum( p1 );
67   */
68 }
69
70 // eof - $RCSfile$