Hi all,<br><br>I would like to color an isosurface with scalar field. When I associate my scalars to my data set before filtering, I have no problem. To reduce time processing, I want to associate my scalars after filtering operation, but I only get grey 3D object on screen.<br>
<br><br> //before filtering<br> int nbPoints = (int)m_ImageData->GetPointData()->GetArray(0)->GetNumberOfTuples();<br> <br> vtkIntArray *colorArray = vtkIntArray::New();<br> colorArray->SetName("colorArray");<br>
//m_ProcessedImageData->SetScalarTypeToShort();<br> colorArray->SetNumberOfValues(nbPoints);<br> int *ptrColorArray = colorArray->GetPointer(0);<br> for( int i = 0; i < nbPoints i++){<br>
ptrColorArray[i] = 1; // just to test<br> }<br> m_ImageData->GetPointData()->AddArray(colorArray);<br><br>[filtering]<br><br> m_Reverser->Update();<br> int nbPoints = (int)m_ReverseSenceFilter->GetOutput()->GetPointData()->GetArray(0)->GetNumberOfTuples();<br>
<br> vtkIntArray *colorArray2 = vtkIntArray::New();<br> colorArray2->SetName("colorArray2");<br> //m_ReverseSenceFilter->GetOutput()->SetScalarTypeToShort();<br> colorArray2->SetNumberOfValues(nbPoints);<br>
int *ptrColorArray2 = colorArray2->GetPointer(0);<br> for(i = 0; i < 100; i++)<br> ptrColorArray2[i] = 2;<br> for(i = 100; i < nbPoints; i++)<br>
ptrColorArray2[i] = 4;<br><br> m_ReverseSenceFilter->GetOutput()->GetPointData()->AddArray(colorArray2);<br> m_ReverseSenceFilter->GetOutput()->GetPointData()->SetActiveScalars("colorArray2");<br>
<br><br> // render<br> m_PolyDataMapper->ScalarVisibilityOn();<br> <br> m_PolyDataMapper->SetScalarRange(0,11);<br> m_PolyDataMapper->SetScalarModeToUseCellFieldData();<br> m_PolyDataMapper->SelectColorArray("colorArray2"); // my object is just grey<br>
//m_PolyDataMapper->SelectColorArray("colorArray"); // no problem if I uncomment this line<br><br><br>My colorArray2 scalars are well add to my ReverseSenseFilter. <br><br>Where is my mistake and any idea about how to overcome it?<br>
<br>Thanks,<br>Corinne<br><a href="mailto:corinne.tith@eisti.fr" target="_blank"></a>