[vtkusers] Help Display Slice of images on 3D ((vtkImageActor))

Julien Finet julien.finet at kitware.com
Wed Mar 7 13:01:59 EST 2012


you have to play more with the transfer functions (opacity and colors).
The range is not 0 to 255 but it's your image range (-1000 to 3000 ?).
j.

On Wed, Mar 7, 2012 at 11:57 AM, Hellice <saouli-abdelhak at hotmail.com>wrote:

> Hi Again well afer Hours of reading examples  and testing them i comme up
> withe some resulte :
> This video on youtube shows my work :
> http://www.youtube.com/watch?v=74_RJe47-js&feature=youtu.be
> http://www.youtube.com/watch?v=74_RJe47-js&feature=youtu.be
>
> As you can see i did not get he rendring right , i just used a simple ray
> cast and applide on Dicom slices
>
> please if you just have some idea to get it done just tell me.
>
> here is my code
>
> --------------------------------------------------------------------------------------------
> *
> #include "vtkPolyDataMapper.h"
> #include "vtkRenderWindow.h"
> #include "vtkPiecewiseFunction.h"
> #include "vtkThreshold.h"
> #include "vtkRenderer.h"
> #include "vtkVolumeProperty.h"
> #include "vtkRenderWindowInteractor.h"
> #include <vtkDICOMImageReader.h>
> #include <vtkDataSetTriangleFilter.h>
> #include <vtkVolumeRayCastMapper.h>
> #include <vtkImageData.h>
> #include "vtkColorTransferFunction.h"
> #include <vtkVolumeRayCastCompositeFunction.h>
> #include <vtkVolume.h>
> #include <vtkDICOMImageReader.h>
>
> using namespace std;
>
> int main()
> {
>         vtkRenderer *ren1 = vtkRenderer::New();
>         vtkRenderWindow *renWin = vtkRenderWindow::New();
>         vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
>
>         renWin->AddRenderer( ren1 );
>        iren->SetRenderWindow( renWin );
>
>        vtkDICOMImageReader *reader = vtkDICOMImageReader::New();
>         reader->SetDirectoryName("Data");
>    reader->Update();
>
>
>
>
>        vtkPiecewiseFunction *opacityTransferFunction =
> vtkPiecewiseFunction::New();
>        opacityTransferFunction->AddPoint(20.0,0.0);
>        opacityTransferFunction->AddPoint(255.0,2.0);
>
>        vtkColorTransferFunction *colorTransferFunction =
> vtkColorTransferFunction::New();
>        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,1.0);
>        colorTransferFunction->AddRGBPoint(192.0,1.0,0.0,0.0);
>        colorTransferFunction->AddRGBPoint(255.0,0.0,0.2,0.0);
>
>        vtkVolumeProperty *volumeProperty = vtkVolumeProperty::New();
>        volumeProperty->SetColor( colorTransferFunction );
>        volumeProperty->SetScalarOpacity( opacityTransferFunction );
>        volumeProperty->ShadeOn();
>        volumeProperty->SetInterpolationTypeToLinear();
>
>        vtkVolumeRayCastCompositeFunction  *compositeFunction =
> vtkVolumeRayCastCompositeFunction::New();
>        vtkVolumeRayCastMapper *volumeMapper =
> vtkVolumeRayCastMapper::New();
>
>        volumeMapper->SetVolumeRayCastFunction( compositeFunction );
>        volumeMapper->SetInputConnection ( reader->GetOutputPort() );
>
>        vtkVolume *volume = vtkVolume::New();
>        volume->SetMapper( volumeMapper ) ;
>        volume->SetProperty ( volumeProperty );
>
>        ren1->AddVolume( volume );
>        ren1->SetBackground(0.1,0.21,0.31);
>
>        renWin->SetWindowName("Volume");
>        renWin->SetSize(500,500);
>         renWin->Render();
>
>        iren->Start();
>
>        return 0;
> }
> *
> 20 mn of your precious for reading and try to figur out the prob and i will
> be thankful for eternity ^^
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Help-Display-Slice-of-images-on-3D-vtkImageActor-tp5533571p5544760.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120307/e0e3a035/attachment.htm>


More information about the vtkusers mailing list