[vtkusers] problem with vtkVolumeRayCastMapper for DICOM images!

Veelion Chong veelion at gmail.com
Wed Mar 22 00:30:33 EST 2006


Hi, all

I use vtkDICOMImageReader read Medical image of DICOM format, and then use
vtkDICOMImageReader::SetDataScalarTypeToUnsignedShort() to change the
datatype,

but when I use vtkVolumeRayCastMapper, i got the follow message:
vtkVolumeRayCastMapper(0x02AA83A8): Cannot volume render data of type short,
only unsigned char or unsigned short.

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 use  vtkVolumeRayCastMapper?

my code is,

pvtkDICOMImagereader = vtkDICOMImageReader::New();
pvtkDICOMImagereader->SetDirectoryName(directoryname);
pvtkDICOMImagereader->SetDataScalarTypeToUnsignedShort();
pvtkDICOMImagereader->Update();

vtkPiecewiseFunction *opacityTFunc=vtkPiecewiseFunction::New();
opacityTFunc->AddPoint(0.0, 0.0);
opacityTFunc->AddPoint(scalar1, alphar1);
opacityTFunc->AddPoint(scalar2, alphar2);
opacityTFunc->AddPoint(scalar3, alphar3);
opacityTFunc->AddPoint(scalar4, alphar4);


vtkVolumeProperty *volumeProperty=vtkVolumeProperty::New();
// volumeProperty->SetColor(colorTFunc);
volumeProperty->SetScalarOpacity(opacityTFunc);
volumeProperty->SetInterpolationTypeToLinear();
volumeProperty->SetAmbient(1.8);//0.2
volumeProperty->SetDiffuse(1.0);
volumeProperty->SetSpecular(0.7);//0.2
volumeProperty->SetSpecularPower(30);
volumeProperty->ShadeOn();

//
vtkVolumeRayCastMIPFunction
*compositeFunction=vtkVolumeRayCastMIPFunction::New();


vtkVolumeRayCastMapper *volumeMapper=vtkVolumeRayCastMapper::New();
volumeMapper->SetInput(this->reader->GetOutput());
volumeMapper->SetVolumeRayCastFunction(compositeFunction);
volumeMapper->SetNumberOfThreads(3);
cerr<<volumeMapper->GetNumberOfThreads();

vtkVolume *volume=vtkVolume::New();
volume->SetMapper(volumeMapper);
volume->SetProperty(volumeProperty);
this->pvtkRenderer->AddVolume(volume);



--
veelion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060322/750b057c/attachment.htm>


More information about the vtkusers mailing list