X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkMagnitud.cxx;h=96e7726fca33dcabc07bbd2f88601770dec60df1;hb=208df598c5aeefbd6a683a5c6da00598a4a3d9ea;hp=cc4a2a288362ea70f9f2a5af3e3c9af8bcc6fa0d;hpb=0a4e8193b1c12923f11f2f5637558d2d44f0941f;p=bbtk.git diff --git a/packages/vtk/src/bbvtkMagnitud.cxx b/packages/vtk/src/bbvtkMagnitud.cxx index cc4a2a2..96e7726 100644 --- a/packages/vtk/src/bbvtkMagnitud.cxx +++ b/packages/vtk/src/bbvtkMagnitud.cxx @@ -1,4 +1,31 @@ -//===== +/* + # --------------------------------------------------------------------- + # + # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image + # pour la Santé© + # 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. + # ------------------------------------------------------------------------ */ + + +//===== // 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) //===== #include "bbvtkMagnitud.h" @@ -14,6 +41,8 @@ BBTK_BLACK_BOX_IMPLEMENTATION(Magnitud,bbtk::AtomicBlackBox); void Magnitud::Process() { +printf("EED Magnitud::Process Start\n"); + // THE MAIN PROCESSING METHOD BODY // Here we simply set the input 'In' value to the output 'Out' // And print out the output value @@ -26,39 +55,77 @@ void Magnitud::Process() // * TYPE is the C++ type of the input/output // (the one provided in the attribute 'type' of the tag 'input') - - // ---------- - if (bbGetInputIn()!=NULL) { - vGreenToRedLut->SetHueRange(0.6667,0.0); - vGreenToRedLut->Build(); +// ---------- + if (bbGetInputIn()!=NULL) + { + vGreenToRedLut->SetHueRange(0.6667,0.0); + vGreenToRedLut->Build(); //Input Data +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vVecMagnitude->SetInput(bbGetInputIn()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vVecMagnitude->SetInputData(bbGetInputIn()); +#endif + vVecMagnitude->NormalizeOff(); vVecMagnitude->Update(); vVecMagnitude->GetOutput()->GetScalarRange( range1 ); vVecMagnitude->Update(); //Glyph +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vMaskPoint->SetInput(bbGetInputIn()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vMaskPoint->SetInputData(bbGetInputIn()); +#endif + vMaskPoint->SetOnRatio(100); vMaskPoint->Update(); vMaskPoint->RandomModeOn(); - - vGlyph->SetInput(vMaskPoint->GetOutput()); - vGlyph->SetSource(cone->GetOutput()); + vGlyph->SetScaleModeToScaleByVector(); vGlyph->SetColorModeToColorByVector(); vGlyph->SetScaleFactor(0.20); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + vGlyph->SetInput(vMaskPoint->GetOutput()); + vGlyph->SetSource(cone->GetOutput()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vGlyph->SetInputData(vMaskPoint->GetOutput()); + cone->Update(); + vGlyph->SetSourceData(cone->GetOutput()); +#endif + + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vGlyphMapper->SetInput( vGlyph->GetOutput() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vGlyphMapper->SetInputData( vGlyph->GetOutput() ); +#endif + step = (range1[1]-range1[0])/10; //Contour - dRangeColorForMultipleContourVelocity[0]=0; - dRangeColorForMultipleContourVelocity[1]=1; - dRangeColorForGlyphVelocity[0]=0; - dRangeColorForGlyphVelocity[1]=1; + dRangeColorForMultipleContourVelocity[0] = 0; + dRangeColorForMultipleContourVelocity[1] = 1; + dRangeColorForGlyphVelocity[0] = 0; + dRangeColorForGlyphVelocity[1] = 1; +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vMultipleContourVelocity->SetInput((vtkDataSet *) vVecMagnitude->GetOutput()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vMultipleContourVelocity->SetInputData((vtkDataSet *) vVecMagnitude->GetOutput()); +#endif index = 0; double h; @@ -70,7 +137,14 @@ void Magnitud::Process() index+=1; } +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vMultipleContourMapper->SetInput( vMultipleContourVelocity->GetOutput() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vMultipleContourMapper->SetInputData( vMultipleContourVelocity->GetOutput() ); +#endif + vMultipleContourMapper->SetScalarRange( range1 ); vMultipleContourMapper->SetLookupTable( vGreenToRedLut ); vMultipleContourMapper->Update(); @@ -80,11 +154,21 @@ void Magnitud::Process() //Glyph Mapper vGlyphMapper->SetLookupTable(vGreenToRedLut); vGlyphMapper->SetScalarRange(range1); - vGlyphMapper->ImmediateModeRenderingOn(); +//EED 2020-04-21 vtk8 deprecated +// vGlyphMapper->ImmediateModeRenderingOn(); //Outline Grid +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vOutlineGrid->SetInput( bbGetInputIn() ); vOutlineMapper->SetInput(vOutlineGrid->GetOutput()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vOutlineGrid->SetInputData( bbGetInputIn() ); + vOutlineGrid->Update(); + vOutlineMapper->SetInputData( vOutlineGrid->GetOutput() ); +#endif + //Outline Grid Actor vOutlineActor->SetMapper(vOutlineMapper); @@ -117,10 +201,14 @@ void Magnitud::Process() vGlyph->SetScaleFactor(vGlyph->GetScaleFactor()+0.1); vGlyph->Update(); if( (bbGetInputScale()/100)<0 ) + { bbSetInputScale(0); + } if( (bbGetInputScale()/100)>1 ) + { bbSetInputScale(1); - + } + //vGlyph->SetScaleFactor(dScale); vGlyph->SetScaleFactor( bbGetInputScale()/100 ); vGlyph->Update(); @@ -140,9 +228,14 @@ void Magnitud::Process() vMultipleContourMapper->SetScalarRange( range1 ); if( bbGetInputOpactity()/100<0 ) - bbSetInputOpactity(0); + { + bbSetInputOpactity(0); + } + if( bbGetInputOpactity()/100>1 ) - bbSetInputOpactity(1); + { + bbSetInputOpactity(1); + } //Set Contour Opacity vMultipleContourActor->GetProperty()->SetOpacity( bbGetInputOpactity()/100 ); @@ -153,7 +246,9 @@ void Magnitud::Process() //Set The Number of Contours if( bbGetInputContour()<1) - bbSetInputContour(1); + { + bbSetInputContour(1); + } step=(range1[1]-range1[0])/bbGetInputContour(); index=0; @@ -166,18 +261,24 @@ void Magnitud::Process() //End: Change values by the user /////////////////////////////////////////////////////////////////////////////////////////////////// //The Plane Widget +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vPlaneWidget->SetInput(bbGetInputIn()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vPlaneWidget->SetInputData(bbGetInputIn()); +#endif vPlaneWidget->NormalToXAxisOn(); vPlaneWidget->NormalToZAxisOn(); vPlaneWidget->SetResolution(1); vPlaneWidget->SetRepresentationToOutline(); //vPlaneWidget->SetInteractor(vIren); - vPlaneWidget->SetPlaceFactor(1); //défini zoom initial + vPlaneWidget->SetPlaceFactor(1); //déæini zoom initial vPlaneWidget->PlaceWidget(); vPlaneWidget->On(); vPlaneWidget->GetOrigin(p0); - vPlaneWidget->GetCenter(c); //These is from Execute Method + vPlaneWidget->GetCenter(c); //These is fromvtkImageMathematics Execute Method vPlaneWidget->GetNormal(n); vPlaneWidget->GetPoint1(p1); vPlaneWidget->GetPoint2(p2); @@ -202,7 +303,14 @@ void Magnitud::Process() vDiskSourceEED->SetCircumferentialResolution (20); //Stream Lines +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vPointWidget->SetInput( bbGetInputIn() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vPointWidget->SetInputData( bbGetInputIn() ); +#endif + vPointWidget->AllOff(); vPointWidget->PlaceWidget(); //vPointWidget->SetInteractor(vIren); @@ -220,8 +328,16 @@ void Magnitud::Process() source->SetCenter( c ); source->SetRadius(5.0); +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) streamer->SetInput( bbGetInputIn() ); streamer->SetSource(source->GetOutput()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + streamer->SetInputData( bbGetInputIn() ); + streamer->SetSourceData( source->GetOutput() ); +#endif + streamer->SetIntegratorTypeToRungeKutta45(); streamer->SetMaximumPropagation(500000); //EED streamer->SetMaximumPropagationUnitToTimeUnit (); @@ -231,13 +347,28 @@ void Magnitud::Process() //EED streamer->ComputeVorticityOn (); streamer->Update(); +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) rf->SetInput(streamer->GetOutput()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + rf->SetInputData(streamer->GetOutput()); +#endif + rf->SetRadius(.5); rf->SetNumberOfSides(12); rf->SetVaryRadiusToVaryRadiusOff(); streamer->GetOutput()->GetScalarRange( range ); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) streamMapper2->SetInput(rf->GetOutput()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + streamMapper2->SetInputData(rf->GetOutput()); +#endif + streamMapper2->SetLookupTable(vGreenToRedLut); //vStreamlineActor2->SetMapper( streamMapper2 ); @@ -259,40 +390,77 @@ void Magnitud::Process() //End: Part of the Execute Method ////////////////////////////////////////////////////////////////////////////////////// - vtransformpolydatafilter->SetInput( vDiskSourceEED->GetOutput() ); vtransformpolydatafilter->SetTransform( transformEED ); - vtransformpolydatafilter->Update(); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) + vtransformpolydatafilter->SetInput( vDiskSourceEED->GetOutput() ); vProbeslices->SetInput( ( vtkDataSet* )vtransformpolydatafilter->GetOutput()); vProbeslices->SetSource( bbGetInputIn() ); + vGlyphFlowPlane->SetInput( vProbeslices->GetOutput() ); + vGlyphFlowPlane->SetSource( vArrowSource->GetOutput() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vtransformpolydatafilter->SetInputData( vDiskSourceEED->GetOutput() ); + vProbeslices->SetInputData( ( vtkDataSet* )vtransformpolydatafilter->GetOutput()); + vProbeslices->SetSourceData( bbGetInputIn() ); + vGlyphFlowPlane->SetInputData( vProbeslices->GetOutput() ); + vArrowSource->Update(); + vGlyphFlowPlane->SetSourceData( vArrowSource->GetOutput() ); +#endif + + vtransformpolydatafilter->Update(); vProbeslices->Update( ); - vGlyphFlowPlane->SetInput(vProbeslices->GetOutput()); - vGlyphFlowPlane->SetSource(vArrowSource->GetOutput()); + vGlyphFlowPlane->SetScaleModeToScaleByVector(); vGlyphFlowPlane->SetColorModeToColorByVector(); vGlyphFlowPlane->SetScaleFactor(0.2); vGlyphFlowPlane->Update(); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vProbeslicesFlowWidget->SetInput( ( vtkDataSet* )vPlanSource->GetOutput()); vProbeslicesFlowWidget->SetSource( vVecMagnitude->GetOutput() ); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vProbeslicesFlowWidget->SetInputData( ( vtkDataSet* )vPlanSource->GetOutput()); + vVecMagnitude->Update(); + vProbeslicesFlowWidget->SetSourceData( vVecMagnitude->GetOutput() ); +#endif + vProbeslicesFlowWidget->Update( ); vVecMagnitude->GetOutput()->GetScalarRange( range ); + +//EED 2017-01-01 Migration VTK7 +#if (VTK_MAJOR_VERSION <= 5) vAppendDataForFlowWidgetVisualisation->AddInput(vGlyphFlowPlane->GetOutput()); vAppendDataForFlowWidgetVisualisation->AddInput(vProbeslicesFlowWidget->GetPolyDataOutput()); - vSliceMapper->SetInput( vAppendDataForFlowWidgetVisualisation->GetOutput()); +#endif +#if (VTK_MAJOR_VERSION >= 6) + vGlyphFlowPlane->Update(); + vProbeslicesFlowWidget->Update(); + vAppendDataForFlowWidgetVisualisation->AddInputData( vGlyphFlowPlane->GetOutput() ); + vAppendDataForFlowWidgetVisualisation->AddInputData( vProbeslicesFlowWidget->GetPolyDataOutput() ); + vSliceMapper->SetInputData( vAppendDataForFlowWidgetVisualisation->GetOutput() ); +#endif + vSliceMapper->SetScalarRange( range ); vSliceMapper->SetLookupTable( vGreenToRedLut ); vSliceActor->SetMapper( vSliceMapper ); if(bbGetInputShowPlane() == 1) + { vPlaneWidget->On(); - else if(bbGetInputShowPlane() == 0) + } else if(bbGetInputShowPlane() == 0) { vPlaneWidget->Off(); + } vSliceActor->GetProperty()->SetOpacity( bbGetInputShowPlane() ); @@ -303,26 +471,30 @@ void Magnitud::Process() bbSetOutputOut2( vGlyphActor ); bbSetOutputOut3( vOutlineActor ); bbSetOutputOut4( vMultipleContourActor ); - //bbSetOutputOut5( vScalarBarActor ); + +// bbSetOutputOut5( vScalarBarActor ); + if(bbGetInputShowStream() == 1) + { vStreamlineActor2->SetMapper( streamMapper2 ); - else + } else { vStreamlineActor2->SetMapper( NULL ); - + } bbSetOutputOut5( vStreamlineActor2 ); //bbSetOutputOut5( vStreamlineActor2 ); //bbSetOutputOutExport( exporter ); //temp->GetData( (vtkInformation*) vMultipleContourVelocity->GetOutput() ); //temp->GetData( vMultipleContourMapper->GetOutput() ); //bbSetOutputOutTest( temp ); - - } // if - + +printf("EED Magnitud::Process End\n"); + + } // process - - - + + + //===== // 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) //===== @@ -359,13 +531,13 @@ void Magnitud::bbUserInitializeProcessing() // if any // ---------- [ - cone = vtkArrowSource::New(); - exporter = vtkImageExport::New(); - point = vtkPolyData::New(); - rf = vtkTubeFilter::New(); - source = vtkPointSource::New(); - streamer = vtkStreamTracer::New(); - streamMapper2 = vtkPolyDataMapper::New(); + cone = vtkArrowSource::New(); + exporter = vtkImageExport::New(); + point = vtkPolyData::New(); + rf = vtkTubeFilter::New(); + source = vtkPointSource::New(); + streamer = vtkStreamTracer::New(); + streamMapper2 = vtkPolyDataMapper::New(); transformEED = vtkTransform::New(); vAppendDataForFlowWidgetVisualisation = vtkAppendPolyData::New(); @@ -376,7 +548,7 @@ void Magnitud::bbUserInitializeProcessing() vGlyphFlowPlane = vtkGlyph3D::New(); vGlyphMapper = vtkPolyDataMapper::New(); vGreenToRedLut = vtkLookupTable::New(); - vIren = vtkRenderWindowInteractor::New(); +// vIren = vtkRenderWindowInteractor::New(); vMaskPoint = vtkMaskPoints::New(); vMultipleContourActor = vtkActor::New(); vMultipleContourMapper = vtkPolyDataMapper::New();