Dear all, I have come up with a pretty good preliminary solution namely:
I run the first loop that returns me CNR and some other stuff from the command mri_cnr. It creates one txt. file for each subject. for i in *3T; do mri_cnr $i/surf $i/mri/norm.mgz > $i/"$i"_cnr.txt; done (All of my subjects' names contain the expression 3T, so if someone would like to use it, just adjust it properly) The second loop gives me a single txt. file with the list of cnr value only (that is 'total CNR'). However, without subjects ID. I couldnt figure it out yet, how to do this. for i in $(find . -name *cnr.txt); do awk 'NR==8 {print $4}' "$i" >> cnr_sample.txt; done But all in all, I would say the problem is more or less solved, so thanks everybody for your input. Cheers, Jacek > gray/white CNR is the first column > On Thu, 22 Jan 2015, Jacek Manko wrote: > > > Dear Dr. Greve, dear Dr. Fischl > > > >> would something like this work? > >> > >> set cnr = `mri_cnr $SUBJECTS_DIR/$subject/surf > >> $SUBJECTS_DIR/$subject/mri/norm.mgz | grep total | awk '{print $4}'` > >> echo $subject $cnr > yourfile > > > > Unfortunately it doesnt. I was trying to modify the paths, but got > always results like: > > > > MRISread(/surf/lh.white): could not open file > > No such file or directory > > mri_cnr: could not read surface file /surf/lh.white > > No such file or directory > > > > and @Dr. Fischl > > > >> actually if you run mri_cnr with -l out.log it will write a line to > >> out.log > >> of the form: > >> > >> gray_white_cnr gray_csf_cnr white_mean gray_mean csf_mean > >> sqrt(white_var) sqrt(gray_var) sqrt(csf_var)) > >> > >> > >> so you would create one file for each subject. You could then run a for > >> loop over your subjects to cat them into a single file > >> > > > > > > Indeed, but I dont quite get it, how to extract CNR from these values. > > > > > > Thanks, > > > > > > Cheers, > > Jacek Manko > > > >> On 01/21/2015 02:46 PM, Jacek Manko wrote: > >>> My desirable output would be then a .txt file that consists of merely > >> two columns. The first column is the subject's ID and the second is the > >> CNR value only, for example: > >>> > >>> bruce 1.602 > >>> bert 1.555 > >>> john_doe 1.666 > >>> > >>> Thanks in advance. > >>> > >>> Cheers, > >>> Jacek > >>> > >>> Dnia 21-01-2015 o godz. 20:34 Bruce Fischl napisał(a): > >>>> Hi Jacek > >>>> > >>>> if you give us an example of what the desired output would be for you it > >>>> would just be a couple of minutes to put it in the code. Or maybe someone > >>>> can post some sed code (or some easy alternative) to parse the CNR out of > >>>> the output. > >>>> > >>>> Bruce > >>>> > >>>> > >>>> On Wed, > >>>> 21 Jan 2015, Jacek Manko wrote: > >>>> > >>>>> Oh, I thought it was already defined. I am referring actually to this > >>>> thread... > >>>>> https://mail.nmr.mgh.harvard.edu/pipermail//freesurfer/2012-August/025251.html > >>>>> > >>>>> ...and, allowing myself to specify my problem, when I type the command > >>>> 'mri_cnr' what I become in my terminal is something more or less like > >>>> that: > >>>>> " > >>>>>>> mri_cnr ~/local_subjects/bruce/surf > >>>>>>> ~/local_subjects/bruce/mri/norm.mgz > >>>>>>> processing MRI volume > >>>>>> /homes/4/fischl/local_subjects/bruce/mri/norm.mgz... > >>>>>>> white = 95.8+-9.7, gray = 65.3+-17.9, csf = 40.1+-17.2 > >>>>>>> gray/white CNR = 2.241, gray/csf CNR = 1.026 > >>>>>>> lh CNR = 1.633 > >>>>>>> white = 95.7+-9.9, gray = 65.5+-17.8, csf = 41.5+-17.4 > >>>>>>> gray/white CNR = 2.205, gray/csf CNR = 0.937 > >>>>>>> rh CNR = 1.571 > >>>>>>> total CNR = 1.602 > >>>>> " > >>>>> > >>>>> My question is, if there is a way to export the CNR value, that is > >>>> 1.602, to a seperate file alongside with the subject's ID. I suppose > >>>> there are no such bulit-in commands in FreeSurfer, is that right? > >>>>> Thanks. > >>>>> > >>>>> > >>>>> Cheers, > >>>>> Jacek Manko > >>>>> > >>>>> > >>>>> > >>>>> Dnia 21-01-2015 o godz. 18:38 Douglas N Greve napisał(a): > >>>>>> how do you want to define CNR? > >>>>>> > >>>>>> On 01/21/2015 06:21 AM, Jacek Manko wrote: > >>>>>>> Dear All, > >>>>>>> > >>>>>>> I have been wondering if there is a way (already implemented in the > >>>>>> FreeSurfer) to export CNR measurement outputs to seperate file, like a > >>>>>> table or someting. If not, it will possible only via some pretty > >>>>>> advanced bash scripting, am I right? If so, has anyone some experience > >>>>>> with that matter? > >>>>>>> Thanks. > >>>>>>> > >>>>>>> Cheers, > >>>>>>> Jacek Manko > >>>>>>> > >>>>>>> > >>>>>>> _______________________________________________ > >>>>>>> Freesurfer mailing list > >>>>>>> Freesurfer@nmr.mgh.harvard.edu > >>>>>>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > >>>>>>> > >>>>>>> > >>>>>> -- > >>>>>> Douglas N. Greve, Ph.D. > >>>>>> MGH-NMR Center > >>>>>> gr...@nmr.mgh.harvard.edu > >>>>>> Phone Number: 617-724-2358 > >>>>>> Fax: 617-726-7422 > >>>>>> > >>>>>> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting > >>>>>> FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2 > >>>>>> www.nmr.mgh.harvard.edu/facility/filedrop/index.html > >>>>>> Outgoing: > >>>>>> ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/ > >>>>>> > >>>>>> _______________________________________________ > >>>>>> 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 > >>> > >>> > >> > >> -- > >> Douglas N. Greve, Ph.D. > >> MGH-NMR Center > >> gr...@nmr.mgh.harvard.edu > >> Phone Number: 617-724-2358 > >> Fax: 617-726-7422 > >> > >> Bugs: surfer.nmr.mgh.harvard.edu/fswiki/BugReporting > >> FileDrop: https://gate.nmr.mgh.harvard.edu/filedrop2 > >> www.nmr.mgh.harvard.edu/facility/filedrop/index.html > >> Outgoing: ftp://surfer.nmr.mgh.harvard.edu/transfer/outgoing/flat/greve/ > >> > >> _______________________________________________ > >> Freesurfer mailing list > >> Freesurfer@nmr.mgh.harvard.edu > >> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > > > > > _______________________________________________ > > Freesurfer mailing list > > Freesurfer@nmr.mgh.harvard.edu > > https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer > > > > > > _______________________________________________ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer