<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2769" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff background="">
<DIV><FONT face="Courier New" size=2>Hi!<BR><BR>I'm trying to render a volume
adding the XYZ axes in the rendering, but when I add the vtkActor of the axes
the volume disappears: I mean I can see or the volume either the axes. Can
someone help me? <BR><BR>The code of the pipeline is the following:</FONT></DIV>
<DIV><FONT face="Courier New" size=2><BR>void
C3D_ReconstructorView::Pipeline(vtkImageData *pData)<BR>{<BR></DIV></FONT>
<DIV><FONT face="Courier New" size=2>
vtkWin32OpenGLRenderWindow *renWin;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> vtkRenderer
*ren;</FONT></DIV>
<DIV><FONT face="Courier New" size=2>
vtkWin32RenderWindowInteractor *iren;</FONT></DIV>
<DIV><FONT face="Courier New" size=2>
vtkStructuredPointsReader * VTKreader;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> vtkImageIslandRemoval2D
* islandRemover;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> vtkImageGaussianSmooth
*gaussian;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> vtkImageThreshold
*selectTissue;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> vtkPiecewiseFunction
*opacityTransferFunction;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> vtkColorTransferFunction
*colorTransferFunction;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> vtkVolumeProperty *
volumeProperty[1];</FONT></DIV>
<DIV><FONT face="Courier New" size=2>
vtkVolumeRayCastCompositeFunction *compositeFunction;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> vtkVolumeRayCastMapper
*volumeMapper;</FONT></DIV>
<DIV><FONT face="Courier New" size=2> vtkVolume
*volume;</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2> islandRemover =
vtkImageIslandRemoval2D::New();<BR>
islandRemover->SetAreaThreshold(4);<BR>
islandRemover->SetIslandValue(-1);<BR>
islandRemover->SetReplaceValue(1.0);<BR>
islandRemover->SetInput(pData);<BR> gaussian =
vtkImageGaussianSmooth::New();<BR>
gaussian->SetStandardDeviations(1.0, 1.0, 1.0);<BR>
gaussian->SetRadiusFactors(1.0, 1.0, 1.0);<BR>
gaussian->SetInput(islandRemover->GetOutput());<BR>
selectTissue = vtkImageThreshold::New();<BR>
selectTissue->ThresholdBetween(m_stVievParms.dblNoise,
255.0);<BR>
selectTissue->ReplaceInOff();<BR>
selectTissue->SetOutValue(0.0);<BR>
selectTissue->SetInput(gaussian->GetOutput());</FONT></DIV><FONT
face="Courier New" size=2>
<DIV><BR>// Create transfer mapping scalar value to
opacity<BR> opacityTransferFunction =
vtkPiecewiseFunction::New();<BR>
opacityTransferFunction->AddPoint(0, 0.0);<BR>
opacityTransferFunction->AddPoint(static_cast<int>(m_stVievParms.dblNoise),
0.259);<BR> opacityTransferFunction->AddPoint(255,
1.0);</DIV>
<DIV><BR>// Create transfer mapping scalar value to color<BR>
colorTransferFunction = vtkColorTransferFunction::New();<BR>
colorTransferFunction->AddRGBPoint(0.0, 0.0, 0.0, 0.0);<BR>
colorTransferFunction->AddRGBPoint(m_stVievParms.dblNoise, 0.259, 0.259,
0.259);<BR> colorTransferFunction->AddRGBPoint(255.0, 1.0,
1.0, 1.0);</DIV>
<DIV><BR>// The property describes how the data will look<BR>
volumeProperty[0] = vtkVolumeProperty::New();<BR>
volumeProperty[0]->SetColor(colorTransferFunction);<BR>
volumeProperty[0]->SetScalarOpacity(opacityTransferFunction);<BR>
volumeProperty[0]->SetInterpolationTypeToLinear();<BR>//<BR>// The mapper /
ray cast function know how to render the data<BR>
compositeFunction =
vtkVolumeRayCastCompositeFunction::New();<BR> volumeMapper =
vtkVolumeRayCastMapper::New();<BR>
volumeMapper->SetSampleDistance(0.2);<BR>
volumeMapper->SetVolumeRayCastFunction(compositeFunction);<BR>
volumeMapper->SetInput(selectTissue->GetOutput());</DIV>
<DIV><BR>// axes to follow camera<BR> float
bounds[6];<BR>
volumeMapper->GetBounds(bounds);<BR> vtkAxes* axes =
vtkAxes::New(); //source.<BR> vtkPolyDataMapper* axesMapper =
vtkPolyDataMapper::New();<BR> vtkActor* axesActor =
vtkActor::New();<BR> axes->SetOrigin(
bounds[0],bounds[2],bounds[4]);<BR>
axes->SetScaleFactor(bounds[1] - bounds[0]);<BR>
axesMapper->SetInput( axes->GetOutput());<BR>
axesActor->SetMapper(axesMapper);<BR>
axesActor->PickableOff();<BR>
axesActor->GetProperty()->SetColor( 255, 255, 255);<BR>
axesActor->GetProperty()->SetLineWidth( 5.);<BR>
axesActor->GetProperty()->SetOpacity(10);<BR><BR>// The volume holds the
mapper and the property and<BR>// can be used to position/orient the
volume<BR>
volume->SetMapper(volumeMapper);<BR>
volume->SetProperty(volumeProperty[0]);<BR>
volume->Update();<BR>// ren->AddActor( axesActor); //this is
the line that makes disappear the volume<BR>
ren->AddVolume(volume);</FONT></DIV>
<DIV><FONT face="Courier New" size=2><BR>
axes->Delete();<BR>
axesMapper->Delete();<BR>
axesActor->Delete();<BR>
islandRemover->Delete();<BR>
gaussian->Delete();<BR>
selectTissue->Delete();<BR>
opacityTransferFunction->Delete();<BR>
colorTransferFunction->Delete();<BR>
compositeFunction->Delete();<BR>
volumeProperty[0]->Delete();<BR>
volumeMapper->Delete();<BR>}</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Thank you in advance.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Sandro Rosi<BR>R&D Software Project
Manager<BR>Optikon 2000 S.p.A.<BR>Via del Casale di Settebagni, 13<BR>00138 Roma
(Italy)<BR>Tel +39068887978</FONT></DIV></BODY></HTML>