Markups misalignment with the volume

SANTIAGO_PENDON_MING
Thu, 12 Feb 2026 12:12:31 +0000
Support

Hi to everyone. I’m using this script to extract the pointCloud positions in IJK system:

def RAStoIJK(xyz, volumeNode, RAS = True):
    """
    Transforms a list of points or np array of shape (n,3) in RAS coordinates
    to IJK coordinates.

    :xyz: list of lists (Ex: [[1,2,3], [4,5,6]]) or np array with the RAS coordinates
            of the points.
    :volumeNode: node of the reference images
    :RAS: True if coordinates are in RAS coordinate system (could be LPS)
    """

    transf = vtk.vtkMatrix4x4()
    volumeNode.GetRASToIJKMatrix(transf)

    transf = arrayFromVTKMatrix(transf)

    correccion = np.array([1, 1, 1]) if RAS else np.array([-1, -1, 1])

    puntos_malla = np.hstack((xyz*correccion, np.ones(len(xyz)).reshape(-1, 1))).T

    puntos_ijk = np.round(transf.dot(puntos_malla)).astype(int).T[:, :-1]

    return puntos_ijk # Coordenadas en la matriz (vóxeles)



volumeNode = getNode("resliced")

points = array('pointCloud_left')

points_ijk = RAStoIJK(points, volumeNode)

import numpy as np

np.save("points_ijk.npy", points_ijk)

volume = arrayFromVolume(volumeNode)

np.save("volume.npy", volume)

And in the scene I see:

but when I use this data outside:

I used to extract data with this code several times and this is the first time that something like this happens. The scene can be found in: https://drive.google.com/file/d/1CiSP08h5oVePyaFyIzsggmpPjy1tQn-5/view?usp=drive_link

2 posts - 2 participants