Video summary
The video introduces MGL, a MATLAB toolbox developed by researchers who were previously frustrated with the slow development pace of S-Toolbox before Mario Kleer took over. This new library functions similarly to the original Toolbox Base Library but offers significantly improved documentation and examples accessible via an R package on its website. A key component distinct from standard toolboxes is the Task Library, which simplifies the prototyping and execution of experiments involving fMRI segments within TRI. Users can define trial parameters such as segment timing and randomization requirements through a few lines of code, while writing simple callback functions to handle screen displays and subject responses; once configured, the library automatically manages data saving, integration with trackers and scanners, and overall experimental flow.
MGL is deeply integrated with other tools originating from Mandell's lab at Stanford, specifically the M-Tools package used for electrophysiology analysis, resting-state connectivity measurements, and related tasks. This ecosystem allows researchers to run experiments where all variables and timing data can be exported seamlessly into these analytical packages. The development team also addressed Apple's decision to deprecate OpenGL in favor of Metal by creating a new version of MGL that utilizes this low-level graphics programming language. From the user's perspective, the MATLAB interface remains unchanged, but under the hood, it connects to custom applications built on Metal, enabling advanced capabilities like high-bit-depth color displays and precise rendering control that were previously difficult or impossible with standard OpenGL implementations.
The most exciting advancement highlighted is a community project led by programmer Ben aimed at achieving more accurate timing using Metal's specific advantages. Unlike traditional graphics pipelines where frame drops might go unnoticed until after the fact, Metal provides timestamps for every moment within the rendering pipeline. The video demonstrates how this allows researchers to detect exactly when frames are dropped or delayed during display updates, even down to the level of fragment and vertex encoders. This precision is crucial for analyses involving white noise or other sensitive temporal metrics, ensuring that any interruptions in frame reporting can be accurately identified and accounted for without compromising data integrity.
Read the full video transcript
so I'm here to introduce mjl to you so
mjl is toolbx quite similar in some
respects Ty toolbox in fact a bunch of
us who were postto in David Ker's lab um
had were a little bit frustrated with
development on site to before Mario
kleer took it over for Eli Mar and here
well worked on this and we were just
supporting just wed to have an interface
from mapb that we could use on OS um and
the library Works in in some sorts very
similar just like toolbox The Base
Library here which um has very simple
commands that abstract um original
version openl functions so just
something before in few code um it has a
sensive amount of documentation which we
created over the years which you can
find with the following rki which has
examples and of different things that
you might want to be able to do and you
can download it from that book site as
well um the other piece of the library
which is bit different from SE toolboxes
there's a task Library the library is
built on top of mgl and the idea of the
task library is to make it easy to
prototype and run experiments where you
have fs and segments within Tri again
there's a lot of documentation about how
to use that give you a flavor of how it
works is that there is um few lines of
code that you will set up that tells you
about like what the segments and timing
of a trial or the parameters that you
might have that you want to randomize
over and how and when you want to
require subject responses and then you
write on very simple callback functions
like what you want to do when you want
the screen to display something how you
want display displays and what you want
to do like when a subject responds to
particular part of um this Tas Library
so and then the rest of test library
takes care about the rest of it in terms
of timing keep saving all the data and
integrating with it trackers and the M
scaners um the this uh mgl library is
the integrated with another set of tools
that originated in mandell's lab at
Stanford Vista thater took to myu called
Mr tools and Mr tools is a package for
doing EP analysis res chy prf
measurements back related things andg
libraries highly integrated with that so
when you run experiment with mgl you can
export all the different variables and
timing tools and be able to run
run um so uh a few years ago some of you
may know uh Apple decided to uh
deprecate openg standard Graphics that
like toolbox andl others have been using
um in favor of a library called metal
and metal is Apples version of a
lowlevel graphics programming language
um we decided that we would try and see
what we could do with that um and so we
built a new version of mgl which uses
the same function so from the mat lab
point of view nothing has changed but um
underneath we connect to an application
that we built and developed that's based
on metal metal advantages of metal is
that it really allows you to do
programming on the graphics card level
way that Apple specified with the
library so many things are are possible
that a few things that we've done is you
know for example some of these things
took a long time for Apple to be able to
get with everybody else and have high
bit depth displays where you can have
more than eight bits for color channels
you can do this quite Rec the the thing
that we're most excited about now is um
wor the
DJ has been supporting us Community
project with support of than GLE is a
programmer um is in trying to get more
frin accurate timing using metal so one
of the real advantages of metal it gives
you time sents for every uh every moment
within your graphics rendering pipeline
that are highly accurate so this is just
depiction of things that Ben has been
working on so right on display where
we're just randomly join polygon
I'm looking at the timing um there's a
lot that's being shown on this but you
see the different fragman encoders and
verx encoders that it takes to do that
and especially important is the Tim that
it takes to render the frame and you con
see particularly when um there might be
a drop in the frame is reported so in
this example here there's one frame
that's being dropped and you actually
get reported values that are quite
accurate about that so if you do happens
in this Frame and that's important to
you because they Anis or white noise
kind of analysis dur able to to know
that that happened and then be able to
that that's it thanks