RAS coordinates to Image coordinates

Operating system: macOS Big Sur 11.0.1
Slicer version: 4.10.1

Dear Developers and Users,

I have a lot of fiducial markup points in the RAS Coordinates System, as can be seen in the screen capture, for example X’5 :arrow_right: R: -33.594 A: 15.622 S: 16.020

I want to obtain their coordinates in the Image Space, and associate them with the labels from the volume called ‘aseg’ in the scene (as can be seen in the Data Probe tab). This volume contains the exact area of the brain where each fiducial markup is located.

Basically, what I need to do is to automatically relate the position of all Fiducial Markups with the information of this ‘aseg’ volume. So, for example, the outcome for this point X’5 should be something like:

X’5: RAS: [-33.594, 15.622, 16.020] IMAGE: [158, 111, 142] LABEL: Left-Putamen

Please guide me, I really need some help.
Best regards.

See the code here that takes into account image geometry and all linear/warping transformations applied to the volume and fiducial list: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_volume_voxel_coordinates_from_markup_fiducial_RAS_coordinates

Thanks for your response,

I’ve already tried this approach and the output is a single matrix ([203, 128, 161] in my case). But I don’t know what this result means, as according to the documentation this should be the voxel coordinate of a volume corresponding to a markup fiducial point position. As input, I’ve introduced the complete Markup List (containing 38 Markups), shouldn’t the output be a list too?

Sorry if my question is too ignorant, I’m new to Slicer and Image Transformations.
Thanks again for helping me.

This is correct.

This is the voxel coordinate of a single point. The point index specified in the markupsIndex variable.