justingardner / mrtools Goto Github PK
View Code? Open in Web Editor NEWmrTools - matlab based tools for fMRI
Home Page: http://gru.stanford.edu/mrTools
License: Other
mrTools - matlab based tools for fMRI
Home Page: http://gru.stanford.edu/mrTools
License: Other
Hi all,
I was wondering if there were a set of scripts that take data processed in the vistaTools to mrTools? The key thing I would like to transport is the alignment parameters.. mrTools does this very nicely however its a little cryptic what mrVista is doing.
Thanks!
Should allow you to select which ROI you want to use to subselect which fascicles to display, etc...
Hello,
I just came across a problem with how mrTools names time-series files it creates. I wrote an mrLoadRet analysis that separates interleaved frames and writes them to two separate files. The problem arose because the files get written quite fast after one another and some end up being written with the same file name as the preceding one (because the filename is a timestamp in seconds) and overwrites it.
I fixed this in my analysis function by adding a on-second pause between files, but I think there should be a more general fix at a more basic level (for isntance by adding a millisecond timestamp, or by forcing a one-second pause in saveNewTSeries.m?).
I don't have time to do it now, but I can look into it when I get a chance. I just thought I'd share the issue so it doesn't happen to others.
yay! another matlab upgrade problem. the function select3d()
can't access the undocumented axis properties on lines 329 onwards.
Happens when a surface is loaded as base
and mrInterrogator
running (on mouseMoveHandler()
events).
xform = get(ax,'x_RenderTransform');
offset = get(ax,'x_RenderOffset');
scale = get(ax,'x_RenderScale');
These properties got deprecated in latest release. It doesn't look like there's an obvious fix but the same info might be (apparently?) wrapped up inside a property called DataSpace
. Still need to check this.
http://undocumentedmatlab.com/blog/customizing-axes-part-4-additional-properties`
Hi all,
I was wondering if there is a tool to import flat meshes made in freesurfer to mrTools?
If not I'll be happy to share this code when I write it up :)
Cheers!
Kevo.
This gets set from mlrLifePlugin - should add ROI create items that allow you to make for example an ROI plane in the axial dimension or whatever.
Needs retinotopy, surfaces from freeSurfer (converted to mrTools using mlrFreeSurfer whatever it is called) a T1 anatomy and dt6 images and fascicles
The fullcrosshair
mouse pointer is deprecated in R2014b. Trying to use it causes a warning and then sets the pointer to crosshair
. atmo, this only occurs in 3 files in the mrTools code:
mrSearchHelp('fullcrosshair')
---------------------------------------------------------------------------
talairach.m:102: set(gTalairach.fig(a(1)),'pointer','fullcrosshair');
talairach.m:407: set(gTalairach.fig(1),'pointer','fullcrosshair');
talairach.m:408: set(gTalairach.fig(2),'pointer','fullcrosshair');
talairach.m:409: set(gTalairach.fig(3),'pointer','fullcrosshair');
mrInterrogator.m:133: set(MLR.interrogator{viewNum}.fignum,'pointer','fullcrosshair');
mlrVol.m:131: set(gcf,'Pointer','fullcrosshair');
---------------------------------------------------------------------------
Using crosshair
instead fixes this (but at the cost of not having the nice cross hairs).
Error can be consistently re-created in s031020150815 in mlrAnatDB. Generate rV1 and rV2v ROIs on s0310_right_occipital_r90 flat, select a different base anatomy (e.g. (s0310_left_occipital_r90), convert cortical depth, crashes with error:
Improper assignment with rectangular empty matrix.
Error in convertROICorticalDepth (line 133)
[roiBaseCoords(1,:) roiBaseCoords(2,:) roiBaseCoords(3,:)] =
ind2sub(baseDims,roiBaseCoordsLinear);
And the ROI will be gone.
I can re-create the error consistently by being on any base other than the base that the ROIs I am trying to convert are on. (e.g. if my ROI is on left_occipital and I am on base right_occipital, it will delete my ROI when I convert any ROIs drawn on the left base).
(This error was previously reported by Joujou, but I don't think he knew why it was occurring, so it occurs on at least two machines).
When clicking within an ROI in the GUI, the EventRelatedPlot function and other interrogators do not work. Previously, displayed single-voxel results of deconvolution analysis and recalculated analysis on mean time series in ROI. Clicking outside the ROI works fine, displays single-voxel results. When ROI is hidden, single-voxel results display. Possible issue: MATLAB rendering ROI in front of surface, so click on surface is not registering?
Matlab Version: 8.5.0.197613 (R2015A)
O/S: Yosemite 10.10.5
Branch: -notts-newfeatures
In session s031020150815 there are two pRF analyses: pRF_left and pRF_right for each hemisphere separately. When "Add ROIs to AnatDB" runs it fails to load the correct analysis during the screenshotting, causing one screenshot to be empty. See: http://gru.stanford.edu/doku.php/mlranatdb/s0310.
from the documentation: r2014b mat files containing a (saved) figure object cannot be open in earlier versions of matlab - see the little note box towards the bottom of:
http://uk.mathworks.com/help/matlab/ref/save.html
I think this means that saving data via mrQuit
, mrSaveView
et al should not contain the new handles / objects.
This will act like baseChange callback which will be used by Franco to update the listbox with what ROI names are loaded.
... just came across this (and thought I was slowly losing the plot).
I think mlrAdjustGUI
can't do some of the GUI adjustments in more recent versions (I tried to R2019a). Not quite sure which bit of TMW ๐ฏ genius addition has broken this... but leads to GLM_v2
plugin not being loadable.
Just keep an eye out - possibly similar issues with other site-specific plugins people are using.
I will try to have another look at this soon - in the meantime some details on what this looks like for me (R2019a, macos 10.13.6, high sierra)
>> mrLoadRet
(mrGlobals) mrTools has been tested on Matlab versions 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 7.1 7.11 7.12 7.13 7.14 8.0 8.1 8.2. You are running Matlab 9.6
(mrGlobals) mrLoadRet 4.7, Matlab 9.6
(mlrPlugin) Installing plugin Default
(mlrPlugin) Installing plugin GLM_v2
(mlrAdjustGUI) *** Could not find property callback of uimenu exportImageMenuItem ***
(mlrAdjustGUI) *** Could not find property label of uimenu exportImageMenuItem ***
(mlrAdjustGUI) *** Could not find property callback of uimenu copyOverlayMenuItem ***
(mlrAdjustGUI) *** Could not find property label of uimenu copyOverlayMenuItem ***
(mlrAdjustGUI) *** Could not find property callback of uimenu pasteOverlayMenuItem ***
(mlrAdjustGUI) *** Could not find property callback of uimenu copyScanMenuItem ***
(mlrAdjustGUI) *** Could not find property label of uimenu copyScanMenuItem ***
(mlrAdjustGUI) *** Could not find property callback of uimenu pasteScanMenuItem ***
For reference: everything works fine in earlier versions of Matlab (e.g. R2016a)
There appears to be a bug when merging analysis in mrTools. Here's one scenario that one can create the (undesired) result: 1) generate two scans in a group; 2) using the GUI, run one event-related analysis on the first scan; 3) again using the GUI, run another event-related analysis on the second scan. When prompted at the end, choose "Merge". This will save to disk the analysis. However, when inspecting the saved results, you will see that two fields are packed in the reverse order. Assuming you use the default name erAnal, then check erAnal.params.scanNum, and erAnal.params.tseriesFile, and you will find these fields are in a reverse order (i.e., scanNum=[2 1]). However, other structures in the erAnal, e.g., erAnal.params.scanParams, erAnal.d are packed in the normal order. This will cause some problem if one access those fields packed in the reverse order. Hope this can be fixed soonish.
In the mean time, one probably should not rely on the Merge functionality (I only tested this with event-related analysis so do not know how this behaves using other analyses). One possible work around is to always conduct the multiple analysis in a single shot (i.e., do step 1 and 2 together). MLR can handle different parameter settings for different scans, if needed. Just uncheck the box that says using the same setting for all scans (in the event-related analysis interface, at least).
Thank you for looking into this.
This function should convert and ROI in x,y,z coordinates to a base surface type=3, patches with vertices and triangles (similar to what we did to import fascicles). This is a function that takes an mrTools ROI structure and returns and mrTools base strucutre
base = roi2base(roi);
Make the rois cache there base conversions so they don't have to be computed each time the user clicks.
Saw this during a motion compensation run:
Computing motion compensation for scan 9. Please wait... 0took 54 hours 28 min 4 secs 448 ms
(cbiWriteNifti) Scaling data from single to float32
(viewSet) framePeriod set to: 0.000750 seconds
I couldn't immediately find where viewSet is being called from, but it looks like it's overwriting the framePeriod back to what's in the NIFTI file.
This will be set by Franco in the roiListboxSelect function as the user sets which rois they want to display
A number of functions related to figure control fail, some examples here:
When opening an individual voxel timecourse:
Undefined function 'real' for input arguments of type 'matlab.ui.Figure'.
Error in int2str (line 12)
x = real(x);
Error in newGraphWin (line 18)
figloc = mrGetFigLoc(['graphFigure' int2str(h)]);
When closing a window:
Undefined function 'real' for input arguments of type 'matlab.ui.Figure'.
Error in int2str (line 12)
x = real(x);
Error in closeGraphWin (line 19)
mrSetFigLoc(['graphFigure' int2str(h)],get(h,'Position'));
It seems to be caused by Matlab no longer referring to figure handles as integers, instead it's necessary to call figurehandle.number.
As of R2024a, MATLAB's sub2ind
function throws an error when it encounters NaNs, presumably because of new functionality (see: https://www.mathworks.com/help/matlab/ref/sub2ind.html for more information). This function previously did not check for NaNs in prior iterations of MATLAB (R2023b and earlier), and MathWorks' current documentation makes no mention of this additional requirement.
To replicate: open any mrLoadRet session in MATLAB R2024a or later
Error stack:
Error using sub2ind (line 71)
Out of range subscript.
Error in mrSub2ind (line 28)
linear = sub2ind(dims,x,y,z);
Error in refreshMLRDisplay>getROIImageCoords (line 702)
baseCoordsLinear = mrSub2ind(baseDims,baseCoordsHomogeneous(1,:),baseCoordsHomogeneous(2,:),baseCoordsHomogeneous(3,:));
Error in refreshMLRDisplay>displayROIs (line 824)
[x y s] = getROIImageCoords(view,roi{r}.roiBaseCoords,sliceIndex,baseNum,baseCoordsHomogeneous,imageDims);
Error in refreshMLRDisplay>dispBase (line 544)
[roi,v] = displayROIs(v,hAxis,slice,sliceIndex,baseNum,base.coordsHomogeneous,base.dims,rotate,verbose);
Error in refreshMLRDisplay (line 152)
[v img base roi overlays curSliceBaseCoords] = dispBase(gui.axis,v,baseNum,gui,true,verbose);
Error in mrOpenWindow (line 207)
refreshMLRDisplay(view.viewNum);
Error in mrLoadRet (line 51)
v = mrOpenWindow('Volume',mrLastView);
Relevant change from sub2ind
:
R2024a:
sub2ind
accepts mix of scalars and vectors for subscript inputs
sub2ind
now leverages scalar expansion and accepts a mix of scalars and vectors for subscript inputs. For example,sub2ind(sz,[1 2 3],2)
is now the same assub2ind(sz,[1 2 3],[2 2 2])
. Previously, the subscript inputs were required to be the same size.
Relevant code from sub2ind
(lines 69-72):
if ~isempty(v) && (anynan(v) || min(v,[],'all') < 1 || max(v,[],'all') > siz_i)
% Verify subscripts are within range
error(message('MATLAB:sub2ind:IndexOutOfRange'));
end
As a result, the functionality of mrSub2ind
no longer works in versions of MATLAB starting from R2024a, due to assigning x(badCoords)
, y(badCoords)
, and z(badCoords)
a value of NaN.
Relevant code from mrSub2ind
(lines 21-28):
badCoords = find((x < 1) | (x > dims(1)) | ...
(y < 1) | (y > dims(2)) | ...
(z < 1) | (z > dims(3)));
x(badCoords) = nan;
y(badCoords) = nan;
z(badCoords) = nan;
linear = sub2ind(dims,x,y,z);
Trying to run mrTool on MATLAB_2019b (works for a colleague).
It seems ti run fine, except for when I open the mrLoadRet GUI, the image display stay empty. It does successfully loads the data, as it shows the correct #volumes and TR, yet it won't display. Also when I start mrAlign and load, for example, the reference volume its load the anatomy but the display becomes black.
(mrInit) Unknown argument stimfileMatchList
Stimfiles aren't being matched correctly, it just picks them in order by number. Not sure if this is isolated to when you specify your own stimfileMatchList or in the default case as well.. I'm still investigating.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.