External Email - Use Caution Hi Bruce and Doug,
To respond to your questions: I projected the BOLD data on the surface using mri_vol2surf function. Then obtained a .mgz file of size 10242 x 1 x 1 x 200. Then I performed diffusion embedding (unsupervised dimensionality reduction technique) on this .mgz file, whose output was a .npy file. I then loaded this file into a matrix on python, which size was 1 x 18715 x 5. I then saved this file as a .mat file. Then loaded it on matlab, and kept only 1 x 18715 x 1 part of the matrix, and stored it into a zeros(1, 20484). Then kept only the part from (0:10242) and used save_mgh function to save this data into a .mgz file Looking at the info of my .mgz file created with save_mgh, I see that the file doesn't seem to include the data: " mri_info lh_emb_sub-002_compassion.mgz Volume information for lh_emb_sub-002_compassion.mgz type: MGH dimensions: 1 x 16 x 1 voxel sizes: -nan, -nan, -nan type: FLOAT (3) fov: -nan dof: 1 xstart: -nan, xend: -nan ystart: -nan, yend: -nan zstart: -nan, zend: -nan TR: 0.00 msec, TE: 0.00 msec, TI: 0.00 msec, flip angle: 0.00 degrees nframes: 1 PhEncDir: UNKNOWN FieldStrength: 0.000000 ras xform present xform info: x_r = -nan, y_r = -nan, z_r = -nan, c_r = -nan : x_a = -nan, y_a = -nan, z_a = -nan, c_a = -nan : x_s = -nan, y_s = -nan, z_s = -nan, c_s = -nan talairach xfm : Orientation : III Primary Slice Direction: axial voxel to ras transform: -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan -nan 0.0000 0.0000 0.0000 1.0000 voxel-to-ras determinant -nan ras to voxel transform: mat = NULL! MatrixFree: NULL mat POINTER! " It seems that save_mgh function requires tclsh package, as when I ran save_mgh for the first time with this command line: save_mgh('freeview_overlay', ['/home/loic/Documents/emb_output/mgh_format/emb_' char(subjectsList(1)) '_' char(statesList(1)) '.MGZ'], M); I was getting this message in return in the matlab window: " /usr/share/modules/init/bash: line 36: /usr/bin/tclsh: No such file or directory /usr/share/modules/init/bash: line 58: export: _moduleraw: not a function /usr/share/modules/init/bash: line 60: export: module: not a function " Checking into the '/usr/bin/tclsh' directory, the only package called/related to tclsh was 'tclsh8.6'. I thus changed the name from 'tclsh8.6' to 'tclsh'. Then tried to save the matrix again with save_mgh function. Now I don't see the error message anymore. However I still get a .mgz file with nans, as seen in the previous mri_info message above. Would any of you have an advice on how I could make this work, in order to visualize this .mgz file on the left hemisphere pial surface in Freeview? Thanks in advance, Sincerely, Loïc Le ven. 21 juin 2019 à 16:24, Bruce Fischl <fis...@nmr.mgh.harvard.edu> a écrit : > I don't think it matters but I would use eye instead of nan for M. But the > critical issue is where you get your data and what dimensions it has > cheers > Bruce > > On Fri, 21 Jun 2019, Loïc Daumail wrote: > > > > > External Email - Use Caution > > > > Me again, > > > > Also, here is how I save the matrix on matlab: > > > > M = nan(4,4); > > save_mgh('freeview_overlay', > ['/home/loic/Documents/emb_output/mgh_format/lh_emb_' > > char(subjectsList(1)) '_' char(statesList(1)) '.mgz'], M); > > > > Thanks, > > > > Sincerely, > > > > Loïc > > > > Le ven. 21 juin 2019 à 12:25, Loïc Daumail <loic.daum...@gmail.com> a > écrit : > > Hi Bruce, > > > > Thanks for your tip. Unfortunately, I am still running through an > error... > > I have a matrix of 18715 elements regarding both hemispheres. > > The size of fsaverage5 is 20484 I believe, so I filled the remaining > elements with zeros, and > > also tried with rand(). > > > > The other issue is that I am not so sure which part of the matrix is for > lh and the other one > > for rh. Thus, I divided 18715/2 and took the 9357 first elements of the > 18715 matrix. Then > > filled it with zeros or random values to reach 10242. > > > > Then I saved it with save_mgh function and tried to load it with > freeview using the following > > command line: > > freeview > -f~/Documents/recon_all_success/freesurfer/fsaverage5/surf/lh.pial:overlay=~/Documents/emb_output/mgh > > _format/lh_emb_sub-002_compassion.mgz > > > > I am getting the following error: > > " > > Did not find any volume info > > 2 [0]PETSC ERROR: > ------------------------------------------------------------------------ > > [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, > probably memory access > > out of range > > [0]PETSC ERROR: Try option -start_in_debugger or > -on_error_attach_debugger > > [0]PETSC ERROR: or see > > > http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#Signal[0]PETSC > ERROR: > > or try http://valgrind.org on linux or man libgmalloc on Apple to find > memory corruption > > errors > > [0]PETSC ERROR: configure using --with-debugging=yes, recompile, link, > and run > > [0]PETSC ERROR: to get more information on the crash. > > [0]PETSC ERROR: --------------------- Error Message > ------------------------------------ > > [0]PETSC ERROR: Signal received! > > [0]PETSC ERROR: > ------------------------------------------------------------------------ > > [0]PETSC ERROR: Petsc Release Version 2.3.3, Patch 13, Thu May 15 > 17:29:26 CDT 2008 HG > > revision: 4466c6289a0922df26e20626fd4a0b4dd03c8124 > > [0]PETSC ERROR: See docs/changes/index.html for recent updates. > > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. > > [0]PETSC ERROR: See docs/index.html for manual pages. > > [0]PETSC ERROR: > ------------------------------------------------------------------------ > > [0]PETSC ERROR: Unknown Name on a linux-gnu named loic-HP-ZBook-17 by > loic Fri Jun 21 12:15:53 > > 2019 > > [0]PETSC ERROR: Libraries linked > from/autofs/space/lyon_006/pubsw/Linux2-2.3-x86_64/packages/petsc/2.3.3-p13/src/petsc-2.3.3-p13/lib/lin > > ux-gnu-c-opt > > [0]PETSC ERROR: Configure run at Tue Aug 10 15:01:59 2010 > > [0]PETSC ERROR: Configure options --with-debugging=no --with-cc=gcc > --with-fc=g77 > > --download-f-blas-lapack=0 --download-mpich=1 --with-mpi=1 --with-x=0 > > --with-gnu-copyright-code=0 --with-shared=0 COPTFLAGS=-O3 > CXXOPTFLAGS=-O3 FOPTFLAGS=-O3 > > [0]PETSC ERROR: > ------------------------------------------------------------------------ > > [0]PETSC ERROR: User provided function() line 0 in unknown directory > unknown file > > [unset]: aborting job: > > application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0" > > > > Any idea of what could be wrong in my process? > > > > Thanks > > > > Sincerely, > > > > Loïc > > > > > > > > Le jeu. 20 juin 2019 à 19:39, Bruce Fischl <fis...@nmr.mgh.harvard.edu> > a écrit : > > Hi Loïc > > > > the .mgz file should having dimensions nvertices x 1 x 1 for > freeview to > > know it is a surface overlay I believe > > > > cheers > > Bruce > > > > > > > > On Thu, 20 Jun 2019, Loïc Daumail wrote: > > > > > > > > External Email - Use Caution > > > > > > Hi Bruce, > > > > > > I am reaching out to you, as I am trying to load the surface > scalar values of > > diffusion embedding > > > for overlay on a pial surface in Freeview. > > > > > > I used save_mgh to save a scalar matrix containing surface > embedding values in > > an .mgz format. > > > However I can't load it in freeview, be either only half of the > matrix data (one > > hemisphere I > > > assume) or the whole matrix saved in the same file. > > > > > > Is there anything specific I need to do in order to be able to > visualize a > > scalar overlay on a > > > surface? Is .mgz a wrong format for scalar values? I also tried > with .nii.gz, or > > .mgh. I am not even > > > sure save_mgh can do all this... > > > > > > Thanks in advance, > > > > > > Sincerely, > > > > > > Loïc > > > > > > > > > > > > Le lun. 27 mai 2019 à 11:54, Loïc Daumail < > loic.daum...@gmail.com> a écrit : > > > Hi Tim, > > > > > > Your link works perfectly, it's awesome! > > > Thanks a lot, > > > > > > Best, > > > > > > Loïc > > > > > > Le lun. 27 mai 2019 à 11:43, Loïc Daumail < > loic.daum...@gmail.com> a écrit : > > > Hi Tim, > > > > > > 'mean_rest' is a diffusion embedding map, which contains scores > for every vertex > > on > > > fsaverage5 surface resolution. > > > 'surf.b' is the pial surface of both hemispheres of > fsaverage5... I also tried > > forjust > > > lh hemisphere, but it gives me the same result... > > > > > > Thanks for the link! > > > > > > Best, > > > > > > Loïc > > > > > > Le lun. 27 mai 2019 à 11:20, Tim Schäfer <ts...@rcmd.org> a > écrit : > > > External Email - Use Caution > > > > > > Hi Loïc, > > > > > > that does not look correct, the data is definitely off. > I'm not sure where > > > the variables `mean_rest` and `surf.b` come from in your > code, and I > > suspect > > > that something is wrong with them. > > > > > > In the meantime, I got interested in this myself and put > together some > > code > > > that will load the Desikan data for both hemispheres and > display it in > > > surfstat. Feel free to use it, there also is an example > screenshot of the > > > results: > > > > > > > > > > > > https://github.com/dfsp-spirit/comp_neuro_science/tree/master/surfstat_desikan > > > > > > Best, > > > > > > Tim > > > > > > -- > > > Dr. Tim Schäfer > > > Postdoc Computational Neuroimaging > > > Department of Child and Adolescent Psychiatry, > Psychosomatics and > > > Psychotherapy > > > University Hospital Frankfurt, Goethe University Frankfurt > am Main, > > Germany > > > > > > > On May 27, 2019 at 11:01 AM Loïc Daumail < > loic.daum...@gmail.com> wrote: > > > > > > > > > > > > External Email - Use Caution > > > > > > > > Hi Tim, > > > > > > > > Thanks a lot for your help, indeed, this is exactly what > I needed! > > > > I wrote this : > > > > " > > > > subjects_dir = > '/home/loic/Documents/recon_all_success/freesurfer/'; > > > > subject_id = 'sub-004'; > > > > hemi = 'lh'; > > > > > > > > aparc_file_this_hemi = fullfile(subjects_dir, > subject_id, 'label', > > > > sprintf("%s.aparc.annot", hemi)); > > > > [vertices, label, colortable] = > read_annotation(aparc_file_this_hemi); > > > > fprintf("Read aparc parcellation file '%s' containing %d > regions.\n", > > > > aparc_file_this_hemi, length(colortable.struct_names)); > > > > for sidx = 1:length(colortable.struct_names) > > > > region = colortable.struct_names{sidx}; > > > > struct_code = colortable.table(sidx, 5); > > > > vertices_of_struct_roi = find(label == struct_code); > > > > fprintf("Found region '%s' with %d verts.\n", region, > > > > length(vertices_of_struct_roi)); > > > > end > > > > fig1 = figure(); > > > > SurfStatView(mean_rest, surf.b); > > > > SurfStatColormap(colortable.table(:,1:3)/255); > > > > " > > > > However, the image I obtain seems a bit fuzzy...( see > attached) > > > > Is it because of my data? > > > > > > > > Thanks in advance, > > > > > > > > Loïc > > > > > > > > > > > > Le jeu. 23 mai 2019 à 17:20, Tim Schäfer <ts...@rcmd.org> > a écrit : > > > > > > > > > External Email - Use Caution > > > > > > > > > > Afaik SurfStat is not maintained anymore and I think > it's been this > > way > > > > > for quite a while now. Maybe someone else knows better? > > > > > > > > > > The website is at > http://www.math.mcgill.ca/keith/surfstat/ and it > > says > > > > > 'Updated 26 September 2008'. I'm not sure whether > that's really true, > > > but > > > > > at least for the last 14 months (the only time frame I > know about), > > > there > > > > > have not been any changes to that website or any new > releases of > > > SurfStat. > > > > > > > > > > Tim > > > > > > > > > > > On May 23, 2019 at 4:36 PM Bruce Fischl < > fis...@nmr.mgh.harvard.edu> > > > > > wrote: > > > > > > > > > > > > > > > > > > Hi Loic > > > > > > > > > > > > sorry, can you ask whoever maintains surfstat? Or > maybe someone else > > > on > > > > > the > > > > > > list knows? I don't. You can label surfaces manually > with the dev > > > > > version > > > > > > of freeview if you want. > > > > > > > > > > > > cheers > > > > > > Bruce > > > > > > > > > > > > > > > > > > On Thu, 23 May 2019, Loïc > > > > > > Daumail wrote: > > > > > > > > > > > > > > > > > > > > External Email - Use Caution > > > > > > > > > > > > > > Hi Bruce, > > > > > > > > > > > > > > I am coming back to this request as I was > wondering: > > > > > > > would it be possible to load freesurfer surface > atlases in > > surfstat > > > in > > > > > order to label my surfaces? > > > > > > > Is their format compatible? I saw surfstat only > accepts a limited > > > > > array of formats... > > > > > > > > > > > > > > Thanks, > > > > > > > Best, > > > > > > > > > > > > > > Loïc > > > > > > > > > > > > > > Le lun. 20 mai 2019 à 16:15, Bruce Fischl > > > <fis...@nmr.mgh.harvard.edu> > > > > > a écrit : > > > > > > > sure. All the fsaverages are in the same > space (they are > > > subsets > > > > > of > > > > > > > fsaverage) > > > > > > > On Mon, 20 May 2019, Loïc Daumail wrote: > > > > > > > > > > > > > > > > > > > > > > > External Email - Use Caution > > > > > > > > > > > > > > > > Hi Bruce, > > > > > > > > > > > > > > > > Thanks for your response. Is it also fine > for fsaverage5 > > > > > surface or I need to switch > > > > > > > my data to > > > > > > > > fsaverage? > > > > > > > > > > > > > > > > Thanks, > > > > > > > > > > > > > > > > Sincerely, > > > > > > > > > > > > > > > > Loïc > > > > > > > > > > > > > > > > Le lun. 20 mai 2019 à 15:52, Bruce Fischl < > > > > > fis...@nmr.mgh.harvard.edu> a écrit : > > > > > > > > Hi Loic > > > > > > > > > > > > > > > > if you are on the fsaverage surface > you can save the > > > > > -log10(p) values > > > > > > > > using save_mgh.m, then load them in > freeview and > > > > > threshold them or > > > > > > > > whatever > > > > > > > > > > > > > > > > cheers > > > > > > > > Bruce > > > > > > > > On Mon, 20 May 2019, Loïc Daumail > wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > External Email - Use > Caution > > > > > > > > > > > > > > > > > > Also, one more thing: > > > > > > > > > > > > > > > > > > My data is on fsaverage5 > resolution. > > > > > > > > > > > > > > > > > > Thanks in advance, > > > > > > > > > > > > > > > > > > Sincerely, > > > > > > > > > > > > > > > > > > Loïc > > > > > > > > > > > > > > > > > > Le lun. 20 mai 2019 à 09:49, Loïc > Daumail < > > > > > loic.daum...@gmail.com> a écrit : > > > > > > > > > Dear Freesurfer community, > > > > > > > > > > > > > > > > > > I obtained score matrices of > surfaces after > > > performing > > > > > diffusion embedding map > > > > > > > on fMRI > > > > > > > > data. > > > > > > > > > > > > > > > > > > I am now using the SurfStat > toolbox(Matlab) in > > order > > > > > to obtain p-value maps to > > > > > > > compare > > > > > > > > between > > > > > > > > > two groups. > > > > > > > > > > > > > > > > > > After obtaining the p-value map, I > would like to > > > label > > > > > the surface in order to > > > > > > > > identify the > > > > > > > > > regions of significant difference > between both > > > groups. > > > > > > > > > > > > > > > > > > Would it be possible to use > Freview in order to do > > > it? > > > > > > > > > If so, which format should I use > for my SurfStatP > > > > > output p-value map? > > > > > > > > > How would you do it, (tools to > convert into a > > > specific > > > > > format, surfaces and > > > > > > > atlas to > > > > > > > > load on > > > > > > > > > Freeview, which format for those > ones)? > > > > > > > > > I would be very grateful if you > could detail a > > bit, > > > as > > > > > I am new to these > > > > > > > tools! > > > > > > > > > > > > > > > > > > Thanks in advance, > > > > > > > > > > > > > > > > > > Loïc Daumail > > > > > > > > > > > > > > > > > > > > > > > > > > > >_______________________________________________ > > > > > > > > Freesurfer mailing list > > > > > > > > Freesurfer@nmr.mgh.harvard.edu > > > > > > > > > > > > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > > > > > > > > > > > > > > > > > > > > > >_______________________________________________ > > > > > > > Freesurfer mailing list > > > > > > > Freesurfer@nmr.mgh.harvard.edu > > > > > > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > > > > > > > > > > > > > > > > > >_______________________________________________ > > > > > > Freesurfer mailing list > > > > > > Freesurfer@nmr.mgh.harvard.edu > > > > > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > > > > > > > -- > > > > > Dr. Tim Schäfer > > > > > Postdoc Computational Neuroimaging > > > > > Department of Child and Adolescent Psychiatry, > Psychosomatics and > > > > > Psychotherapy > > > > > University Hospital Frankfurt, Goethe University > Frankfurt am Main, > > > Germany > > > > > > > > > > _______________________________________________ > > > > > Freesurfer mailing list > > > > > Freesurfer@nmr.mgh.harvard.edu > > > > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > _______________________________________________ > > > > Freesurfer mailing list > > > > Freesurfer@nmr.mgh.harvard.edu > > > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > > > _______________________________________________ > > > Freesurfer mailing list > > > Freesurfer@nmr.mgh.harvard.edu > > > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > > > > > >_______________________________________________ > > Freesurfer mailing list > > Freesurfer@nmr.mgh.harvard.edu > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > > >_______________________________________________ > Freesurfer mailing list > Freesurfer@nmr.mgh.harvard.edu > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
_______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer