From: Eduardo DAVILA Date: Fri, 3 Dec 2021 10:23:02 +0000 (+0100) Subject: #3472 MeshDeformation X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=970a183246a4df7f29e583846745086c5b9f7090;p=creaVtk.git #3472 MeshDeformation --- diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx index 5f0aaa1..82651c6 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkCutter.cxx @@ -33,26 +33,27 @@ void Cutter::Process() // See example in: // https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/Cutter/ - vtkCutter *cutter; - - cutter = vtkCutter::New(); - cutter->SetInputData( bbGetInputIn() ); - cutter->SetCutFunction( bbGetInputImplicitFunction() ); - cutter->Update(); - bbSetOutputOut( cutter->GetOutput() ); - - + if (bbGetInputIn()!=NULL) + { + vtkCutter *cutter; + cutter = vtkCutter::New(); + cutter->SetInputData( bbGetInputIn() ); + cutter->SetCutFunction( bbGetInputImplicitFunction() ); + cutter->Update(); + bbSetOutputOut( cutter->GetOutput() ); + } else { + bbSetOutputOut( NULL ); + } } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) //===== void Cutter::bbUserSetDefaultValues() { - // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 // bbSetInputIn(NULL); - + bbSetOutputOut( NULL ); } //===== // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) @@ -79,7 +80,7 @@ void Cutter::bbUserFinalizeProcessing() // if any } -} -// EO namespace bbcreaVtk + +}// EO namespace bbcreaVtk diff --git a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx index b5b4294..3fac0f9 100644 --- a/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx +++ b/bbtk_creaVtk_PKG/src/bbcreaVtkMeshDeformation.cxx @@ -28,14 +28,16 @@ void MeshDeformation::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <=0)) { + vtkPoints* points=bbGetInputIn()->GetPoints(); long i,size=points->GetNumberOfPoints(); double p[3]; // point @@ -67,12 +69,14 @@ void MeshDeformation::Process() double displcement_x = 0; double displcement_y = 0; double displcement_z = 0; + if (bbGetInputDirection().size()==3) { displcement_x = bbGetInputDirection()[0]; displcement_y = bbGetInputDirection()[1]; displcement_z = bbGetInputDirection()[2]; } + size=voiIdPoints.size(); for (i=0;i