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

Luis Ibanez luis.ibanez at kitware.com
Thu May 25 22:05:15 EDT 2006


Hi Niloofar,


Please look at the examples:

      InsightApplications/
              Auxiliary/vtk/
                 itkReadITKImage3DSegmentShowVTK.cxx
                 itkReadITKImageSegmentShowVTK.cxx
                 itkReadITKImageShowSplineVTK.cxx
                 itkReadITKImageShowVTK.cxx


They illustrate how to combine ITK and VTK in order
to process images with ITK and visualize them with VTK.


    Regards,


       Luis



========================
Niloofar Gheissari wrote:
> 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();
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 




More information about the Insight-users mailing list