]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Image/Algorithm.hxx
...
[FrontAlgorithms.git] / lib / fpa / Image / Algorithm.hxx
index 0ae9b90f993aa5bb0af9b31c11af088795151edc..98592f63d21c375268ff7d1e5fa68ae56f2dd550 100644 (file)
@@ -14,8 +14,10 @@ TMarks*
 fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
 GetMarks( )
 {
-  dynamic_cast< TMarks* >(
-    this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
+  return(
+    dynamic_cast< TMarks* >(
+      this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
+      )
     );
 }
 
@@ -27,8 +29,10 @@ TMarks*
 fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
 GetMarks( ) const
 {
-  dynamic_cast< const TMarks* >(
-    this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
+  return(
+    dynamic_cast< const TMarks* >(
+      this->itk::ProcessObject::GetOutput( this->m_MarksIdx )
+      )
     );
 }
 
@@ -51,6 +55,42 @@ fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInt
 {
 }
 
+// -------------------------------------------------------------------------
+template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
+typename
+fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+TNodes fpa::Image::Algorithm< _TInputImage, _TOutputImage, _TMarksInterface, _TSeedsInterface >::
+_UnifySeeds( )
+{
+  const TInputImage* input = this->GetInput( );
+  typename TInputImage::RegionType region = input->GetRequestedRegion( );
+  TSeeds seeds = this->GetSeeds( );
+  TNodes nodes;
+
+  typename TSeeds::iterator sIt = seeds.begin( );
+  for( ; sIt != seeds.end( ); ++sIt )
+  {
+    TNode node;
+    if( sIt->IsPoint )
+      input->TransformPhysicalPointToIndex( sIt->Point, sIt->Vertex );
+    else
+      input->TransformIndexToPhysicalPoint( sIt->Vertex, sIt->Point );
+    if( region.IsInside( sIt->Vertex ) )
+    {
+      sIt->IsUnified = true;
+      node.Vertex = sIt->Vertex;
+      node.Parent = node.Vertex;
+      node.FrontId = nodes.size( ) + 1;
+      nodes.insert( node );
+    }
+    else
+      sIt->IsUnified = false;
+      
+  } // rof
+
+  return( nodes );
+}
+
 // -------------------------------------------------------------------------
 template< class _TInputImage, class _TOutputImage, class _TMarksInterface, class _TSeedsInterface >
 void