[Insight-users] visualising MRI images using vtkActor and vtkDataSetMapper

Niloofar Gheissari Niloofar.Gheissari at anu.edu.au
Thu May 25 01:39:11 EDT 2006


Hi,

I am new to vtk. I have some mri images in the hdr/img format. I use the 
following code to connect an ITK   image to VTK and visualise it.  What 
I get in the  visualisation toolkit window makes sense to some extend 
but has very horrible quality. The colour is terrible and data points 
are messy.  How can I fix it? Is there any other property in vtkactor I 
need to set?


............................
 // Connect ITK -> VTK

    typedef itk::ImageToVTKImageFilter< InputImageType >
        ImageToVTKType;

    ImageToVTKType::Pointer bridge = ImageToVTKType::New();

    bridge->SetInput( blur->GetOutput() );

    // Viz

    vtkContourFilter *contour = vtkContourFilter::New();
    contour->SetInput((vtkDataSet *) bridge->GetOutput());
    contour->SetValue(0, isoLevel );


    vtkDataSetMapper* isoMapper = vtkDataSetMapper::New();
    isoMapper->SetInput(bridge->GetOutput());
    isoMapper->ScalarVisibilityOn();

    vtkActor* actor = vtkActor::New();
    actor->SetMapper(isoMapper);
    actor->GetProperty()->SetDiffuseColor(0,0,0);
    actor->GetProperty()->SetColor(255,255,255);   
   
    reader->Update();

    renwin->AddRenderer( ren );
    ren->SetBackground(0,0,0);
    ren->AddActor(actor);
    iren->SetRenderWindow(renwin);
   
    // Main program event loop

//Niloo
    renwin->Render();
    iren->Initialize();

    iren->Start();


More information about the Insight-users mailing list