[vtkusers] vtkFixedPointVolumeRayCastMapper problem
Heye ZHANG
heye.zhang at gmail.com
Wed Jan 18 09:19:52 EST 2006
Dear all,
I run again one problem of vtkFixedPointVolumeRaycastMapper.
First
I generate
vtkImageData* id= vtkImageData::New();
id->SetDimensions(init_vtk3d.ndiv[0]+1,init_vtk3d.ndiv[1]+1,init_vtk3d.ndiv[2]+1);
id->SetScalarTypeToUnsignedShort();
id->SetNumberOfScalarComponents(2);
id->AllocateScalars();
id->SetSpacing(x_inc,y_inc,z_inc);
id->SetOrigin(x_start+length/2,y_start+width/2,z_start+height/2);
printf("origin:%lf,%lf,%lf\n",x_start+length/2,y_start+width/2,z_start+height/2);
unsigned short *ptr= (unsigned short*) id->GetScalarPointer();
then I use loop to initialize the "id":
for(i=0;i<=init_vtk3d.ndiv[2];i++)
{
for(j=0;j<=init_vtk3d.ndiv[1];j++)
{
for(k=0;k<=init_vtk3d.ndiv[0];k++)
{
fread(coor_pos,3,sizeof(double),vtkcoor_handle);
fread(ptr,1,sizeof(unsigned short),vtkdata_handle);
if(coor_pos[1]<=-5)//---auck heart
*ptr=0;
ptr++;
*ptr=*(ptr-1);
ptr++;
}
}
}
As I understand. I think 2 compoment data should be placed point by point in
this way : compoment1 of point1,compoment1 of point1,compoment1 of
point2,compoment1 of point2..... So If two components are the same,
vtkFixedPointVolumeRaycastMapper should provide the same result as one
compoment data.
those are other setting:
volumeProperty->SetColor(color);
volumeProperty->SetGradientOpacity(opacity1);
volumeProperty->SetScalarOpacity(opacity);
volumeProperty->SetInterpolationTypeToLinear();
volumeProperty->SetAmbient(0.6);
volumeProperty->SetDiffuse(0.6);
volumeProperty->ShadeOn();
volumeMapper->SetInput(id);
But finially I cannot get what I want. the Geometry I want is inside a
black box,but I think that black color should be transparent because I have
set the opacity . I snap a figure and attach here. Please let me know you
have a solution of my problem. Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: untitled.JPG
Type: image/jpeg
Size: 15308 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060118/bc5b76c8/attachment.jpeg>
More information about the vtkusers
mailing list