0
votes

I'm trying to read a DICOM image with ITK reader then convert it into vtkimagedata for rendering.

As I convert ITK image with "itk::ImageToVTKImageFilter" and render it in vtkrenderwindow, the origin of this volume is set at center of this volume. How can I do to set the coordinate of render window same to the DICOM image?

Here's my code:

vtkSmartPointer<vtkImageData> vtkImg = ITKconnectVTK(itkImg);

vtkSmartPointer<vtkImageData> ITKconnectVTK(ImageType::Pointer inputImg)
{
    ConnectorType::Pointer connector = ConnectorType::New();
    connector->SetInput(inputImg);
    connector->Update();

    return connector->GetOutput();
}
2

2 Answers

0
votes

You can read the direct dicom series in the VTK, and if you need some filter send the image to itk and then get it again.

reading with vtk: https://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/ReadDICOM

convert from itk to vtk: https://itk.org/Wiki/ITK/Examples/IO/ImageToVTKImageFilter

convert from vtk to itk https://itk.org/Wiki/ITK/Examples/Broken/Images/VTKImageToImageFilter

you need to enable itkvtkglue in itk for this.