Open Hannah-Savage opened 4 years ago
Hi Hannah,
There are multiple options for displaying results. Some newer functions like
publish_mediation_report.m
May do what you want, and have code that you can examine as well.
For flexible control over display, you can use our object-oriented display tools, which are described on the web at canlab.github.io
There is a “walkthroughs” section with some tutorials on how to visualize and do other analyses. All of the mediation output images (or any .nii/.img statistical maps) are compatible with this.
Some functions you might want to check out: orthviews( ) method montage( ) method
These are methods for the fmri_data object type.
fmridisplay.m and associated methods for flexible control over montages with any set of slices you want.
I hope this helps!
Best wishes, Tor
On Oct 4, 2020, at 10:45 PM, Hannah-Savage notifications@github.com wrote:
Hi Tor and team,
Thanks for making such a great toolbox!
I have run a multilevel mediation and would like some help with how best to display our results. Many of our results are in midline, cortical regions and therefore I would like to increase the number of sagittal slices that are generated in the figures by the toolbox. I have detailed my attempts to resolve this below, but would appreciate your input.
With pwd set to the results directory of the mediation, I have followed the manual (‘Saving clusters for later’ pg 3 of Mediation_help_11_6_08.pdf) and saved the [clpos, clpos_data, clneg, clneg_data] variables as a seperate file. I then clear the workspace and load these variables.
I have attempted to use cluster_orthviews_showcenters to get a slice for the peak of each cluster. Ideally I’d like to be able to run this for sagittal views (as many of our clusters of interest are midline regions, likely best viewed on this plane). Trying to basic code (for axial slices - as in the manual) the following code, I get the error: slices_fig_h = cluster_orthviews_showcenters([clpos_data clneg_data], 'axial', [], 0); Undefined function or variable 'wh'. Error in cluster_orthviews_showcenters>get_orth_axishandles (line 134) axish = ch(find(wh)); Error in cluster_orthviews_showcenters (line 68) axh = get_orth_axishandles; As far as I can tell this ‘wh’ variable is not something that I can easily define or change. Do you know why this may be occurring and if so, what I may do to fix this?
I have also tried to use mediaton_brain_results.m (multi-threshold [fdr and unc 001], 3 plane montages) to increase the number of sagittal slices. I have been able to restrict the display to two thresholds, as desired. I tried to increase the number of sagittal slices it generates by increasing the first input of the code where it calls the cluster_orthviews_montage function for sagittal presentations to ’10’ instead of ‘5’ (see below). This did not work. Line 739 cluster_orthviews_montage(10, 'sagittal', overlay, 'onerow’); % was originally cluster_orthviews_montage(5, 'sagittal', overlay, 'onerow'); Is it possible to increase this display and if so, how?
I have also used the imcalc function in spm to display the pos/neg_X/M/Y_pval files within MRIcroGL - this has allowed me to visualise the cluster extents, general shape and relative position of the clusters. It has also allowed me to overlay the results of different mediations (to look for common and distinct mediators). This is currently limited however, by two factors. (1) I am currently viewing both positive and negative effects - is it possible to create a pos or neg only version of this file? (Or is there a way I can do this in imcalc - I understand this may be more related to imcalc functionality). (2) When loading into MRIcroGL, I am unable to set a cluster threshold, and therefore many small clusters/voxels of no interest are shown. These limitations mean we cannot use an MRIcroGL display, as is, to represent our results for publication. Do you have any recommendations to allow me to export the mediation results into another software (such as MRIcroGL) for visualisation?
Please let me know if you need more information to be able to solve these issues, and thanks again for the toolbox!
Hannah Savage (PhD candidate at the Melbourne Neuropsychiatry Centre, The University of Melbourne)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/canlab/MediationToolbox/issues/14, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPY7LBKMV6PSER3LZDZZWLSJEXNLANCNFSM4SED5AAA.
Thank you Tor! :) I'll check out the other options and be in touch if I have any further queries.
Hi Tor,
I'm enjoying playing around with the fmri_data tools - they look really nice - thanks!
I have used the fmri_data to import and visualise the '_effect.img', and can get it to display how I'd like by thresholding [-1 1] and with a cluster extent of 5 (for the main task effect, for example). I was wondering, however, what the values in this file/display are? I'd like to be able to set this threshold more specifically at fdr q <0.05 and/or unc p <0.01, but I can't seem to work out what that would be in the [-? ?] range. The range of the values in .dat is (min) -3.106 to (max) 3.71.
I have tried using the statistical_image() import method with the pvals, but the directionality of the effect is lost and I would like to have both positive and negative mediators shown.
Alternatively, I've also tried using 'clusters_with_extracted_data', as I thought these would be thresholded when I generate the files. I've used addblobs to plot the 'clpos_data2' OR 'clpos_extent' (colour bar generated goes from 6.9 to 23.1) . This looks nice, but again, I don't understand - what are these values?
Apologies if there is a simple and obvious solution, and thanks again for your help,
Hannah
Hi Hannah,
Some of the robust regression results tools (robust_results…m) have examples of code that creates signed, thresholded t-maps, and statistic_image class objects that can be used for flexible display in multiple formats. They also create reports/images/etc — which you may have seen.
If you want to go beyond what those do, looking at the code to see how to run the underlying functions would be good. e.g., try running robust_results_batch.m, and looking at the code.
It also creates statistic_image objects and returns them. To learn how to visualize those in various ways, canlab.github.io has a series of walkthroughs that show you how to gain some flexible control over manipulating and visualizing the objects.
Hope this helps!
Best wishes, Tor
Tor Wager Diana L. Taylor Distinguished Professor Presidential Cluster in Neuroscience and Department of Psychological and Brain Sciences Dartmouth College
On Oct 28, 2020, at 2:25 AM, Hannah-Savage notifications@github.com wrote:
Hi Tor,
I'm enjoying playing around with the fmri_data tools - they look really nice - thanks!
I have used the fmri_data to import and visualise the '_effect.img', and can get it to display how I'd like by thresholding [-1 1] and with a cluster extent of 5 (for the main task effect, for example). I was wondering, however, what the values in this file/display are? I'd like to be able to set this threshold more specifically at fdr q <0.05 and/or unc p <0.01, but I can't seem to work out what that would be in the [-? ?] range. The range of the values in .dat is (min) -3.106 to (max) 3.71.
I have tried using the statistical_image() import method with the pvals, but the directionality of the effect is lost and I would like to have both positive and negative mediators shown.
Alternatively, I've also tried using 'clusters_with_extracted_data', as I thought these would be thresholded when I generate the files. I've used addblobs to plot the 'clpos_data2' OR 'clpos_extent' (colour bar generated goes from 6.9 to 23.1) . This looks nice, but again, I don't understand - what are these values?
Apologies if there is a simple and obvious solution, and thanks again for your help,
Hannah
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/canlab/MediationToolbox/issues/14#issuecomment-717727476, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPY7LAZCLRMQAZX4BWDIJLSM62PPANCNFSM4SED5AAA.
Hi Tor,
I ended up writing a short code to make the pals directional (from the effect file), which allowed me to threshold using 'raw-between' in threshold. I thought I'd copy the code below in case anyone else wants to use it, or improve on it in the future. Disclaimer - The render and the legend don't really work, but the montages do.
Thanks again for your help! Hannah
%% I run this from the Results directory
%% This generates a full montage with two thresholds displayed.
% You can change which path is loaded - this example is for path A
% load in the pvals files (to get statistical significance)
pathA = fmri_data('X-M_pvals.img');
% load in the effect file (to get the direction of the effect)
pathAe = fmri_data('X-M_effect.img');
%This loops through each row and multiplies the pvalue by +/- to reflect the direction of the task effect.
for i = 1:length(pathAe.dat)
if sign(pathAe.dat(i)) ~= 0
pathA.dat(i) = pathA.dat(i) * sign(pathAe.dat(i));
else
end
end
% Generate the full canlab montage
disp_PATHA = canlab_results_fmridisplay([], 'montagetype', 'full');
% Threshold to only show values that are only up to +/-0.00054, k=5
% FDR = q < 0.05 = 0.00054 unc
% I found this unc value using the mediation_brain_corrected_threshold.m and running from the Results directory, and it is also in the web report
pathAthreshfdr = threshold(pathA,[-0.00054 0.00054],'raw-between','k', 5);
%Threshold the display to only show values that are only up to unc +/- 0.001, k=5
pathAthresh001unc = threshold(pathA,[-0.001 0.001],'raw-between','k', 5);
%Display 0.001unc and FDR
disp_PATHA = addblobs(disp_PATHA, pathAthresh001unc, 'splitcolor', {[0.3 0.2 1] [0.3 0.2 1] [1 .5 0] [1 .5 0]});
hold on
disp_PATHA = addblobs(disp_PATHA, pathAthreshfdr, 'splitcolor', {[0.2 0.9 1] [0.2 0.9 1] [1 0.8 0.2] [1 0.8 0.2]});
hold off
% This saves the figure as a png file in the pwd
saveas(gcf, 'PathA.png');
Hi Tor and team,
Thanks for making such a great toolbox!
I have run a multilevel mediation and would like some help with how best to display our results. Many of our results are in midline, cortical regions and therefore I would like to increase the number of sagittal slices that are generated in the figures by the toolbox. I have detailed my attempts to resolve this below, but would appreciate your input.
With pwd set to the results directory of the mediation, I have followed the manual (‘Saving clusters for later’ pg 3 of Mediation_help_11_6_08.pdf) and saved the [clpos, clpos_data, clneg, clneg_data] variables as a seperate file. I then clear the workspace and load these variables.
As far as I can tell this ‘wh’ variable is not something that I can easily define or change. Do you know why this may be occurring and if so, what I may do to fix this?
Is it possible to increase this display and if so, how?
Do you have any recommendations to allow me to export the mediation results into another software (such as MRIcroGL) for visualisation?
Please let me know if you need more information to be able to solve these issues, and thanks again for the toolbox!
Hannah Savage (PhD candidate at the Melbourne Neuropsychiatry Centre, The University of Melbourne)