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

da remywendy at gmail.com
Tue Jan 19 18:45:05 EST 2010


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/d268fc4e/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: WhiteContourLinesBug.jpg
Type: image/jpeg
Size: 98414 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100119/d268fc4e/attachment.jpg>


More information about the vtkusers mailing list