]> Creatis software - cpPlugins.git/commitdiff
Seeds widget updated
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 15 Feb 2016 21:10:54 +0000 (16:10 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 15 Feb 2016 21:10:54 +0000 (16:10 -0500)
lib/cpExtensions/Visualization/ImageSliceActors.cxx
lib/cpPlugins/Interface/PointList.cxx
lib/cpPlugins/Interface/PointList.h
lib/cpPlugins/Interface/Workspace.cxx
lib/cpPlugins/Plugins/Widgets/SeedWidget.cxx

index 90e09238c22ffec682c9422e5ac131eac5b2e35a..024fbe09c9bc94051ac6652bc19092f7de7a2424 100644 (file)
@@ -963,6 +963,7 @@ UpdateText( double pos[ 3 ] )
             ijk[ 0 ], ijk[ 1 ], ijk[ 2 ], n
             );
       str << ")";
+
 #if defined(WIN32)
       sprintf_s(
         this->m_TextBuffer, 1024, "Axis: %c (%d)\nPixel %s",
@@ -974,8 +975,6 @@ UpdateText( double pos[ 3 ] )
         axis, slice, str.str( ).c_str( )
         );
 #endif // defined(WIN32)
-
-
     } // fi
   }
   else
index 87a3570f1a373d9bbb8dc01ef2c1f5f5246c8313..8c3f2321f047e42243fffe06bc0dbff386611ea9 100644 (file)
@@ -1,5 +1,12 @@
 #include <cpPlugins/Interface/PointList.h>
 
+// -------------------------------------------------------------------------
+bool cpPlugins::Interface::PointList::
+HaveEuclideanPoints( ) const
+{
+  return( this->m_HaveEuclideanPoints );
+}
+
 // -------------------------------------------------------------------------
 unsigned long cpPlugins::Interface::PointList::
 GetNumberOfPoints( ) const
@@ -19,7 +26,8 @@ Clear( )
 // -------------------------------------------------------------------------
 cpPlugins::Interface::PointList::
 PointList( )
-  : Superclass( )
+  : Superclass( ),
+    m_HaveEuclideanPoints( true )
 {
   this->Clear( );
 }
index f41fb189e37a0d36596bf8ef6b9c76451f0f8764..6f43b32aef99afebea85f76446f69db1ffe3f0d9 100644 (file)
@@ -23,7 +23,12 @@ namespace cpPlugins
       itkTypeMacro( PointList, DataObject );
       cpPlugins_Id_Macro( PointList, DataObject );
 
+      itkBooleanMacro( HaveEuclideanPoints );
+      itkGetConstMacro( HaveEuclideanPoints, bool );
+      itkSetMacro( HaveEuclideanPoints, bool );
+
     public:
+      bool HaveEuclideanPoints( ) const;
       unsigned long GetNumberOfPoints( ) const;
 
       void Clear( );
@@ -45,6 +50,7 @@ namespace cpPlugins
 
     protected:
       unsigned long m_NumberOfPoints;
+      bool m_HaveEuclideanPoints;
     };
 
   } // ecapseman
index 7f7f7db83e4087bf9ba0d5edcce8b5b96fcd2c15..437b03793ed9addc12481385c8bbeca5c8e5305d 100644 (file)
@@ -121,7 +121,7 @@ CreateFilter( const std::string& filter, const std::string& name )
     {
       f->SetSingleInteractor( this->m_SingleInteractor );
       f->SetMPRViewer( this->m_MPRViewer );
-      
+
       TObject::Pointer o = f.GetPointer( );
       this->m_Graph->SetVertex( name, o );
 
index f9bb4fb339e67291c86fb80f7e802d1ff28cf73d..58cbed574e677b8953c389c94d0e4a83ce1ef19e 100644 (file)
@@ -25,7 +25,7 @@ SeedWidget( )
   this->_AddOutput< cpPlugins::Interface::PointList >( "Output" );
 
   this->m_Parameters->ConfigureAsBool( "SeedsAreInRealSpace" );
-  this->m_Parameters->SetBool( "SeedsAreInRealSpace", true );
+  this->m_Parameters->SetBool( "SeedsAreInRealSpace", false );
 }
 
 // -------------------------------------------------------------------------
@@ -61,8 +61,6 @@ template< class I >
 std::string cpPlugins::Widgets::SeedWidget::
 _GD0( itk::DataObject* image )
 {
-  std::cout << "update seeds" << std::endl;
-
   typedef cpExtensions::Interaction::ImageInteractorStyle _S;
 
   I* base_image = dynamic_cast< I* >( image );
@@ -70,8 +68,11 @@ _GD0( itk::DataObject* image )
     this->GetOutputData< cpPlugins::Interface::PointList >( "Output" );
   double aux_pnt[ 3 ];
   unsigned int dim = ( I::ImageDimension < 3 )? I::ImageDimension: 3;
+  bool real_space = this->m_Parameters->GetBool( "SeedsAreInRealSpace" );
 
+  // Prepare output
   out->Clear( );
+  out->SetHaveEuclideanPoints( real_space );
 
   // MPR
   if( this->m_MPRViewer != NULL )
@@ -92,7 +93,15 @@ _GD0( itk::DataObject* image )
             typename I::PointType seed;
             for( unsigned int d = 0; d < dim; ++d )
               seed[ d ] = aux_pnt[ d ];
-            out->AddPoint( seed );
+
+            if( !real_space )
+            {
+              typename I::IndexType index;
+              if( base_image->TransformPhysicalPointToIndex( seed, index ) )
+                out->AddPoint( index );
+            }
+            else
+              out->AddPoint( seed );
 
           } // rof
         }
@@ -117,7 +126,14 @@ _GD0( itk::DataObject* image )
         typename I::PointType seed;
         for( unsigned int d = 0; d < dim; ++d )
           seed[ d ] = aux_pnt[ d ];
-        out->AddPoint( seed );
+        if( !real_space )
+        {
+          typename I::IndexType index;
+          if( base_image->TransformPhysicalPointToIndex( seed, index ) )
+            out->AddPoint( index );
+        }
+        else
+          out->AddPoint( seed );
 
       } // rof
     }