vtkcutter with vtkimagereslice does not consider extent

Hi everybody

I would like an stl or polydata overlay an vtkimagedata. The problem i found is that the transform in vtkimagereslice does not consider the extent. So i use vtkcutter properly to compute the cut of the stl or polydata but the data is not projected unlike vtkimagereslice. It is in 3d in the cut orientation. So i apply the inverse transformation of the vtkimagereslice that i apply to create the vtkimagedata but it is not working in all cases.

So if i have a euclidean vector in a positive direction (e.g, ->) the polydata can be projected propertly. But if the euclidean vector is on the opposite way (e.g <-) so the image is reversed the polydata stays in the same place as if the data was in the opposite direction (->)

What i did to solve this was to reslice the polydata by myself using rays from a certain height of the center point and increasing points where the euclidean vector increases and decreasing on the opposite direction on the other side of the center point. But this is slow and i have to deal with the order when one line intersects with two points. And i can have error in difficult shapes.
So my algorithm would be
x=— c-spacing[0]*2, c-spacing[0] <- center of the slice -> x= c+spacing[0], c+spacing[0]*2…

So i wonder if there is any way to apply the same transformation of vtkimagereslice to the polydata without doing this which is not efficient.


I have realized the x is correct what it is wrong is y (even if i flip it). Someone had the same issue to overlay stl with vtkimagedata?

I solved it making a translation to the center point y (with value-z) after applying the transformacion of reslice of the original polydata but i would like to understand why vtkimagreslice transform does not transform propertly the stl. If someone has any idea, it would be very helpful.

Thank you