[vtkusers] volume rendering from book, GUISupport
"한종철"
madness78 at pusan.ac.kr
Thu Jun 28 23:14:33 EDT 2007
Hi all,
I'm quite new using vtk and trying to realize volume rendering from book.
By the way, when I use vtk 4.4.2 , it has works.
this is the source.
int main()
{
vtkStructuredPointsReader *pvtkStructuredPointsReader=vtkStructuredPointsReader::New() ;
pvtkStructuredPointsReader->SetFileName("C:/vtk/vtkdata/vtkdata-5.0.3/Data/ironProt.vtk");
vtkPiecewiseFunction *opacityTransferFunction= vtkPiecewiseFunction::New();
vtkColorTransferFunction *colorTransferFunction=vtkColorTransferFunction::New();
vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
vtkVolumeRayCastCompositeFunction *compositeFunction = vtkVolumeRayCastCompositeFunction::New();
vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();
vtkVolume *volume = vtkVolume::New();
opacityTransferFunction->AddPoint(40,0.0);
opacityTransferFunction->AddPoint(255,0.2);
colorTransferFunction->AddRGBPoint( 0.0,0.0,0.0,0.0);
colorTransferFunction->AddRGBPoint( 64.0,1.0,0.0,0.0);
colorTransferFunction->AddRGBPoint(128.0,0.0,0.0,1.0);
colorTransferFunction->AddRGBPoint(192.0,0.0,1.0,0.0);
colorTransferFunction->AddRGBPoint(255.0,0.0,0.2,0.0);
volumeProperty->SetColor(colorTransferFunction);
volumeProperty->SetScalarOpacity(opacityTransferFunction);
volumeProperty->ShadeOn();
volumeProperty->SetInterpolationTypeToLinear();
compositeFunction->SetCompositeMethodToInterpolateFirst();
volumeMapper -> SetVolumeRayCastFunction(compositeFunction);
volumeMapper -> SetInput((vtkImageData*)pvtkStructuredPointsReader->GetOutput());
volume->SetMapper(volumeMapper);
volume->SetProperty(volumeProperty);
vtkRenderer *ren1 = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin -> AddRenderer( ren1 );
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren-> SetRenderWindow (renWin);
ren1-> SetBackground (1, 1, 1);
ren1 ->AddVolume(volume);
ren1-> ResetCamera();
ren1-> GetActiveCamera()-> Zoom( 1.5);
iren-> Initialize();
iren->Start();
return 0;
}
but when I used latest version vtk 5.03, it got the error.
lumeRendering.obj : error LNK2001: unresolved external symbol "public: static class vtkVolumeRayCastMapper * __cdecl vtkVolumeRayCastMapper::New(void)" (?New at vtkVolumeRayCastMapper@@SAPAV1 at XZ)
VolumeRendering.obj : error LNK2001: unresolved external symbol "public: static class vtkVolumeRayCastCompositeFunction * __cdecl vtkVolumeRayCastCompositeFunction::New(void)" (?New at vtkVolumeRayCastCompositeFunction@@SAPAV1 at XZ)
Debug/VolumeRendering.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
ALL_BUILD - 3 error(s), 0 warning(s)
what's the problem with this??
And when I used vtk 4.4.2, I couldn't find GUISupport.
I want to use MFC, but I couldn,t.
what's the problem??
Can you help me??
li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070629/a672d0d3/attachment.htm>
More information about the vtkusers
mailing list