[vtkusers] Trouble getting vtkContourLines to be colored - always shows up as a solid color...

da remywendy at gmail.com
Tue Jan 19 19:25:11 EST 2010


Update: its working now using vtkAssignAttribute, which is then connected to
the vtkDataSetSurfaceFilter...

vtkAssignAttribute *m_AssignFilter = vtkAssignAttribute::New();
m_AssignFilter->SetInput(mb);
m_AssignFilter->Assign(m_TargetArray.toAscii().constData(),
vtkDataSetAttributes::SCALARS, vtkAssignAttribute::POINT_DATA);

I remember when I tried this before that this assigns the active attribute
of vtkPointData class, so changing from one array to another would mess up
if there were multiple contours (say, contours on array 1 and array 2, but
there is only one active attribute so both contours would map the same
array), however I didn't notice it this time. Anyone have more info on this?

On Tue, Jan 19, 2010 at 4:45 PM, da <remywendy at gmail.com> wrote:

> Hey guys,
>
> I've been trying to fix this all day and can't seem to figure out what the
> problem is.
> I have a vtkMultiBlockDataSet that I want to draw contour lines on the
> surface of.
>
> When I run the following code, the contour lines show up (correctly as well
> - matches Paraview's lines); however the lines are all solid color - white,
> instead of based on the lookup table... (I've also tried building a lookup
> table with the same results). I've debugged and checked that the
> m_NumberContours and other parameters are all okay... Although m_TargetArray
> is a qstring thats something like "Var 0 - f00000.00183.p3d"
>
>
> // Composite Pipeline
> vtkCompositeDataPipeline* prototype = vtkCompositeDataPipeline::New();
>  vtkAlgorithm::SetDefaultExecutivePrototype(prototype);
> prototype->Delete();
>
> // Extract the Surface, then Contour
> vtkDataSetSurfaceFilter *surfaceFilter = vtkDataSetSurfaceFilter::New();
>  surfaceFilter->SetInput(mb);
> m_ContourFilter = vtkContourFilter::New();
>  m_ContourFilter->SetInputConnection(surfaceFilter->GetOutputPort());
> m_ContourFilter->SetInputArrayToProcess(0,0,0,
>
> vtkDataObject::FIELD_ASSOCIATION_POINTS,m_TargetArray.toAscii().constData());
> m_ContourFilter->GenerateValues(m_NumberContours, m_Min, m_Max);
>  m_ContourFilter->ComputeScalarsOn();
> surfaceFilter->Delete();
>
>  // Mapper
> m_Mapper = vtkCompositePolyDataMapper::New();
> m_Mapper->SetInputConnection( m_ContourFilter->GetOutputPort() );
>  m_Mapper->SetScalarRange(m_Min, m_Max);
> m_Mapper->SetInterpolateScalarsBeforeMapping(1);
>  m_Mapper->SetColorModeToMapScalars();
> m_Mapper->CreateDefaultLookupTable();
>
> this->SetupScalarBar();
>
> // Actor
>  m_Actor = vtkLODActor::New();
> m_Actor->SetNumberOfCloudPoints(1000);
> m_Actor->GetProperty()->SetRepresentation(2);
>  m_Actor->SetMapper(m_Mapper);
> m_Renderer->AddActor(m_Actor);
>
>  vtkAlgorithm::SetDefaultExecutivePrototype(0); // End composite pipeline
>
>
> A side question I have is about vtkAssignAttribute class - this class just
> assigns the active attribute correct? So if I wanted to show two contours
> from the same vtkPointData, I couldn't use this class?
>
> Any info is appreciated!
> Thanks,
> Da
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100119/6f59382f/attachment.htm>


More information about the vtkusers mailing list