Hi, all <br><br>I use vtkDICOMImageReader read Medical image of DICOM format, and then use vtkDICOMImageReader::SetDataScalarTypeToUnsignedShort() to change the datatype,<br><br>but when I use vtkVolumeRayCastMapper, i got the follow message:
<br>vtkVolumeRayCastMapper(0x02AA83A8): Cannot volume render data of type short, only unsigned char or unsigned short.<br><br>It seems the function SetDataScalarTypeToUnsignedShort() did not work. why? and how can i change the data type into unsinged char? or some other methods to&nbsp;use&nbsp; vtkVolumeRayCastMapper?
<br><br>my code is,<br><br>                pvtkDICOMImagereader = vtkDICOMImageReader::New();<br>                pvtkDICOMImagereader-&gt;SetDirectoryName(directoryname);<br>                pvtkDICOMImagereader-&gt;SetDataScalarTypeToUnsignedShort();<br>                pvtkDICOMImagereader-&gt;Update();
<br><br>                vtkPiecewiseFunction *opacityTFunc=vtkPiecewiseFunction::New();<br>                opacityTFunc-&gt;AddPoint(0.0, 0.0);<br>                opacityTFunc-&gt;AddPoint(scalar1, alphar1);<br>                opacityTFunc-&gt;AddPoint(scalar2, alphar2);<br>                opacityTFunc-&gt;AddPoint(scalar3, alphar3);
<br>                opacityTFunc-&gt;AddPoint(scalar4, alphar4);<br><br><br>                vtkVolumeProperty *volumeProperty=vtkVolumeProperty::New();<br>                //  volumeProperty-&gt;SetColor(colorTFunc);<br>                volumeProperty-&gt;SetScalarOpacity(opacityTFunc);
<br>                volumeProperty-&gt;SetInterpolationTypeToLinear();<br>                volumeProperty-&gt;SetAmbient(1.8);//0.2<br>                volumeProperty-&gt;SetDiffuse(1.0);<br>                volumeProperty-&gt;SetSpecular(0.7);//0.2<br>                volumeProperty-&gt;SetSpecularPower(30);
<br>                volumeProperty-&gt;ShadeOn();<br><br>                //<br>                vtkVolumeRayCastMIPFunction <br>                  *compositeFunction=vtkVolumeRayCastMIPFunction::New();<br><br><br>                vtkVolumeRayCastMapper *volumeMapper=vtkVolumeRayCastMapper::New();
<br>                volumeMapper-&gt;SetInput(this-&gt;reader-&gt;GetOutput());<br>                volumeMapper-&gt;SetVolumeRayCastFunction(compositeFunction);<br>                volumeMapper-&gt;SetNumberOfThreads(3);<br>                cerr&lt;&lt;volumeMapper-&gt;GetNumberOfThreads();
<br><br>                vtkVolume *volume=vtkVolume::New();<br>                volume-&gt;SetMapper(volumeMapper);<br>                volume-&gt;SetProperty(volumeProperty);<br>                this-&gt;pvtkRenderer-&gt;AddVolume(volume);<br><br><br clear="all"><br>-- <br>veelion