# Transform matrix and image coordinates for .fcsv files

**URL:** https://discourse.slicer.org/t/transform-matrix-and-image-coordinates-for-fcsv-files/12249
**Category:** Support
**Created:** [June 27, 2020, 11:53pm UTC](https://discourse.slicer.org/t/transform-matrix-and-image-coordinates-for-fcsv-files/12249 "2020-06-27T23:53:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![FatihSogukpinar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fatihsogukpinar/32/7257_2.png) [@FatihSogukpinar](https://discourse.slicer.org/u/FatihSogukpinar)
#### Post date: [June 27, 2020, 11:53pm UTC](https://discourse.slicer.org/t/transform-matrix-and-image-coordinates-for-fcsv-files/12249/1 "2020-06-27T23:53:09Z")

</div>

Operating system: Windows 10  
Slicer version: 4.10.2

Hi all,

In Slicer I have an atlas and a .fcsv file. I need to get coordinates of .fcsv file in the image coordinates from Slicer to Matlab (and also the anatomical regions to which these points correspond). So basically I need the transform matrix for the .fcsv file, so that I can also transform the coordinates in Matlab and explore the locations.

How can I get the matrix from Slicer ?

And also, is there a way to get the anatomical locations directly from Slicer to Matlab ?

Thank you so much !

PS: I am new to Slicer …

---

<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: [June 28, 2020, 12:02am UTC](https://discourse.slicer.org/t/transform-matrix-and-image-coordinates-for-fcsv-files/12249/2 "2020-06-28T00:02:40Z")

</div>

You can get voxel coordinates from physical (RAS) coordinates from the volume’s IJK to RAS matrix, as shown in this example:  
[https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get\_volume\_voxel\_coordinates\_from\_markup\_fiducial\_RAS\_coordinates](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Get_volume_voxel_coordinates_from_markup_fiducial_RAS_coordinates)

You can get IJK to RAS matrix in Matlab by reading the exported nrrd file using this reader: [https://github.com/PerkLab/SlicerMatlabBridge/blob/master/MatlabCommander/commandserver/nrrdread.m](https://github.com/PerkLab/SlicerMatlabBridge/blob/master/MatlabCommander/commandserver/nrrdread.m)

However, I would strongly recommend to move on from Matlab to Python. Python has so much more libraries, several magnitudes more developers, it is also a generic programming language that you can use to implement complete solutions. Python is also free, so you can use it after you finish your studies (Matlab commercial licenses are so expensive that companies rarely use it). Whatever you develop you can easily deploy it to end users if you use Python, as there are no licensing issues. You also have a full Python environment within 3D Slicer, so you can do all your processing within one application. You can also run all Slicer features in Python, customize the application and add new modules using Python scripting.

---

<div class="post-metadata">

### Author: ![FatihSogukpinar](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fatihsogukpinar/32/7257_2.png) [@FatihSogukpinar](https://discourse.slicer.org/u/FatihSogukpinar)
#### Post date: [July 1, 2020, 6:12am UTC](https://discourse.slicer.org/t/transform-matrix-and-image-coordinates-for-fcsv-files/12249/3 "2020-07-01T06:12:49Z")

</div>

Thank you so much Andras ! This was really helpful and I was able to solve most of my problems by the Python interface.  
Now I have further questions about Python scripting. For example, I want to load fiducial lists, use more python libraries, etc. Is there a detailed documentation which you can recommend me for all these python features ?

Thank you so much.

---

<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: [July 1, 2020, 1:11pm UTC](https://discourse.slicer.org/t/transform-matrix-and-image-coordinates-for-fcsv-files/12249/4 "2020-07-01T13:11:41Z")

</div>

Yes, everything is quite thoroughly documented. The only caveat is that you need to look for documentation of each library (Slicer core, VTK, CTK, Qt, ITK, …) at a different location. You can find a link to each library in this [programming tutorial](https://github.com/PerkLab/PerkLabBootcamp/blob/master/Doc/day3_2_SlicerProgramming.pptx?raw=true) (slide 48).

There are also lots of examples to learn from: [Slicer core](https://github.com/Slicer/Slicer), all the [extensions](https://github.com/Slicer/ExtensionsIndex), and the [script repository](https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository).
