[vtkusers] Questions about unsigned char scalars
Mario Biondini
Mario_Biondini at ndsu.nodak.edu
Fri Oct 13 11:59:48 EDT 2000
I am running a program designed for volume rendering. Within the program
I have this code:
// Create a structure point dataset
vtkStructuredPoints *vol = vtkStructuredPoints::New();
vol->SetDimensions(76,49,45);
vol->SetOrigin(100.0,80.0,1.0);
sp = 1.0;
vol->SetSpacing(sp, sp, sp);
// Creat a scalar and read the scalar data from file
vtkScalars *scalars = vtkScalars::New();
scalars->CreateDefaultLookupTable();
for (k=0; k<45; k++)
{
kOffset = k * 76 * 49;
for (j=0; j<49; j++)
{
jOffset = j * 76;
for (i=0; i<76; i++)
{
in1 >> s;
offset = i + jOffset + kOffset;
scalars->InsertScalar(offset,ss);
}
}
}
// Input the scalar data into the Structure Point Data Set
vol->GetPointData()->SetScalars(scalars);
scalars->Delete();
// Create the volume mapper and set the ray function and scalar input
vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();
volumeMapper->SetInput(vol);
volumeMapper->SetVolumeRayCastFunction(compositeFunction);
At execution time I get the following error
ERROR: In vtkVolumeRayCastMapper.cxx, line 921
vtkVolumeRayCastMapper (0x82b3ab0): The scalar data type: 10 is not
supported when volume rendering. Please convert the data to unsigned
char or unsigned short.
Reading Schroeder, Martin and Lorensen book the Visualization Toolkit
(2nd Edition) I noticed than in version 2.0 of VTK there was a function
called vtkUnsignedCharScalars to creat scalars of the type unsigned
char. This function however is not availabe in verson 3.1.
Question: is there an error in my code? and how do I create scalars that
are if type unsigned char?
Mario Biondini, Ph.D.
Department of Animal and Range Sciences
North Dakota State University
Fargo, ND 58103
Phone: (701) 231-8208
Fax: (701) 231-7590
e-mail: Mario_Biondini at ndsu.nodak.edu
http://www.ndsu.nodak.edu/instruct/biondini/vita/MEBvita.htm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20001013/5137d7c6/attachment.htm>
More information about the vtkusers
mailing list