<html><div style='background-color:'><DIV>Hi Gary,</DIV>
<DIV> Unfortunately I am no expert so take my suggestions with a few grains of salt! I see Lisa has some suggestions on the ray casting front.</DIV>
<DIV> </DIV>
<DIV>Back to vtkSampleFunction, I suppose you used vtkImplicitDataSet on your data? with SetOutValue of 0? You might want to use SetModelBounds with vtkSampleFuntion to just extend the original volume a bit, so it will actually generate those "OutValues" of 0, although this sounds like a hard way to do the same as vtkImageConstantPad. Really I thought CappingOn would do it, I am surprised you get a blank screen, try some different contour values, eg: 0.5, 0.75 to see if you can get some kind of output.</DIV>
<DIV> </DIV>
<DIV>Finally, your call to altPad->SetOutputWholeExtent looks a bit strange, just verify that it will give the bounds you need, because if you have specified the wrong bit of space you will surely "draw a blank". It should be something like:</DIV>
<DIV>altDimsMinX-delta, altDimsMaxX+delta, etc where delta is some fraction of the original volume dimension. If the volume dimensions vary a lot you may want different deltas in each direction. I think I have tackled this one by using GetBounds on the input data, then loop through the dimensions, calculate each extent and add a portion, say 5% and use these values with SetBounds or Extent for the next stage.</DIV>
<DIV> </DIV>
<DIV> just more guessing, but hey maybe there's a lead in there...</DIV>
<DIV>good luck</DIV>
<DIV> Dave Pont</DIV>
<DIV> </DIV>
<DIV></DIV>
<DIV></DIV>>From: "Gary L. Graf" <GLGRAF@ASU.EDU>
<DIV></DIV>>To: David Pont <DAVID_PONT@HOTMAIL.COM>
<DIV></DIV>>Subject: Re: [vtkusers] Ray Cast not working
<DIV></DIV>>Date: Sun, 12 May 2002 18:19:00 -0700
<DIV></DIV>>
<DIV></DIV>>David,
<DIV></DIV>> Thanks for the prompt reply. I tried vtkSampleFuction but it looks
<DIV></DIV>>like the only possible input is an implicit function, so I converted my
<DIV></DIV>>vtkStructuredPoints to an implicit, then applied it to
<DIV></DIV>>vtkSampleFunction, then a contour filter but all I got was a blank
<DIV></DIV>>screen.
<DIV></DIV>>
<DIV></DIV>> Looking at your other option though, led me to vtkImageConstantPad.
<DIV></DIV>>I applied it to my vtkStructuredPoints ("altVol"), set the output
<DIV></DIV>>dimension to me one greater than the input dimensions, set the constant
<DIV></DIV>>to zero, then sent it to a vtkContourFilter. If I set the pad constant
<DIV></DIV>>to zero, I get the error message saying there is no data to display
<DIV></DIV>>(i.e., the original scalars go away somehow so the contour filter can't
<DIV></DIV>>find a surface - or at least that's my interpretation of the problem).
<DIV></DIV>>If I set the constant to anything one or over I get a solid box whose
<DIV></DIV>>dimensions equal the dimensions of the original vtkStructuredPoints. If
<DIV></DIV>>I swap out the two input lines in the vtkContourFilter section below, I
<DIV></DIV>>get my original image (with defect I'm trying to correct). Have you
<DIV></DIV>>worked with this? On the surface it seems like it should be simple but
<DIV></DIV>>I am not getting the result I expected. Thanks - Gary
<DIV></DIV>>
<DIV></DIV>>Code*****************************************************************************************************
<DIV></DIV>>
<DIV></DIV>>vtkImageConstantPad *altPad = vtkImageConstantPad::New();
<DIV></DIV>> altPad->SetInput(altVol);
<DIV></DIV>> altPad->SetConstant(0.0);
<DIV></DIV>> altPad->SetOutputWholeExtent(-1, altDimsX+1, -1, altDimsY+1, -1,
<DIV></DIV>>altDimsZ+1);
<DIV></DIV>>
<DIV></DIV>> vtkContourFilter *altContour = vtkContourFilter::New();
<DIV></DIV>>// altContour->SetInput(altVol);
<DIV></DIV>> altContour->SetInput(altPad->GetOutput());
<DIV></DIV>> altContour->SetValue(0,1.0);
<DIV></DIV>>
<DIV></DIV>>David Pont wrote:
<DIV></DIV>>
<DIV></DIV>> >
<DIV></DIV>> >
<DIV></DIV>> > Gary,
<DIV></DIV>> >
<DIV></DIV>> > I just had a quick peek at the doxygen so I am guessing... what
<DIV></DIV>> > about vtkSampleFunction with CappingOn and SetCapValue 0, then
<DIV></DIV>> > vtkContourFilter or others?
<DIV></DIV>> >
<DIV></DIV>> > I also wondered about using vtkImageReslice to pad your data set in
<DIV></DIV>> > all directions with scalar values of 0, although I think this will
<DIV></DIV>> > give surfaces all over the boundary...
<DIV></DIV>> >
<DIV></DIV>> > regards
<DIV></DIV>> >
<DIV></DIV>> > Dave Pont
<DIV></DIV>> > >From: "Gary L. Graf"
<DIV></DIV>> > >To: vtk vtk
<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
<DIV></DIV>> > 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
<DIV></DIV>> > object
<DIV></DIV>> > >and 1 if the point is inside the object. For various reasons, it
<DIV></DIV>> > would
<DIV></DIV>> > >be extremely difficult to change the dimensions of the array. At some
<DIV></DIV>> >
<DIV></DIV>> > >locations, the object touches the boundary of the array. I have tried
<DIV></DIV>> >
<DIV></DIV>> > >the contour filter, marching cubes, and a few others and I can
<DIV></DIV>> > generate
<DIV></DIV>> > >the surface but those filters leave gaps where the object contacts
<DIV></DIV>> > 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
<DIV></DIV>> > 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
<DIV></DIV>> > response
<DIV></DIV>> > >would be GREATLY appreciated. Thanks - Gary Graf
<DIV></DIV>> > >
<DIV></DIV>> > >
<DIV></DIV>> > ode*****************************************************************************************************
<DIV></DIV>> >
<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 =
<DIV></DIV>> > 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>> >
<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></DIV>> >
<DIV></DIV>> > -----------------------------------------------------------------------
<DIV></DIV>> > Send and receive Hotmail on your mobile device: Click Here
<DIV></DIV></div><br clear=all><hr>Get your FREE download of MSN Explorer at <a href='http://g.msn.com/1HM104201/41'>http://explorer.msn.com</a>.<br></html>