From: Eduardo DAVILA Date: Mon, 4 Sep 2017 11:15:44 +0000 (+0200) Subject: #3107 BBTK Bug New Normal - branch vtk7itk4 compilation with vtk7 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=5ff413fe20e5820f4442f44e78e2ecf68e7e9691;p=bbtk.git #3107 BBTK Bug New Normal - branch vtk7itk4 compilation with vtk7 --- diff --git a/packages/vtk/bbs/appli/exampleMagnitud.bbg b/packages/vtk/bbs/appli/exampleMagnitud.bbg new file mode 100644 index 0000000..d113854 --- /dev/null +++ b/packages/vtk/bbs/appli/exampleMagnitud.bbg @@ -0,0 +1,158 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /tmpEED/creaTools2/creatools_source/bbtk/packages/vtk/bbs/appli/exampleMagnitud.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:11 +BOX +vtk:Magnitud:Box00 +ISEXEC:FALSE +-53.653620:-11.121479:-900.000000 +-5.333620:-21.121479:-900.000000 +PORT +Contour:"2" +PORT +MRatio:"1" +PORT +MoveX:"0" +PORT +MoveY:"0" +PORT +MoveZ:"0" +PORT +Opactity:"1" +PORT +PlaneCenterSL:"20 20 20" +PORT +Scale:"100" +PORT +ShowPlane:"1" +PORT +ShowStream:"1" +PORT +ValInf:"0" +PORT +ValSup:"1000" +FIN_BOX +BOX +std:Configuration:Box01 +ISEXEC:FALSE +-20.890345:63.422486:-900.000000 +18.534655:53.422486:-900.000000 +FIN_BOX +BOX +std:ConcatStrings:Box02 +ISEXEC:FALSE +-34.717048:42.682432:-900.000000 +5.007952:32.682432:-900.000000 +PORT +In2:"/creaVtk/Vectors.vtk" +FIN_BOX +BOX +vtk:StructuredPointsReader:Box03 +ISEXEC:FALSE +-48.243171:16.832508:-900.000000 +0.456829:6.832508:-900.000000 +FIN_BOX +BOX +creaVtk:Actor:Box06 +ISEXEC:TRUE +41.029239:-68.231774:-900.000000 +72.629239:-78.231774:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +vtk:LoadHola:Box07 +ISEXEC:FALSE +21.190926:-10.820898:-900.000000 +56.740926:-20.820898:-900.000000 +FIN_BOX +BOX +creaMaracasVisu:ViewerNV:Box08 +ISEXEC:TRUE +11.572349:-29.456889:-900.000000 +75.292349:-39.456889:-900.000000 +FIN_BOX +BOX +creaVtk:Actor:Box09 +ISEXEC:TRUE +-111.804551:-63.561380:-900.000000 +-80.204551:-73.561380:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +creaVtk:Actor:Box10 +ISEXEC:TRUE +-70.763916:-64.902596:-900.000000 +-39.163916:-74.902596:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +creaVtk:Actor:Box11 +ISEXEC:TRUE +-33.931408:-73.758324:-900.000000 +-2.331408:-83.758324:-900.000000 +PORT +Active:"true" +FIN_BOX +BOX +creaVtk:Actor:Box12 +ISEXEC:TRUE +1.999359:-69.689091:-900.000000 +33.599359:-79.689091:-900.000000 +PORT +Active:"true" +FIN_BOX +CONNECTIONS:14 +CONNECTION +Box01:DataPath:Box02:In1 +NumberOfControlPoints:0 +CONNECTION +Box02:Out:Box03:In +NumberOfControlPoints:0 +CONNECTION +Box03:Out:Box00:In +NumberOfControlPoints:0 +CONNECTION +Box00:Out5:Box06:In +NumberOfControlPoints:0 +CONNECTION +Box07:Out:Box08:In +NumberOfControlPoints:0 +CONNECTION +Box08:Renderer1:Box06:Renderer +NumberOfControlPoints:0 +CONNECTION +Box00:Out1:Box09:In +NumberOfControlPoints:0 +CONNECTION +Box00:Out2:Box10:In +NumberOfControlPoints:0 +CONNECTION +Box00:Out3:Box11:In +NumberOfControlPoints:0 +CONNECTION +Box00:Out4:Box12:In +NumberOfControlPoints:0 +CONNECTION +Box08:Renderer1:Box12:Renderer +NumberOfControlPoints:0 +CONNECTION +Box08:Renderer1:Box11:Renderer +NumberOfControlPoints:0 +CONNECTION +Box08:Renderer1:Box10:Renderer +NumberOfControlPoints:0 +CONNECTION +Box08:Renderer1:Box09:Renderer +NumberOfControlPoints:0 +APP_END diff --git a/packages/vtk/bbs/appli/exampleMagnitud.bbs b/packages/vtk/bbs/appli/exampleMagnitud.bbs new file mode 100644 index 0000000..4ea9860 --- /dev/null +++ b/packages/vtk/bbs/appli/exampleMagnitud.bbs @@ -0,0 +1,97 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /tmpEED/creaTools2/creatools_source/bbtk/packages/vtk/bbs/appli/exampleMagnitud.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include vtk +include std +include creaVtk +include creaMaracasVisu + +author "Author ??" +description "Description ??" +category "" + +new vtk:Magnitud Box00 + set Box00.Contour "2" + set Box00.MRatio "1" + set Box00.MoveX "0" + set Box00.MoveY "0" + set Box00.MoveZ "0" + set Box00.Opactity "1" + set Box00.PlaneCenterSL "20 20 20" + set Box00.Scale "100" + set Box00.ShowPlane "1" + set Box00.ShowStream "1" + set Box00.ValInf "0" + set Box00.ValSup "1000" + +new std:Configuration Box01 + +new std:ConcatStrings Box02 + set Box02.In2 "/creaVtk/Vectors.vtk" + +new vtk:StructuredPointsReader Box03 + +new creaVtk:Actor Box06 + set Box06.Active "true" + +new vtk:LoadHola Box07 + +new creaMaracasVisu:ViewerNV Box08 + +new creaVtk:Actor Box09 + set Box09.Active "true" + +new creaVtk:Actor Box10 + set Box10.Active "true" + +new creaVtk:Actor Box11 + set Box11.Active "true" + +new creaVtk:Actor Box12 + set Box12.Active "true" + + +connect Box01.DataPath Box02.In1 + +connect Box02.Out Box03.In + +connect Box03.Out Box00.In + +connect Box00.Out5 Box06.In + +connect Box07.Out Box08.In + +connect Box08.Renderer1 Box06.Renderer + +connect Box00.Out1 Box09.In + +connect Box00.Out2 Box10.In + +connect Box00.Out3 Box11.In + +connect Box00.Out4 Box12.In + +connect Box08.Renderer1 Box12.Renderer + +connect Box08.Renderer1 Box11.Renderer + +connect Box08.Renderer1 Box10.Renderer + +connect Box08.Renderer1 Box09.Renderer + + + +# Complex input ports +exec Box06 +exec Box08 +exec Box09 +exec Box10 +exec Box11 +exec Box12 diff --git a/packages/vtk/src/bbvtkMagnitud.cxx b/packages/vtk/src/bbvtkMagnitud.cxx index c0e21ce..b6205e1 100644 --- a/packages/vtk/src/bbvtkMagnitud.cxx +++ b/packages/vtk/src/bbvtkMagnitud.cxx @@ -41,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 @@ -54,9 +56,10 @@ void Magnitud::Process() // (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 @@ -84,6 +87,10 @@ void Magnitud::Process() vMaskPoint->SetOnRatio(100); vMaskPoint->Update(); vMaskPoint->RandomModeOn(); + + vGlyph->SetScaleModeToScaleByVector(); + vGlyph->SetColorModeToColorByVector(); + vGlyph->SetScaleFactor(0.20); //EED 2017-01-01 Migration VTK7 #if (VTK_MAJOR_VERSION <= 5) @@ -92,12 +99,10 @@ void Magnitud::Process() #endif #if (VTK_MAJOR_VERSION >= 6) vGlyph->SetInputData(vMaskPoint->GetOutput()); + cone->Update(); vGlyph->SetSourceData(cone->GetOutput()); #endif - vGlyph->SetScaleModeToScaleByVector(); - vGlyph->SetColorModeToColorByVector(); - vGlyph->SetScaleFactor(0.20); //EED 2017-01-01 Migration VTK7 #if (VTK_MAJOR_VERSION <= 5) @@ -110,10 +115,10 @@ void Magnitud::Process() 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()); @@ -159,7 +164,8 @@ void Magnitud::Process() #endif #if (VTK_MAJOR_VERSION >= 6) vOutlineGrid->SetInputData( bbGetInputIn() ); - vOutlineMapper->SetInputData(vOutlineGrid->GetOutput()); + vOutlineGrid->Update(); + vOutlineMapper->SetInputData( vOutlineGrid->GetOutput() ); #endif @@ -194,10 +200,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(); @@ -217,9 +227,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 ); @@ -230,7 +245,9 @@ void Magnitud::Process() //Set The Number of Contours if( bbGetInputContour()<1) - bbSetInputContour(1); + { + bbSetInputContour(1); + } step=(range1[1]-range1[0])/bbGetInputContour(); index=0; @@ -317,7 +334,7 @@ void Magnitud::Process() #endif #if (VTK_MAJOR_VERSION >= 6) streamer->SetInputData( bbGetInputIn() ); - streamer->SetSourceData(source->GetOutput()); + streamer->SetSourceData( source->GetOutput() ); #endif streamer->SetIntegratorTypeToRungeKutta45(); @@ -380,15 +397,16 @@ void Magnitud::Process() vtransformpolydatafilter->SetInput( vDiskSourceEED->GetOutput() ); vProbeslices->SetInput( ( vtkDataSet* )vtransformpolydatafilter->GetOutput()); vProbeslices->SetSource( bbGetInputIn() ); - vGlyphFlowPlane->SetInput(vProbeslices->GetOutput()); - vGlyphFlowPlane->SetSource(vArrowSource->GetOutput()); + 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()); - vGlyphFlowPlane->SetSourceData(vArrowSource->GetOutput()); + vGlyphFlowPlane->SetInputData( vProbeslices->GetOutput() ); + vArrowSource->Update(); + vGlyphFlowPlane->SetSourceData( vArrowSource->GetOutput() ); #endif vtransformpolydatafilter->Update(); @@ -408,6 +426,7 @@ void Magnitud::Process() #endif #if (VTK_MAJOR_VERSION >= 6) vProbeslicesFlowWidget->SetInputData( ( vtkDataSet* )vPlanSource->GetOutput()); + vVecMagnitude->Update(); vProbeslicesFlowWidget->SetSourceData( vVecMagnitude->GetOutput() ); #endif @@ -423,9 +442,11 @@ void Magnitud::Process() vSliceMapper->SetInput( vAppendDataForFlowWidgetVisualisation->GetOutput()); #endif #if (VTK_MAJOR_VERSION >= 6) - vAppendDataForFlowWidgetVisualisation->AddInputData(vGlyphFlowPlane->GetOutput()); - vAppendDataForFlowWidgetVisualisation->AddInputData(vProbeslicesFlowWidget->GetPolyDataOutput()); - vSliceMapper->SetInputData( vAppendDataForFlowWidgetVisualisation->GetOutput()); + vGlyphFlowPlane->Update(); + vProbeslicesFlowWidget->Update(); + vAppendDataForFlowWidgetVisualisation->AddInputData( vGlyphFlowPlane->GetOutput() ); + vAppendDataForFlowWidgetVisualisation->AddInputData( vProbeslicesFlowWidget->GetPolyDataOutput() ); + vSliceMapper->SetInputData( vAppendDataForFlowWidgetVisualisation->GetOutput() ); #endif vSliceMapper->SetScalarRange( range ); @@ -434,9 +455,11 @@ void Magnitud::Process() vSliceActor->SetMapper( vSliceMapper ); if(bbGetInputShowPlane() == 1) + { vPlaneWidget->On(); - else if(bbGetInputShowPlane() == 0) + } else if(bbGetInputShowPlane() == 0) { vPlaneWidget->Off(); + } vSliceActor->GetProperty()->SetOpacity( bbGetInputShowPlane() ); @@ -447,21 +470,25 @@ 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"); - } // if } // process @@ -503,13 +530,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(); @@ -520,7 +547,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(); diff --git a/packages/vtk/src/bbvtkMagnitud.h b/packages/vtk/src/bbvtkMagnitud.h index 28f63ab..c3d6737 100644 --- a/packages/vtk/src/bbvtkMagnitud.h +++ b/packages/vtk/src/bbvtkMagnitud.h @@ -110,66 +110,66 @@ class bbvtk_EXPORT Magnitud // 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) //===== // -------------- [ - vtkImageData* temp; - std::vector tempc; - - int sizeIma; - long int index; - double p0[3], p1[3],p2[3], n[3], c[3], slCenter[3]; - double range[2]; - double range1[2]; - double step; - double h; - double nx; - double ny; - double nz; - double alfa; - double beta; - double dRangeColorForGlyphVelocity[2]; - double dRangeColorForMultipleContourVelocity[2]; - double dRangeColorForGlyphVelocityForFlowPlane[2]; - - int Ratio; - double dOpactity; - double dScale; - int nContour; - bool bShow; + vtkImageData *temp; + std::vector tempc; + + int sizeIma; + long int index; + double p0[3], p1[3],p2[3], n[3], c[3], slCenter[3]; + double range[2]; + double range1[2]; + double step; + double h; + double nx; + double ny; + double nz; + double alfa; + double beta; + double dRangeColorForGlyphVelocity[2]; + double dRangeColorForMultipleContourVelocity[2]; + double dRangeColorForGlyphVelocityForFlowPlane[2]; + + int Ratio; + double dOpactity; + double dScale; + int nContour; + bool bShow; - vtkActor* vGlyphActor; - vtkActor* vMultipleContourActor; - vtkActor* vOutlineActor; - vtkActor* vSliceActor; - vtkActor* vStreamlineActor2; - vtkAppendPolyData* vAppendDataForFlowWidgetVisualisation; - vtkArrowSource* cone; - vtkArrowSource* vArrowSource; - vtkContourFilter* vMultipleContourVelocity; - vtkDiskSource* vDiskSourceEED; - vtkGlyph3D* vGlyph; - vtkGlyph3D* vGlyphFlowPlane; - vtkImageExport* exporter; - vtkLookupTable* vGreenToRedLut; - vtkMaskPoints* vMaskPoint; - vtkPlaneSource* vPlanSource; - vtkProbeFilter* vProbeslices; - vtkProbeFilter* vProbeslicesFlowWidget; - vtkPlaneWidget* vPlaneWidget; - vtkPolyData* point; - vtkPolyDataMapper* vSliceMapper; - vtkPointSource* source; - vtkPointWidget* vPointWidget; - vtkPolyDataMapper* vGlyphMapper; - vtkPolyDataMapper* vMultipleContourMapper; - vtkOutlineFilter* vOutlineGrid; - vtkPolyDataMapper* vOutlineMapper; - vtkPolyDataMapper* streamMapper2; - vtkRenderWindowInteractor* vIren; - vtkScalarBarActor* vScalarBarActor; - vtkStreamTracer* streamer; - vtkTransform* transformEED; - vtkTransformPolyDataFilter* vtransformpolydatafilter; - vtkTubeFilter* rf; - vtkVectorNorm* vVecMagnitude; + vtkActor *vGlyphActor; + vtkActor *vMultipleContourActor; + vtkActor *vOutlineActor; + vtkActor *vSliceActor; + vtkActor *vStreamlineActor2; + vtkAppendPolyData *vAppendDataForFlowWidgetVisualisation; + vtkArrowSource *cone; + vtkArrowSource *vArrowSource; + vtkContourFilter *vMultipleContourVelocity; + vtkDiskSource *vDiskSourceEED; + vtkGlyph3D *vGlyph; + vtkGlyph3D *vGlyphFlowPlane; + vtkImageExport *exporter; + vtkLookupTable *vGreenToRedLut; + vtkMaskPoints *vMaskPoint; + vtkPlaneSource *vPlanSource; + vtkProbeFilter *vProbeslices; + vtkProbeFilter *vProbeslicesFlowWidget; + vtkPlaneWidget *vPlaneWidget; + vtkPolyData *point; + vtkPolyDataMapper *vSliceMapper; + vtkPointSource *source; + vtkPointWidget *vPointWidget; + vtkPolyDataMapper *vGlyphMapper; + vtkPolyDataMapper *vMultipleContourMapper; + vtkOutlineFilter *vOutlineGrid; + vtkPolyDataMapper *vOutlineMapper; + vtkPolyDataMapper *streamMapper2; + vtkRenderWindowInteractor *vIren; + vtkScalarBarActor *vScalarBarActor; + vtkStreamTracer *streamer; + vtkTransform *transformEED; + vtkTransformPolyDataFilter *vtransformpolydatafilter; + vtkTubeFilter *rf; + vtkVectorNorm *vVecMagnitude; // -------------- ] }; @@ -177,7 +177,7 @@ class bbvtk_EXPORT Magnitud BBTK_BEGIN_DESCRIBE_BLACK_BOX(Magnitud,bbtk::AtomicBlackBox); BBTK_NAME("Magnitud"); BBTK_AUTHOR("seba-tor@uniandes.edu.co"); -BBTK_DESCRIPTION("Receive an ImgaData and generates an Actor"); +BBTK_DESCRIPTION("Receive an ImgaData and generates an Actor. 'EED this box habe to be splited in 5 box'"); BBTK_CATEGORY(""); // -------------- [ BBTK_INPUT(Magnitud,In,"Receive the image source",vtkImageData*, "");