<DIV>Hello David,</DIV>
<DIV>I had tried your solution but I failed to use it. I don't understand why it doesn't work :</DIV>
<DIV> </DIV>
<DIV> mapper = vtkDataSetMapper()<BR> mapper.SetInput( cloud )<BR> mapper.SetScalarRange( cloud.GetScalarRange() )<BR> lut = mapper.GetLookupTable()<BR> lut.Build()<BR> lut.SetTableValue( 0, 0, 0, 0, 0 )<BR></DIV>
<DIV>Black points are still visible... :-(</DIV>
<DIV>Do you have a simple example of a vtkStructuredPoints or vtkStructuredGrid build by hand on wich you can choose each point value color. Here is my Python code that doesn't work :</DIV>
<DIV> </DIV>
<DIV>from vtk import *</DIV>
<DIV>def main():<BR> math = vtkMath()<BR> # 20x10x10 points<BR> nx = 20<BR> ny = 10<BR> nz = 10<BR> <BR> scalars = vtkUnsignedCharArray()</DIV>
<DIV> for z in range(0, nz):<BR> for y in range(0, ny):<BR> for x in range(0, nx):<BR> if x < 5:<BR> scalars.InsertNextTuple1( 0 )<BR> else:<BR> scalars.InsertNextTuple1( math.Random( 0, 255 ) + 1 )<BR> <BR> cloud = vtkStructuredPoints()<BR> cloud.SetDimensions( nx, ny, nz )<BR> cloud.SetOrigin( 0, 0, 0 )<BR> cloud.SetSpacing( 1, 1, 1 )<BR>
cloud.GetPointData().SetScalars( scalars )<BR></DIV>
<DIV> mapper = vtkDataSetMapper()<BR> mapper.SetInput( cloud )<BR> mapper.SetScalarRange( cloud.GetScalarRange() )<BR> lut = mapper.GetLookupTable()<BR> lut.Build()<BR> lut.SetTableValue( 0, 0, 0, 0, 0 )<BR></DIV>
<DIV> actor = vtkActor()<BR> actor.SetMapper( mapper )<BR> <BR> ren = vtkRenderer()<BR> ren.AddActor( actor )<BR> ren.SetBackground( 1, 1, 1 )<BR> <BR> renWin = vtkRenderWindow()<BR> renWin.AddRenderer( ren )<BR> iren = vtkRenderWindowInteractor()<BR> iren.SetRenderWindow( renWin )<BR> <BR> renWin.SetSize( 500, 500 )<BR> renWin.Render()<BR> iren.Start()</DIV>
<DIV>if __name__ == '__main__':<BR> main()</DIV>
<DIV> </DIV>
<DIV>I don't understand what is wrong.</DIV>
<DIV>Thanks for your help.</DIV>
<DIV><BR><BR><B><I>David.Pont@ForestResearch.co.nz</I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR><BR>Hi Aurélien,<BR>The code fragment below constructs a greyscale lookuptable with 5<BR>colors. After the call to Build one color is changed so that alpha is 0.<BR>Data values mapped into this color in the lookuptable will be transparent.<BR><BR>vtkLookupTable *lut1 = vtkLookupTable::New();<BR>lut1->SetRange( 0, 0.5 );<BR>lut1->SetNumberOfColors( 5 );<BR>lut1->SetHueRange( 0, 0 );<BR>lut1->SetSaturationRange( 0, 0 );<BR>lut1->SetValueRange( 0, 1 );<BR>lut1->Build();<BR>lut1->SetTableValue( 1, 0, 0, 0, 0 ); // make one band<BR>disappear, note: rgb values not important<BR><BR>vtkPolyDataMapper *pdm1 = vtkPolyDataMapper::New();<BR>pdm1->SetInput( clpd1->GetOutput() );<BR>pdm1->SetScalarRange( 0, 0.5 );<BR>pdm1->SetLookupTable( lut1 );<BR>pdm1->ScalarVisibilityOn();<BR><BR>You should be able to use appropriate values for
SetRange,<BR>SetNumberOfColors, SetTableValue and SetScalarRange to hide parts of your<BR>dataset. This worked for me on polydata surfaces, I am not sure about<BR>rendering points, but I would expect it to work.<BR><BR>bon chance<BR>Dave Pont<BR></BLOCKQUOTE><p>
                <hr size=1>
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
<br><a href="http://fr.rd.yahoo.com/mail/taglines/*http://fr.benefits.yahoo.com/">Créez votre Yahoo! Mail</a>