[Paraview-developers] LookUpTables

Phil Amburn phil.amburn at gmail.com
Tue Mar 26 14:35:01 EDT 2013


I'm working on a set of C++ plug-ins to visualize weather data.  I'm having
a problem applying a LUT to a contour surface of relative humidity.

 

Here's my description of what I'm doing.  If any of this is inaccurate, I
would appreciate corrections.  I still have a good deal to learn about how
ParaView works.

 

On the client side (VTK filter algorithm)  I'm building a contour surface of
the scalar variable relative humidity through a 3D structured grid, and the
XML name is "CloudSurface".  Then using a sample by Sebastien on the server
side I catch the signal onSourceAdded.

 

My intent is to modify the LUT that PV creates for the representation rather
than creating a new LUT.  My problem is that the modified PV LUT isn't in
force on the first application of the filter, but the LUT is correct on
subsequent applications of the filter to the same data set.  Any help
someone can provide to have this LUT in effect from the first application
would be great.

 

I'm working on Windows 7 with Visual Studio 2008, and I'm using ParaView
3.10.1.  I haven't been able to move to a later version of PV because of a
problem with the glyph filter that works on 32-bit PV 3.10.1 but has memory
problems on later versions of PV (Mantis ID 0013697) .  I plan to revisit
that situation with version 4.

 

Below is the code.

 

Thanks!

Phil

============================================================================
================================

      success =
QObject::connect(pqApplicationCore::instance()->getServerManagerModel(),

            SIGNAL(sourceAdded(pqPipelineSource*)),

            this, SLOT(onSourceAdded(pqPipelineSource*)));

 

when the CloudSurface filter is applied a representation is created and I
process that with

 

            else if ( strcmp( XMLName, "CloudSurface" ) == 0 )

            {

                  pqDR0 = p0->getRepresentation( activeView );

                  if ( pqDR0 == pipelineRep )

                  {

                        vtkSMProxy *pqProxy = pipelineRep->getProxy();

 

                        pipelineRep->colorByArray( "Height", 0 );  // 0:
POINT_DATA / 1:CELL_DATA

 

                        vtkSMProxy *pq0Proxy = pipelineRep->getProxy();

 

                        intProp = vtkSMIntVectorProperty::SafeDownCast(
pq0Proxy->GetProperty( "MapScalars" ) );

                        if ( intProp )

                              success = intProp->SetElements1( 1 );     

 

                        pqScalarsToColors *existingLUT =
pqDR0->getLookupTable();

                        setUpCloudLUT( existingLUT );

                        

                        vtkSMDoubleVectorProperty *opProp;

 

                        // setting opacity of surface to 0.9

                        if ( pq0Proxy )

                        {

                              opProp =
vtkSMDoubleVectorProperty::SafeDownCast( pq0Proxy->GetProperty( "Opacity" )
);

                              if ( opProp )

                                    success = opProp->SetElements1( 0.9 );

                        }

                        smRep->UpdateVTKObjects();

                  }

            }

 

And the cloud lookup table is set up with

void pqSurfaceRepresentationBehavior::setUpCloudLUT( pqScalarsToColors
*existingLUT )

{

      vtkSMDoubleVectorProperty* dvp =
vtkSMDoubleVectorProperty::SafeDownCast(

            existingLUT->getProxy()->GetProperty( "RGBPoints" ) );

      QList<QVariant> ctlPts;

      int numElementsPerCommand = dvp->GetNumberOfElementsPerCommand();

      // now load the new set of RGB points for this color table

 

      ctlPts << -0.380754 << 0.392157 << 0.392157 << 0.392157;

      ctlPts << 2.50049 << 0.92549 << 0.945098 << 0.909804;

      ctlPts << 8.49218 << 1. << 1. << 1.;

 

      pqSMAdaptor::setMultipleElementProperty( dvp, ctlPts );

 

      // set the NaN value

      vtkSMDoubleVectorProperty* nan =
vtkSMDoubleVectorProperty::SafeDownCast(

            existingLUT->getProxy()->GetProperty( "NanColor" ) );

      if ( nan )

            nan->SetElements3( 0.254002, 0., 0. );

 

      // set the ColorSpace

      vtkSMIntVectorProperty *cSpace = vtkSMIntVectorProperty::SafeDownCast(

            existingLUT->getProxy()->GetProperty( "ColorSpace" ) );

      if ( cSpace )

            cSpace->SetElements1( 3 );    // 0 - RGB  1 - HSV  2 - LAB  3 -
Diverging

}

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20130326/fce85588/attachment.htm>


More information about the Paraview-developers mailing list