X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkPolyDataToActor.cxx;h=0002d6c097da8fa273ae7dbd89099e41b5fa8359;hb=ab91e25f4ca81c10788da1fdd681a87f1f17641e;hp=2aad2ec130eb57e7ee73ab1be1e5634a342df18a;hpb=cc8fc303bb892d48d17a1534b5b1c54eaa7118fb;p=bbtk.git diff --git a/packages/vtk/src/bbvtkPolyDataToActor.cxx b/packages/vtk/src/bbvtkPolyDataToActor.cxx index 2aad2ec..0002d6c 100644 --- a/packages/vtk/src/bbvtkPolyDataToActor.cxx +++ b/packages/vtk/src/bbvtkPolyDataToActor.cxx @@ -44,6 +44,7 @@ #include "vtkProperty.h" #include "vtkLinearTransform.h" #include "vtkCleanPolyData.h" +#include "vtkFieldData.h" #include "bbvtkPolyDataToActor.h" #include "bbvtkPackage.h" @@ -73,6 +74,9 @@ namespace bbvtk bbSetInputScalarVisibility(false); polydatamapper = NULL; vtkactor = NULL; + + bbSetInputScalarVisibilityOn_LookupTable(NULL); + bbSetInputScalarVisibilityOn_NameColorArray(""); } @@ -104,27 +108,55 @@ namespace bbvtk } + + +/* + +----------------------------------------------- + +https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ScalarBarActor +https://vtk.org/Wiki/VTK/Examples/Cxx/VisualizationAlgorithms/TubesFromSplines +https://vtk.org/Wiki/VTK/Examples/Cxx/Visualization/ElevationBandsWithGlyphs + +vtkSmartPointer scalars = vtkSmartPointer::New(); + scalars set value .... +poly->GetPointData()->SetScalars(scalars); or poly->GetPointData()->SetActiveScalars(""); + +vtkSmartPointer hueLut = vtkSmartPoint | ^~ +er::New(); + hueLut Build .... + + mapper->SetInputData(poly); + mapper->ScalarVisibilityOn(); + mapper->SetScalarModeToUsePointData(); Point of Cell ... + + default: mapper->SetColorModeToDirectScalars() Busca scalars 3 componentes [R,G,B] float 0..1 or integer 0..255 + else: + mapper->SetColorModeToMapScalars() El vector scalar solo tiene un componente + mapper->SetLookupTable( hueLut ); + + To change Array + mapper->SelectColorArray(""); + + mapper->SetUseLookupTableScalarRange( true/false ) true:Para compartir lookuptable con otros mappers + si false then + mapper->SetScalarRange( min, max); Range especifico este mapper + mapper->SetScalarRange( tubePolyData->GetScalarRange() ); + +------------------------------------------ + + mapper->ScalarVisibilityOff(); -> SetScalarModeToDefault() + Utiliza el color del actor + +---------------------------------------- + +*/ + + //--------------------------------------------------------------------- void PolyDataToActor::DoProcess() { -printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); -printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); -printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); -printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); -printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); -printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); -printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); -printf("EED WARNNIN!!!!! PolyDataToActor::DoProcess For better transparent ... Clean this code in the correct part ..........\n"); -//https://stackoverflow.com/questions/47528086/problems-with-rendering-transparent-objects-in-vtk -//https://itk.org/Wiki/VTK/Depth_Peeling -bbGetInputRenderer()->SetUseDepthPeeling(1); -bbGetInputRenderer()->SetOcclusionRatio(0.1); -bbGetInputRenderer()->SetMaximumNumberOfPeels(100); -bbGetInputRenderer()->GetRenderWindow()->SetMultiSamples(0); -bbGetInputRenderer()->GetRenderWindow()->SetAlphaBitPlanes(1); - - if (bbGetInputRenderer()==NULL) { printf("EED Warnning! PolyDataToActor::DoProcess missing Renderer.\n"); @@ -187,7 +219,28 @@ printf("EED WARNNING! PolyDataToActor::DoProcess which is the default values o if (bbGetInputScalarVisibility()==true ) { - polydatamapper->ScalarVisibilityOn(); + polydatamapper->ScalarVisibilityOn(); + if (bbGetInputScalarVisibilityOn_LookupTable()!=NULL) + { +// polydatamapper->SetScalarModeToDefault(); +// polydatamapper->SetScalarModeToUseCellData(); +// polydatamapper->SetScalarModeToUseCellFieldData(); +// polydatamapper->SetScalarModeToUseFieldData(); // 1/2 hausdorff->SetTargetDistanceMethodToPointToCell(); +// polydatamapper->SetScalarModeToUsePointData(); // * + polydatamapper->SetScalarModeToUsePointFieldData(); + + polydatamapper->SetColorModeToMapScalars(); + polydatamapper->SetLookupTable( bbGetInputScalarVisibilityOn_LookupTable() ); + if (bbGetInputScalarVisibilityOn_NameColorArray()!="") + { + polydatamapper->SelectColorArray( bbGetInputScalarVisibilityOn_NameColorArray().c_str() ); + } + if (bbGetInputScalarVisibilityOn_ScalarRange().size()==2) + { + polydatamapper->SetScalarRange( bbGetInputScalarVisibilityOn_ScalarRange()[0] , bbGetInputScalarVisibilityOn_ScalarRange()[1] ); + } + + } // if ScalarVisibilityOn_LookupTable } else { polydatamapper->ScalarVisibilityOff(); } // ScalarVisibility