Hi,
I'm new to MITK and I would like to
1.) use it to display tubes around a polyline that I have generated
using "vtkTubeFilter",
2.) integrate the display of a color scale legend generated by
"vtkScalarBarActor", and
3.) integrate some caption actors generated by "vtkCaptionActor2D".
The code I have works fine when using VTK only but I would like to
integrate it into some application that uses MITK. My original
vtkPolyData which serves as an input to "vtkTubeFilter" consists only of
points and the connecting polyline.
Problems I encounter:
1.) I have successfully visualized data from other sources with MITK
already, however, there seems to be a problem with the output of
"vtkTubeFilter". Below you find my code, which works fine for other
data, but not for the output of this particular filter. In the 3D-view I
generate, nothing is visualized. In the end, I found a way which
however, seems to be a work-around to me. If I uncomment the line
"...->UpdateIncludingVtkActors();", the tubes are displayed. I never had
to do this before with other data.
Still, there is a small problem, since the tubes are not colored
according to the scalar values associated with the points mentioned
above. However, they are colored properly if I use the standard VTK views.
2.) I use the line "...->InsertBackgroundRenderer(..." to integrate a
VTKRenderer that holds the vtkScalarBarActor. It works fine except for
the fact that the legend tick labels are not showing the correct data
values. The ticks always range from 0.0 to 1.0, no matter of the
underlying data range.
3.) I didn't find a way yet to integrate the vtkCaptionActor2Ds. Is that
possible at all since they represent a 2D/3D mixture? I tried
->InsertBackgroundRenderer, ->InsertForegroundRenderer, and
->InsertSceneRenderer. None of them works.
Any help is deeply appreciated.
Thanks in advance,
Steffen
mitk::DataTree::Pointer tree=mitk::DataTree::New();
mitk::DataTreePreOrderIterator it(tree);
mitk::DataStorage::CreateInstance(tree);
...
vtkPolyData *pointEvolution = vtkPolyData::New();
...
pointEvolution->SetPoints(samplePts);
pointEvolution->SetLines(polyLine);
...
vtkTubeFilter *profileTubes = vtkTubeFilter::New();
profileTubes->SetNumberOfSides(20);
profileTubes->SetInput(pointEvolution);
profileTubes->SetRadius(10);
profileTubes->Update();
...
mitk::Surface::Pointer tubes = mitk::Surface::New();
tubes->SetVtkPolyData(profileTubes->GetOutput());
mitk::VtkScalarModeProperty *scalarMode = new mitk::VtkScalarModeProperty;
scalarMode->SetScalarModeToPointData();
mitk::DataTreeNode::Pointer node = mitk::DataTreeNode::New();
node->SetData(tubes);
node->SetProperty( "visible", new mitk::BoolProperty( true ) );
node->SetProperty( "use color", new mitk::BoolProperty( true ) );
node->SetProperty("scalar visibility", new mitk::BoolProperty(true));
node->SetProperty("scalar mode", scalarMode);
it.Add(node);
QmitkRenderWindow* renderWindow = new QmitkRenderWindow(NULL, "");
renderWindow->GetRenderer()->SetData(&it);
renderWindow->GetRenderer()->SetMapperID(mitk::BaseRenderer::Standard3D);
renderWindow->GetVtkLayerController()->InsertBackgroundRenderer(ren, true);
//dynamic_cast<mitk::OpenGLRenderer*>(renderWindow->GetRenderer())->UpdateIncludingVtkActors();
qtapplication.setMainWidget(renderWindow);
renderWindow->show();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
qtapplication.exec();
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users