Convert 3D Slicer index to word coordinate

Hi,
I am trying to convert 3D Slicer index to world coordinate but not sure if I am doing it correctly.
Here is the explanation from Slicer tutorial which is vague.

To extract the “voxel to world” transformation matrix from the NIFTI file’s header (entry: qto_xyz:1-4 ) in Matlab:

d=inv(M) *[ R A S 1 ]’

where M is the matrix and R A S are coordinates in Slicer, then d gives a vector of voxel coordinates.

(Solution courtesy of András Jakab, University of Debrecen

Particularly I am not sure where to find qto_xyz in the header. When I load nifti file in Matlab using load_untouch_nii or built-in nifti_info(‘file.nii’), there is no qto_xyz. Also it is not clear what is M matrix.
Can you please guide me through this process?

I can extract affine matrix then multiply it with the indexes to get world coordinates. However, the issue is that the indixes that I get from Slicer is different than the one I get from BrainSuite for the exact same location.
My goal is to find corresponding points (in physical unit or world coordinates) to do point-based registration.

Your help is very much appreciated!

Operating system: Windows
Slicer version: 4
Expected behavior: Good
Actual behavior: Good

The topic of coordinate conventions in nifti and matlab are a bit beyond the scope of Slicer, since different software and script sometimes contradict each other. For Slicer the conventions are described here and the script repository has examples to go back and forth.

You should be able to use Slicer with the DataProbe and Volumes module to see all the coordinate systems and matrices and then save the file in nifti, open in matlab to learn the correspondences.

Can you include the link to the tutorial? Perhaps when this gets sorted out you can suggest clarifications.

Thank you for your response and pointing me to the script repository with examples.
Would be happy to suggest clarification once this is sorted out.

Here is the link to the tutorial (bottom of the page, Relations to other software / conventions:
https://www.slicer.org/wiki/Coordinate_systems

Note that voxel coordinates are not portable between applications, because each application is free to choose how to map IJK indices to physical positions (origin of an image can be top-left, bottom left, center voxel; first index may be fastest or slowest changing index; etc.).

Therefore, if you want to share point positions between applications, always use physical coordinates (which is most commonly LPS in medical imaging).