Hi, <br><br>I am using the following code for volume rendering (VTK 5.4). But it is giving me the some errors. Could anyone please tell me where I am making the mistake or sent me a correct volume rendering code.<br><br>Thanks,<br>
Nikhil Navkar<br><br>ERRORS :<br>========================================================================<br><br>error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class vtkVolumeRayCastMapper * __cdecl vtkVolumeRayCastMapper::New(void)" (__imp_?New@vtkVolumeRayCastMapper@@SAPAV1@XZ) referenced in function _main<br>
<br>error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class vtkVolumeRayCastCompositeFunction * __cdecl vtkVolumeRayCastCompositeFunction::New(void)" (__imp_?New@vtkVolumeRayCastCompositeFunction@@SAPAV1@XZ) referenced in function _main<br>
<br><br>CODE :<br>========================================================================<br>#include "vtkImageViewer.h"<br>#include "vtkRenderWindowInteractor.h"<br>#include "vtkStructuredPointsReader.h"<br>
#include "vtkPiecewiseFunction.h"<br>#include "vtkColorTransferFunction.h"<br>#include "vtkVolumeProperty.h"<br>#include "vtkVolumeRayCastMapper.h"<br>#include "vtkVolumeRayCastCompositeFunction.h"<br>
#include "vtkVolume.h"<br>#include "vtkRenderer.h"<br><br>int main( int argc, char **argv) <br>{<br> // <br> vtkStructuredPointsReader *reader1 = vtkStructuredPointsReader::New();<br> reader1->SetFileName("c:\\t1.vtk");<br>
<br> // <br> vtkPiecewiseFunction *opacityTranferFunction = vtkPiecewiseFunction::New();<br> opacityTranferFunction->AddPoint( 20, 0.0);<br> opacityTranferFunction->AddPoint(255, 0.2);<br><br> //<br>
vtkColorTransferFunction *colorTransferFunction = vtkColorTransferFunction::New(); <br>
colorTransferFunction->AddRGBPoint( 0.0, 0.0, 0.0, 0.0);<br> colorTransferFunction->AddRGBPoint( 64.0, 0.0, 0.0, 0.0);<br> colorTransferFunction->AddRGBPoint( 128.0, 0.0, 0.0, 0.0);<br> colorTransferFunction->AddRGBPoint( 192.0, 0.0, 0.0, 0.0);<br>
colorTransferFunction->AddRGBPoint( 255.0, 0.0, 0.0, 0.0);<br><br> // <br> vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();<br> volumeProperty->SetColor(colorTransferFunction);<br> volumeProperty->SetScalarOpacity(opacityTranferFunction);<br>
volumeProperty->ShadeOn();<br> volumeProperty->SetInterpolationTypeToLinear();<br><br> //<br> vtkVolumeRayCastCompositeFunction *compositeFunction = vtkVolumeRayCastCompositeFunction::New();<br> vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();<br>
volumeMapper->SetVolumeRayCastFunction(compositeFunction);<br> volumeMapper->SetInputConnection(reader1->GetOutputPort());<br> <br> //<br> vtkVolume *volume = vtkVolume::New();<br> volume->SetMapper(volumeMapper);<br>
volume->SetProperty(volumeProperty);<br><br> vtkRenderer *ren1 = vtkRenderer::New();<br> vtkRenderWindow *renWin = vtkRenderWindow::New();<br> renWin->AddRenderer(ren1);<br> vtkRenderWindowInteractor *renderWindowInteractor = vtkRenderWindowInteractor ::New(); <br>
renderWindowInteractor->SetRenderWindow(renWin);<br><br> ren1->AddVolume(volume);<br> ren1->Render();<br> renderWindowInteractor->Start();<br><br> return 0;<br>}<br>