]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Algorithms/ImageToBoundingBoxFromThreshold.hxx
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpExtensions / Algorithms / ImageToBoundingBoxFromThreshold.hxx
index 9900e2d3b7b73de0247e0d30c438f8658138732b..55659eb3e0eb5e80c98f93fe9c545aed5c5abdf7 100644 (file)
@@ -43,6 +43,19 @@ Compute( )
 
     } // rof
 
+    // Fix indices
+    for( unsigned int d = 0; d < _TImage::ImageDimension; ++d )
+    {
+      min_idx[ d ] -= long( this->m_PAD );
+      max_idx[ d ] += long( this->m_PAD );
+
+      if( min_idx[ d ] < region.GetIndex( )[ d ] )
+        min_idx[ d ] = region.GetIndex( )[ d ];
+      if( max_idx[ d ] > region.GetIndex( )[ d ] + region.GetSize( )[ d ] )
+        max_idx[ d ] = region.GetIndex( )[ d ] + region.GetSize( )[ d ];
+
+    } // rof
+
   } // fi
 
   typename _TImage::SizeType size;
@@ -59,7 +72,8 @@ cpExtensions::Algorithms::ImageToBoundingBoxFromThreshold< _TImage >::
 ImageToBoundingBoxFromThreshold( )
   : Superclass( ),
     m_LowerThreshold( std::numeric_limits< TPixel >::min( ) ),
-    m_UpperThreshold( std::numeric_limits< TPixel >::max( ) )
+    m_UpperThreshold( std::numeric_limits< TPixel >::max( ) ),
+    m_PAD( 0 )
 {
 }