Dear Freesurfer Experts,
While performing the long_mris_slopes cmd, we receive an error:
------------------------------------------- SUBJECT pls_pd_base00 Running Within-Subject GLM
Writing ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat ...
mri_glmfit --y /Applications/freesurfer/subjects/pls_pd_base00/surf/lh.long.thickness-stack.mgh --X ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat --allow-zero-dof --no-contrasts-ok --surf pls_pd_base00 lh --label /Applications/freesurfer/subjects/pls_pd_base00/label/lh.long.cortex.label --glmdir ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/glm
Traceback (most recent call last): File "/Applications/freesurfer/bin/long_mris_slopes", line 732, in <module> run_cmd(cmd,'mri_glmfit did not work?') File "/Applications/freesurfer/bin/long_mris_slopes", line 422, in run_cmd retcode = subprocess.call(args) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 443, in call return Popen(*popenargs, **kwargs).wait() File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 593, in __init__ errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 1079, in _execute_child raise child_exception OSError: [Errno 8] Exec format error -------------------------------------------
we changed the mris_calc and mri_glmfit files with the new ones (8.2MB / 15.8MB).
Can you please help with this ?
Thank you in advance,
Sincerely, Alex.
Not sure. Maybe try the updated scripts From http://martinos.org/~mreuter/long/
Best Martin
Alexandru Hanganu al.hanganu@yahoo.ca wrote:
Dear Freesurfer Experts,
While performing the long_mris_slopes cmd, we receive an error:
SUBJECT pls_pd_base00 Running Within-Subject GLM
Writing ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat ...
mri_glmfit --y /Applications/freesurfer/subjects/pls_pd_base00/surf/lh.long.thickness-stack.mgh
--X ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat --allow-zero-dof
--no-contrasts-ok --surf pls_pd_base00 lh --label /Applications/freesurfer/subjects/pls_pd_base00/label/lh.long.cortex.label
--glmdir ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/glm
Traceback (most recent call last): File "/Applications/freesurfer/bin/long_mris_slopes", line 732, in
<module> run_cmd(cmd,'mri_glmfit did not work?') File "/Applications/freesurfer/bin/long_mris_slopes", line 422, in run_cmd retcode = subprocess.call(args) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py",
line 443, in call return Popen(*popenargs, **kwargs).wait() File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py",
line 593, in __init__ errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py",
line 1079, in _execute_child raise child_exception OSError: [Errno 8] Exec format error
we changed the mris_calc and mri_glmfit files with the new ones (8.2MB / 15.8MB).
Can you please help with this ?
Thank you in advance,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Hello Martin,
thanks for the help, I changed all the scripts from that page, but the problem still persisted, so one of our colleagues found that the mri_glmfit from the ReleaseNotes (15.8MB) is for Linux, and we are using mac, so we changed back the mri_glmfit to the old version (6MB), and now we have another error:
----------------------------- SUBJECT pls_pd_base00 Running Within-Subject GLM
Writing ./tmp-pls_pd_base00_lh_thickness_CMeqOW/X-long.mat ...
mri_glmfit --y ./pls_pd_base00/surf/lh.long.thickness-stack.mgh --X ./tmp-pls_pd_base00_lh_thickness_CMeqOW/X-long.mat --allow-zero-dof --no-contrasts-ok --surf pls_pd_base00 lh --label ./pls_pd_base00/label/lh.long.cortex.label --glmdir ./tmp-pls_pd_base00_lh_thickness_CMeqOW/glm
ERROR: Option --allow-zero-dof unknown ERROR 255 : mri_glmfit did not work? -----------------------------
Any ideas ?
Thanks for the help,
Best regards, Alex.
________________________________ De : Martin Reuter mreuter@nmr.mgh.harvard.edu À : Alexandru Hanganu al.hanganu@yahoo.ca; FS Mailing List Freesurfer@nmr.mgh.harvard.edu Envoyé le : mercredi 3 octobre 2012 17h30 Objet : Re: [Freesurfer] long_mris_slopes error
Not sure. Maybe try the updated scripts From http://martinos.org/~mreuter/long/
Best Martin
Alex Hanganu al.hanganu@yahoo.ca wrote: Dear Freesurfer Experts,
While performing the long_mris_slopes cmd, we receive an error:
SUBJECT pls_pd_base00 Running Within-Subject GLM
Writing ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat ...
mri_glmfit --y /Applications/freesurfer/subjects/pls_pd_base00/surf/lh.long.thickness-stack.mgh --X ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat --allow-zero-dof --no-contrasts-ok --surf pls_pd_base00 lh --label /Applications/freesurfer/subjects/pls_pd_base00/label/lh.long.cortex.label --glmdir ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/glm
Traceback (most recent call last): File "/Applications/freesurfer/bin/long_mris_slopes", line 732, in
<module> run_cmd(cmd,'mri_glmfit did not work?') File
"/Applications/freesurfer/bin/long_mris_slopes", line 422, in
run_cmd retcode = subprocess.call(args) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 443, in call return Popen(*popenargs, **kwargs).wait() File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 593, in __init__ errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py", line 1079, in _execute_child raise child_exception OSError: [Errno 8] Exec format error
we changed the mris_calc and mri_glmfit files with the new ones (8.2MB / 15.8MB).
Can you please help with this ?
Thank you in advance,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
You need a newer version of glmfit. This is not the 5.1 I think.
Best Martin
Alex Hanganu al.hanganu@yahoo.ca wrote:
Hello Martin,
thanks for the help, I changed all the scripts from that page, but the problem still persisted, so one of our colleagues found that the mri_glmfit from the ReleaseNotes (15.8MB) is for Linux, and we are using mac, so we changed back the mri_glmfit to the old version (6MB), and now we have another error:
SUBJECT pls_pd_base00 Running Within-Subject GLM
Writing ./tmp-pls_pd_base00_lh_thickness_CMeqOW/X-long.mat ...
mri_glmfit --y ./pls_pd_base00/surf/lh.long.thickness-stack.mgh --X ./tmp-pls_pd_base00_lh_thickness_CMeqOW/X-long.mat --allow-zero-dof --no-contrasts-ok --surf pls_pd_base00 lh --label ./pls_pd_base00/label/lh.long.cortex.label --glmdir ./tmp-pls_pd_base00_lh_thickness_CMeqOW/glm
ERROR: Option --allow-zero-dof unknown ERROR 255 : mri_glmfit did not work?
Any ideas ?
Thanks for the help,
Best regards, Alex.
De : Martin Reuter mreuter@nmr.mgh.harvard.edu À : Alexandru Hanganu al.hanganu@yahoo.ca; FS Mailing List Freesurfer@nmr.mgh.harvard.edu Envoyé le : mercredi 3 octobre 2012 17h30 Objet : Re: [Freesurfer] long_mris_slopes error
Not sure. Maybe try the updated scripts From http://martinos.org/~mreuter/long/
Best Martin
Alex Hanganu al.hanganu@yahoo.ca wrote: Dear Freesurfer Experts,
While performing the long_mris_slopes cmd, we receive an error:
SUBJECT pls_pd_base00 Running Within-Subject GLM
Writing ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat ...
mri_glmfit --y /Applications/freesurfer/subjects/pls_pd_base00/surf/lh.long.thickness-stack.mgh
--X ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat
--allow-zero-dof
--no-contrasts-ok --surf pls_pd_base00 lh --label /Applications/freesurfer/subjects/pls_pd_base00/label/lh.long.cortex.label
--glmdir ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/glm
Traceback (most recent call last): File "/Applications/freesurfer/bin/long_mris_slopes", line 732, in
<module> run_cmd(cmd,'mri_glmfit did not work?') File
"/Applications/freesurfer/bin/long_mris_slopes", line 422, in
run_cmd retcode = subprocess.call(args) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py",
line 443, in call return Popen(*popenargs, **kwargs).wait() File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py",
line 593, in __init__ errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py",
line 1079, in _execute_child raise child_exception OSError: [Errno 8] Exec format error
we changed the mris_calc and mri_glmfit files with the new ones (8.2MB
/
15.8MB).
Can you please help with this ?
Thank you in advance,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
-- Sent from my phone, please excuse brevity. The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Hello Martin,
everything works fine with the newer versions of files.
Thanks for the help!
Have a wonderful day !
Alex.
Le 04/10/2012 8:04 PM, Martin Reuter a écrit :
You need a newer version of glmfit. This is not the 5.1 I think.
Best Martin
Alex Hanganu al.hanganu@yahoo.ca wrote:
Hello Martin, thanks for the help, I changed all the scripts from that page, but the problem still persisted, so one of our colleagues found that the mri_glmfit from the ReleaseNotes (15.8MB) is for Linux, and we are using mac, so we changed back the mri_glmfit to the old version (6MB), and now we have another error: ----------------------------- SUBJECT pls_pd_base00 Running Within-Subject GLM Writing ./tmp-pls_pd_base00_lh_thickness_CMeqOW/X-long.mat ... mri_glmfit --y ./pls_pd_base00/surf/lh.long.thickness-stack.mgh --X ./tmp-pls_pd_base00_lh_thickness_CMeqOW/X-long.mat --allow-zero-dof --no-contrasts-ok --surf pls_pd_base00 lh --label ./pls_pd_base00/label/lh.long.cortex.label --glmdir ./tmp-pls_pd_base00_lh_thickness_CMeqOW/glm ERROR: Option --allow-zero-dof unknown ERROR 255 : mri_glmfit did not work? ----------------------------- Any ideas ? Thanks for the help, Best regards, Alex. ------------------------------------------------------------------------ *De :* Martin Reuter <mreuter@nmr.mgh.harvard.edu> *À :* Alexandru Hanganu <al.hanganu@yahoo.ca>; FS Mailing List <Freesurfer@nmr.mgh.harvard.edu> *Envoyé le :* mercredi 3 octobre 2012 17h30 *Objet :* Re: [Freesurfer] long_mris_slopes error Not sure. Maybe try the updated scripts From http://martinos.org/~mreuter/long <http://martinos.org/%7Emreuter/long>/ Best Martin Alex Hanganu <al.hanganu@yahoo.ca> wrote: Dear Freesurfer Experts, While performing the long_mris_slopes cmd, we receive an error: ------------------------------------------------------------------------ SUBJECT pls_pd_base00 Running Within-Subject GLM Writing ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat ... mri_glmfit --y /Applications/freesurfer/subjects/pls_pd_base00/surf/lh.long.thickness-stack.mgh --X ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/X-long.mat --allow-zero-dof --no-contrasts-ok --surf pls_pd_base00 lh --label /Applications/freesurfer/subjects/pls_pd_base00/label/lh.long.cortex.label --glmdir ./tmp-pls_pd_base00_lh_thickness_Rx7HLs/glm Traceback (most recent call last): File "/Applications/freesurfer/bin/long_mris_slopes", line 732, in <module> run_cmd(cmd,'mri_glmfit did not work?') File "/Applications/freesurfer/bin/long_mris_slopes", line 422, in run_cmd retcode = subprocess.call(args) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py <http://subprocess.py/>", line 443, in call return Popen(*popenargs, **kwargs).wait() File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py <http://subprocess.py/>", line 593, in __init__ errread, errwrite) File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/subprocess.py <http://subprocess.py/>", line 1079, in _execute_child raise child_exception OSError: [Errno 8] Exec format error ------------------------------------------------------------------------ we changed the mris_calc and mri_glmfit files with the new ones (8.2MB / 15.8MB). Can you please help with this ? Thank you in advance, Sincerely, Alex. ------------------------------------------------------------------------ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer-- Sent from my phone, please excuse brevity.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Dear FreeSurfer Experts,
we performed the long_mris_slopes cmd and finished without error. According to the "Longitudinal Processing Tutorial", we created after that the cross sectional form of the qdec table, and then the qdec/.Qdecrc file.
When running the qdec analyses, we receive an error:
Couldn't open ...subjects-base/surf/lh.thickness.fwhm.10.fsaverage.mgz or mgh file.
The file is missing, it wasn't created.
What did we miss ?
Thanks,
Sincerely, Alex.
Hi Alex,
check the bases of other subjects. Are there any fwhm????fsaverage files?
Did you run with the --qcache flag? Then these should have been created. Maybe you passed a specific fwhm value different from 10?
Best, Martin
On Fri, 2012-11-09 at 17:13 -0500, Alex Hanganu wrote:
Dear FreeSurfer Experts,
we performed the long_mris_slopes cmd and finished without error. According to the "Longitudinal Processing Tutorial", we created after that the cross sectional form of the qdec table, and then the qdec/.Qdecrc file.
When running the qdec analyses, we receive an error:
Couldn't open ...subjects-base/surf/lh.thickness.fwhm.10.fsaverage.mgz or mgh file.
The file is missing, it wasn't created.
What did we miss ?
Thanks,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Hello Martin, thanks for your answer,
I used the --qcache. The cmd was:
long_mris_slopes --qdec qdecfile --meas thickness --hemi lh --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label --time months --fwhm 10 --qcache fsaverage --sd SUBJECTS_DIR
All the bases subjects have the specific files after this cmd: lh.long.thickness-avg[pc1/rate/spc].fwhm0[5, 10, 15, 20, 25].fsaverage.mgh
but the file that qdec asks for - is missing in all the bases subjects. Qdec asks for: lh.thickness ... but long_mris_slopes created: lh.long.thickness...
it seems to be a qdec error ? maybe.
btw, i changed the qdec.bin and qdeclibs.tgz with the last versions, from the release notes link. Also i used the last version of long_mris_slopes, from 2012/05/30. We work on mac leopard, but the recon-all -all / -base and -long was performed on linux (cluster).
Sincerely, Alex.
Le 09/11/2012 9:14 PM, Martin Reuter a écrit :
Hi Alex,
check the bases of other subjects. Are there any fwhm????fsaverage files?
Did you run with the --qcache flag? Then these should have been created. Maybe you passed a specific fwhm value different from 10?
Best, Martin
On Fri, 2012-11-09 at 17:13 -0500, Alex Hanganu wrote:
Dear FreeSurfer Experts,
we performed the long_mris_slopes cmd and finished without error. According to the "Longitudinal Processing Tutorial", we created after that the cross sectional form of the qdec table, and then the qdec/.Qdecrc file.
When running the qdec analyses, we receive an error:
Couldn't open ...subjects-base/surf/lh.thickness.fwhm.10.fsaverage.mgz or mgh file.
The file is missing, it wasn't created.
What did we miss ?
Thanks,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Hi Alex.
Take a look at the wiki page: http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial
you need to create a .Qdecrc file in the qdec directory to tell qdec about the filenames with the .long in it:
Also QDEC will not know about our new files (e.g. lh.long.thickness-spc...). We can tell it to look for them by creating a qdec/.Qdecrc file in the qdec directory that contains the following lines:
MEASURE1 = long.thickness-avg MEASURE2 = long.thickness-rate MEASURE3 = long.thickness-pc1 MEASURE4 = long.thickness-spcYou can then run qdec and do all kinds of analysis on any of those files and other variables from the qdec table:
qdec --table ./qdec/cross.qdec.table.datBest, Martin----- Original Message ----- From: "Alex Hanganu" al.hanganu@yahoo.ca To: "Martin Reuter" mreuter@nmr.mgh.harvard.edu Cc: "FS Mailing List" Freesurfer@nmr.mgh.harvard.edu Sent: Friday, November 09, 2012 9:47 PM Subject: Re: [Freesurfer] Qdec - longitudinal. File missing
Hello Martin, thanks for your answer,
I used the --qcache. The cmd was:
long_mris_slopes --qdec qdecfile --meas thickness --hemi lh --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label --time months --fwhm 10 --qcache fsaverage --sd SUBJECTS_DIR
All the bases subjects have the specific files after this cmd: lh.long.thickness-avg[pc1/rate/spc].fwhm0[5, 10, 15, 20, 25].fsaverage.mgh
but the file that qdec asks for - is missing in all the bases subjects. Qdec asks for: lh.thickness ... but long_mris_slopes created: lh.long.thickness...
it seems to be a qdec error ? maybe.
btw, i changed the qdec.bin and qdeclibs.tgz with the last versions, from the release notes link. Also i used the last version of long_mris_slopes, from 2012/05/30. We work on mac leopard, but the recon-all -all / -base and -long was performed on linux (cluster).
Sincerely, Alex.
Le 09/11/2012 9:14 PM, Martin Reuter a écrit :
Hi Alex,
check the bases of other subjects. Are there any fwhm????fsaverage files?
Did you run with the --qcache flag? Then these should have been created. Maybe you passed a specific fwhm value different from 10?
Best, Martin
On Fri, 2012-11-09 at 17:13 -0500, Alex Hanganu wrote:
Dear FreeSurfer Experts,
we performed the long_mris_slopes cmd and finished without error. According to the "Longitudinal Processing Tutorial", we created after that the cross sectional form of the qdec table, and then the qdec/.Qdecrc file.
When running the qdec analyses, we receive an error:
Couldn't open ...subjects-base/surf/lh.thickness.fwhm.10.fsaverage.mgz or mgh file.
The file is missing, it wasn't created.
What did we miss ?
Thanks,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Hello Martin,
thanks again for your help. We created the .Qdecrc file in the qdec directory. It still gives the same error. Also we made some changes to the .Qdecrc file, for example we changed the ...long.thickness.. to ...long-thickness..., but the error remaines the same.
We performed additionally the same analysis on linux, starting with long_mris_slopes, and we updated there also all the files and scripts, but when we open qdec, the error is the same.
Qdec just doesn't see the .Qdecrc file.
two systems - mac and linux, same error.
Are there some other Qdec files that need to be updated ? besides qdec.bin and qdeclibs.tgz (for mac)
Best regards,
Alex.
Le 10/11/2012 9:17 AM, Martin Reuter a écrit :
Hi Alex.
Take a look at the wiki page: http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial
you need to create a .Qdecrc file in the qdec directory to tell qdec about the filenames with the .long in it:
Also QDEC will not know about our new files (e.g. lh.long.thickness-spc...). We can tell it to look for them by creating a qdec/.Qdecrc file in the qdec directory that contains the following lines:
MEASURE1 = long.thickness-avg MEASURE2 = long.thickness-rate MEASURE3 = long.thickness-pc1 MEASURE4 = long.thickness-spcYou can then run qdec and do all kinds of analysis on any of those files and other variables from the qdec table:
qdec --table ./qdec/cross.qdec.table.datBest, Martin----- Original Message ----- From: "Alex Hanganu" al.hanganu@yahoo.ca To: "Martin Reuter" mreuter@nmr.mgh.harvard.edu Cc: "FS Mailing List" Freesurfer@nmr.mgh.harvard.edu Sent: Friday, November 09, 2012 9:47 PM Subject: Re: [Freesurfer] Qdec - longitudinal. File missing
Hello Martin, thanks for your answer,
I used the --qcache. The cmd was:
long_mris_slopes --qdec qdecfile --meas thickness --hemi lh --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label --time months --fwhm 10 --qcache fsaverage --sd SUBJECTS_DIR
All the bases subjects have the specific files after this cmd: lh.long.thickness-avg[pc1/rate/spc].fwhm0[5, 10, 15, 20, 25].fsaverage.mgh
but the file that qdec asks for - is missing in all the bases subjects. Qdec asks for: lh.thickness ... but long_mris_slopes created: lh.long.thickness...
it seems to be a qdec error ? maybe.
btw, i changed the qdec.bin and qdeclibs.tgz with the last versions, from the release notes link. Also i used the last version of long_mris_slopes, from 2012/05/30. We work on mac leopard, but the recon-all -all / -base and -long was performed on linux (cluster).
Sincerely, Alex.
Le 09/11/2012 9:14 PM, Martin Reuter a écrit :
Hi Alex,
check the bases of other subjects. Are there any fwhm????fsaverage files?
Did you run with the --qcache flag? Then these should have been created. Maybe you passed a specific fwhm value different from 10?
Best, Martin
On Fri, 2012-11-09 at 17:13 -0500, Alex Hanganu wrote:
Dear FreeSurfer Experts,
we performed the long_mris_slopes cmd and finished without error. According to the "Longitudinal Processing Tutorial", we created after that the cross sectional form of the qdec table, and then the qdec/.Qdecrc file.
When running the qdec analyses, we receive an error:
Couldn't open ...subjects-base/surf/lh.thickness.fwhm.10.fsaverage.mgz or mgh file.
The file is missing, it wasn't created.
What did we miss ?
Thanks,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Hi Alex,
the .Qdecrc (with captial Q) needs to be in the qdec directory within the $SUBJECTS_DIR. Can you check if that is the case?
Thanks, Martin
On Tue, 2012-11-13 at 13:51 -0500, Alex Hanganu wrote:
Hello Martin,
thanks again for your help. We created the .Qdecrc file in the qdec directory. It still gives the same error. Also we made some changes to the .Qdecrc file, for example we changed the ...long.thickness.. to ...long-thickness..., but the error remaines the same.
We performed additionally the same analysis on linux, starting with long_mris_slopes, and we updated there also all the files and scripts, but when we open qdec, the error is the same.
Qdec just doesn't see the .Qdecrc file.
two systems - mac and linux, same error.
Are there some other Qdec files that need to be updated ? besides qdec.bin and qdeclibs.tgz (for mac)
Best regards,
Alex.
Le 10/11/2012 9:17 AM, Martin Reuter a écrit :
Hi Alex.
Take a look at the wiki page: http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial
you need to create a .Qdecrc file in the qdec directory to tell qdec about the filenames with the .long in it:
Also QDEC will not know about our new files (e.g. lh.long.thickness-spc...). We can tell it to look for them by creating a qdec/.Qdecrc file in the qdec directory that contains the following lines:
MEASURE1 = long.thickness-avg MEASURE2 = long.thickness-rate MEASURE3 = long.thickness-pc1 MEASURE4 = long.thickness-spcYou can then run qdec and do all kinds of analysis on any of those files and other variables from the qdec table:
qdec --table ./qdec/cross.qdec.table.datBest, Martin----- Original Message ----- From: "Alex Hanganu" al.hanganu@yahoo.ca To: "Martin Reuter" mreuter@nmr.mgh.harvard.edu Cc: "FS Mailing List" Freesurfer@nmr.mgh.harvard.edu Sent: Friday, November 09, 2012 9:47 PM Subject: Re: [Freesurfer] Qdec - longitudinal. File missing
Hello Martin, thanks for your answer,
I used the --qcache. The cmd was:
long_mris_slopes --qdec qdecfile --meas thickness --hemi lh --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label --time months --fwhm 10 --qcache fsaverage --sd SUBJECTS_DIR
All the bases subjects have the specific files after this cmd: lh.long.thickness-avg[pc1/rate/spc].fwhm0[5, 10, 15, 20, 25].fsaverage.mgh
but the file that qdec asks for - is missing in all the bases subjects. Qdec asks for: lh.thickness ... but long_mris_slopes created: lh.long.thickness...
it seems to be a qdec error ? maybe.
btw, i changed the qdec.bin and qdeclibs.tgz with the last versions, from the release notes link. Also i used the last version of long_mris_slopes, from 2012/05/30. We work on mac leopard, but the recon-all -all / -base and -long was performed on linux (cluster).
Sincerely, Alex.
Le 09/11/2012 9:14 PM, Martin Reuter a écrit :
Hi Alex,
check the bases of other subjects. Are there any fwhm????fsaverage files?
Did you run with the --qcache flag? Then these should have been created. Maybe you passed a specific fwhm value different from 10?
Best, Martin
On Fri, 2012-11-09 at 17:13 -0500, Alex Hanganu wrote:
Dear FreeSurfer Experts,
we performed the long_mris_slopes cmd and finished without error. According to the "Longitudinal Processing Tutorial", we created after that the cross sectional form of the qdec table, and then the qdec/.Qdecrc file.
When running the qdec analyses, we receive an error:
Couldn't open ...subjects-base/surf/lh.thickness.fwhm.10.fsaverage.mgz or mgh file.
The file is missing, it wasn't created.
What did we miss ?
Thanks,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Hi Alex,
just tested it with our dev version and it works for me. When you setup the subjectsdir and have the file in $SUBJECT_DIR/qdec/.Qdecrc then after starting qdec you should be able to select e.g. long.thickness-rate under 'Measure' in the 'Design' tab.
Best, Martin
On Tue, 2012-11-13 at 13:51 -0500, Alex Hanganu wrote:
Hello Martin,
thanks again for your help. We created the .Qdecrc file in the qdec directory. It still gives the same error. Also we made some changes to the .Qdecrc file, for example we changed the ...long.thickness.. to ...long-thickness..., but the error remaines the same.
We performed additionally the same analysis on linux, starting with long_mris_slopes, and we updated there also all the files and scripts, but when we open qdec, the error is the same.
Qdec just doesn't see the .Qdecrc file.
two systems - mac and linux, same error.
Are there some other Qdec files that need to be updated ? besides qdec.bin and qdeclibs.tgz (for mac)
Best regards,
Alex.
Le 10/11/2012 9:17 AM, Martin Reuter a écrit :
Hi Alex.
Take a look at the wiki page: http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial
you need to create a .Qdecrc file in the qdec directory to tell qdec about the filenames with the .long in it:
Also QDEC will not know about our new files (e.g. lh.long.thickness-spc...). We can tell it to look for them by creating a qdec/.Qdecrc file in the qdec directory that contains the following lines:
MEASURE1 = long.thickness-avg MEASURE2 = long.thickness-rate MEASURE3 = long.thickness-pc1 MEASURE4 = long.thickness-spcYou can then run qdec and do all kinds of analysis on any of those files and other variables from the qdec table:
qdec --table ./qdec/cross.qdec.table.datBest, Martin----- Original Message ----- From: "Alex Hanganu" al.hanganu@yahoo.ca To: "Martin Reuter" mreuter@nmr.mgh.harvard.edu Cc: "FS Mailing List" Freesurfer@nmr.mgh.harvard.edu Sent: Friday, November 09, 2012 9:47 PM Subject: Re: [Freesurfer] Qdec - longitudinal. File missing
Hello Martin, thanks for your answer,
I used the --qcache. The cmd was:
long_mris_slopes --qdec qdecfile --meas thickness --hemi lh --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label --time months --fwhm 10 --qcache fsaverage --sd SUBJECTS_DIR
All the bases subjects have the specific files after this cmd: lh.long.thickness-avg[pc1/rate/spc].fwhm0[5, 10, 15, 20, 25].fsaverage.mgh
but the file that qdec asks for - is missing in all the bases subjects. Qdec asks for: lh.thickness ... but long_mris_slopes created: lh.long.thickness...
it seems to be a qdec error ? maybe.
btw, i changed the qdec.bin and qdeclibs.tgz with the last versions, from the release notes link. Also i used the last version of long_mris_slopes, from 2012/05/30. We work on mac leopard, but the recon-all -all / -base and -long was performed on linux (cluster).
Sincerely, Alex.
Le 09/11/2012 9:14 PM, Martin Reuter a écrit :
Hi Alex,
check the bases of other subjects. Are there any fwhm????fsaverage files?
Did you run with the --qcache flag? Then these should have been created. Maybe you passed a specific fwhm value different from 10?
Best, Martin
On Fri, 2012-11-09 at 17:13 -0500, Alex Hanganu wrote:
Dear FreeSurfer Experts,
we performed the long_mris_slopes cmd and finished without error. According to the "Longitudinal Processing Tutorial", we created after that the cross sectional form of the qdec table, and then the qdec/.Qdecrc file.
When running the qdec analyses, we receive an error:
Couldn't open ...subjects-base/surf/lh.thickness.fwhm.10.fsaverage.mgz or mgh file.
The file is missing, it wasn't created.
What did we miss ?
Thanks,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Hi Martin,
Yes, that's it, I wasn't changing the "Measure" in the "Design" tab !
Thank you very much for the advice and support !
Sincerely, Alex
Le 13/11/2012 3:41 PM, Martin Reuter a écrit :
Hi Alex,
just tested it with our dev version and it works for me. When you setup the subjectsdir and have the file in $SUBJECT_DIR/qdec/.Qdecrc then after starting qdec you should be able to select e.g. long.thickness-rate under 'Measure' in the 'Design' tab.
Best, Martin
On Tue, 2012-11-13 at 13:51 -0500, Alex Hanganu wrote:
Hello Martin,
thanks again for your help. We created the .Qdecrc file in the qdec directory. It still gives the same error. Also we made some changes to the .Qdecrc file, for example we changed the ...long.thickness.. to ...long-thickness..., but the error remaines the same.
We performed additionally the same analysis on linux, starting with long_mris_slopes, and we updated there also all the files and scripts, but when we open qdec, the error is the same.
Qdec just doesn't see the .Qdecrc file.
two systems - mac and linux, same error.
Are there some other Qdec files that need to be updated ? besides qdec.bin and qdeclibs.tgz (for mac)
Best regards,
Alex.
Le 10/11/2012 9:17 AM, Martin Reuter a écrit :
Hi Alex.
Take a look at the wiki page: http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial
you need to create a .Qdecrc file in the qdec directory to tell qdec about the filenames with the .long in it:
Also QDEC will not know about our new files (e.g. lh.long.thickness-spc...). We can tell it to look for them by creating a qdec/.Qdecrc file in the qdec directory that contains the following lines:
MEASURE1 = long.thickness-avg MEASURE2 = long.thickness-rate MEASURE3 = long.thickness-pc1 MEASURE4 = long.thickness-spcYou can then run qdec and do all kinds of analysis on any of those files and other variables from the qdec table:
qdec --table ./qdec/cross.qdec.table.datBest, Martin----- Original Message ----- From: "Alex Hanganu" al.hanganu@yahoo.ca To: "Martin Reuter" mreuter@nmr.mgh.harvard.edu Cc: "FS Mailing List" Freesurfer@nmr.mgh.harvard.edu Sent: Friday, November 09, 2012 9:47 PM Subject: Re: [Freesurfer] Qdec - longitudinal. File missing
Hello Martin, thanks for your answer,
I used the --qcache. The cmd was:
long_mris_slopes --qdec qdecfile --meas thickness --hemi lh --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label --time months --fwhm 10 --qcache fsaverage --sd SUBJECTS_DIR
All the bases subjects have the specific files after this cmd: lh.long.thickness-avg[pc1/rate/spc].fwhm0[5, 10, 15, 20, 25].fsaverage.mgh
but the file that qdec asks for - is missing in all the bases subjects. Qdec asks for: lh.thickness ... but long_mris_slopes created: lh.long.thickness...
it seems to be a qdec error ? maybe.
btw, i changed the qdec.bin and qdeclibs.tgz with the last versions, from the release notes link. Also i used the last version of long_mris_slopes, from 2012/05/30. We work on mac leopard, but the recon-all -all / -base and -long was performed on linux (cluster).
Sincerely, Alex.
Le 09/11/2012 9:14 PM, Martin Reuter a écrit :
Hi Alex,
check the bases of other subjects. Are there any fwhm????fsaverage files?
Did you run with the --qcache flag? Then these should have been created. Maybe you passed a specific fwhm value different from 10?
Best, Martin
On Fri, 2012-11-09 at 17:13 -0500, Alex Hanganu wrote:
Dear FreeSurfer Experts,
we performed the long_mris_slopes cmd and finished without error. According to the "Longitudinal Processing Tutorial", we created after that the cross sectional form of the qdec table, and then the qdec/.Qdecrc file.
When running the qdec analyses, we receive an error:
Couldn't open ...subjects-base/surf/lh.thickness.fwhm.10.fsaverage.mgz or mgh file.
The file is missing, it wasn't created.
What did we miss ?
Thanks,
Sincerely, Alex.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
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
Dear Freesurfer Experts,
We are analysing longitudinal data - the difference between 2 groups (P and M) [19 and 17 subjects] with 2 time points for each group (A, B).
We are using the example of "Repeated Measures Anova" (http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova)
For our first approach - we took all the subjects - 36 classes, and tried to create the contrast for:
P(B-A) - M(B-A) 2 within subject factors, and 2 inter-subject
We considered the recent explanations (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html), and, as we understood, our null hypothesis is:
PB-PA=0 AND MB-MA=0 -> Combining: PB-PA-MB+MA=0
and the matrix seems to be: 0 0 0 .... (36 zeros) -1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) -1
but we still get a dimension mismatch between X and C: X has 72, C has 37.
The fsgd file is like this: Class subject 1 . . . Class subject 36 Variables TP1-vs-TP2 Input groupPsubj1-A Subject1 -1 Input groupPsubj1- B Subject1 1 Input groupPsubj2-A Subject2 -1 . . . Input groupMsubj35-A Subject35 1 Input groupMsubj35-B Subject35 -1 Input groupMsubj36-A Subject36 1 Input groupMsubj36-B Subject36 -1
==============
Our second approach - we run mris_glmfit for each group separately and then we wanted to use mris_calc to compute the difference:
mris_calc -o avg.mgh groupP/glm-dir/Contrast/sig.mgh add groupM/glm-dir/Contrast/sig.mgh
though the sig.mgh for each group shows significant results, the avg.mgh reveals no effect.
Can you please help with this analysis ?
Thanks!
Sincerely, Alex.
Hi Alex,
I am not familiar with the way Doug describes the repeated measure anova on the wiki. Of course in a longitudinal setting repeated measures are correlated and I am not sure if this is considered in that model there.
Since you have only 2 time points, why not simply compare the difference (or weighted by the time distance, if the time points are not the same distance apart)?
You would compute (tp2-tp1)/time for each subject and then compare this across groups with a standard glm. Since in the longitudinal stream both thickness maps are registered, you can simply use mris_calc to compute the difference directly.
There are also scripts for this (long_mris_slopes, even for more than 2 time points, where we fit a line into each subject). See the http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial This is a simple approach, first reducing the variable of interest (change across time) to a single number per subject and then running a standard test. It should be sufficient for your setting.
You can also do more complex modeling using our new linear mixed effects models if you want (see older email from Jorge about that). It considers both temporal and spacial correlation of measures. This model is especially useful if you have differently many time points and time distances per subject.
Best, Martin
On Tue, 2012-12-04 at 18:26 -0500, Alex Hanganu wrote:
Dear Freesurfer Experts,
We are analysing longitudinal data - the difference between 2 groups (P and M) [19 and 17 subjects] with 2 time points for each group (A, B).
We are using the example of "Repeated Measures Anova" (http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova)
For our first approach - we took all the subjects - 36 classes, and tried to create the contrast for:
P(B-A) - M(B-A) 2 within subject factors, and 2 inter-subject
We considered the recent explanations (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html), and, as we understood, our null hypothesis is:
PB-PA=0 AND MB-MA=0 -> Combining: PB-PA-MB+MA=0
and the matrix seems to be: 0 0 0 .... (36 zeros) -1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) -1
but we still get a dimension mismatch between X and C: X has 72, C has 37.
The fsgd file is like this: Class subject 1 . . . Class subject 36 Variables TP1-vs-TP2 Input groupPsubj1-A Subject1 -1 Input groupPsubj1- B Subject1 1 Input groupPsubj2-A Subject2 -1 . . . Input groupMsubj35-A Subject35 1 Input groupMsubj35-B Subject35 -1 Input groupMsubj36-A Subject36 1 Input groupMsubj36-B Subject36 -1
==============
Our second approach - we run mris_glmfit for each group separately and then we wanted to use mris_calc to compute the difference:
mris_calc -o avg.mgh groupP/glm-dir/Contrast/sig.mgh add groupM/glm-dir/Contrast/sig.mgh
though the sig.mgh for each group shows significant results, the avg.mgh reveals no effect.
Can you please help with this analysis ?
Thanks!
Sincerely, Alex. _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Hello Martin,
thanks for the quick reply !
as I understood, from the "LongitudinalTutorial", after long_mris_slopes the results can be seen for each subject, and in order to see the group results, all subjects should be analysed in the Qdec, and there I could see the results for each group, but couldn't do the inter-group, this is why we tried the "RepeatedMeasuresAnova"
Indeed, there is some difference in the time distance, so we will try your new idea !
I know about Jorge's work - Marvellous ! but it seems to need too much time to be comprehended and applied. We hoped to be done with these results and start already writing the paper :)
Thank you very much for Your help !!!
Sincerely, Alex.
Le 04/12/2012 6:44 PM, Martin Reuter a écrit :
Hi Alex,
I am not familiar with the way Doug describes the repeated measure anova on the wiki. Of course in a longitudinal setting repeated measures are correlated and I am not sure if this is considered in that model there.
Since you have only 2 time points, why not simply compare the difference (or weighted by the time distance, if the time points are not the same distance apart)?
You would compute (tp2-tp1)/time for each subject and then compare this across groups with a standard glm. Since in the longitudinal stream both thickness maps are registered, you can simply use mris_calc to compute the difference directly.
There are also scripts for this (long_mris_slopes, even for more than 2 time points, where we fit a line into each subject). See the http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial This is a simple approach, first reducing the variable of interest (change across time) to a single number per subject and then running a standard test. It should be sufficient for your setting.
You can also do more complex modeling using our new linear mixed effects models if you want (see older email from Jorge about that). It considers both temporal and spacial correlation of measures. This model is especially useful if you have differently many time points and time distances per subject.
Best, Martin
On Tue, 2012-12-04 at 18:26 -0500, Alex Hanganu wrote:
Dear Freesurfer Experts,
We are analysing longitudinal data - the difference between 2 groups (P and M) [19 and 17 subjects] with 2 time points for each group (A, B).
We are using the example of "Repeated Measures Anova" (http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova)
For our first approach - we took all the subjects - 36 classes, and tried to create the contrast for:
P(B-A) - M(B-A) 2 within subject factors, and 2 inter-subject
We considered the recent explanations (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html), and, as we understood, our null hypothesis is:
PB-PA=0 AND MB-MA=0 -> Combining: PB-PA-MB+MA=0
and the matrix seems to be: 0 0 0 .... (36 zeros) -1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) -1
but we still get a dimension mismatch between X and C: X has 72, C has 37.
The fsgd file is like this: Class subject 1 . . . Class subject 36 Variables TP1-vs-TP2 Input groupPsubj1-A Subject1 -1 Input groupPsubj1- B Subject1 1 Input groupPsubj2-A Subject2 -1 . . . Input groupMsubj35-A Subject35 1 Input groupMsubj35-B Subject35 -1 Input groupMsubj36-A Subject36 1 Input groupMsubj36-B Subject36 -1
==============
Our second approach - we run mris_glmfit for each group separately and then we wanted to use mris_calc to compute the difference:
mris_calc -o avg.mgh groupP/glm-dir/Contrast/sig.mgh add groupM/glm-dir/Contrast/sig.mgh
though the sig.mgh for each group shows significant results, the avg.mgh reveals no effect.
Can you please help with this analysis ?
Thanks!
Sincerely, Alex. ____________________
Hi Alex,
as far as I know qdec can do what you want (compare e.g. the atrophy rate across the two groups).
However, you don't need to use qdec for the second stage, you can run mri_glmfit directly on the differences (or slopes). Basically you get a thickness_yearly_change (or pct change) in each base directory and can then see if that correlates with any covariate or group membership etc.
Qdec just makes is easier to use.
Best, Martin
On Tue, 2012-12-04 at 19:19 -0500, Alex Hanganu wrote:
Hello Martin,
thanks for the quick reply !
as I understood, from the "LongitudinalTutorial", after long_mris_slopes the results can be seen for each subject, and in order to see the group results, all subjects should be analysed in the Qdec, and there I could see the results for each group, but couldn't do the inter-group, this is why we tried the "RepeatedMeasuresAnova"
Indeed, there is some difference in the time distance, so we will try your new idea !
I know about Jorge's work - Marvellous ! but it seems to need too much time to be comprehended and applied. We hoped to be done with these results and start already writing the paper :)
Thank you very much for Your help !!!
Sincerely, Alex.
Le 04/12/2012 6:44 PM, Martin Reuter a écrit :
Hi Alex,
I am not familiar with the way Doug describes the repeated measure anova on the wiki. Of course in a longitudinal setting repeated measures are correlated and I am not sure if this is considered in that model there.
Since you have only 2 time points, why not simply compare the difference (or weighted by the time distance, if the time points are not the same distance apart)?
You would compute (tp2-tp1)/time for each subject and then compare this across groups with a standard glm. Since in the longitudinal stream both thickness maps are registered, you can simply use mris_calc to compute the difference directly.
There are also scripts for this (long_mris_slopes, even for more than 2 time points, where we fit a line into each subject). See the http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial This is a simple approach, first reducing the variable of interest (change across time) to a single number per subject and then running a standard test. It should be sufficient for your setting.
You can also do more complex modeling using our new linear mixed effects models if you want (see older email from Jorge about that). It considers both temporal and spacial correlation of measures. This model is especially useful if you have differently many time points and time distances per subject.
Best, Martin
On Tue, 2012-12-04 at 18:26 -0500, Alex Hanganu wrote:
Dear Freesurfer Experts,
We are analysing longitudinal data - the difference between 2 groups (P and M) [19 and 17 subjects] with 2 time points for each group (A, B).
We are using the example of "Repeated Measures Anova" (http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova)
For our first approach - we took all the subjects - 36 classes, and tried to create the contrast for:
P(B-A) - M(B-A) 2 within subject factors, and 2 inter-subject
We considered the recent explanations (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html), and, as we understood, our null hypothesis is:
PB-PA=0 AND MB-MA=0 -> Combining: PB-PA-MB+MA=0
and the matrix seems to be: 0 0 0 .... (36 zeros) -1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) -1
but we still get a dimension mismatch between X and C: X has 72, C has 37.
The fsgd file is like this: Class subject 1 . . . Class subject 36 Variables TP1-vs-TP2 Input groupPsubj1-A Subject1 -1 Input groupPsubj1- B Subject1 1 Input groupPsubj2-A Subject2 -1 . . . Input groupMsubj35-A Subject35 1 Input groupMsubj35-B Subject35 -1 Input groupMsubj36-A Subject36 1 Input groupMsubj36-B Subject36 -1
==============
Our second approach - we run mris_glmfit for each group separately and then we wanted to use mris_calc to compute the difference:
mris_calc -o avg.mgh groupP/glm-dir/Contrast/sig.mgh add groupM/glm-dir/Contrast/sig.mgh
though the sig.mgh for each group shows significant results, the avg.mgh reveals no effect.
Can you please help with this analysis ?
Thanks!
Sincerely, Alex. ____________________
Hello Martin,
Thanks for pointing out about qdec, I missed that part.
We performed this analysis on qdec.
Thanks for explaning the advantages of each longitudinal statistic method (http://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalStatistics) !
We are working now with the LME Model.
Sincerely,
Alex.
Le 04/12/2012 7:50 PM, Martin Reuter a écrit :
Hi Alex,
as far as I know qdec can do what you want (compare e.g. the atrophy rate across the two groups).
However, you don't need to use qdec for the second stage, you can run mri_glmfit directly on the differences (or slopes). Basically you get a thickness_yearly_change (or pct change) in each base directory and can then see if that correlates with any covariate or group membership etc.
Qdec just makes is easier to use.
Best, Martin
On Tue, 2012-12-04 at 19:19 -0500, Alex Hanganu wrote:
Hello Martin,
thanks for the quick reply !
as I understood, from the "LongitudinalTutorial", after long_mris_slopes the results can be seen for each subject, and in order to see the group results, all subjects should be analysed in the Qdec, and there I could see the results for each group, but couldn't do the inter-group, this is why we tried the "RepeatedMeasuresAnova"
Indeed, there is some difference in the time distance, so we will try your new idea !
I know about Jorge's work - Marvellous ! but it seems to need too much time to be comprehended and applied. We hoped to be done with these results and start already writing the paper :)
Thank you very much for Your help !!!
Sincerely, Alex.
Le 04/12/2012 6:44 PM, Martin Reuter a écrit :
Hi Alex,
I am not familiar with the way Doug describes the repeated measure anova on the wiki. Of course in a longitudinal setting repeated measures are correlated and I am not sure if this is considered in that model there.
Since you have only 2 time points, why not simply compare the difference (or weighted by the time distance, if the time points are not the same distance apart)?
You would compute (tp2-tp1)/time for each subject and then compare this across groups with a standard glm. Since in the longitudinal stream both thickness maps are registered, you can simply use mris_calc to compute the difference directly.
There are also scripts for this (long_mris_slopes, even for more than 2 time points, where we fit a line into each subject). See the http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial This is a simple approach, first reducing the variable of interest (change across time) to a single number per subject and then running a standard test. It should be sufficient for your setting.
You can also do more complex modeling using our new linear mixed effects models if you want (see older email from Jorge about that). It considers both temporal and spacial correlation of measures. This model is especially useful if you have differently many time points and time distances per subject.
Best, Martin
On Tue, 2012-12-04 at 18:26 -0500, Alex Hanganu wrote:
Dear Freesurfer Experts,
We are analysing longitudinal data - the difference between 2 groups (P and M) [19 and 17 subjects] with 2 time points for each group (A, B).
We are using the example of "Repeated Measures Anova" (http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova)
For our first approach - we took all the subjects - 36 classes, and tried to create the contrast for:
P(B-A) - M(B-A) 2 within subject factors, and 2 inter-subject
We considered the recent explanations (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html), and, as we understood, our null hypothesis is:
PB-PA=0 AND MB-MA=0 -> Combining: PB-PA-MB+MA=0
and the matrix seems to be: 0 0 0 .... (36 zeros) -1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) -1
but we still get a dimension mismatch between X and C: X has 72, C has 37.
The fsgd file is like this: Class subject 1 . . . Class subject 36 Variables TP1-vs-TP2 Input groupPsubj1-A Subject1 -1 Input groupPsubj1- B Subject1 1 Input groupPsubj2-A Subject2 -1 . . . Input groupMsubj35-A Subject35 1 Input groupMsubj35-B Subject35 -1 Input groupMsubj36-A Subject36 1 Input groupMsubj36-B Subject36 -1
==============
Our second approach - we run mris_glmfit for each group separately and then we wanted to use mris_calc to compute the difference:
mris_calc -o avg.mgh groupP/glm-dir/Contrast/sig.mgh add groupM/glm-dir/Contrast/sig.mgh
though the sig.mgh for each group shows significant results, the avg.mgh reveals no effect.
Can you please help with this analysis ?
Thanks!
Sincerely, Alex. ____________________
Yeah, wrote that wiki page yesterday after all the emails on the list.
Glad it helps.
Best, Martin
On Wed, 2012-12-05 at 13:49 -0500, Alex Hanganu wrote:
Hello Martin,
Thanks for pointing out about qdec, I missed that part.
We performed this analysis on qdec.
Thanks for explaning the advantages of each longitudinal statistic method (http://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalStatistics) !
We are working now with the LME Model.
Sincerely,
Alex.
Le 04/12/2012 7:50 PM, Martin Reuter a écrit :
Hi Alex,
as far as I know qdec can do what you want (compare e.g. the atrophy rate across the two groups).
However, you don't need to use qdec for the second stage, you can run mri_glmfit directly on the differences (or slopes). Basically you get a thickness_yearly_change (or pct change) in each base directory and can then see if that correlates with any covariate or group membership etc.
Qdec just makes is easier to use.
Best, Martin
On Tue, 2012-12-04 at 19:19 -0500, Alex Hanganu wrote:
Hello Martin,
thanks for the quick reply !
as I understood, from the "LongitudinalTutorial", after long_mris_slopes the results can be seen for each subject, and in order to see the group results, all subjects should be analysed in the Qdec, and there I could see the results for each group, but couldn't do the inter-group, this is why we tried the "RepeatedMeasuresAnova"
Indeed, there is some difference in the time distance, so we will try your new idea !
I know about Jorge's work - Marvellous ! but it seems to need too much time to be comprehended and applied. We hoped to be done with these results and start already writing the paper :)
Thank you very much for Your help !!!
Sincerely, Alex.
Le 04/12/2012 6:44 PM, Martin Reuter a écrit :
Hi Alex,
I am not familiar with the way Doug describes the repeated measure anova on the wiki. Of course in a longitudinal setting repeated measures are correlated and I am not sure if this is considered in that model there.
Since you have only 2 time points, why not simply compare the difference (or weighted by the time distance, if the time points are not the same distance apart)?
You would compute (tp2-tp1)/time for each subject and then compare this across groups with a standard glm. Since in the longitudinal stream both thickness maps are registered, you can simply use mris_calc to compute the difference directly.
There are also scripts for this (long_mris_slopes, even for more than 2 time points, where we fit a line into each subject). See the http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial This is a simple approach, first reducing the variable of interest (change across time) to a single number per subject and then running a standard test. It should be sufficient for your setting.
You can also do more complex modeling using our new linear mixed effects models if you want (see older email from Jorge about that). It considers both temporal and spacial correlation of measures. This model is especially useful if you have differently many time points and time distances per subject.
Best, Martin
On Tue, 2012-12-04 at 18:26 -0500, Alex Hanganu wrote:
Dear Freesurfer Experts,
We are analysing longitudinal data - the difference between 2 groups (P and M) [19 and 17 subjects] with 2 time points for each group (A, B).
We are using the example of "Repeated Measures Anova" (http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova)
For our first approach - we took all the subjects - 36 classes, and tried to create the contrast for:
P(B-A) - M(B-A) 2 within subject factors, and 2 inter-subject
We considered the recent explanations (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html), and, as we understood, our null hypothesis is:
PB-PA=0 AND MB-MA=0 -> Combining: PB-PA-MB+MA=0
and the matrix seems to be: 0 0 0 .... (36 zeros) -1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) -1
but we still get a dimension mismatch between X and C: X has 72, C has 37.
The fsgd file is like this: Class subject 1 . . . Class subject 36 Variables TP1-vs-TP2 Input groupPsubj1-A Subject1 -1 Input groupPsubj1- B Subject1 1 Input groupPsubj2-A Subject2 -1 . . . Input groupMsubj35-A Subject35 1 Input groupMsubj35-B Subject35 -1 Input groupMsubj36-A Subject36 1 Input groupMsubj36-B Subject36 -1
==============
Our second approach - we run mris_glmfit for each group separately and then we wanted to use mris_calc to compute the difference:
mris_calc -o avg.mgh groupP/glm-dir/Contrast/sig.mgh add groupM/glm-dir/Contrast/sig.mgh
though the sig.mgh for each group shows significant results, the avg.mgh reveals no effect.
Can you please help with this analysis ?
Thanks!
Sincerely, Alex. ____________________
Hi Alex I think that your design is very simple and so will be to use our lme tools. There is an example of a mass-univariate analysis on the wiki at http://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalStatistics. However, the analysis there is much more complex (because of the more complex data) than what you actually need. Since you only have two repeated measures your model only requires one random effect for the intercept term (a compound symmetry covariance always hold when there are only two repeated measures). So you don’t have to carry out any model selection procedure. Your design matrix only contains four colums 1- A column of 1s (intercept term) 2- The time covariate (or alternative a variable composed of 0s and 1s indicating whether the measurement occasion is the second time point or not). 3- The group covariate (composed of 0s and 1s indicating group membership) 4- The group by time interaction (the point to point product of the previous second and third covariates). Once you have run the Freesurfer’s mris_preproc and mri_surf2surf cmd it is quite easy to read the generated data into Matlab using lme. If you think that it is to difficult to apply the spatiotemporal mixed-effects model at least try the voxel-wise mixed model. It only requires you to run one Matlab function lme_mass_fit_vw(X,1,Y,ni,cortex) were X is your ordered design matrix, Y is the cortical thickness data matrix, ni is 2*ones(36,1) and cortex is your average subject's cortex label. Even that voxel-wise mixed model analysis will perform much better than other approaches (both in power and family wise error). Then you only need to test if the coefficient for the interaction term is greater than zero with the contrast C=[0 0 0 1] and write your results for visualization in Freesurfer (or you can obtained the anatomical coordinates of the detected clusters usin the mri_surfcluster cmd). I think that what is called “RepeatedMeasuresAnova” in the wiki is not actually a true repeated measures Anova analysis and in your case (two repeated measures and two groups) it will give you exactly the same results as using the mris_slope cmd. The only advantage of those methods over the lme tool at the moment is the possibility of using other multiple comparison methods in addition to FDR. I encourage people to give a try to the lme tools because it will pay good dividends after all, especially for those studies with more than three repeated measures. Just write to me any doubt you have and I will answer you ASAP. Best -Jorge
De: Alex Hanganu al.hanganu@yahoo.ca Para: Martin Reuter mreuter@nmr.mgh.harvard.edu CC: FS Mailing List Freesurfer@nmr.mgh.harvard.edu Enviado: Martes 4 de diciembre de 2012 19:19 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast
Hello Martin,
thanks for the quick reply !
as I understood, from the "LongitudinalTutorial", after long_mris_slopes the results can be seen for each subject, and in order to see the group results, all subjects should be analysed in the Qdec, and there I could see the results for each group, but couldn't do the inter-group, this is why we tried the "RepeatedMeasuresAnova"
Indeed, there is some difference in the time distance, so we will try your new idea !
I know about Jorge's work - Marvellous ! but it seems to need too much time to be comprehended and applied. We hoped to be done with these results and start already writing the paper :)
Thank you very much for Your help !!!
Sincerely, Alex.
Le 04/12/2012 6:44 PM, Martin Reuter a écrit :
Hi Alex,
I am not familiar with the way Doug describes the repeated measure anova on the wiki. Of course in a longitudinal setting repeated measures are correlated and I am not sure if this is considered in that model there.
Since you have only 2 time points, why not simply compare the difference (or weighted by the time distance, if the time points are not the same distance apart)?
You would compute (tp2-tp1)/time for each subject and then compare this across groups with a standard glm. Since in the longitudinal stream both thickness maps are registered, you can simply use mris_calc to compute the difference directly.
There are also scripts for this (long_mris_slopes, even for more than 2 time points, where we fit a line into each subject). See the http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial This is a simple approach, first reducing the variable of interest (change across time) to a single number per subject and then running a standard test. It should be sufficient for your setting.
You can also do more complex modeling using our new linear mixed effects models if you want (see older email from Jorge about that). It considers both temporal and spacial correlation of measures. This model is especially useful if you have differently many time points and time distances per subject.
Best, Martin
On Tue, 2012-12-04 at 18:26 -0500, Alex Hanganu wrote:
Dear Freesurfer Experts,
We are analysing longitudinal data - the difference between 2 groups (P and M) [19 and 17 subjects] with 2 time points for each group (A, B).
We are using the example of "Repeated Measures Anova" (http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova)
For our first approach - we took all the subjects - 36 classes, and tried to create the contrast for:
P(B-A) - M(B-A) 2 within subject factors, and 2 inter-subject
We considered the recent explanations (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html), and, as we understood, our null hypothesis is:
PB-PA=0 AND MB-MA=0 -> Combining: PB-PA-MB+MA=0
and the matrix seems to be: 0 0 0 .... (36 zeros) -1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) -1
but we still get a dimension mismatch between X and C: X has 72, C has 37.
The fsgd file is like this: Class subject 1 . . . Class subject 36 Variables TP1-vs-TP2 Input groupPsubj1-A Subject1 -1 Input groupPsubj1- B Subject1 1 Input groupPsubj2-A Subject2 -1 . . . Input groupMsubj35-A Subject35 1 Input groupMsubj35-B Subject35 -1 Input groupMsubj36-A Subject36 1 Input groupMsubj36-B Subject36 -1
==============
Our second approach - we run mris_glmfit for each group separately and then we wanted to use mris_calc to compute the difference:
mris_calc -o avg.mgh groupP/glm-dir/Contrast/sig.mgh add groupM/glm-dir/Contrast/sig.mgh
though the sig.mgh for each group shows significant results, the avg.mgh reveals no effect.
Can you please help with this analysis ?
Thanks!
Sincerely, Alex. ____________________
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Hi Jorge,
thanks for such a detailed help !!!
Martin explained very well the advantages of this method, so we are working on it now, and we have an Error.
we loaded the lh.thickness_sm10.mgh file, read the surface and label. Then we read the qdec.table.dat. During the "sids = Qdec(:,1);" cmd we have an error: "Index exceeds matrix dimensions"
does this mean we have an error in the qdec or fsgd file ? These files seems to be correct.
Thanks !
Sincerely,
Alex.
Le 04/12/2012 8:45 PM, jorge luis a écrit :
Hi Alex I think that your design is very simple and so will be to use our lme tools. There is an example of a mass-univariate analysis on the wiki at http://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalStatistics. However, the analysis there is much more complex (because of the more complex data) than what you actually need. Since you only have two repeated measures your model only requires one random effect for the intercept term (a compound symmetry covariance always hold when there are only two repeated measures). So you don't have to carry out any model selection procedure. Your design matrix only contains four colums 1- A column of 1s (intercept term) 2- The time covariate (or alternative a variable composed of 0s and 1s indicating whether the measurement occasion is the second time point or not). 3- The group covariate (composed of 0s and 1s indicating group membership) 4- The group by time interaction (the point to point product of the previous second and third covariates). Once you have run the Freesurfer's mris_preproc and mri_surf2surf cmd it is quite easy to read the generated data into Matlab using lme. If you think that it is to difficult to apply the spatiotemporal mixed-effects model at least try the voxel-wise mixed model. It only requires you to run one Matlab function ///lme_mass_fit_vw(X,1,Y,ni,cortex)/ were X is your ordered design matrix, Y is the cortical thickness data matrix, ni is 2*ones(36,1) and cortex is your average subject's cortex label. Even that voxel-wise mixed model analysis will perform much better than other approaches (both in power and family wise error). Then you only need to test if the coefficient for the interaction term is greater than zero with the contrast C=[0 0 0 1] and write your results for visualization in Freesurfer (or you can obtained the anatomical coordinates of the detected clusters usin the mri_surfcluster cmd). I think that what is called "RepeatedMeasuresAnova" in the wiki is not actually a true repeated measures Anova analysis and in your case (two repeated measures and two groups) it will give you exactly the same results as using the mris_slope cmd. The only advantage of those methods over the lme tool at the moment is the possibility of using other multiple comparison methods in addition to FDR. I encourage people to give a try to the lme tools because it will pay good dividends after all, especially for those studies with more than three repeated measures. Just write to me any doubt you have and I will answer you ASAP. Best -Jorge
*De:* Alex Hanganu <al.hanganu@yahoo.ca> *Para:* Martin Reuter <mreuter@nmr.mgh.harvard.edu> *CC:* FS Mailing List <Freesurfer@nmr.mgh.harvard.edu> *Enviado:* Martes 4 de diciembre de 2012 19:19 *Asunto:* Re: [Freesurfer] Longitudinal analysis - contrast Hello Martin, thanks for the quick reply ! as I understood, from the "LongitudinalTutorial", after long_mris_slopes the results can be seen for each subject, and in order to see the group results, all subjects should be analysed in the Qdec, and there I could see the results for each group, but couldn't do the inter-group, this is why we tried the "RepeatedMeasuresAnova" Indeed, there is some difference in the time distance, so we will try your new idea ! I know about Jorge's work - Marvellous ! but it seems to need too much time to be comprehended and applied. We hoped to be done with these results and start already writing the paper :) Thank you very much for Your help !!! Sincerely, Alex. Le 04/12/2012 6:44 PM, Martin Reuter a écrit : > Hi Alex, > > I am not familiar with the way Doug describes the repeated measure anova > on the wiki. Of course in a longitudinal setting repeated measures are > correlated and I am not sure if this is considered in that model there. > > Since you have only 2 time points, why not simply compare the difference > (or weighted by the time distance, if the time points are not the same > distance apart)? > > You would compute (tp2-tp1)/time for each subject and then compare this > across groups with a standard glm. > Since in the longitudinal stream both thickness maps are registered, you > can simply use mris_calc to compute the difference directly. > > There are also scripts for this (long_mris_slopes, even for more than 2 > time points, where we fit a line into each subject). See the > http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial > This is a simple approach, first reducing the variable of interest > (change across time) to a single number per subject and then running a > standard test. It should be sufficient for your setting. > > You can also do more complex modeling using our new linear mixed effects > models if you want (see older email from Jorge about that). It considers > both temporal and spacial correlation of measures. This model is > especially useful if you have differently many time points and time > distances per subject. > > Best, Martin > > > On Tue, 2012-12-04 at 18:26 -0500, Alex Hanganu wrote: >> Dear Freesurfer Experts, >> >> We are analysing longitudinal data - the difference between 2 groups (P >> and M) [19 and 17 subjects] with 2 time points for each group (A, B). >> >> We are using the example of "Repeated Measures Anova" >> (http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova) >> >> For our first approach - we took all the subjects - 36 classes, and >> tried to create the contrast for: >> >> P(B-A) - M(B-A) >> 2 within subject factors, and 2 inter-subject >> >> We considered the recent explanations >> (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html), >> and, as we understood, our null hypothesis is: >> >> PB-PA=0 AND MB-MA=0 -> >> Combining: PB-PA-MB+MA=0 >> >> and the matrix seems to be: >> 0 0 0 .... (36 zeros) -1 >> 0 0 0 .... (36 zeros) 1 >> 0 0 0 .... (36 zeros) 1 >> 0 0 0 .... (36 zeros) -1 >> >> but we still get a dimension mismatch between X and C: X has 72, C has 37. >> >> The fsgd file is like this: >> Class subject 1 >> . >> . >> . >> Class subject 36 >> Variables TP1-vs-TP2 >> Input groupPsubj1-A Subject1 -1 >> Input groupPsubj1- B Subject1 1 >> Input groupPsubj2-A Subject2 -1 >> . >> . >> . >> Input groupMsubj35-A Subject35 1 >> Input groupMsubj35-B Subject35 -1 >> Input groupMsubj36-A Subject36 1 >> Input groupMsubj36-B Subject36 -1 >> >> ============== >> >> Our second approach - we run mris_glmfit for each group separately and >> then we wanted to use mris_calc to compute the difference: >> >> mris_calc -o avg.mgh groupP/glm-dir/Contrast/sig.mgh add >> groupM/glm-dir/Contrast/sig.mgh >> >> though the sig.mgh for each group shows significant results, the avg.mgh >> reveals no effect. >> >> Can you please help with this analysis ? >> >> Thanks! >> >> Sincerely, >> Alex. >> ____________________
Hi Alex
This error is likely due to the Qdec variable being empty. So, nothing was read into this variable when you applied
Qdec = fReadQdec('qdec.table.dat');
Please check that. If you don't find a solution to this then send me your Qdec table data file and I will check it out.
Best -Jorge
De: Alex Hanganu al.hanganu@yahoo.ca Para: jorge luis jbernal0019@yahoo.es CC: FS Mailing List Freesurfer@nmr.mgh.harvard.edu Enviado: Miércoles 5 de diciembre de 2012 13:50 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast
Hi Jorge,
thanks for such a detailed help !!!
Martin explained very well the advantages of this method, so we
are working on it now, and we have an Error.
we loaded the lh.thickness_sm10.mgh file, read the surface and
label. Then we read the qdec.table.dat.
During the "sids = Qdec(:,1);" cmd we have an error: "Index exceeds matrix dimensions"
does this mean we have an error in the qdec or fsgd file ? These
files seems to be correct.
Thanks !
Sincerely,
Alex.
Le 04/12/2012 8:45 PM, jorge luis a écrit :
Hi Alex
I think that your design is very simple and so will be to use our lme tools. There is an example of a mass-univariate analysis on the wiki at http://surfer.nmr.mgh.harvard.edu/fswiki/LongitudinalStatistics. However, the analysis there is much more complex (because of the more complex data) than what you actually need. Since you only have two repeated measures your model only requires one random effect for the intercept term (a compound symmetry covariance always hold when there are only two repeated measures). So you don’t have to carry out any model selection procedure. Your design matrix only contains four colums 1- A column of 1s (intercept term) 2- The time covariate (or alternative a variable composed of 0s and 1s indicating whether the measurement occasion is the second time point or not). 3- The group covariate (composed of 0s and 1s indicating group membership) 4- The group by time interaction (the point to point product of the previous second and third covariates). Once you have run the Freesurfer’s mris_preproc and mri_surf2surf cmd it is quite easy to read the generated data into Matlab using lme. If you think that it is to difficult to apply the spatiotemporal mixed-effects model at least try the voxel-wise mixed model. It only requires you to run one Matlab function lme_mass_fit_vw(X,1,Y,ni,cortex) were X is your ordered design matrix, Y is the cortical thickness data matrix, ni is 2*ones(36,1) and cortex is your average subject's cortex label. Even that voxel-wise mixed model analysis will perform much better than other approaches (both in power and family wise error). Then you only need to test if the coefficient for the interaction term is greater than zero with the contrast C=[0 0 0 1] and write your results for visualization in Freesurfer (or you can obtained the anatomical coordinates of the detected clusters usin the mri_surfcluster cmd). I think that what is called “RepeatedMeasuresAnova” in the wiki is not actually a true repeated measures Anova analysis and in your case (two repeated measures and two groups) it will give you exactly the same results as using the mris_slope cmd. The only advantage of those methods over the lme tool at the moment is the possibility of using other multiple comparison methods in addition to FDR. I encourage people to give a try to the lme tools because it will pay good dividends after all, especially for those studies with more than three repeated measures. Just write to me any doubt you have and I will answer you ASAP. Best -Jorge
De: Alex Hanganu al.hanganu@yahoo.ca
Para: Martin Reuter mreuter@nmr.mgh.harvard.edu CC: FS Mailing List Freesurfer@nmr.mgh.harvard.edu Enviado: Martes 4 de diciembre de 2012 19:19 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast
Hello Martin,
thanks for the quick reply !
as I understood, from the "LongitudinalTutorial", after
long_mris_slopes
the results can be seen for each subject, and in order
to see the group
results, all subjects should be analysed in the Qdec,
and there I could
see the results for each group, but couldn't do the
inter-group, this is
why we tried the "RepeatedMeasuresAnova"
Indeed, there is some difference in the time distance,
so we will try
your new idea !
I know about Jorge's work - Marvellous ! but it seems to
need too much
time to be comprehended and applied. We hoped to be done
with these
results and start already writing the paper :)
Thank you very much for Your help !!!
Sincerely, Alex.
Le 04/12/2012 6:44 PM, Martin Reuter a écrit :
Hi Alex,
I am not familiar with the way Doug describes the
repeated measure anova
on the wiki. Of course in a longitudinal setting
repeated measures are
correlated and I am not sure if this is considered
in that model there.
Since you have only 2 time points, why not simply
compare the difference
(or weighted by the time distance, if the time
points are not the same
distance apart)?
You would compute (tp2-tp1)/time for each subject
and then compare this
across groups with a standard glm. Since in the longitudinal stream both thickness
maps are registered, you
can simply use mris_calc to compute the difference
directly.
There are also scripts for this (long_mris_slopes,
even for more than 2
time points, where we fit a line into each
subject). See the
http://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/LongitudinalTutorial This is a simple approach, first reducing the
variable of interest
(change across time) to a single number per subject
and then running a
standard test. It should be sufficient for your
setting.
You can also do more complex modeling using our new
linear mixed effects
models if you want (see older email from Jorge
about that). It considers
both temporal and spacial correlation of measures.
This model is
especially useful if you have differently many time
points and time
distances per subject.
Best, Martin
On Tue, 2012-12-04 at 18:26 -0500, Alex Hanganu
wrote:
Dear Freesurfer Experts,
We are analysing longitudinal data - the
difference between 2 groups (P
and M) [19 and 17 subjects] with 2 time points
for each group (A, B).
We are using the example of "Repeated Measures
Anova"
(http://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova)
For our first approach - we took all the
subjects - 36 classes, and
tried to create the contrast for:
P(B-A) - M(B-A) 2 within subject factors, and 2 inter-subject
We considered the recent explanations (http://www.mail-archive.com/freesurfer@nmr.mgh.harvard.edu/msg25459.html), and, as we understood, our null hypothesis is:
PB-PA=0 AND MB-MA=0 -> Combining: PB-PA-MB+MA=0
and the matrix seems to be: 0 0 0 .... (36 zeros) -1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) 1 0 0 0 .... (36 zeros) -1
but we still get a dimension mismatch between X
and C: X has 72, C has 37.
The fsgd file is like this: Class subject 1 . . . Class subject 36 Variables TP1-vs-TP2 Input groupPsubj1-A Subject1 -1 Input groupPsubj1- B Subject1 1 Input groupPsubj2-A Subject2 -1 . . . Input groupMsubj35-A Subject35 1 Input groupMsubj35-B Subject35 -1 Input groupMsubj36-A Subject36 1 Input groupMsubj36-B Subject36 -1
==============
Our second approach - we run mris_glmfit for
each group separately and
then we wanted to use mris_calc to compute the
difference:
mris_calc -o avg.mgh
groupP/glm-dir/Contrast/sig.mgh add
groupM/glm-dir/Contrast/sig.mgh
though the sig.mgh for each group shows
significant results, the avg.mgh
reveals no effect.
Can you please help with this analysis ?
Thanks!
Sincerely, Alex. ____________________
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Hi Jorge,
On the page presenting the "../fswiki/LinearMixedEffectsModels", I think there is a misunderstanding - You show the command:
"mris_preproc --qdec ...."
but "--qdec" is not recognized, and in the help menu of "mris_preproc" I don't see this flag. So I guess you meant the "--fsgd" flag.
so, in the fsgd file, in our example, with 2 groups, and 2 time points, would it be more correct to put the classes for each subject (exmpl.1) or for 2 groups (exmpl.2), or this is not important at this stage ?
For the previous error, we found the answer, it was because in the qdec file, we used the "tab" between the lines. We changed that to "space", and it was ok.
Further, after performing the step: [M,Y,ni] = sortData(M,2,Y,sids);
we get the Error: File: sortData.m Line: 59 Column: 6 Expression or statement is incorrect--possibly unbalanced (, {, or [.
Can you please help with this?
Also, in the "lme_mass_fit_vw.m" help, we saw that we need to create the X - ordered design matrix. Is this matrix the qdec file ?
As we see it now, the steps that we should perform in Matlab, are these:
[Y,mri] ... lhsphere ... lhcortex ... Qdec = fRead... Qdec = rmQdecCol... sids... Qdec = rmQdecCol... M = ... [M,Y,ni] ...
lme_mass_fit_vw(M,months,Y,Group,[],OutputFileName,[],[],[])
where M - should be something like '-1' '1' '1' '-1' months - is the column from qdec file, where is shown the difference between time points Y - is the lh.thickness_sm10.mgh file Group - should be the Group column from the qdec file [] - are showing that the default values are to be taken.
But this approach doesn't seem to be entirely correct, cause the M (matrix) includes either the group, either the months (depending how we play with the command).
Thank you !!
Best regards, Alex.
Le 05/12/2012 2:30 PM, jorge luis a écrit :
Hi Alex
This error is likely due to the Qdec variable being empty. So, nothing was read into this variable when you applied
/Qdec = fReadQdec('qdec.table.dat'); /
Please check that. If you don't find a solution to this then send me your Qdec table data file and I will check it out.
Best -Jorge
Can you please help with this ?
Thanks in advance !
best, Alex.
Le 05/12/2012 6:12 PM, Alex Hanganu a écrit :
Hi Jorge,
On the page presenting the "../fswiki/LinearMixedEffectsModels", I think there is a misunderstanding - You show the command:
"mris_preproc --qdec ...."
but "--qdec" is not recognized, and in the help menu of "mris_preproc" I don't see this flag. So I guess you meant the "--fsgd" flag.
so, in the fsgd file, in our example, with 2 groups, and 2 time points, would it be more correct to put the classes for each subject (exmpl.1) or for 2 groups (exmpl.2), or this is not important at this stage ?
For the previous error, we found the answer, it was because in the qdec file, we used the "tab" between the lines. We changed that to "space", and it was ok.
Further, after performing the step: [M,Y,ni] = sortData(M,2,Y,sids);
we get the Error: File: sortData.m Line: 59 Column: 6 Expression or statement is incorrect--possibly unbalanced (, {, or [.
Can you please help with this?
Also, in the "lme_mass_fit_vw.m" help, we saw that we need to create the X - ordered design matrix. Is this matrix the qdec file ?
As we see it now, the steps that we should perform in Matlab, are these:
[Y,mri] ... lhsphere ... lhcortex ... Qdec = fRead... Qdec = rmQdecCol... sids... Qdec = rmQdecCol... M = ... [M,Y,ni] ...
lme_mass_fit_vw(M,months,Y,Group,[],OutputFileName,[],[],[])
where M - should be something like '-1' '1' '1' '-1' months - is the column from qdec file, where is shown the difference between time points Y - is the lh.thickness_sm10.mgh file Group - should be the Group column from the qdec file [] - are showing that the default values are to be taken.
But this approach doesn't seem to be entirely correct, cause the M (matrix) includes either the group, either the months (depending how we play with the command).
Thank you !!
Best regards, Alex.
Le 05/12/2012 2:30 PM, jorge luis a écrit :
Hi Alex
This error is likely due to the Qdec variable being empty. So, nothing was read into this variable when you applied
/Qdec = fReadQdec('qdec.table.dat'); /
Please check that. If you don't find a solution to this then send me your Qdec table data file and I will check it out.
Best -Jorge
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Hi Alex
I think that Martin added the flag --qdec to mris_preproc for version 5.2. Martin, could you confirm this please?
The code for building the study design matrix X that is in the wiki is just an example of how lme tools can be used for that purpose but the actual instance of your code will depend on your particular Qdec table. For instance, usually, Freesurfer's longitudinal Qdec tables are of the form:
fsid fsid-base sID time group... 002 002_base 002 0 0 003 003_base 003 0 1 003_m6 003_base 003 0.56 1 003_m12 003_base 003 1.12 1 003_m24 003_base 003 2.2 1 005 005_base 005 0 0 005_m6 005_base 005 0.45 0 005_m12 005_base 005 1.2 0
were “fsid” is the Freesurfer's ID, “fsid-base” is the name of the subject's specific template, sID is the subject-specific ID uniquely identifying each subject, “time” is the time covariate and group is the group membership covariate (there can be more covariates of course). I suppose that you processed your longitudinal MRI scans using a Qdec table similar to that.
You can read that Qdec table into Matlab:
Qdec = fReadQdec('qdec.table.dat');
Now you need to build your numeric design matrix X from the cell string array Qdec to represent a specific longitudinal design. Here you don't need the columns fsid and fsid-base in Qdec so you simply remove them:
Qdec = rmQdecCol(Qdec,1); Qdec = rmQdecCol(Qdec,1);
The you can grab the subject-specific ID:
sID = Qdec(:,1);
and then remove that column:
Qdec = rmQdecCol(Qdec,1);
You can now convert your cell string array Qdec to a numeric matrix:
M = Qdec2num(Qdec);
Here, the data in M is already ordered according to time for each subject, otherwise, you can order the data using:
[M,Y,ni] = sortData(M,1,Y,sID);
where Y is the cortical thickness data matrix that you read with fs_read_Y. Please take a look at the help of sortData. Note that matrix M only have two columns and you need to build your design matrix from it. In your case it is quite simple:
X = [ones(length(M),1) M M(:,1).*M(:,2)];
That is to say X contains a column of 1s (the intercept), a column with the time covariate, a column with the group membership and a column with the interaction term.
Now, you are ready for fitting the lme model:
stats = lme_mass_fit_vw(X,1,Y,ni,cortex);
The 1 here (second input) means that you are using a single random effect for the intercept term which is located in column 1 of X. Then you can test the interaction term using:
CM.C = [0 0 0 1];
F_stats = lme_mass_F(stats,CM);
and write the significance map for visualization and FDR correction in tksurfer
fs_write_fstats(F_stats,mri,'sig.mgh','sig');
It must be recognized that some basic Matlab knowledge is required to apply the lme tools. But the gain in flexibility for building your design matrix and analysis is significant. As you see, the relatively difficult part is how to get from the Qdec variable to your design matrix X. It requires some study-specific Matlab code. Sorry, but this is what he have at this point.
Best -Jorge
De: Alex Hanganu al.hanganu@yahoo.ca Para: FS Mailing List Freesurfer@nmr.mgh.harvard.edu; Jorge Luis Bernal-Russiel jbernal0019@yahoo.es Enviado: Miércoles 5 de diciembre de 2012 18:20 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast
Can you please help with this ?
Thanks in advance !
best, Alex.
Le 05/12/2012 6:12 PM, Alex Hanganu a écrit :
Hi Jorge,
On the page presenting the "../fswiki/LinearMixedEffectsModels",
I think there is a misunderstanding -
You show the command:
"mris_preproc --qdec ...."
but "--qdec" is not recognized, and in the help menu of
"mris_preproc" I don't see this flag. So I guess you meant the "--fsgd" flag.
so, in the fsgd file, in our example, with 2 groups, and 2 time
points, would it be more correct to put the classes for each subject (exmpl.1) or for 2 groups (exmpl.2), or this is not important at this stage ?
For the previous error, we found the answer, it was because in
the qdec file, we used the "tab" between the lines. We changed that to "space", and it was ok.
Further, after performing the step: [M,Y,ni] = sortData(M,2,Y,sids);
we get the Error: File: sortData.m Line: 59 Column: 6 Expression or statement is incorrect--possibly unbalanced (, {,
or [.
Can you please help with this?
Also, in the "lme_mass_fit_vw.m" help, we saw that we need to
create the X - ordered design matrix. Is this matrix the qdec file ?
As we see it now, the steps that we should perform in Matlab,
are these:
[Y,mri] ... lhsphere ... lhcortex ... Qdec = fRead... Qdec = rmQdecCol... sids... Qdec = rmQdecCol... M = ... [M,Y,ni] ...
lme_mass_fit_vw(M,months,Y,Group,[],OutputFileName,[],[],[])
where M - should be something like '-1' '1' '1' '-1' months - is the column from qdec file, where is shown the
difference between time points
Y - is the lh.thickness_sm10.mgh file Group - should be the Group column from the qdec file [] - are showing that the default values are to be taken.
But this approach doesn't seem to be entirely correct, cause the
M (matrix) includes either the group, either the months (depending how we play with the command).
Thank you !!
Best regards, Alex.
Le 05/12/2012 2:30 PM, jorge luis a écrit :
Hi Alex
This error is likely due to the Qdec variable being empty. So,
nothing was read into this variable when you applied
Qdec = fReadQdec('qdec.table.dat');
Please check that. If you don't find a solution to this then
send me your Qdec table data file and I will check it out.
Best -Jorge
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
--
Alexandru Hanganu, M.D., PhD Post-doc, PCAN lab, Centre de Recherche, Institut Universitaire de Gériatrie de Montréal 4565, chemin Queen Mary Montréal, QC, CA. H3W 1W5 Tél: +1 514 340 3540 #4280 Portable: +1 514 441 9159 _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Yes,
in 5.2 there should be the two new options --qdec and --qdec-long
to allow passing qdec tables both in the regular cross sectional and in the longitudinal format in addition to the existing other ways of passing subjects lists (--s or --fsgd or --f ).
Now care needs to be taken in the longitudinal setting. What you want is to get the files (e.g. thickness) from the *.long.<base> directories into the target (e.g fsaverage space). Not from the cross sectional directories!
For this you will be able to use the longitudinal qdec file (with a column of 'fsid' and 'fsid-base' to group time points into subjects, see wiki).
In 5.1 you should do the following: create a text file with each longitudinal id (containing the .long.<base> ) per line and pass it using the --f flag. So in the example below you'd write: 002.long.002_base 003.long.003_base 003_m6.long.003_base
You can use a simple shell command to get such a list from a longitudinal qdec file: cat long.qdec.table.txt | awk '{if ($1 != "fsid" && substr($1,0,1) != "#") printf("%s.long.%s\n", $1, $2)}' > outsubjectsfile.txt
Then preproc will do its job. The order of subjects needs to be identical to the qdec file that you use to run the LME matlab tools to ensure thickenss maps are stacked in the same order as you pass the covariates.
Best, Martin
On Thu, 2012-12-06 at 04:27 +0000, jorge luis wrote:
Hi Alex
I think that Martin added the flag --qdec to mris_preproc for version 5.2. Martin, could you confirm this please?
The code for building the study design matrix X that is in the wiki is just an example of how lme tools can be used for that purpose but the actual instance of your code will depend on your particular Qdec table. For instance, usually, Freesurfer's longitudinal Qdec tables are of the form:
fsid fsid-base sID time group... 002 002_base 002 0 0 003 003_base 003 0 1 003_m6 003_base 003 0.56 1 003_m12 003_base 003 1.12 1 003_m24 003_base 003 2.2 1 005 005_base 005 0 0 005_m6 005_base 005 0.45 0 005_m12 005_base 005 1.2 0
were “fsid” is the Freesurfer's ID, “fsid-base” is the name of the subject's specific template, sID is the subject-specific ID uniquely identifying each subject, “time” is the time covariate and group is the group membership covariate (there can be more covariates of course). I suppose that you processed your longitudinal MRI scans using a Qdec table similar to that.
You can read that Qdec table into Matlab:
Qdec = fReadQdec('qdec.table.dat');
Now you need to build your numeric design matrix X from the cell string array Qdec to represent a specific longitudinal design. Here you don't need the columns fsid and fsid-base in Qdec so you simply remove them:
Qdec = rmQdecCol(Qdec,1); Qdec = rmQdecCol(Qdec,1);
The you can grab the subject-specific ID:
sID = Qdec(:,1);
and then remove that column:
Qdec = rmQdecCol(Qdec,1);
You can now convert your cell string array Qdec to a numeric matrix:
M = Qdec2num(Qdec);
Here, the data in M is already ordered according to time for each subject, otherwise, you can order the data using:
[M,Y,ni] = sortData(M,1,Y,sID);
where Y is the cortical thickness data matrix that you read with fs_read_Y. Please take a look at the help of sortData. Note that matrix M only have two columns and you need to build your design matrix from it. In your case it is quite simple:
X = [ones(length(M),1) M M(:,1).*M(:,2)];
That is to say X contains a column of 1s (the intercept), a column with the time covariate, a column with the group membership and a column with the interaction term.
Now, you are ready for fitting the lme model:
stats = lme_mass_fit_vw(X,1,Y,ni,cortex);
The 1 here (second input) means that you are using a single random effect for the intercept term which is located in column 1 of X. Then you can test the interaction term using:
CM.C = [0 0 0 1];
F_stats = lme_mass_F(stats,CM);
and write the significance map for visualization and FDR correction in tksurfer
fs_write_fstats(F_stats,mri,'sig.mgh','sig');
It must be recognized that some basic Matlab knowledge is required to apply the lme tools. But the gain in flexibility for building your design matrix and analysis is significant. As you see, the relatively difficult part is how to get from the Qdec variable to your design matrix X. It requires some study-specific Matlab code. Sorry, but this is what he have at this point.
Best -Jorge
______________________________________________________________ De: Alex Hanganu <al.hanganu@yahoo.ca> Para: FS Mailing List <Freesurfer@nmr.mgh.harvard.edu>; Jorge Luis Bernal-Russiel <jbernal0019@yahoo.es> Enviado: Miércoles 5 de diciembre de 2012 18:20 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast Can you please help with this ? Thanks in advance ! best, Alex. Le 05/12/2012 6:12 PM, Alex Hanganu a écrit : > Hi Jorge, > > On the page presenting the > "../fswiki/LinearMixedEffectsModels", I think there is a > misunderstanding - > You show the command: > > "mris_preproc --qdec ...." > > but "--qdec" is not recognized, and in the help menu of > "mris_preproc" I don't see this flag. So I guess you meant > the "--fsgd" flag. > > so, in the fsgd file, in our example, with 2 groups, and 2 > time points, would it be more correct to put the classes for > each subject (exmpl.1) or for 2 groups (exmpl.2), or this is > not important at this stage ? > > For the previous error, we found the answer, it was because > in the qdec file, we used the "tab" between the lines. We > changed that to "space", and it was ok. > > Further, after performing the step: > [M,Y,ni] = sortData(M,2,Y,sids); > > we get the Error: > File: sortData.m Line: 59 Column: 6 > Expression or statement is incorrect--possibly unbalanced (, > {, or [. > > Can you please help with this? > > Also, in the "lme_mass_fit_vw.m" help, we saw that we need > to create the X - ordered design matrix. Is this matrix the > qdec file ? > > As we see it now, the steps that we should perform in > Matlab, are these: > > [Y,mri] ... > lhsphere ... > lhcortex ... > Qdec = fRead... > Qdec = rmQdecCol... > sids... > Qdec = rmQdecCol... > M = ... > [M,Y,ni] ... > > lme_mass_fit_vw(M,months,Y,Group,[],OutputFileName,[],[],[]) > > where M - should be something like '-1' '1' '1' '-1' > months - is the column from qdec file, where is shown the > difference between time points > Y - is the lh.thickness_sm10.mgh file > Group - should be the Group column from the qdec file > [] - are showing that the default values are to be taken. > > But this approach doesn't seem to be entirely correct, cause > the M (matrix) includes either the group, either the months > (depending how we play with the command). > > Thank you !! > > Best regards, > Alex. > > > Le 05/12/2012 2:30 PM, jorge luis a écrit : > > > Hi Alex > > > > This error is likely due to the Qdec variable being empty. > > So, nothing was read into this variable when you applied > > > > Qdec = fReadQdec('qdec.table.dat'); > > > > Please check that. If you don't find a solution to this > > then send me your Qdec table data file and I will check it > > out. > > > > Best > > -Jorge > > > > > > > _______________________________________________ > Freesurfer mailing list > Freesurfer@nmr.mgh.harvard.edu > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > The information in this e-mail is intended only for the person to whom it is > addressed. If you believe this e-mail was sent to you in error and the e-mail > contains patient information, please contact the Partners Compliance HelpLine at > http://www.partners.org/complianceline . If the e-mail was sent to you in error > but does not contain patient information, please contact the sender and properly > dispose of the e-mail. -- Alexandru Hanganu, M.D., PhD Post-doc, PCAN lab, Centre de Recherche, Institut Universitaire de Gériatrie de Montréal 4565, chemin Queen Mary Montréal, QC, CA. H3W 1W5 Tél: +1 514 340 3540 #4280 Portable: +1 514 441 9159 _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Hello Martin,
Thanks for your confirmation. I downloaded the last version of FreeSurfer: the dev5-20120624, from the "..fswiki/LMEModels" page, but there is the old mris_preproc, so I will use the fsgd file.
Thanks for pointing out about the long.base - files!! That was a mistake of mine. And thanks for the shell command line ! So the fsgd file was created /only/ with long subjects, then I created the lh.thickness_sm10.mgh file and went further ! OK. =======================
Hi Jorge,
Thanks for showing clearly the steps ! Everything went fine. The X contains those columns as you said. our stats command is:
/stats = lme_mass_fit_vw(X,1,Y,144,cortex);
/where "144" is the 2*ones. We have 36 subjects and 2 time points, so we have 72 ones * 2 -> 144. (but I also tried with 72, 36, 2)
Unfortunately, there is again an error:
/File: lme_mass_fit.m Line: 162 Column: 14// //The variable stats in a parfor cannot be classified. Error in ==> lme_mass_fit_vw at 73 [stats1,st1] = lme_mass_fit(X,[],Xrows,Zcols,Y,ni,prs,e); / Also when applying: /[M,Y,144] = sortData(M,1,Y,sID); /there is an error:/An array for multiple LHS assignment cannot contain numeric value.
/Our M contains: <72x2 double> value The X: <72x4 double> value but the sID contains: <73x1 cell>
so we thought that might be the problem and we removed the cell "sID" , and we got and sID: <72x1 cell>. The error persisted.
did we miss something ?
Thank you !
Sincerely, Alex.
Le 06/12/2012 11:15 AM, Martin Reuter a écrit :
Yes,
in 5.2 there should be the two new options --qdec and --qdec-long
to allow passing qdec tables both in the regular cross sectional and in the longitudinal format in addition to the existing other ways of passing subjects lists (--s or --fsgd or --f ).
Now care needs to be taken in the longitudinal setting. What you want is to get the files (e.g. thickness) from the *.long.<base> directories into the target (e.g fsaverage space). Not from the cross sectional directories!
For this you will be able to use the longitudinal qdec file (with a column of 'fsid' and 'fsid-base' to group time points into subjects, see wiki).
In 5.1 you should do the following: create a text file with each longitudinal id (containing the .long.<base> ) per line and pass it using the --f flag. So in the example below you'd write: 002.long.002_base 003.long.003_base 003_m6.long.003_base
You can use a simple shell command to get such a list from a longitudinal qdec file: cat long.qdec.table.txt | awk '{if ($1 != "fsid" && substr($1,0,1) != "#") printf("%s.long.%s\n", $1, $2)}' > outsubjectsfile.txt
Then preproc will do its job. The order of subjects needs to be identical to the qdec file that you use to run the LME matlab tools to ensure thickenss maps are stacked in the same order as you pass the covariates.
Best, Martin
On Thu, 2012-12-06 at 04:27 +0000, jorge luis wrote:
Hi Alex
I think that Martin added the flag --qdec to mris_preproc for version 5.2. Martin, could you confirm this please?
The code for building the study design matrix X that is in the wiki is just an example of how lme tools can be used for that purpose but the actual instance of your code will depend on your particular Qdec table. For instance, usually, Freesurfer's longitudinal Qdec tables are of the form:
fsid fsid-base sID time group... 002 002_base 002 0 0 003 003_base 003 0 1 003_m6 003_base 003 0.56 1 003_m12 003_base 003 1.12 1 003_m24 003_base 003 2.2 1 005 005_base 005 0 0 005_m6 005_base 005 0.45 0 005_m12 005_base 005 1.2 0
were "fsid" is the Freesurfer's ID, "fsid-base" is the name of the subject's specific template, sID is the subject-specific ID uniquely identifying each subject, "time" is the time covariate and group is the group membership covariate (there can be more covariates of course). I suppose that you processed your longitudinal MRI scans using a Qdec table similar to that.
You can read that Qdec table into Matlab:
Qdec = fReadQdec('qdec.table.dat');
Now you need to build your numeric design matrix X from the cell string array Qdec to represent a specific longitudinal design. Here you don't need the columns fsid and fsid-base in Qdec so you simply remove them:
Qdec = rmQdecCol(Qdec,1); Qdec = rmQdecCol(Qdec,1);
The you can grab the subject-specific ID:
sID = Qdec(:,1);
and then remove that column:
Qdec = rmQdecCol(Qdec,1);
You can now convert your cell string array Qdec to a numeric matrix:
M = Qdec2num(Qdec);
Here, the data in M is already ordered according to time for each subject, otherwise, you can order the data using:
[M,Y,ni] = sortData(M,1,Y,sID);
where Y is the cortical thickness data matrix that you read with fs_read_Y. Please take a look at the help of sortData. Note that matrix M only have two columns and you need to build your design matrix from it. In your case it is quite simple:
X = [ones(length(M),1) M M(:,1).*M(:,2)];
That is to say X contains a column of 1s (the intercept), a column with the time covariate, a column with the group membership and a column with the interaction term.
Now, you are ready for fitting the lme model:
stats = lme_mass_fit_vw(X,1,Y,ni,cortex);
The 1 here (second input) means that you are using a single random effect for the intercept term which is located in column 1 of X. Then you can test the interaction term using:
CM.C = [0 0 0 1];
F_stats = lme_mass_F(stats,CM);
and write the significance map for visualization and FDR correction in tksurfer
fs_write_fstats(F_stats,mri,'sig.mgh','sig');
It must be recognized that some basic Matlab knowledge is required to apply the lme tools. But the gain in flexibility for building your design matrix and analysis is significant. As you see, the relatively difficult part is how to get from the Qdec variable to your design matrix X. It requires some study-specific Matlab code. Sorry, but this is what he have at this point.
Best -Jorge
______________________________________________________________ De: Alex Hanganu <al.hanganu@yahoo.ca> Para: FS Mailing List <Freesurfer@nmr.mgh.harvard.edu>; Jorge Luis Bernal-Rusiel <jbernal0019@yahoo.es> Enviado: Miércoles 5 de diciembre de 2012 18:20 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast Can you please help with this ? Thanks in advance ! best, Alex. Le 05/12/2012 6:12 PM, Alex Hanganu a écrit : > Hi Jorge, > > On the page presenting the > "../fswiki/LinearMixedEffectsModels", I think there is a > misunderstanding - > You show the command: > > "mris_preproc --qdec ...." > > but "--qdec" is not recognized, and in the help menu of > "mris_preproc" I don't see this flag. So I guess you meant > the "--fsgd" flag. > > so, in the fsgd file, in our example, with 2 groups, and 2 > time points, would it be more correct to put the classes for > each subject (exmpl.1) or for 2 groups (exmpl.2), or this is > not important at this stage ? > > For the previous error, we found the answer, it was because > in the qdec file, we used the "tab" between the lines. We > changed that to "space", and it was ok. > > Further, after performing the step: > [M,Y,ni] = sortData(M,2,Y,sids); > > we get the Error: > File: sortData.m Line: 59 Column: 6 > Expression or statement is incorrect--possibly unbalanced (, > {, or [. > > Can you please help with this? > > Also, in the "lme_mass_fit_vw.m" help, we saw that we need > to create the X - ordered design matrix. Is this matrix the > qdec file ? > > As we see it now, the steps that we should perform in > Matlab, are these: > > [Y,mri] ... > lhsphere ... > lhcortex ... > Qdec = fRead... > Qdec = rmQdecCol... > sids... > Qdec = rmQdecCol... > M = ... > [M,Y,ni] ... > > lme_mass_fit_vw(M,months,Y,Group,[],OutputFileName,[],[],[]) > > where M - should be something like '-1' '1' '1' '-1' > months - is the column from qdec file, where is shown the > difference between time points > Y - is the lh.thickness_sm10.mgh file > Group - should be the Group column from the qdec file > [] - are showing that the default values are to be taken. > > But this approach doesn't seem to be entirely correct, cause > the M (matrix) includes either the group, either the months > (depending how we play with the command). > > Thank you !! > > Best regards, > Alex. > > > Le 05/12/2012 2:30 PM, jorge luis a écrit : > > > Hi Alex > > > > This error is likely due to the Qdec variable being empty. > > So, nothing was read into this variable when you applied > > > > Qdec = fReadQdec('qdec.table.dat'); > > > > Please check that. If you don't find a solution to this > > then send me your Qdec table data file and I will check it > > out. > > > > Best > > -Jorge > > > > > >
Hi Alex Sorry, my bad. You are right. To grab the subjects'ID the correct code is: sID = Qdec(2:end,1); I'm going to fix that in the wiki. The new error is due to the numeric value on the left hand side of [M,Y,144] = sortData(M,1,Y,sID);
You cannot assign any value to 144. Just change that code by this: [M,Y,ni] = sortData(M,1,Y,sID); and use ni instead of 144 everywhere. Note that ni must be a vector of the same size as the number of subjects in your study (36), not a single numeric value. Best -Jorge
De: Alex Hanganu al.hanganu@yahoo.ca Para: Martin Reuter mreuter@nmr.mgh.harvard.edu CC: FS Mailing List Freesurfer@nmr.mgh.harvard.edu; Jorge Luis Bernal-Rusiel jbernal0019@yahoo.es Enviado: Jueves 6 de diciembre de 2012 16:45 Asunto: Re: Re: [Freesurfer] Longitudinal analysis - contrast
Hello Martin,
Thanks for your confirmation. I downloaded the last version of
FreeSurfer: the dev5-20120624, from the "..fswiki/LMEModels" page, but there is the old mris_preproc, so I will use the fsgd file.
Thanks for pointing out about the long.base - files!! That was a
mistake of mine. And thanks for the shell command line !
So the fsgd file was created only with long subjects, then I created the lh.thickness_sm10.mgh file and went further ! OK.
Hi Jorge,
Thanks for showing clearly the steps ! Everything went fine. The X
contains those columns as you said.
our stats command is:
stats = lme_mass_fit_vw(X,1,Y,144,cortex);
where "144" is the 2*ones. We have 36 subjects and 2 time points, so we have 72 ones * 2 -> 144. (but I also tried with 72, 36, 2)
Unfortunately, there is again an error:
File: lme_mass_fit.m Line: 162 Column: 14 The variable stats in a parfor cannot be classified. Error in ==> lme_mass_fit_vw at 73 [stats1,st1] = lme_mass_fit(X,[],Xrows,Zcols,Y,ni,prs,e);
Also when applying: [M,Y,144] = sortData(M,1,Y,sID); there is an error:An array for multiple LHS assignment cannot contain numeric value.
Our M contains: <72x2 double> value The X: <72x4 double> value but the sID contains: <73x1 cell>
so we thought that might be the problem and we removed the cell
"sID" , and we got and sID: <72x1 cell>. The error persisted.
did we miss something ?
Thank you !
Sincerely, Alex.
Le 06/12/2012 11:15 AM, Martin Reuter a écrit :
Yes, in 5.2 there should be the two new options --qdec and --qdec-long to allow passing qdec tables both in the regular cross sectional and in
the longitudinal format in addition to the existing other ways of passing subjects lists (--s or --fsgd or --f ). Now care needs to be taken in the longitudinal setting. What you want is to get the files (e.g. thickness) from the *.long.<base> directories into the target (e.g fsaverage space). Not from the cross sectional directories! For this you will be able to use the longitudinal qdec file (with a column of 'fsid' and 'fsid-base' to group time points into subjects, see wiki). In 5.1 you should do the following: create a text file with each longitudinal id (containing the .long.<base> ) per line and pass it using the --f flag. So in the example below you'd write: 002.long.002_base 003.long.003_base 003_m6.long.003_base You can use a simple shell command to get such a list from a longitudinal qdec file: cat long.qdec.table.txt | awk '{if ($1 != "fsid" && substr($1,0,1) != "#") printf("%s.long.%s\n", $1, $2)}' > outsubjectsfile.txt Then preproc will do its job. The order of subjects needs to be identical to the qdec file that you use to run the LME matlab tools to ensure thickenss maps are stacked in the same order as you pass the covariates. Best, Martin On Thu, 2012-12-06 at 04:27 +0000, jorge luis wrote:
Hi Alex I think that Martin added the flag --qdec to mris_preproc for version
5.2. Martin, could you confirm this please? The code for building the study design matrix X that is in the wiki is just an example of how lme tools can be used for that purpose but the actual instance of your code will depend on your particular Qdec table. For instance, usually, Freesurfer's longitudinal Qdec tables are of the form: fsid fsid-base sID time group... 002 002_base 002 0 0 003 003_base 003 0 1 003_m6 003_base 003 0.56 1 003_m12 003_base 003 1.12 1 003_m24 003_base 003 2.2 1 005 005_base 005 0 0 005_m6 005_base 005 0.45 0 005_m12 005_base 005 1.2 0 were “fsid” is the Freesurfer's ID, “fsid-base” is the name of the subject's specific template, sID is the subject-specific ID uniquely identifying each subject, “time” is the time covariate and group is the group membership covariate (there can be more covariates of course). I suppose that you processed your longitudinal MRI scans using a Qdec table similar to that. You can read that Qdec table into Matlab: Qdec = fReadQdec('qdec.table.dat'); Now you need to build your numeric design matrix X from the cell string array Qdec to represent a specific longitudinal design. Here you don't need the columns fsid and fsid-base in Qdec so you simply remove them: Qdec = rmQdecCol(Qdec,1); Qdec = rmQdecCol(Qdec,1); The you can grab the subject-specific ID: sID = Qdec(:,1); and then remove that column: Qdec = rmQdecCol(Qdec,1); You can now convert your cell string array Qdec to a numeric matrix: M = Qdec2num(Qdec); Here, the data in M is already ordered according to time for each subject, otherwise, you can order the data using: [M,Y,ni] = sortData(M,1,Y,sID); where Y is the cortical thickness data matrix that you read with fs_read_Y. Please take a look at the help of sortData. Note that matrix M only have two columns and you need to build your design matrix from it. In your case it is quite simple: X = [ones(length(M),1) M M(:,1).*M(:,2)]; That is to say X contains a column of 1s (the intercept), a column with the time covariate, a column with the group membership and a column with the interaction term. Now, you are ready for fitting the lme model: stats = lme_mass_fit_vw(X,1,Y,ni,cortex); The 1 here (second input) means that you are using a single random effect for the intercept term which is located in column 1 of X. Then you can test the interaction term using: CM.C = [0 0 0 1]; F_stats = lme_mass_F(stats,CM); and write the significance map for visualization and FDR correction in tksurfer fs_write_fstats(F_stats,mri,'sig.mgh','sig'); It must be recognized that some basic Matlab knowledge is required to apply the lme tools. But the gain in flexibility for building your design matrix and analysis is significant. As you see, the relatively difficult part is how to get from the Qdec variable to your design matrix X. It requires some study-specific Matlab code. Sorry, but this is what he have at this point. Best -Jorge ______________________________________________________________ De: Alex Hanganu mailto:al.hanganu@yahoo.ca Para: FS Mailing List mailto:Freesurfer@nmr.mgh.harvard.edu; Jorge Luis Bernal-Rusiel mailto:jbernal0019@yahoo.es Enviado: Miércoles 5 de diciembre de 2012 18:20 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast Can you please help with this ? Thanks in advance ! best, Alex. Le 05/12/2012 6:12 PM, Alex Hanganu a écrit : > Hi Jorge, > > On the page presenting the > "../fswiki/LinearMixedEffectsModels", I think there is a > misunderstanding - > You show the command: > > "mris_preproc --qdec ...." > > but "--qdec" is not recognized, and in the help menu of > "mris_preproc" I don't see this flag. So I guess you meant > the "--fsgd" flag. > > so, in the fsgd file, in our example, with 2 groups, and 2 > time points, would it be more correct to put the classes for > each subject (exmpl.1) or for 2 groups (exmpl.2), or this is > not important at this stage ? > > For the previous error, we found the answer, it was because > in the qdec file, we used the "tab" between the lines. We > changed that to "space", and it was ok. > > Further, after performing the step: > [M,Y,ni] = sortData(M,2,Y,sids); > > we get the Error: > File: sortData.m Line: 59 Column: 6 > Expression or statement is incorrect--possibly unbalanced (, > {, or [. > > Can you please help with this? > > Also, in the "lme_mass_fit_vw.m" help, we saw that we need > to create the X - ordered design matrix. Is this matrix the > qdec file ? > > As we see it now, the steps that we should perform in > Matlab, are these: > > [Y,mri] ... > lhsphere ... > lhcortex ... > Qdec = fRead... > Qdec = rmQdecCol... > sids... > Qdec = rmQdecCol... > M = ... > [M,Y,ni] ... > > lme_mass_fit_vw(M,months,Y,Group,[],OutputFileName,[],[],[]) > > where M - should be something like '-1' '1' '1' '-1' > months - is the column from qdec file, where is shown the > difference between time points > Y - is the lh.thickness_sm10.mgh file > Group - should be the Group column from the qdec file > [] - are showing that the default values are to be taken. > > But this approach doesn't seem to be entirely correct, cause > the M (matrix) includes either the group, either the months > (depending how we play with the command). > > Thank you !! > > Best regards, > Alex. > > > Le 05/12/2012 2:30 PM, jorge luis a écrit : > > > Hi Alex > > > > This error is likely due to the Qdec variable being empty. > > So, nothing was read into this variable when you applied > > > > Qdec = fReadQdec('qdec.table.dat'); > > > > Please check that. If you don't find a solution to this > > then send me your Qdec table data file and I will check it > > out. > > > > Best > > -Jorge > > > > > >
Hi Jorge,
Sorry, but I am not following :( What is "/ni"/ ? if "/ni/" is "/number of repeated measures for each subject"/ (as /sortData/ help says) - then, for each subject we did only 2 repeated measures, so /ni/ should be /ni = [2];
/if "/ni/" is the "/vector of the same size as the number of subjects in the study/" - then we have 36 subjects, so /ni/ should be: /ni = [1 2 3 4 5 .... 35 36];/ or: /ni = [01 02 ... 36]; / still : /[M,Y,ni] = sortData(M,1,Y,sID); Error: File sortData.m Line: 59 Column 6 Expression or statement is incorrect possibly unbalanced ...
/If taking as an example the previous qdec:
fsid fsid-base sID time group 002 002_base 002 0 0 003 003_base 003 0 1 003_m6 003_base 003 0.56 1 003_m12 003_base 003 1.12 1 003_m24 003_base 003 2.2 1 005 005_base 005 0 0 005_m6 005_base 005 0.45 0 005_m12 005_base 005 1.2 0
then: /ni = [1 2 3]; /or /ni = [002 003 005];/ (as in sID column)
and another question: this /sID/ column - is this a simple numerotation of subjects, like: 01 02 03 04 ... ? You didn't talk about this column in the wiki explanation of qdec, so it is also probable that actually it is not needed.
Sorry, but I'm still confused, can you please help with this issue ?
Thanks !!!
best,
Alex. / // // // / Le 06/12/2012 6:21 PM, jorge luis a écrit :
Hi Alex Sorry, my bad. You are right. To grab the subjects'ID the correct code is: sID = Qdec(2:end,1); I'm going to fix that in the wiki. The new error is due to the numeric value on the left hand side of /[M,Y,144] = sortData(M,1,Y,sID);/ You cannot assign any value to 144. Just change that code by this: /[M,Y,ni] = sortData(M,1,Y,sID);/ // and use /ni /instead of 144 everywhere. Note that /ni/ must be a vector of the same size as the number of subjects in your study (36), not a single numeric value. Best -Jorge
*De:* Alex Hanganu <al.hanganu@yahoo.ca> *Para:* Martin Reuter <mreuter@nmr.mgh.harvard.edu> *CC:* FS Mailing List <Freesurfer@nmr.mgh.harvard.edu>; Jorge Luis Bernal-Rusiel <jbernal0019@yahoo.es> *Enviado:* Jueves 6 de diciembre de 2012 16:45 *Asunto:* Re: Re: [Freesurfer] Longitudinal analysis - contrast Hello Martin, Thanks for your confirmation. I downloaded the last version of FreeSurfer: the dev5-20120624, from the "..fswiki/LMEModels" page, but there is the old mris_preproc, so I will use the fsgd file. Thanks for pointing out about the long.base - files!! That was a mistake of mine. And thanks for the shell command line ! So the fsgd file was created /only/ with long subjects, then I created the lh.thickness_sm10.mgh file and went further ! OK. ======================= Hi Jorge, Thanks for showing clearly the steps ! Everything went fine. The X contains those columns as you said. our stats command is: /stats = lme_mass_fit_vw(X,1,Y,144,cortex); /where "144" is the 2*ones. We have 36 subjects and 2 time points, so we have 72 ones * 2 -> 144. (but I also tried with 72, 36, 2) Unfortunately, there is again an error: /File: lme_mass_fit.m Line: 162 Column: 14// //The variable stats in a parfor cannot be classified. Error in ==> lme_mass_fit_vw at 73 [stats1,st1] = lme_mass_fit(X,[],Xrows,Zcols,Y,ni,prs,e); / Also when applying: /[M,Y,144] = sortData(M,1,Y,sID); /there is an error:/An array for multiple LHS assignment cannot contain numeric value. /Our M contains: <72x2 double> value The X: <72x4 double> value but the sID contains: <73x1 cell> so we thought that might be the problem and we removed the cell "sID" , and we got and sID: <72x1 cell>. The error persisted. did we miss something ? Thank you ! Sincerely, Alex. Le 06/12/2012 11:15 AM, Martin Reuter a écrit :Yes, in 5.2 there should be the two new options --qdec and --qdec-long to allow passing qdec tables both in the regular cross sectional and in the longitudinal format in addition to the existing other ways of passing subjects lists (--s or --fsgd or --f ). Now care needs to be taken in the longitudinal setting. What you want is to get the files (e.g. thickness) from the *.long.<base> directories into the target (e.g fsaverage space). Not from the cross sectional directories! For this you will be able to use the longitudinal qdec file (with a column of 'fsid' and 'fsid-base' to group time points into subjects, see wiki). In 5.1 you should do the following: create a text file with each longitudinal id (containing the .long.<base> ) per line and pass it using the --f flag. So in the example below you'd write: 002.long.002_base 003.long.003_base 003_m6.long.003_base You can use a simple shell command to get such a list from a longitudinal qdec file: cat long.qdec.table.txt | awk '{if ($1 != "fsid" && substr($1,0,1) != "#") printf("%s.long.%s\n", $1, $2)}' > outsubjectsfile.txt Then preproc will do its job. The order of subjects needs to be identical to the qdec file that you use to run the LME matlab tools to ensure thickenss maps are stacked in the same order as you pass the covariates. Best, Martin On Thu, 2012-12-06 at 04:27 +0000, jorge luis wrote:Hi Alex I think that Martin added the flag --qdec to mris_preproc for version 5.2. Martin, could you confirm this please? The code for building the study design matrix X that is in the wiki is just an example of how lme tools can be used for that purpose but the actual instance of your code will depend on your particular Qdec table. For instance, usually, Freesurfer's longitudinal Qdec tables are of the form: fsid fsid-base sID time group... 002 002_base 002 0 0 003 003_base 003 0 1 003_m6 003_base 003 0.56 1 003_m12 003_base 003 1.12 1 003_m24 003_base 003 2.2 1 005 005_base 005 0 0 005_m6 005_base 005 0.45 0 005_m12 005_base 005 1.2 0 were "fsid" is the Freesurfer's ID, "fsid-base" is the name of the subject's specific template, sID is the subject-specific ID uniquely identifying each subject, "time" is the time covariate and group is the group membership covariate (there can be more covariates of course). I suppose that you processed your longitudinal MRI scans using a Qdec table similar to that. You can read that Qdec table into Matlab: Qdec = fReadQdec('qdec.table.dat'); Now you need to build your numeric design matrix X from the cell string array Qdec to represent a specific longitudinal design. Here you don't need the columns fsid and fsid-base in Qdec so you simply remove them: Qdec = rmQdecCol(Qdec,1); Qdec = rmQdecCol(Qdec,1); The you can grab the subject-specific ID: sID = Qdec(:,1); and then remove that column: Qdec = rmQdecCol(Qdec,1); You can now convert your cell string array Qdec to a numeric matrix: M = Qdec2num(Qdec); Here, the data in M is already ordered according to time for each subject, otherwise, you can order the data using: [M,Y,ni] = sortData(M,1,Y,sID); where Y is the cortical thickness data matrix that you read with fs_read_Y. Please take a look at the help of sortData. Note that matrix M only have two columns and you need to build your design matrix from it. In your case it is quite simple: X = [ones(length(M),1) M M(:,1).*M(:,2)]; That is to say X contains a column of 1s (the intercept), a column with the time covariate, a column with the group membership and a column with the interaction term. Now, you are ready for fitting the lme model: stats = lme_mass_fit_vw(X,1,Y,ni,cortex); The 1 here (second input) means that you are using a single random effect for the intercept term which is located in column 1 of X. Then you can test the interaction term using: CM.C = [0 0 0 1]; F_stats = lme_mass_F(stats,CM); and write the significance map for visualization and FDR correction in tksurfer fs_write_fstats(F_stats,mri,'sig.mgh','sig'); It must be recognized that some basic Matlab knowledge is required to apply the lme tools. But the gain in flexibility for building your design matrix and analysis is significant. As you see, the relatively difficult part is how to get from the Qdec variable to your design matrix X. It requires some study-specific Matlab code. Sorry, but this is what he have at this point. Best -Jorge ______________________________________________________________ De: Alex Hanganumailto:al.hanganu@yahoo.ca Para: FS Mailing Listmailto:Freesurfer@nmr.mgh.harvard.edu; Jorge Luis Bernal-Rusielmailto:jbernal0019@yahoo.es Enviado: Miércoles 5 de diciembre de 2012 18:20 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast Can you please help with this ? Thanks in advance ! best, Alex. Le 05/12/2012 6:12 PM, Alex Hanganu a écrit : > Hi Jorge, > > On the page presenting the > "../fswiki/LinearMixedEffectsModels", I think there is a > misunderstanding - > You show the command: > > "mris_preproc --qdec ...." > > but "--qdec" is not recognized, and in the help menu of > "mris_preproc" I don't see this flag. So I guess you meant > the "--fsgd" flag. > > so, in the fsgd file, in our example, with 2 groups, and 2 > time points, would it be more correct to put the classes for > each subject (exmpl.1) or for 2 groups (exmpl.2), or this is > not important at this stage ? > > For the previous error, we found the answer, it was because > in the qdec file, we used the "tab" between the lines. We > changed that to "space", and it was ok. > > Further, after performing the step: > [M,Y,ni] = sortData(M,2,Y,sids); > > we get the Error: > File: sortData.m Line: 59 Column: 6 > Expression or statement is incorrect--possibly unbalanced (, > {, or [. > > Can you please help with this? > > Also, in the "lme_mass_fit_vw.m" help, we saw that we need > to create the X - ordered design matrix. Is this matrix the > qdec file ? > > As we see it now, the steps that we should perform in > Matlab, are these: > > [Y,mri] ... > lhsphere ... > lhcortex ... > Qdec = fRead... > Qdec = rmQdecCol... > sids... > Qdec = rmQdecCol... > M = ... > [M,Y,ni] ... > > lme_mass_fit_vw(M,months,Y,Group,[],OutputFileName,[],[],[]) > > where M - should be something like '-1' '1' '1' '-1' > months - is the column from qdec file, where is shown the > difference between time points > Y - is the lh.thickness_sm10.mgh file > Group - should be the Group column from the qdec file > [] - are showing that the default values are to be taken. > > But this approach doesn't seem to be entirely correct, cause > the M (matrix) includes either the group, either the months > (depending how we play with the command). > > Thank you !! > > Best regards, > Alex. > > > Le 05/12/2012 2:30 PM, jorge luis a écrit : > > > Hi Alex > > > > This error is likely due to the Qdec variable being empty. > > So, nothing was read into this variable when you applied > > > > Qdec = fReadQdec('qdec.table.dat'); > > > > Please check that. If you don't find a solution to this > > then send me your Qdec table data file and I will check it > > out. > > > > Best > > -Jorge > > >
Hi Alex In your case ni is a vector of size 36 ni =[2 2 2 2... 2]; Note that it may happen that the number of repeated measures being different across subjects for some longitudinal studies. In your case all subjects have the same number of repeated measures (2). this sID column - is this a simple numerotation of subjects, like: 01 02 03 04 ... ? Yes, it is. Best -Jorge
De: Alex Hanganu al.hanganu@yahoo.ca Para: Jorge Luis Bernal-Rusiel jbernal0019@yahoo.es CC: FS Mailing List Freesurfer@nmr.mgh.harvard.edu Enviado: Viernes 7 de diciembre de 2012 12:52 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast
Hi Jorge,
Sorry, but I am not following :( What is "ni" ? if "ni" is "number of repeated measures for each subject" (as sortData help says) - then, for each subject we did only 2 repeated measures, so ni should be ni = [2];
if "ni" is the "vector of the same size as the number of subjects in the study" - then we have 36 subjects, so ni should be: ni = [1 2 3 4 5 .... 35 36]; or: ni = [01 02 ... 36];
still : [M,Y,ni] = sortData(M,1,Y,sID); Error: File sortData.m Line: 59 Column 6 Expression or statement is incorrect possibly unbalanced ...
If taking as an example the previous qdec:
fsid fsid-base sID time group
002 002_base 002 0 0 003 003_base 003 0 1 003_m6 003_base 003 0.56 1 003_m12 003_base 003 1.12 1 003_m24 003_base 003 2.2 1 005 005_base 005 0 0 005_m6 005_base 005 0.45 0 005_m12 005_base 005 1.2 0 then:
ni = [1 2 3]; or ni = [002 003 005]; (as in sID column)
and another question: this sID column - is this a simple numerotation of subjects, like: 01 02 03 04 ... ? You didn't talk about this column in the wiki explanation of qdec,
so it is also probable that actually it is not needed.
Sorry, but I'm still confused, can you please help with this issue
?
Thanks !!!
best,
Alex.
Le 06/12/2012 6:21 PM, jorge luis a écrit :
Hi Alex
Sorry, my bad. You are right. To grab the subjects'ID the correct code is: sID = Qdec(2:end,1); I'm going to fix that in the wiki. The new error is due to the numeric value on the left hand side of [M,Y,144] = sortData(M,1,Y,sID);
You cannot assign any value to 144. Just change that code by this: [M,Y,ni] = sortData(M,1,Y,sID); and use ni instead of 144 everywhere. Note that ni must be a vector of the same size as the number of subjects in your study (36), not a single numeric value. Best -Jorge
De: Alex Hanganu mailto:al.hanganu@yahoo.ca
Para: Martin Reuter mailto:mreuter@nmr.mgh.harvard.edu CC: FS Mailing List mailto:Freesurfer@nmr.mgh.harvard.edu; Jorge Luis Bernal-Rusiel mailto:jbernal0019@yahoo.es Enviado: Jueves 6 de diciembre de 2012 16:45 Asunto: Re: Re: [Freesurfer] Longitudinal analysis - contrast
Hello Martin,
Thanks for your confirmation. I downloaded the
last version of FreeSurfer: the dev5-20120624, from the "..fswiki/LMEModels" page, but there is the old mris_preproc, so I will use the fsgd file.
Thanks for pointing out about the long.base -
files!! That was a mistake of mine. And thanks for the shell command line !
So the fsgd file was created only with long subjects, then I created the lh.thickness_sm10.mgh file and went further ! OK.
Hi Jorge,
Thanks for showing clearly the steps ! Everything
went fine. The X contains those columns as you said.
our stats command is:
stats = lme_mass_fit_vw(X,1,Y,144,cortex);
where "144" is the 2*ones. We have 36 subjects and 2 time points, so we have 72 ones * 2 -> 144. (but I also tried with 72, 36, 2)
Unfortunately, there is again an error:
File: lme_mass_fit.m Line: 162 Column: 14 The variable stats in a parfor cannot be classified. Error in ==> lme_mass_fit_vw at 73 [stats1,st1] =
lme_mass_fit(X,[],Xrows,Zcols,Y,ni,prs,e);
Also when applying: [M,Y,144] = sortData(M,1,Y,sID); there is an error:An array for multiple LHS assignment cannot contain numeric value.
Our M contains: <72x2 double> value The X: <72x4 double> value but the sID contains: <73x1 cell>
so we thought that might be the problem and we
removed the cell "sID" , and we got and sID: <72x1 cell>. The error persisted.
did we miss something ?
Thank you !
Sincerely, Alex.
Le 06/12/2012 11:15 AM, Martin Reuter a écrit :
Yes, in 5.2 there should be the two new options --qdec and --qdec-long to allow passing qdec tables both in the regular cross sectional and in
the longitudinal format in addition to the existing other ways of passing subjects lists (--s or --fsgd or --f ). Now care needs to be taken in the longitudinal setting. What you want is to get the files (e.g. thickness) from the *.long.<base> directories into the target (e.g fsaverage space). Not from the cross sectional directories! For this you will be able to use the longitudinal qdec file (with a column of 'fsid' and 'fsid-base' to group time points into subjects, see wiki). In 5.1 you should do the following: create a text file with each longitudinal id (containing the .long.<base> ) per line and pass it using the --f flag. So in the example below you'd write: 002.long.002_base 003.long.003_base 003_m6.long.003_base You can use a simple shell command to get such a list from a longitudinal qdec file: cat long.qdec.table.txt | awk '{if ($1 != "fsid" && substr($1,0,1) != "#") printf("%s.long.%s\n", $1, $2)}' > outsubjectsfile.txt Then preproc will do its job. The order of subjects needs to be identical to the qdec file that you use to run the LME matlab tools to ensure thickenss maps are stacked in the same order as you pass the covariates. Best, Martin On Thu, 2012-12-06 at 04:27 +0000, jorge luis wrote:
Hi Alex I think that Martin added the flag --qdec to mris_preproc for version
5.2. Martin, could you confirm this please? The code for building the study design matrix X that is in the wiki is just an example of how lme tools can be used for that purpose but the actual instance of your code will depend on your particular Qdec table. For instance, usually, Freesurfer's longitudinal Qdec tables are of the form: fsid fsid-base sID time group... 002 002_base 002 0 0 003 003_base 003 0 1 003_m6 003_base 003 0.56 1 003_m12 003_base 003 1.12 1 003_m24 003_base 003 2.2 1 005 005_base 005 0 0 005_m6 005_base 005 0.45 0 005_m12 005_base 005 1.2 0 were “fsid” is the Freesurfer's ID, “fsid-base” is the name of the subject's specific template, sID is the subject-specific ID uniquely identifying each subject, “time” is the time covariate and group is the group membership covariate (there can be more covariates of course). I suppose that you processed your longitudinal MRI scans using a Qdec table similar to that. You can read that Qdec table into Matlab: Qdec = fReadQdec('qdec.table.dat'); Now you need to build your numeric design matrix X from the cell string array Qdec to represent a specific longitudinal design. Here you don't need the columns fsid and fsid-base in Qdec so you simply remove them: Qdec = rmQdecCol(Qdec,1); Qdec = rmQdecCol(Qdec,1); The you can grab the subject-specific ID: sID = Qdec(:,1); and then remove that column: Qdec = rmQdecCol(Qdec,1); You can now convert your cell string array Qdec to a numeric matrix: M = Qdec2num(Qdec); Here, the data in M is already ordered according to time for each subject, otherwise, you can order the data using: [M,Y,ni] = sortData(M,1,Y,sID); where Y is the cortical thickness data matrix that you read with fs_read_Y. Please take a look at the help of sortData. Note that matrix M only have two columns and you need to build your design matrix from it. In your case it is quite simple: X = [ones(length(M),1) M M(:,1).*M(:,2)]; That is to say X contains a column of 1s (the intercept), a column with the time covariate, a column with the group membership and a column with the interaction term. Now, you are ready for fitting the lme model: stats = lme_mass_fit_vw(X,1,Y,ni,cortex); The 1 here (second input) means that you are using a single random effect for the intercept term which is located in column 1 of X. Then you can test the interaction term using: CM.C = [0 0 0 1]; F_stats = lme_mass_F(stats,CM); and write the significance map for visualization and FDR correction in tksurfer fs_write_fstats(F_stats,mri,'sig.mgh','sig'); It must be recognized that some basic Matlab knowledge is required to apply the lme tools. But the gain in flexibility for building your design matrix and analysis is significant. As you see, the relatively difficult part is how to get from the Qdec variable to your design matrix X. It requires some study-specific Matlab code. Sorry, but this is what he have at this point. Best -Jorge ______________________________________________________________ De: Alex Hanganu mailto:al.hanganu@yahoo.ca Para: FS Mailing List mailto:Freesurfer@nmr.mgh.harvard.edu; Jorge Luis Bernal-Rusiel mailto:jbernal0019@yahoo.es Enviado: Miércoles 5 de diciembre de 2012 18:20 Asunto: Re: [Freesurfer] Longitudinal analysis - contrast Can you please help with this ? Thanks in advance ! best, Alex. Le 05/12/2012 6:12 PM, Alex Hanganu a écrit : > Hi Jorge, > > On the page presenting the > "../fswiki/LinearMixedEffectsModels", I think there is a > misunderstanding - > You show the command: > > "mris_preproc --qdec ...." > > but "--qdec" is not recognized, and in the help menu of > "mris_preproc" I don't see this flag. So I guess you meant > the "--fsgd" flag. > > so, in the fsgd file, in our example, with 2 groups, and 2 > time points, would it be more correct to put the classes for > each subject (exmpl.1) or for 2 groups (exmpl.2), or this is > not important at this stage ? > > For the previous error, we found the answer, it was because > in the qdec file, we used the "tab" between the lines. We > changed that to "space", and it was ok. > > Further, after performing the step: > [M,Y,ni] = sortData(M,2,Y,sids); > > we get the Error: > File: sortData.m Line: 59 Column: 6 > Expression or statement is incorrect--possibly unbalanced (, > {, or [. > > Can you please help with this? > > Also, in the "lme_mass_fit_vw.m" help, we saw that we need > to create the X - ordered design matrix. Is this matrix the > qdec file ? > > As we see it now, the steps that we should perform in > Matlab, are these: > > [Y,mri] ... > lhsphere ... > lhcortex ... > Qdec = fRead... > Qdec = rmQdecCol... > sids... > Qdec = rmQdecCol... > M = ... > [M,Y,ni] ... > > lme_mass_fit_vw(M,months,Y,Group,[],OutputFileName,[],[],[]) > > where M - should be something like '-1' '1' '1' '-1' > months - is the column from qdec file, where is shown the > difference between time points > Y - is the lh.thickness_sm10.mgh file > Group - should be the Group column from the qdec file > [] - are showing that the default values are to be taken. > > But this approach doesn't seem to be entirely correct, cause > the M (matrix) includes either the group, either the months > (depending how we play with the command). > > Thank you !! > > Best regards, > Alex. > > > Le 05/12/2012 2:30 PM, jorge luis a écrit : > > > Hi Alex > > > > This error is likely due to the Qdec variable being empty. > > So, nothing was read into this variable when you applied > > > > Qdec = fReadQdec('qdec.table.dat'); > > > > Please check that. If you don't find a solution to this > > then send me your Qdec table data file and I will check it > > out. > > > > Best > > -Jorge > > >
Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail.
freesurfer@nmr.mgh.harvard.edu