[vtkusers] Converting the SimpleRayCast.tcl example ( VTK/Examples/VolumeRen
Mathieu Malaterre
mathieu.malaterre at kitware.com
Fri Apr 16 21:09:48 EDT 2004
Wagner,
you need to add:
#include "vtkStructuredPoints.h"
Mathieu
> Hi all,
>
> I have the same problem asked below. I was searched and founded the same
> ask, but unforttunately, without answer.
> Can anyone help me? May be that's newbie programmers problem.
>
> thks
>
>
> Hi All,
>
> Below is my example of raycasting that I downloaded from the
> internet on the the ironProt.vtk datafile. Some of you will recognise this
> the code below, but I cannot get it to compile on vtk-4.2.2.
>
> It throws up the error:
> Building object file ironpot.o...
> /home/cs/pmcguinn/visual/project/ironpot.cxx: In function `int main (int,
> char **)':
> /home/cs/pmcguinn/visual/project/ironpot.cxx:152: no matching function for
> call to
> `vtkVolumeRayCastMapper::SetInput (vtkStructuredPoints *)'
> /usr/local/include/vtk/vtkVolumeMapper.h:59: candidates are: void
> vtkVolumeMapper::SetInput
> (vtkImageData *)
>
> I have spent the last two days playing around with the code modifying it,
> using vtkVolumeMapper, converting structuredpoints into Imagedata,
> but nothing seems to get it to work.
> Has anyone got this code to work using vtk 4.2.2?
>
> Thanks.
> Paul.
>
>
> #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"
> #include "vtkCamera.h"
>
>
> int main( int argc, char *argv[] )
> {
> vtkRenderer *renderer = vtkRenderer::New();
> vtkRenderWindow *renWindow = vtkRenderWindow::New();
> vtkRenderWindowInteractor *interactor =
> vtkRenderWindowInteractor::New();
> vtkStructuredPointsReader *reader =
> vtkStructuredPointsReader::New();
> vtkPiecewiseFunction *opacity = vtkPiecewiseFunction::New();
> vtkColorTransferFunction *color =
> vtkColorTransferFunction::New();
> vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
> vtkVolumeRayCastCompositeFunction *compositeFunction =
> vtkVolumeRayCastCompositeFunction::New();
> vtkVolumeRayCastMapper *volumeMapper =
> vtkVolumeRayCastMapper::New();
> vtkVolume *volume = vtkVolume::New();
>
> renWindow->SetSize(400,400);
>
>
> reader->SetFileName("ironProt.vtk");
> reader->Update();
>
>
>
> opacity->AddSegment(0, 0.0, 255, 0.5);
> color->AddRGBPoint(64, 1.0, 0.0, 0.0);
> color->AddRGBPoint(128, 1.0, 1.0, 0.0);
> color->AddRGBPoint(196, 0.0, 1.0, 1.0);
>
> volumeProperty->SetColor(color);
> volumeProperty->SetScalarOpacity(opacity);
> volumeProperty->SetInterpolationTypeToLinear();
> volumeProperty->ShadeOn();
>
> volumeMapper->SetInput(reader->GetOutput());
> volumeMapper->SetVolumeRayCastFunction(compositeFunction);
>
> volume->SetMapper(volumeMapper);
> volume->SetProperty(volumeProperty);
>
> renderer->SetBackground(0.2, 0.2, 0.8);
> renderer->AddVolume(volume);
> renderer->GetActiveCamera()->Azimuth(20.0);
> renderer->GetActiveCamera()->Dolly(1.60);
> renderer->ResetCameraClippingRange();
>
> interactor->SetRenderWindow(renWindow);
> renWindow->AddRenderer(renderer);
> renWindow->Render();
> interactor->Start();
>
> renderer->Delete();
> renWindow->Delete();
> interactor->Delete();
> reader->Delete();
> opacity->Delete();
> color->Delete();
> volumeProperty->Delete();
> compositeFunction->Delete();
> volumeMapper->Delete();
> volume->Delete();
>
> return 0;
>
> }
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list