InsightSoftwareConsortium / InsightSoftwareConsortium/itkwidgets

itk orientation vs vtk orientation display

Open
#436 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
624
Forks
83
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have a segmented image using itk pipeline. For the display in itkwidgets, I used itk-vtkglue lib and used a marching cubes to display only the segmented surface. But when I display both itk image and segmented surface, they are not in the same orientation.

````python
import itk
import vtk
from itkwidgets import view

itk_image = itk.imread(PATH_TO_SEGMENTATION)
vtk_image = itk.vtk_image_from_image(itk_image,)

marching_cubes_filter = vtk.vtkDiscreteMarchingCubes()
marching_cubes_filter.SetInputData(vtk_image)
marching_cubes_filter.SetNumberOfContours(1)
marching_cubes_filter.SetComputeNormals(1)
marching_cubes_filter.GenerateValues(1,1,1)
marching_cubes_filter.Update()

view(vtk_image, geometries={"vessel":marching_cubes_filter.GetOutput()}) # Alignement between image and polydata is ok
view(itk_image, geometries={"vessel":marching_cubes_filter.GetOutput()}) # 90° orientation missmatch
````
I have tried to use the OrientImageFilter to check if the images were not in RAS (change from LPS to RAS) but it is not the case.

Not sure also if the problem is with itkwidgets? or with itk-vtkglue? or (more probably) with my understanding of image orientation?
For example, when I code myself the transformation from itk to vtk, it seems that providing the direction cosine produce a wrong alignment also. To reproduce the result of itk-vtkglue, I have to use only extent, spacing and origin.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.