Hi,<br><br>You should include the exact error message you are getting so that people can help.<br><br>I'm not very familiar with building custom apps using paraview so I won't be able to answer your question exactly... but to change the representation to volume you must create proxy objects for a lookup table and a piecewise function, then assign them to the representation's proxy properties LookupTable and ScalarOpacityFunction. <br>
<br>The best example I have is in python- a image-data source is created and the representation is set to volume, the scalar value 37 is set to the color red with an <span class="il">opacity</span> value of 0, and scalar value 270 is set to the color blue with <span class="il">opacity</span> value 0.5:<br>
<div class="im">
<br>
</div>Wavelet()<br>
rep = Show()<br>
rep.ColorArrayName = "RTData"<br>
rep.Representation = "<span class="il">Volume</span>"<br>
<br>
lut = CreateLookupTable()<br>
lut.RGBPoints = [37, 1, 0, 0, 270, 0, 0, 1]<br>
rep.LookupTable = lut<br>
<br>
func = CreatePiecewiseFunction()<br><div class="im">
func.Points = [37, 0, 270, 0.5]<br>
rep.ScalarOpacityFunction = func<br>
<br>
Render()</div><br><br>Goodluck!<br><br>Pat<br><br><div class="gmail_quote">On Tue, Jan 26, 2010 at 2:38 AM, Adebayo Olowoyeye <span dir="ltr"><<a href="mailto:aolowoye@umail.iu.edu">aolowoye@umail.iu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">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>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>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br>