[vtkusers] vtkVolumeRayCastMapper under vtk 4.2
Juan Aja
juaja at hotmail.com
Sat Dec 4 18:50:33 EST 2004
Hi to all.
I found a thread
(http://public.kitware.com/pipermail/vtkusers/2003-July/068382.html and
http://public.kitware.com/pipermail/vtkusers/2003-July/068402.html,
basically he posted it twice with different titles) asking about the same
problem, but as no one answered I considered posting this:
I've been trying to compile the example found in:
http://public.kitware.com/cgi-bin/cvsweb.cgi/Examples/VolumeRendering/Tcl/SimpleRayCast.tcl?rev=1.3&view=markup
(it's the Simple raycast example, written in Tcl), I converted it to C++,
thus resulting in:
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkStructuredPointsReader.h"
#include "vtkPiecewiseFunction.h"
#include "vtkVolumeProperty.h"
#include "vtkVolumeRayCastCompositeFunction.h"
#include "vtkVolumeRayCastMapper.h"
#include "vtkVolume.h"
#include "vtkColorTransferFunction.h"
int main()
{
vtkRenderer *renderer = vtkRenderer::New();
vtkRenderWindow *renWindow = vtkRenderWindow::New();
vtkRenderWindowInteractor *interactor = vtkRenderWindowInteractor::New();
vtkStructuredPointsReader *reader = vtkStructuredPointsReader::New();
vtkPiecewiseFunction *opacityTransferFunction =
vtkPiecewiseFunction::New();
vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
vtkVolumeRayCastCompositeFunction *compositeFunction =
vtkVolumeRayCastCompositeFunction::New();
vtkVolumeRayCastMapper *volumeMapper = vtkVolumeRayCastMapper::New();
vtkVolume *volume = vtkVolume::New();
vtkColorTransferFunction *color = vtkColorTransferFunction::New();
reader->SetFileName("$VTK_DATA_ROOT/Data/ironProt.vtk");
opacityTransferFunction->AddPoint(20, 0.0);
opacityTransferFunction->AddPoint(255, 0.2);
color->AddRGBPoint(64, 1.0, 0.0, 0.0);
color->AddRGBPoint(128, 0.0, 0.0, 1.0);
color->AddRGBPoint(192, 0.0, 1.0, 0.0);
color->AddRGBPoint(255, 0.0, 0.2, 0.0);
volumeProperty->SetColor(color);
volumeProperty->SetScalarOpacity(opacityTransferFunction);
volumeMapper->SetVolumeRayCastFunction(compositeFunction);
volumeMapper->SetInput(reader->GetOutput());
volume->SetMapper(volumeMapper);
volume->SetProperty(volumeProperty);
renderer->AddProp(volume);
renWindow->Render();
return 0;
}
When trying to compile it yields the following error message: "no matching
function for call to
`vtkVolumeRayCastMapper::SetInput(vtkStructuredPoints*)'
/usr/local/include/vtk/vtkVolumeMapper.h:59: candidates are: virtual void
vtkVolumeMapper::SetInput(vtkImageData*)"
I've double checked my code, and it's almost a carbon copy of the original
written in tcl, so I suppose that in vtk 4.2.2 the function
SetInput(vtkStructuredPoints*) in vtkVolumeRayCastMapper was dropped for
SetInput(vtkImageData*).
Is this correct?
How can it be solved?
I need to apply ray casting to a structured grid, so I used a structured
grid reader, but now I don't know how to use vtkVolumeRayCasting mapper on
it.
What shall I do?
Cheers.
Juan
_________________________________________________________________
Don't just search. Find. Check out the new MSN Search!
http://search.msn.com/
More information about the vtkusers
mailing list