]> Creatis software - cpPlugins.git/blobdiff - plugins/Widgets/SeedWidget.cxx
...
[cpPlugins.git] / plugins / Widgets / SeedWidget.cxx
index ab38f2e4af70b68d63feb8dee1827c52fc27f446..cc589b1509679bbfb868ba70523f9262c080921b 100644 (file)
@@ -164,34 +164,38 @@ _GD0_Image( vtkImageData* image )
     std::string text = this->m_Parameters.GetString( "Text" );
     std::vector< std::string > tok1, tok2;
     cpExtensions::Tokenize( tok1, text, "#" );
-    for( auto t1 = tok1.begin( ); t1 != tok1.end( ); ++t1 )
+    if( tok1.size( ) > seeds->GetPoints( )->GetNumberOfPoints( ) )
     {
-      if( *t1 != "" )
+      for( auto t1 = tok1.begin( ); t1 != tok1.end( ); ++t1 )
       {
-        cpExtensions::Tokenize( tok2, *t1, " " );
-        double x[ 3 ];
-        for( unsigned int d = 0; d < 3; ++d )
+        if( *t1 != "" )
         {
-          if( d < tok2.size( ) )
+          cpExtensions::Tokenize( tok2, *t1, " " );
+          double x[ 3 ];
+          for( unsigned int d = 0; d < 3; ++d )
           {
-            std::istringstream str( tok2[ d ] );
-            str >> x[ d ];
-          }
-          else
-            x[ d ] = double( 0 );
-
-        } // rof
+            if( d < tok2.size( ) )
+            {
+              std::istringstream str( tok2[ d ] );
+              str >> x[ d ];
+            }
+            else
+              x[ d ] = double( 0 );
+
+          } // rof
+
+          seeds->GetPoints( )->InsertNextPoint( x );
+          seeds->GetVerts( )->InsertNextCell( 1 );
+          seeds->GetVerts( )->InsertCellPoint(
+            seeds->GetPoints( )->GetNumberOfPoints( ) - 1
+            );
+          seeds->Modified( );
 
-        seeds->GetPoints( )->InsertNextPoint( x );
-        seeds->GetVerts( )->InsertNextCell( 1 );
-        seeds->GetVerts( )->InsertCellPoint(
-          seeds->GetPoints( )->GetNumberOfPoints( ) - 1
-          );
-        seeds->Modified( );
+        } // fi
 
-      } // fi
+      } // rof
 
-    } // rof
+    } // fi
   }
   else
   {