Put mrTools-4.0 in your matlab path. Remove eveything else from your path to be sure that there are no conflicting functions. My startup.m looks like this:

addpath(genpath('/heegerlab/mrTools-4.0'));
setpref('mrLoadRet','site','NYU');
setpref('mrLoadRet','verbose',1);
setpref('mrLoadRet','interpMethod','nearest');
setpref('mrLoadRet','niftiFileExtension','.img');

Note the preferences specified by setpref (soon to be documented below).

Run matlab and cd to the sample data directory (mrTools-4.0/testData). This is a simple synthetic dataset that consists of a 16x16x16 spherical brain with one active voxel in a block alternation protocol (4 cycles/scan). There are 3 synthetic scans. The first one has the active voxel at location (8,8,8). The "subject" moved between the first scan and the second scan so it is at location (9,9,9) in scan 2. The "subject" moved in the middle of scan 3 so without motion compensation, there is modulation at (8,8,8) for the first half of the run but then at (9,9,9) for the second half.

Type mrLoadRet at the matlab prompt.

Use the overlay popup near the bottom to switch between the co, amp, and ph overlays. Note that the overlay min, overlay max, and alpha (transparency) sliders update themselves when you switch overlays (e.g., if you set the cothresh at 0.3 and the ph max to pi).

Groups replace what was called dataTypes in mrLoadRet-3. In addition to the "Raw" group, there are two other groups in this dataset:

Inspect some of the data structures:

Some of my primary goals were to separate the viewer from the analysis, make the analysis modular, and keep the analysis parameters with the results of the analysis. So far, I have prototypes of corAnal, averageTSeries, and motionComp but that's enough to give you the idea. The parameters that were used for the analysis are in MLR.views{1}.analysis{1}.params(1). You can redo exactly the same analysis by typing:

or by choosing "View/Modify Params & Recompute" from the Analysis menu.

You can do the corAnal from scratch by typing:

Note that the first line opens a separate GUI for corAnal. The idea is that each analysis has its own separate GUI like this one that simply allows the user to set the parameters (i.e., it doesn't do the analysis). Each analysis has a function (like the corAnal function here) that takes two arguments: a view and the parameters structure returned by the corresponding GUI.

To start from scratch:

Look through the various menus and try some stuff. Under the window menu, you can open another volume view. Under the Edit menu, you can copy/paste scans from one group to another, delete scans from a group (but note that it doesn't yet rm the corresponding tseries file), and copy/paste ROIs from one view (window) to another. From the Edit menu, you can edit an overlay to change its colormap. The View menu allows you to get rid of stuff (remove analyses, remove base anatomies, etc).

Not all the features are implemented yet so some of the menu items will not execute.

Run it on a real dataset. Pick one of your datasets (e.g., from a retintopy scanning session). To get started, all you need are the original time series files (nifti format) as they come off the scanner in a subdirectory call "Raw/TSeries". Then run mrAlign, mrLoadRet and mrInitRet as above. Note that you should run mrAlign (version 4.4) first so that the data are registered to the high res volume anatomy (to do so, see the documentation in the mrAlign-4.4 directory).

One nice feature of mrLoadRet-4.0 is that there is no longer a distinction between the inplane and volume views. If the data have been aligned with mrAlign, then you can load any number of base anatomies and mrLoadRet will use the alignment information to properly superimpose the overlays on whatever base anatomy is currently selected. Try this by loading the inplanes and the high res volume from your dataset, while displaying the corAnal maps. Then try loading one of the EPI runs as the base anatomy - mrLoadRet recognizes that it is a 4D file and asks you if you want to use the mean (over time) or the first frame.

Programming conventions (partial list)

To begin, take a look through the code in the following functions:

In fact, you could read through all of the code because there's not that much. The GUIs have all been made using guide.

  1. Always use viewGet and viewSet for accessing fields. Never use view.fieldname. viewSet is designed to properly side-effect the global variable, not just the local copy. Note that viewGet and viewSet assume defaults (e.g., the current view) for some fields.

  2. Use mrMsgBox, mrErrorDlg, mrWarnDlg, mrWaitBar, and mrCloseDlg to give messages and errors to the user. These functions switch of the 'mrLoadRet' 'verbose' preference. If the preference is off (not defined or defined to be 0) then the messages go to the matlab window instead of opening dialog boxes. Verbose preference also determines if user is queried about overwriting a file. Very useful for running scripts that are intended to be non-interactive.

  3. Disclaimer: There are plenty of bugs and plenty of unimplemented features. But I am hoping that this is enough for you to get started. Glance at todoMLR.txt for a partial list of what I'm planning to do next.