]> Creatis software - cpPlugins.git/commitdiff
Machete filter visualization finished.
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 24 Nov 2015 03:44:04 +0000 (22:44 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Tue, 24 Nov 2015 03:44:04 +0000 (22:44 -0500)
lib/cpExtensions/Visualization/ImageSliceActors.cxx
lib/cpPlugins/Interface/BaseMPRWidget.cxx
lib/cpPlugins/Interface/BaseMPRWidget.h
lib/cpPlugins/Interface/Parameters.cxx
lib/cpPlugins/Interface/Parameters.hxx
lib/cpPlugins/Plugins/BasicFilters/MacheteFilter.cxx

index e2ac88acf22357f4417cbef89cc1e6ccec0bcdb8..24bae091f038ea2a653e2cb289e6ece20aedb171 100644 (file)
@@ -84,7 +84,7 @@ AddBinaryConnection(
     return( -1 );
   this->m_Blender->AddInputConnection( aout );
   this->_ConfigureBinaryImage( r, g, b );
-  return( this->m_Blender->GetNumberOfInputPorts( ) - 1 );
+  return( this->m_Blender->GetNumberOfInputs( ) - 1 );
 }
 
 // -------------------------------------------------------------------------
@@ -98,7 +98,7 @@ AddBinaryImage(
     return( -1 );
   this->m_Blender->AddInputData( data );
   this->_ConfigureBinaryImage( r, g, b );
-  return( this->m_Blender->GetNumberOfInputPorts( ) - 1 );
+  return( this->m_Blender->GetNumberOfInputs( ) - 1 );
 }
 
 // -------------------------------------------------------------------------
index b971b71b215ae2973f08ff3a05d4dfe831a6ffc2..d96ae328abc3b65133a62b6519711c95f9989729 100644 (file)
@@ -9,6 +9,19 @@
 #include <QTreeWidgetItem>
 #include <vtkRendererCollection.h>
 
+double cpPlugins::Interface::BaseMPRWidget::
+cm_Colors[ 8 ][ 3 ] =
+{
+  { 1.0, 0.0, 0.0 },
+  { 0.0, 1.0, 0.0 },
+  { 0.0, 0.0, 1.0 },
+  { 0.0, 1.0, 1.0 },
+  { 1.0, 0.0, 1.0 },
+  { 1.0, 1.0, 0.0 },
+  { 1.0, 0.5, 0.0 },
+  { 1.0, 0.0, 0.5 }
+};
+
 // -------------------------------------------------------------------------
 cpPlugins::Interface::BaseMPRWidget::
 BaseMPRWidget( QWidget* parent )
@@ -184,10 +197,13 @@ ShowData( const std::string& name )
       this->m_MPRObjects->SetInputImage( iIt->second.Image );
     else
     {
-      std::cout << this->m_MPRObjects->GetNumberOfImages( ) << std::endl;
-
-
-      this->m_MPRObjects->AddBinaryImage( iIt->second.Image, 1, 0, 0 );
+      unsigned int i = ( this->m_MPRObjects->GetNumberOfImages( ) - 1 ) % 8;
+      this->m_MPRObjects->AddBinaryImage(
+        iIt->second.Image,
+        Self::cm_Colors[ i ][ 0 ],
+        Self::cm_Colors[ i ][ 1 ],
+        Self::cm_Colors[ i ][ 2 ]
+        );
     }
     this->m_MPRObjects->Show( );
   }
index a5ba35c31bebd7e5243a7651831b704eb7cb96c0..40819a3afbaa17a71c55138d5ae75b9b002d20fc 100644 (file)
@@ -45,6 +45,7 @@ namespace cpPlugins
       Q_OBJECT;
 
     public:
+      typedef BaseMPRWidget Self;
       typedef cpExtensions::Visualization::MPRObjects TMPRObjects;
 
       typedef TMPRObjects::TStyle                   TStyle;
index c85aeee595cb123d3f1563e27d0a9f802e08dcff..4a05b4fb4763654783d4318d78233306fb739069 100644 (file)
@@ -229,7 +229,13 @@ GetReal( const TString& name ) const
   if( i != this->m_Parameters.end( ) )
   {
     if( i->second.first == Self::Real )
-      return( TReal( std::atof( i->second.second.second.c_str( ) ) ) );
+    {
+      std::istringstream tok_str( i->second.second.second );
+      float v;
+      tok_str >> v;
+      return( TReal( v ) );
+
+    } // fi
 
   } // fi
   return( TReal( 0 ) );
@@ -317,7 +323,13 @@ GetRealList( std::vector< TReal >& lst, const TString& name ) const
   std::istringstream str( i->second.second.second );
   std::string token;
   while( std::getline( str, token, '#' ) )
-    lst.push_back( TReal( std::atof( token.c_str( ) ) ) );
+  {
+    std::istringstream tok_str( token );
+    float v;
+    tok_str >> v;
+    lst.push_back( TReal( v ) );
+
+  } // elihw
 }
 
 // -------------------------------------------------------------------------
index 0bb20c7e46ff65bbb9ff472f931822ebc364bc3c..b633f879f5e33b70b0a3064e259ca0c754849b4d 100644 (file)
@@ -94,7 +94,8 @@ GetPoint( const TString& name, const TUint& dim ) const
       unsigned int d = 0;
       while( std::getline( str, token, ';' ) && d < dim )
       {
-        v[ d ] = std::atof( token.c_str( ) );
+        std::istringstream tok_str( token );
+        tok_str >> v[ d ];
         d++;
 
       } // elihw
@@ -126,7 +127,8 @@ GetVector( const TString& name, const TUint& dim ) const
       unsigned int d = 0;
       while( std::getline( str, token, ';' ) && d < dim )
       {
-        v[ d ] = std::atof( token.c_str( ) );
+        std::istringstream tok_str( token );
+        tok_str >> v[ d ];
         d++;
 
       } // elihw
@@ -203,7 +205,8 @@ GetPointList(
     P v;
     while( std::getline( str2, token2, ';' ) && d < dim )
     {
-      v[ d ] = std::atof( token.c_str( ) );
+      std::istringstream tok_str( token );
+      tok_str >> v[ d ];
       d++;
 
     } // elihw
@@ -238,7 +241,8 @@ GetVectorList(
     V v;
     while( std::getline( str2, token2, ';' ) && d < dim )
     {
-      v[ d ] = std::atof( token.c_str( ) );
+      std::istringstream tok_str( token );
+      tok_str >> v[ d ];
       d++;
 
     } // elihw
index 916d2ed1e84823475e238c3aacd72d81fbecaaed..f25c6dd5d9938ec47e54f26d2a9c59c603a52cf2 100644 (file)
@@ -71,6 +71,7 @@ accept( )
   double center[ 3 ], normal[ 3 ];
   wdg->GetCenter( center );
   wdg->GetNormal( normal );
+
   this->m_Filter->GetParameters( )->SetPoint( "PlaneCenter", 3, center );
   this->m_Filter->GetParameters( )->SetVector( "PlaneNormal", 3, normal );