Hi, You should include the exact error message you are getting so that people can help.
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. 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 opacity value of 0, and scalar value 270 is set to the color blue with opacity value 0.5: Wavelet() rep = Show() rep.ColorArrayName = "RTData" rep.Representation = "Volume" lut = CreateLookupTable() lut.RGBPoints = [37, 1, 0, 0, 270, 0, 0, 1] rep.LookupTable = lut func = CreatePiecewiseFunction() func.Points = [37, 0, 270, 0.5] rep.ScalarOpacityFunction = func Render() Goodluck! Pat On Tue, Jan 26, 2010 at 2:38 AM, Adebayo Olowoyeye <aolow...@umail.iu.edu>wrote: > Hi all, > 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. > Thanks for your time! > > using namespace std; > > // our main window > class MainWindow : public QMainWindow > { > public: > MainWindow() > { > // automatically make a server connection > pqApplicationCore* core = pqApplicationCore::instance(); > pqObjectBuilder* ob = core->getObjectBuilder(); > pqServer* server = ob->createServer( > pqServerResource("builtin:")); > > // create a graphics window and put it in our main window > this->RenderView = > qobject_cast<pqRenderView*>(ob->createView(pqRenderView::renderViewType(), > server)); > this->setCentralWidget(this->RenderView->getWidget()); > > // create source and elevation filter > pqPipelineSource* source; > pqPipelineSource* elevation; > > source = ob->createSource("sources", "SphereSource", server); > // updating source so that when elevation filter is created, the > defaults > // are setup correctly using the correct data bounds etc. > vtkSMSourceProxy::SafeDownCast(source->getProxy())->UpdatePipeline(); > > QStringList files; > files.push_back("../brain.vtk"); > > pqPipelineSource *reader; > pqObjectBuilder *builder = core->getObjectBuilder(); > reader = builder->createReader(QString("internal_sources"), > QString("legacyreader"), files, server); > > > pqDataRepresentation *repr = > ob->createDataRepresentation(reader->getOutputPort(0), this->RenderView); > > if(repr){ > > vtkSMPropertyHelper(repr->getProxy(), > "Representation").Set(vtkSMPVRepresentationProxy::VOLUME); > > pqDisplayPolicy pqDisplayP = core->getDisplayPolicy(); > repr->getProxy()->UpdateVTKObjects(); > > } > > //elevation = ob->createFilter("filters", "ElevationFilter", source); > > // put the elevation in the window > //ob->createDataRepresentation(elevation->getOutputPort(0), > this->RenderView); > > // zoom to sphere > this->RenderView->resetCamera(); > // make sure we update > this->RenderView->render(); > } > > QPointer<pqRenderView> RenderView; > > }; > ... > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the ParaView Wiki at: > http://paraview.org/Wiki/ParaView > > Follow this link to subscribe/unsubscribe: > http://www.paraview.org/mailman/listinfo/paraview > >
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview