From 620982e33be3ad63c78dc1e6d7cfcf8af1cb0c14 Mon Sep 17 00:00:00 2001 From: davila Date: Mon, 7 Jul 2014 22:52:19 +0200 Subject: [PATCH] 2117 BBTK Bug In Progress Normal - Conflict between SurfaceTexture box and PolyDataToActor box (ScalarVisibilityOff/On) --- kernel/src/bbtkVtkBlackBoxMacros.h | 6 ++++-- packages/vtk/src/bbvtkPolyDataToActor.cxx | 17 ++++++++++++++--- packages/vtk/src/bbvtkPolyDataToActor.h | 6 ++++-- packages/vtk/src/bbvtkSphereSource.xml | 13 ++++++++++--- packages/vtk/src/bbvtkSurfaceTexture.cxx | 21 +++++++++++++++++++-- packages/vtk/src/bbvtkSurfaceTexture.h | 2 +- 6 files changed, 52 insertions(+), 13 deletions(-) diff --git a/kernel/src/bbtkVtkBlackBoxMacros.h b/kernel/src/bbtkVtkBlackBoxMacros.h index bd2d0e8..0bf9acc 100644 --- a/kernel/src/bbtkVtkBlackBoxMacros.h +++ b/kernel/src/bbtkVtkBlackBoxMacros.h @@ -64,11 +64,13 @@ //=========================================================================== #define BBTK_VTK_SET_DEFAULT_VALUES() \ - mVtkObject = NULL; + mVtkObject = bbVtkObject::New(); +// mVtkObject = NULL; //=========================================================================== #define BBTK_VTK_INITIALIZE_PROCESSING() \ - mVtkObject = bbVtkObject::New(); + mVtkObject = mVtkObject; +// mVtkObject = bbVtkObject::New(); //=========================================================================== #define BBTK_VTK_FINALIZE_PROCESSING() \ diff --git a/packages/vtk/src/bbvtkPolyDataToActor.cxx b/packages/vtk/src/bbvtkPolyDataToActor.cxx index 1af68a2..d49a294 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.cxx +++ b/packages/vtk/src/bbvtkPolyDataToActor.cxx @@ -67,6 +67,7 @@ namespace bbvtk bbSetInputOpacity(1); bbSetInputRepresentation(2); bbSetInputLineWidth(1); + bbSetInputScalarVisibility(false); polydatamapper = NULL; vtkactor = NULL; @@ -82,8 +83,6 @@ namespace bbvtk // polydatamapper->SetInput(marchingcubes->GetOutput()); vtkactor->SetMapper(polydatamapper); - polydatamapper->ScalarVisibilityOff(); -// polydatamapper->ScalarVisibilityOn(); polydatamapper->ImmediateModeRenderingOn(); } @@ -130,8 +129,20 @@ namespace bbvtk { firsttime=false; bbGetInputRenderer()->AddActor( vtkactor ); - } + } // firsttime + + if (bbGetInputScalarVisibility()==true ) + { + polydatamapper->ScalarVisibilityOn(); + } else { + polydatamapper->ScalarVisibilityOff(); + } // ScalarVisibility + + } + + + } // EO namespace bbtk #endif //_USE_VTK_ diff --git a/packages/vtk/src/bbvtkPolyDataToActor.h b/packages/vtk/src/bbvtkPolyDataToActor.h index 035dc64..8705f83 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.h +++ b/packages/vtk/src/bbvtkPolyDataToActor.h @@ -84,8 +84,9 @@ namespace bbvtk BBTK_DECLARE_INPUT(Colour,std::vector); BBTK_DECLARE_INPUT(Renderer,vtkRenderer *); BBTK_DECLARE_INPUT(Transform, vtkLinearTransform *); - BBTK_DECLARE_INPUT(Representation, int); - BBTK_DECLARE_INPUT(LineWidth, double); + BBTK_DECLARE_INPUT(Representation, int); + BBTK_DECLARE_INPUT(LineWidth, double); + BBTK_DECLARE_INPUT(ScalarVisibility, bool); BBTK_DECLARE_OUTPUT(Out,vtkProp3D *); BBTK_PROCESS(DoProcess); @@ -108,6 +109,7 @@ namespace bbvtk BBTK_INPUT(PolyDataToActor,Transform,"Linear Transform (4x4 homogeneous)",vtkLinearTransform*,""); BBTK_INPUT(PolyDataToActor,Representation,"0 points,1 wireframe, 2(default) surface",int,""); BBTK_INPUT(PolyDataToActor,LineWidth,"Width of the wireframe (1 default)",double,""); + BBTK_INPUT(PolyDataToActor,ScalarVisibility,"Scalar Visibility (false default)",bool,""); BBTK_OUTPUT(PolyDataToActor,Out,"Extracted iso-surface",vtkProp3D *,""); BBTK_END_DESCRIBE_BLACK_BOX(PolyDataToActor); diff --git a/packages/vtk/src/bbvtkSphereSource.xml b/packages/vtk/src/bbvtkSphereSource.xml index 967cd2d..2707131 100644 --- a/packages/vtk/src/bbvtkSphereSource.xml +++ b/packages/vtk/src/bbvtkSphereSource.xml @@ -13,15 +13,22 @@ - - - + + +
+ 
+
 bbGetVtkObject()->SetCenter(bbGetInputCenterX(), 
           bbGetInputCenterY(), 
           bbGetInputCenterZ());
