OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Different points after conversion from SITK image to VTK Image

  • Thread starter Thread starter bkusuma
  • Start date Start date
B

bkusuma

Guest
I am trying to convert a SITK image with its corresponding spacing, origin, and direction metadata into a VTK Image, with a conversion to a Numpy array in between.

However, when I try to grab a point within the VTK image (for reference, ( 0, 0, 0 ) ), I am finding a discrepancy in where that point is located. Is there something that I'm not doing properly when converting to the VTK image?

Code:
image = vtkImageData()
image.SetDimensions( sitkDimensions )
image.SetSpacing( sitkSpacing )
image.SetDirectionMatrix( sitkDirectionMatrix )
image.SetOrigin( sitkOrigin )
image.GetPointData().SetScalars( numpy_to_vtk( array.ravel() ) )
image.Modified()

When I print the spacing, origin, and direction matrix, they are the same between SITK and VTK, so I am really confused as to where I went wrong.
<p>I am trying to convert a SITK image with its corresponding spacing, origin, and direction metadata into a VTK Image, with a conversion to a Numpy array in between.</p>
<p>However, when I try to grab a point within the VTK image (for reference, ( 0, 0, 0 ) ), I am finding a discrepancy in where that point is located. Is there something that I'm not doing properly when converting to the VTK image?</p>
<pre><code>image = vtkImageData()
image.SetDimensions( sitkDimensions )
image.SetSpacing( sitkSpacing )
image.SetDirectionMatrix( sitkDirectionMatrix )
image.SetOrigin( sitkOrigin )
image.GetPointData().SetScalars( numpy_to_vtk( array.ravel() ) )
image.Modified()
</code></pre>
<p>When I print the spacing, origin, and direction matrix, they are the same between SITK and VTK, so I am really confused as to where I went wrong.</p>
 

Latest posts

J
Replies
0
Views
1
jbowerbir
J
Top