Operating system: Windows 10
Slicer version: 4.10.2
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 …
You can get voxel coordinates from physical (RAS) coordinates from the volume’s IJK to RAS matrix, as shown in this example:
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
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.
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.
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 (slide 48).
There are also lots of examples to learn from: Slicer core, all the extensions, and the script repository.