How do I get the intersection point of an MRI image and a straight line in space?

I used vtkImageReslice to cut a series of MRI images(dicom format), and I got the cut reslice result as an vtkImageData in 3D space. There was another straight line in the 3D space.

How could I get the intersection point of the reslice result(MRI image) and the straight line?

I think I should first adjust the position and orientation of the slice result data set to the pose I want, but I don’t know how to adjust the pose of the imageData data set.

or should I convert vtkImageData to other format,then do the next step?

any advices would be helpful,thansk!

I’m not exactly sure what you mean by “I got the cut reslice”. If you mean a single 2D slice of the MRI image in a certain orientation, you can use a point on that slice and its orientation to set the origin and the normal of a vtkPlane respectively, and then use the IntersectWithLine method to find the intersection point.

There is even a static method for this so you don’t even need to instantiate vtkPlane
See VTK: vtkPlane Class Reference

hi, somso, thanks for your reply.

yeah ,I got a single 2D slice of MRI image.
anther info is that the line and the 2D MRI image are in the same plane. So I think it’s not the right way to use vtkPlane’s IntersectWithLine method.

I have anther idea: should I get the edge contour line of the 2D MRI image and then use some Locators to get the instersection point?

would that way be workable?

thanks.

Add info : the line and the 2D MRI image are in the same plane

May I ask what you are trying to achieve with this? I might be a better help if I know what’s the purpose of this.
Are you trying to extract the voxels which the line intersects with or do you just want the indices of the voxels or something else?

I try to get the isntersection point 's position.
and get the distance between isntersection point and another point