+//bbGetVtkObject()->SetPhiResolution(bbGetInputPhiResolution());
+//bbGetVtkObject()->SetThetaResolution(bbGetInputThetaResolution());
+//bbGetVtkObject()->SetRadius(bbGetInputRadius());
+//printf("EED box vtk:SphereSource theta=%d  phi=%d\n", bbGetInputThetaResolution() , bbGetInputPhiResolution());
+
 bbGetVtkObject()->Update();
 
diff --git a/packages/vtk/src/bbvtkSurfaceTexture.cxx b/packages/vtk/src/bbvtkSurfaceTexture.cxx index d59b7a8..12d32b0 100644 --- a/packages/vtk/src/bbvtkSurfaceTexture.cxx +++ b/packages/vtk/src/bbvtkSurfaceTexture.cxx @@ -62,9 +62,26 @@ printf("EED SurfaceTexture::Process Start\n"); } else { colorLookupTable = vtkLookupTable::New(); } + colorLookupTable->SetTableRange(range[0],range[1]); + colorLookupTable->Build(); + double rgba1[4]; + double rgba2[4]; + for (int iLookTable = 0; iLookTable<128; iLookTable++) + { + colorLookupTable->GetTableValue( iLookTable, rgba1); + colorLookupTable->GetTableValue(256-1-iLookTable, rgba2); + + colorLookupTable->SetTableValue(256-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]); + colorLookupTable->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]); + } // for iLookTable + } - colorLookupTable->SetTableRange(range[0],range[1]); - colorLookupTable->Build(); + + + + + + bbGetInputMesh()->GetPointData()->SetScalars(colors); if (bbGetInputColorType()==1) diff --git a/packages/vtk/src/bbvtkSurfaceTexture.h b/packages/vtk/src/bbvtkSurfaceTexture.h index a0b3ea4..2ad3062 100644 --- a/packages/vtk/src/bbvtkSurfaceTexture.h +++ b/packages/vtk/src/bbvtkSurfaceTexture.h @@ -52,7 +52,7 @@ BBTK_DESCRIPTION("Surface texture"); BBTK_CATEGORY(""); BBTK_INPUT(SurfaceTexture,Mesh,"Mesh topology",vtkPolyData*,""); BBTK_INPUT(SurfaceTexture,Image,"Image Reference",vtkImageData*,""); - BBTK_INPUT(SurfaceTexture,ColorType,"Color Type (default 0) 0 Colors, 1 ColorWindowLevel",int,""); + BBTK_INPUT(SurfaceTexture,ColorType,"Color Type (default 0) 0 Colors(JET), 1 ColorWindowLevel",int,""); BBTK_INPUT(SurfaceTexture,ColorLevel,"Color Level (default 500)",double,""); BBTK_INPUT(SurfaceTexture,ColorWindow,"ColorWindow (default 500)",double,""); BBTK_INPUT(SurfaceTexture,Transform,"vtk Linear Transform (default NULL)",vtkLinearTransform*,""); -- 2.47.1