Hi ali,<br><br>Sorry for late answer, I didn&#39;t see your mail. In the future, please send your question to the vtkusers list, not only to me.<br>For your problem -but maybe it&#39;s too late?-, the VTK error message is clear. Your data has no scalar attributes and it seems normal because<br>
- sphere source does not produce scalar<br>- delaunay does not produce scalar<br>- so the mapper input has no scalars<br><br>You have to use a source/filter that has scalars in its output (elevation filter, threshold,...)<br>
<br>HTH<br>Jerome<br><br><div class="gmail_quote">2009/10/5  <span dir="ltr">&lt;<a href="mailto:ali.mahmoud.habib@gmail.com">ali.mahmoud.habib@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I wrote a code to make tetrahedral mesh on sphere , but it no give result except :<br>
<br>
ERROR: In m:\dev\cur\vtkdotnet\branch\50\VolumeRendering\vtkUnstructuredGridVolumeRayCastMapper.cxx, line 274<br>
vtkUnstructuredGridVolumeRayCastMapper (05B22CB8): Can&#39;t use the ray cast mapper without scalars!<br>
<br>
every time I  run the code<br>
<br>
I want to fix the proplem because I want to apply the same concept on 3D Skull be reconstructed<br>
<br>
The code is :<br>
// volume property<br>
int shade = 0, compos = 0, interp = 0;<br>
<br>
// renderer<br>
vtkRenderer *ren1 = gcnew vtkRenderer();<br>
ren1-&gt;SetBackground(1.0, 1.0, 1.0);<br>
<br>
// render window<br>
vtkRenderWindow *renWin = gcnew vtkRenderWindow();<br>
renWin-&gt;AddRenderer(ren1);<br>
renWin-&gt;SetSize(800, 600);<br>
<br>
// interactor<br>
vtkRenderWindowInteractor *iren1 = gcnew vtkRenderWindowInteractor();<br>
iren1-&gt;SetRenderWindow(renWin);<br>
<br>
// set up the input file for unstructured grid reader<br>
//1.Create a volume data<br>
// create sphere geometry<br>
vtkSphereSource *sphere = gcnew vtkSphereSource();<br>
sphere-&gt;SetRadius(1.0);<br>
sphere-&gt;SetThetaResolution(18);<br>
sphere-&gt;SetPhiResolution(18);<br>
//2.Apply the tetrahedral mish<br>
vtkPolyData *vp = gcnew vtkPolyData();<br>
<br>
vtkDelaunay3D *unstructuredReader = gcnew vtkDelaunay3D();<br>
unstructuredReader-&gt;SetInput(sphere-&gt;GetOutput());<br>
<br>
<br>
// set up opacity transfer function<br>
vtkPiecewiseFunction *opacityTransferFunction = gcnew vtkPiecewiseFunction();<br>
opacityTransferFunction-&gt;AddPoint(0, 0.02);<br>
opacityTransferFunction-&gt;AddPoint(4095.0, 1.0);<br>
<br>
// set up color transfer function<br>
vtkColorTransferFunction *colorTransferFunction = gcnew vtkColorTransferFunction();<br>
colorTransferFunction-&gt;AddRGBPoint(0.0, 0.1, 0.1, 0.1);<br>
colorTransferFunction-&gt;AddRGBPoint(4095.0, 1.0, 0.0, 1.0);<br>
<br>
// set up volume property<br>
vtkVolumeProperty *volumeProperty = gcnew vtkVolumeProperty();<br>
volumeProperty-&gt;SetColor(colorTransferFunction);<br>
volumeProperty-&gt;SetScalarOpacity(opacityTransferFunction);<br>
volumeProperty-&gt;SetInterpolationType(interp);<br>
volumeProperty-&gt;SetShade(shade);<br>
// Add scaler value<br>
vtkDoubleArray *arr = gcnew vtkDoubleArray();<br>
arr-&gt;SetNumberOfTuples(unstructuredReader-&gt;GetOutput()-&gt;GetNumberOfPoints());<br>
arr-&gt;FillComponent(0, 1.0); // e.g. double value = 1.0;<br>
arr-&gt;SetName(&quot;myarray&quot;);<br>
// MessageBox.Show(arr.GetData(<br>
//unstructuredReader.GetOutput().GetPointData().SetScalars();<br>
unstructuredReader-&gt;GetOutput()-&gt;GetPointData()-&gt;AddArray(arr);<br>
unstructuredReader-&gt;GetOutput()-&gt;GetPointData()-&gt;SetActiveScalars(&quot;myarray&quot;);<br>
<br>
<br>
// composite function for strucured grid renderer<br>
           vtkVolumeRayCastCompositeFunction *compositeFunction = gcnew vtkVolumeRayCastCompositeFunction();<br>
compositeFunction-&gt;SetCompositeMethod(compos);<br>
<br>
//unstructuredGridRendering<br>
           vtkUnstructuredGridVolumeRayCastMapper *volumeUnstructedMapper = gcnew vtkUnstructuredGridVolumeRayCastMapper();<br>
//vtkVolumeRayCastMapper volumeUnstructedMapper = new vtk.vtkVolumeRayCastMapper();<br>
//volumeUnstructedMapper.set  (compositeFunction);<br>
volumeUnstructedMapper-&gt;SetInput(unstructuredReader-&gt;GetOutput());<br>
<br>
volumeUnstructedMapper-&gt;SetScalarModeToUseCellData();<br>
<br>
vtkVolume *volume = gcnew vtkVolume();<br>
<br>
volume-&gt;SetMapper(volumeUnstructedMapper);<br>
<br>
volume-&gt;SetProperty(volumeProperty);<br>
<br>
// add volume to renderer<br>
ren1-&gt;AddVolume(volume);<br>
<br>
renWin-&gt;Render();<br>
<br>
iren1-&gt;Start();<br>
</blockquote></div><br>