# Markups misalignment with the volume

**URL:** <https://discourse.slicer.org/t/markups-misalignment-with-the-volume/46137>\
**Category:** Support\
**Tags:** python\
**Created:** [February 12, 2026, 12:12pm UTC](https://discourse.slicer.org/t/markups-misalignment-with-the-volume/46137 "2026-02-12T12:12:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SANTIAGO\_PENDON\_MING](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/santiago_pendon_ming/32/66060_2.png) [@SANTIAGO\_PENDON\_MING](https://discourse.slicer.org/u/SANTIAGO_PENDON_MING)\
**Post date:** [February 12, 2026, 12:12pm UTC](https://discourse.slicer.org/t/markups-misalignment-with-the-volume/46137/1 "2026-02-12T12:12:32Z")

</div>

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

```auto
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:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/a/bafd6a142f2325da197292bbaed16f03c0475c75.jpeg)

but when I use this data outside:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/3/93a67a22fc2d08b9e9807c2fdc64c47230712262.jpeg)

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](https://drive.google.com/file/d/1CiSP08h5oVePyaFyIzsggmpPjy1tQn-5/view?usp=drive_link)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [February 14, 2026, 4:47am UTC](https://discourse.slicer.org/t/markups-misalignment-with-the-volume/46137/2 "2026-02-14T04:47:56Z")

</div>

If the volume’s IJK axes are not forming a right-handed coordinate system then Slicer reorders the voxel indices when the volume is loaded. I would recommend to always use physical coordinates in files, because applications can freely choose memory layout when they loading a volume, but physical position of objects will always be the same.

To confirm that this voxel reordering causes the problem for you: save the updated volume after loading it into Slicer and use that (instead of the original input volume).
