<html><div style='background-color:'><DIV>
<P>Gary,</P>
<P> I just had a quick peek at the doxygen so I am guessing... what about vtkSampleFunction with CappingOn and SetCapValue 0, then vtkContourFilter or others?</P>
<P> I also wondered about using vtkImageReslice to pad your data set in all directions with scalar values of 0, although I think this will give surfaces all over the boundary...</P>
<P>regards</P>
<P> Dave Pont<BR><BR></P></DIV>
<DIV></DIV>
<DIV></DIV>>From: "Gary L. Graf" <GLGRAF@ASU.EDU>
<DIV></DIV>>To: vtk vtk <VTKUSERS@PUBLIC.KITWARE.COM>
<DIV></DIV>>Subject: [vtkusers] Ray Cast not working
<DIV></DIV>>Date: Sat, 11 May 2002 12:40:30 -0700
<DIV></DIV>>
<DIV></DIV>>Hi,
<DIV></DIV>> I have a vtkStructuredPoints ("altVol") which consists of a regular 3D
<DIV></DIV>>array of points and I want to display the object it represents as a
<DIV></DIV>>solid. The scalar values are 0 if that grid point is outside the object
<DIV></DIV>>and 1 if the point is inside the object. For various reasons, it would
<DIV></DIV>>be extremely difficult to change the dimensions of the array. At some
<DIV></DIV>>locations, the object touches the boundary of the array. I have tried
<DIV></DIV>>the contour filter, marching cubes, and a few others and I can generate
<DIV></DIV>>the surface but those filters leave gaps where the object contacts the
<DIV></DIV>>edge of the array. As a result it no longer looks like a solid.
<DIV></DIV>> My latest attempt was to try ray casting. The code from the vtk
<DIV></DIV>>manual, p146, appeared to be a solution. I implemented it as shown
<DIV></DIV>>below, but all I get is a blank screen. I don't see anything obviously
<DIV></DIV>>wrong and I have played with numerous options, but nothing seems to
<DIV></DIV>>work. Can anyone help me resolve this? Unfortunately, I need some
<DIV></DIV>>graphics of this for a progress report due Tuesday, so an early response
<DIV></DIV>>would be GREATLY appreciated. Thanks - Gary Graf
<DIV></DIV>>
<DIV></DIV>>Code*****************************************************************************************************
<DIV></DIV>>
<DIV></DIV>>vtkPiecewiseFunction *altVolOpacity = vtkPiecewiseFunction::New();
<DIV></DIV>> altVolOpacity->AddPoint(0.0, 0.2);
<DIV></DIV>> altVolOpacity->AddPoint(2.0, 0.8);
<DIV></DIV>>
<DIV></DIV>>vtkColorTransferFunction *altVolColor = vtkColorTransferFunction::New();
<DIV></DIV>>
<DIV></DIV>> altVolColor->SetColorSpaceToRGB();
<DIV></DIV>> altVolColor->AddRGBPoint (0.2, 1.0, 0.0, 0.0);
<DIV></DIV>> altVolColor->AddRGBPoint (1.0, 0.0, 0.0, 1.0);
<DIV></DIV>> altVolColor->AddRGBPoint (20.0, 0.0, 1.0, 0.0);
<DIV></DIV>>
<DIV></DIV>>vtkVolumeProperty *altVolProp = vtkVolumeProperty::New();
<DIV></DIV>> altVolProp->SetColor(altVolColor);
<DIV></DIV>> altVolProp->SetScalarOpacity(altVolOpacity);
<DIV></DIV>>
<DIV></DIV>>vtkVolumeRayCastCompositeFunction *altVolComp =
<DIV></DIV>>vtkVolumeRayCastCompositeFunction::New();
<DIV></DIV>>
<DIV></DIV>>vtkVolumeRayCastMapper *altVolMapper = vtkVolumeRayCastMapper::New();
<DIV></DIV>> altVolMapper->SetVolumeRayCastFunction(altVolComp);
<DIV></DIV>> altVolMapper->SetInput(altVol);
<DIV></DIV>>
<DIV></DIV>>vtkVolume *altVolume = vtkVolume::New();
<DIV></DIV>> altVolume->SetMapper(altVolMapper);
<DIV></DIV>> altVolume->SetProperty(altVolProp);
<DIV></DIV>>
<DIV></DIV>> altRenderer->AddProp(altVolume);
<DIV></DIV>> altRenderer->SetBackground(1,1,1);
<DIV></DIV>> altRenWin->SetSize(450,450);
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>
<DIV></DIV>>_______________________________________________
<DIV></DIV>>This is the private VTK discussion list.
<DIV></DIV>>Please keep messages on-topic. Check the FAQ at:
<DIV></DIV>>Follow this link to subscribe/unsubscribe:
<DIV></DIV>>http://public.kitware.com/mailman/listinfo/vtkusers
<DIV></DIV></div><br clear=all><hr>Send and receive Hotmail on your mobile device: <a href='http://g.msn.com/1HM104201/42'>Click Here</a><br></html>