[vtkusers] Oblique slicing without vtkResliceImageViewer

chasank chasank at gmail.com
Tue Jun 11 10:24:59 EDT 2013


Hi,

We have used this following pipeline in our former project for
visualization. Now, we need to add oblique slicing feature to our project.
However, we do not want to use vtkResliceImageViewer class to implement this
feature. How can we implement this feature without vtkResliceImageViewer? Do
you have any suggesstions?

    this->sagittalRenderer = vtkSmartPointer < vtkRenderer > :: New();
    this->sagittalRenderWindow = vtkSmartPointer < vtkRenderWindow > ::
New();
    this->sagittalInteractorStyle = vtkSmartPointer < InteractorImage > ::
New();

    this->sagittalRenderWindow->AddRenderer(this->sagittalRenderer);
    this->sagittalInteractorStyle->AutoAdjustCameraClippingRangeOn();

    vtkSmartPointer<SagittalEventCallBack> sagittalCallBack =
vtkSmartPointer<SagittalEventCallBack>::New();
    sagittalCallBack->SetRegionGrow(this);

    this->sagittalInteractorStyle->AddObserver(vtkCommand::WindowLevelEvent,
sagittalCallBack);
   
this->sagittalInteractorStyle->AddObserver(vtkCommand::StartWindowLevelEvent,
sagittalCallBack);
   
this->sagittalInteractorStyle->AddObserver(vtkCommand::ResetWindowLevelEvent,
sagittalCallBack);

    this->sagittalIren = vtkSmartPointer < vtkRenderWindowInteractor > ::
New();
    this->sagittalIren->SetInteractorStyle(this->sagittalInteractorStyle);
    this->sagittalIren->SetRenderWindow(this->sagittalRenderWindow);
   
this->mainWindow->GetUI()->sagittalWidget->SetRenderWindow(this->sagittalRenderWindow);

    int *ext = this->backupData->GetWholeExtent();

    this->sagittalActor = vtkSmartPointer < vtkImageActor > :: New();
    this->sagittalActor->SetInput(this->imgBlender->GetOutput());
    this->sagittalActor->SetOpacity( 1.0 );
    this->sagittalActor->SetDisplayExtent(ext[1]/2, ext[1]/2, ext[2],
ext[3], ext[4], ext[5]);

    this->sagittalPicker = vtkSmartPointer < vtkPropPicker > :: New();
    this->sagittalPicker->PickFromListOn();
    this->sagittalPicker->AddPickList(this->sagittalActor);

    vtkSmartPointer<SagittalROICallBack> roiCallBack =
vtkSmartPointer<SagittalROICallBack>::New();
    roiCallBack->SetRegionGrow(this);

    double *center = this->backupData->GetCenter();

    this->sagittalTracer = vtkSmartPointer<vtkImageTracerWidget>::New();
    this->sagittalTracer->SetInteractor(this->sagittalIren);
    this->sagittalTracer->SetViewProp(this->sagittalActor);
    this->sagittalTracer->GetLineProperty()->SetLineWidth(5.0);
    this->sagittalTracer->GetLineProperty()->SetColor(0, 0, 1);
    this->sagittalTracer->SetProjectionNormalToXAxes();
    this->sagittalTracer->SetHandlePosition(0, center[0], center[1],
center[2]);
    this->sagittalTracer->AddObserver(vtkCommand::EndInteractionEvent,
roiCallBack);
    this->sagittalTracer->Off();

    this->sagittalRenderer->AddViewProp(this->sagittalActor);
    this->sagittalRenderer->AddActor2D(this->colorBar);

    // ORIENTATION_YZ = 0
    this->sagittalCamera = this->sagittalRenderer->GetActiveCamera();
    this->sagittalCamera->SetFocalPoint(0.0, 0.0, 0.0);
    this->sagittalCamera->SetPosition(1.0, 0.0, 0.0);
    this->sagittalCamera->SetViewUp(0.0, 0.0, 1.0);
    this->sagittalRenderer->ResetCamera();

    this->sagittalIren->Initialize();
    this->sagittalRenderWindow->Render();

Sincerely.



--
View this message in context: http://vtk.1045678.n5.nabble.com/Oblique-slicing-without-vtkResliceImageViewer-tp5721315.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list