help > Updating render with script from command line
Showing 1-2 of 2 posts
Results per page:
Apr 26, 2021  08:04 AM | jontep
Updating render with script from command line

The idea is to use MRIcoGL with Matlab via scripts to render an overlay in subject space. This overlay will be updated with coordinates from a neuronavigation equipment whenever it receives a trigger signal and each time, I would like Matlab to update the MRIcroGL rendering via a script.

However, I can only figure out how to create a new window for each update to the rendered image. Is it possible to run a script from command line that acts on the currently running instance of MRIcroGL?

Hope this question makes sense.

Best regards,
Apr 26, 2021  11:04 AM | Chris Rorden
RE: Updating render with script from command line
The coordinates can be updated (assuming MRIcroGL is in 'Yoked' mode, via script or the 'Display' menu) and read. The details of this method are documented here
For Unix (Linux and MacOS) you would use a shared memory file
For the Windows operating system, MRIcroGL uses memory mutexes, which do not seem to be supported anymore
The shared file is tiny, with one int32 and 5 float32 values. I think they are self explanatory. The integer "Instances" should reveal the number of actively running copies of MRIcroGL. When MRIcroGL quits, it decrements this value and if the reference count reaches zero MRIcroGL will delete the shared file.

TShareMem = record
Instances: integer;
Xmm,Ymm,Zmm, Azimuth, Elevation: single;