Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying multilevel mediation results visualisation #14

Open
Hannah-Savage opened this issue Oct 5, 2020 · 5 comments
Open

Modifying multilevel mediation results visualisation #14

Hannah-Savage opened this issue Oct 5, 2020 · 5 comments

Comments

@Hannah-Savage
Copy link

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.

  1. 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?

  1. 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?

  1. 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)

@torwager
Copy link
Contributor

torwager commented Oct 17, 2020 via email

@Hannah-Savage
Copy link
Author

Thank you Tor! :)
I'll check out the other options and be in touch if I have any further queries.

@Hannah-Savage
Copy link
Author

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

@torwager
Copy link
Contributor

torwager commented Oct 29, 2020 via email

@Hannah-Savage
Copy link
Author

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');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants