Hi all,<br> I am attempting to use paraview's library to visualize
medical volumes in an application I am building from scratch. The
program is written in C++. I am having a hard time finding adequate
documentation (forums and examples) that shows how to build an
application that uses paraview's library in C++. I have ran the example
program BasicApp.cxx and it works, but it uses a SphereSource. I am
loading dicom images or .vtk images. When I edit the code for
BasicApp.cxx to load .vtk files I get an error after setting the
representation to volume. From reading similar problems on forums, I
think the problem pertains to colormaps and scalars, but I cannot find
documentation on how to fix this in C++. I'm including my code below. I
may be over complicating this, but any help is appreciated.<br>
Thanks for your time!<br><br>using namespace std;<br><br>// our main
window<br>class MainWindow : public QMainWindow<br>{<br>public:<br>
MainWindow()<br> {<br> // automatically make a server connection<br>
pqApplicationCore* core = pqApplicationCore::instance();<br>
pqObjectBuilder* ob = core->getObjectBuilder();<br> pqServer*
server = ob->createServer(<div id=":yc" class="ii gt">pqServerResource("builtin:"));<br><br>
// create a graphics window and put it in our main window<br>
this->RenderView = qobject_cast<pqRenderView*>(ob->createView(pqRenderView::renderViewType(),
server));<br>
this->setCentralWidget(this->RenderView->getWidget());<br><br>
// create source and elevation filter<br> pqPipelineSource* source;<br>
pqPipelineSource* elevation;<br><br> source =
ob->createSource("sources", "SphereSource", server);<br>
// updating source so that when elevation filter is created, the
defaults<br> // are setup correctly using the correct data bounds
etc.<br> vtkSMSourceProxy::SafeDownCast(source->getProxy())->UpdatePipeline();<br>
<br> QStringList files;<br> files.push_back("../brain.vtk");<br><br>
pqPipelineSource *reader;<br> pqObjectBuilder *builder =
core->getObjectBuilder();<br> reader =
builder->createReader(QString("internal_sources"),
QString("legacyreader"), files, server);<br>
<br><br> pqDataRepresentation *repr =
ob->createDataRepresentation(reader->getOutputPort(0),
this->RenderView);<br><br> if(repr){<br> <br>
vtkSMPropertyHelper(repr->getProxy(), "Representation").Set(vtkSMPVRepresentationProxy::VOLUME);<br>
<br> pqDisplayPolicy pqDisplayP =
core->getDisplayPolicy();<br> repr->getProxy()->UpdateVTKObjects();<br><br>
}<br><br> //elevation = ob->createFilter("filters",
"ElevationFilter", source);<br>
<br> // put the elevation in the window<br> //ob->createDataRepresentation(elevation->getOutputPort(0),
this->RenderView);<br><br> // zoom to sphere<br>
this->RenderView->resetCamera();<br> // make sure we
update<br>
this->RenderView->render();<br> }<br><br>
QPointer<pqRenderView> RenderView;<br><br>};<br>...<br><br>
</div>