]> Creatis software - creaVtk.git/blobdiff - lib/creaVtk/creaVtkStreamTracer.cpp
#2446 creaVtk Feature New Normal - Stream Tracer, Stream Line (interface, widget)
[creaVtk.git] / lib / creaVtk / creaVtkStreamTracer.cpp
diff --git a/lib/creaVtk/creaVtkStreamTracer.cpp b/lib/creaVtk/creaVtkStreamTracer.cpp
new file mode 100644 (file)
index 0000000..ba22dee
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+#                        pour la Sante)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+#  This software is governed by the CeCILL-B license under French law and
+#  abiding by the rules of distribution of free software. You can  use,
+#  modify and/ or redistribute the software under the terms of the CeCILL-B
+#  license as circulated by CEA, CNRS and INRIA at the following URL
+#  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+#  or in the file LICENSE.txt.
+#
+#  As a counterpart to the access to the source code and  rights to copy,
+#  modify and redistribute granted by the license, users are provided only
+#  with a limited warranty  and the software's author,  the holder of the
+#  economic rights,  and the successive licensors  have only  limited
+#  liability.
+#
+#  The fact that you are presently reading this means that you have had
+#  knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------
+*/
+
+#include "creaVtkStreamTracer.h"
+
+//-----------------------------------------------------------------------------
+creaVtkStreamTracer::creaVtkStreamTracer()
+{
+       _source                 = vtkPointSource::New();
+       _streamer               = vtkStreamTracer::New();
+}
+
+//-----------------------------------------------------------------------------
+creaVtkStreamTracer::~creaVtkStreamTracer()
+{
+}
+
+
+//------------------------------------------------------------------------
+void creaVtkStreamTracer::SetActive(bool active)
+{
+   _active = active;
+}
+
+//------------------------------------------------------------------------
+void creaVtkStreamTracer::SetDataObject(vtkDataObject* dataobject)
+{
+       _dataobject = dataobject;
+}
+
+//---------------------------------------------
+vtkPolyData* creaVtkStreamTracer::GetPolyData()
+{
+       return _streamer->GetOutput();
+}
+
+//---------------------------------------------
+void creaVtkStreamTracer::SetSourcePoints( vtkDataSet* sourcepoints)
+{
+       _sourcePoints = sourcepoints;
+}
+
+//-----------------------------------------------------------------------------
+void creaVtkStreamTracer::Process()
+{
+               if (_active==true)
+               {
+//                     if (_firsttime==true)
+//                     {
+//                             _firsttime=false;
+//                             _vPointWidget->AllOff();
+//                             _vPointWidget->PlaceWidget();
+//                             _vPointWidget->SetInteractor( GetRenderer()->GetRenderWindow()->GetInteractor() );
+//                             _source->SetNumberOfPoints(1000);
+//                             _source->SetRadius(5.0);
+//                     }
+//EED1                 _vPointWidget->On();                    
+//                     double c[3];
+//                     _vPointWidget->GetPosition(c);
+//                     _source->SetCenter( c );
+//                     _source->Update();
+                       
+                       _streamer->SetInput( _dataobject );
+//EED1 _streamer->SetSource( _source->GetOutput() );
+                       _streamer->SetSource( _sourcePoints );
+                       _streamer->SetIntegratorTypeToRungeKutta45();
+                       _streamer->SetMaximumPropagation(500);
+//EED          _streamer->SetMaximumPropagationUnitToTimeUnit();
+                       _streamer->SetInitialIntegrationStep (0.001);
+//EED          _streamer->SetInitialIntegrationStepUnitToCellLengthUnit();
+                       _streamer->SetIntegrationDirectionToBoth();
+//EED    streamer->ComputeVorticityOn ();
+                       _streamer->Update();
+
+//                     _streamer->Print(std::cout);
+//                     _streamer->GetOutput()->Print(std::cout);
+
+       } // active
+} 
+
+
+
+//---------------------------------------------
+//Method template
+//---------------------------------------------
+/*
+void creaVtkStreamTracer::FunctionName(int& parameterA)
+{
+  parameterA = 2 * parameterA;
+  return;
+}
+*/