[vtkusers] OrientationMarkerWidget giving erros in QT+VTK

Rodrigo Lovera lobo.theslayer at gmail.com
Sun Nov 25 22:49:51 EST 2012


I just added the code I linked before, I can't fully provide the code im
working on cuz it's a gui and in these case it's just a function I call to
the main for a qvtkwidget.


    vtkSmartPointer< vtkDICOMImageReader > reader =
        vtkSmartPointer< vtkDICOMImageReader >::New();
    reader->SetDataByteOrderToLittleEndian();
    //reader->SetDirectoryName(argv[1]);
    reader->SetDirectoryName("C:\\VTK5.10\\DATA\\DICOM");
    reader->SetDataSpacing(1, 1, 1);
    reader->SetDataOrigin(0.0, 0.0, 0.0);
    reader->Update();
    reader->GetOutput()->ReleaseDataFlagOn();

    //vtkSmartPointer< vtkMarchingCubes > mCube =
    //    vtkSmartPointer< vtkMarchingCubes >::New();
    mCube = vtkMarchingCubes::New();
    mCube->SetInput(reader->GetOutput());
    mCube->SetValue(0,100);
    mCube->ComputeNormalsOn();
    mCube->ComputeGradientsOff();
    mCube->UpdateWholeExtent();

    vtkSmartPointer< vtkPolyDataMapper > pdMapper =
        vtkSmartPointer< vtkPolyDataMapper >::New();
    pdMapper->SetInput(mCube->GetOutput());
    pdMapper->ImmediateModeRenderingOn();
    pdMapper->ScalarVisibilityOff();
    surfaceActor = vtkActor::New();
    surfaceActor->SetMapper(pdMapper);

    surfaceRenderer = vtkRenderer::New();
    surfaceRenderer->AddActor(surfaceActor);

    vtkSmartPointer< vtkRenderWindow > renderwin =
        vtkSmartPointer< vtkRenderWindow >::New();
    renderwin->AddRenderer(surfaceRenderer);

    vtkSmartPointer< vtkRenderWindowInteractor > intersurf =
        vtkSmartPointer< vtkRenderWindowInteractor >::New();
    intersurf->SetRenderWindow(renderwin);

    vtkSmartPointer< vtkAxesActor > axes =
        vtkSmartPointer< vtkAxesActor >::New();

    vtkSmartPointer< vtkOrientationMarkerWidget > widget =
        vtkSmartPointer< vtkOrientationMarkerWidget >::New();
    widget->SetOutlineColor(0.9300, 0.5700, 0.1300);
    widget->SetOrientationMarker(axes);
    widget->SetInteractor(intersurf);
    widget->SetViewport(0.0, 0.0, 0.4, 0.4);
    widget->SetEnabled(1);
    widget->InteractiveOn();
    surfaceRenderer->ResetCamera();
    //renderwin->Render();

    renderwin->SetSize(800, 600);
    intersurf->Start();

    this->ui->vtksurface->GetRenderWindow()->AddRenderer(surfaceRenderer);


2012/11/25 David Doria <daviddoria at gmail.com>

> On Sun, Nov 25, 2012 at 9:25 PM, Rodrigo Lovera <lobo.theslayer at gmail.com>wrote:
>
>> start, as soons as I open th executable it just crashes... but when I add
>> the code line to open a vtkrender windows it appears with
>
>
> Please provide the smallest possible compilable example of this (relying
> on no external data, etc).
>
> David
>



-- 
*Rodrigo aka WarHearT*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121125/abbd731d/attachment.htm>


More information about the vtkusers mailing list