[vtkusers] Scalar Range Problem with vtkVolumeRayCastMapper

Martin Haidacher maschtei at hotmail.com
Mon Mar 1 06:41:31 EST 2004


hi everybody,

I have a problem with segmenting data. the code should segment a 
vtkImageData (data) with a sphere. it's no problem to compile the code, but 
when i'm starting the program vtk gives out following error message:

ERROR: In C:\martink\vtk42\VTK\Rendering\vtkVolumeRayCastMapper.cxx, line 
328
vtkOpenGLVolumeRayCastMapper (0x01288C90): Cannot volume render data of type 
float, only unsigned char or unsigned short.

I don't understand why error occurs because I set output of the the 
vtkSampleFunction to Unsigned Char.

Has anybody a idea to solve this problem?
thanks everybody how can help me!!!

Greetings, Martin.


code:
...
(data ... vtkImageData)
float middle [3];
data->GetOrigin(middle);

vtkImplicitVolume *implVolume = vtkImplicitVolume::New();
implVolume->SetVolume(data);

vtkSphere *sphere = vtkSphere::New();
sphere->SetRadius((float)dimension[0]/4);
sphere->SetCenter(middle);

vtkImplicitBoolean *boolean = vtkImplicitBoolean::New();
boolean->SetOperationTypeToDifference();
boolean->AddFunction(implVolume);
boolean->AddFunction(sphere);

vtkSampleFunction *sampleFunc = vtkSampleFunction::New();
sampleFunc->SetOutputScalarTypeToUnsignedChar();
sampleFunc->SetImplicitFunction(boolean);
sampleFunc->ComputeNormalsOff();

vtkVolumeRayCastCompositeFunction *compositeFunction = 
vtkVolumeRayCastCompositeFunction::New();

vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();
volumeMapper->SetVolumeRayCastFunction(compositeFunction);
volumeMapper->SetInput(sampleFunc->GetOutput());
...

_________________________________________________________________
Finden Sie mit Hilfe von Match.com einen Partner fürs Leben! Es zahlt sich 
aus! http://match.msn.at/match/mt.cfm?pg=channel




More information about the vtkusers mailing list