[vtkusers] volume rendering from book, GUISupport

Amy Squillacote amy.squillacote at kitware.com
Fri Jun 29 08:08:17 EDT 2007


When you compiled your program with VTK 5.0.3, did you link against the
vtkVolumeRendering library? In VTK 5.0, volume rendering is in its own
library; it was in the vtkRendering library in VTK 4.4.

- Amy

한종철 wrote:
>
> 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
> <mailto:?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
> <mailto:?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
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   

-- 
Amy Squillacote
Kitware, Inc.
28 Corporate Drive
Clifton Park, NY 12065
Phone: (518) 371-3971 x106




More information about the vtkusers mailing list