Hi dears,
I want to using ray casting in vtk through mitk I got the vtkImageData from
the mitk::Image then try to show it into a QVTKwidget instead of showing by
vtkRenderWindowInteractor but in /////////Showing///////////// section as I
wrote in the text I have an error related execution this error ->"The
program has unexpectedly finished."
My code is follow bellow:
vtkRenderer *renderer = vtkRenderer::New();
vtkImageData *input=0;
input = mitkImage->GetVtkImageData();
// Create our volume and mapper
vtkVolume *volume = vtkVolume::New();
vtkFixedPointVolumeRayCastMapper *mapper =
vtkFixedPointVolumeRayCastMapper::New();
mapper->SetInputData(mitkImage->GetVtkImageData());
// Create our transfer function
vtkColorTransferFunction *colorFun = vtkColorTransferFunction::New();
vtkPiecewiseFunction *opacityFun = vtkPiecewiseFunction::New();
// Create the property and attach the transfer functions
vtkVolumeProperty *property = vtkVolumeProperty::New();
property->SetIndependentComponents(independentComponents);
property->SetColor( colorFun );
property->SetScalarOpacity( opacityFun );
property->SetInterpolationTypeToLinear();
// connect up the volume to the property and the mapper
volume->SetProperty( property );
volume->SetMapper( mapper );
colorFun->AddRGBPoint( -3024, 0, 0, 0, 0.5, 0.0 );
colorFun->AddRGBPoint( -155, .55, .25, .15, 0.5, .92 );
colorFun->AddRGBPoint( 217, .88, .60, .29, 0.33, 0.45 );
colorFun->AddRGBPoint( 420, 1, .94, .95, 0.5, 0.0 );
colorFun->AddRGBPoint( 3071, .83, .66, 1, 0.5, 0.0 );
opacityFun->AddPoint(-3024, 0, 0.5, 0.0 );
opacityFun->AddPoint(-155, 0, 0.5, 0.92 );
opacityFun->AddPoint(217, .68, 0.33, 0.45 );
opacityFun->AddPoint(420,.83, 0.5, 0.0);
opacityFun->AddPoint(3071, .80, 0.5, 0.0);
mapper->SetBlendModeToComposite();
property->ShadeOn();
property->SetAmbient(0.1);
property->SetDiffuse(0.9);
property->SetSpecular(0.2);
property->SetSpecularPower(10.0);
property->SetScalarOpacityUnitDistance(0.8919);
// Add the volume to the scene
renderer->AddVolume( volume );
renderer->ResetCamera();
///////////////////////////Showing////////////////////////////
QWidget * x = new QWidget();
x->resize(200,200);
QHBoxLayout * layout = new QHBoxLayout();
layout->setSpacing(2);
layout->setMargin(0);
x->setLayout(layout);
QVTKWidget *qvtk =new QVTKWidget();
qvtk->GetRenderWindow()->AddRenderer(renderer);
layout->addWidget(qvtk);
x->show();
///////////////////////////////////////////////////////////////
The program has unexpectedly finished.
Thanks in advance
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users