Hi YC Yao,

Could you please send the actual call that you are using to invoke the PostFreeSurferPipeline.sh script?

I suspect that for some reason that invocation is missing the required --path=<path-to-study-folder> option or the option is in some way incorrectly formed.

Here is my reasoning.

The "no such file or directory" error you are getting reads:

   line 63: /100307/T1w/100307/mri/c_ras.mat: No such file or directory

Looking line 63 in the FreeSurfer2CaretConvertAndRegisterNonlinear.sh script on line 63, we see that the statement there is trying to put some values in a file named c_ras.mat.

   echo "1 0 0 ""$MatrixX" > "$FreeSurferFolder"/mri/c_ras.mat

The file it is trying to create is named "$FreeSurferFolder"/mri/c_ras.mat and in your case it is trying to create that file as /100307/T1w/100307/mri/c_ras.mat. This means that at the point this statement is being executed the variable FreeSurferFolder has the value /100307/T1w/100307.

Since it is unlikely that you have a directory named 100307 at the very root of your file system (which is what a file path starting with /100307 means), it makes sense that the system is saying that there is no such file or directory. So it seems that there is something wrong with the value of FreeSurferFolder at this point.

So, if we trace back in the FreeSurfer2CaretConvertAndRegisterNonlinear.sh script to where the value of FreeSurferFolder is set, we see that it is the 6th command line parameter passed in to the script. Line 10 reads: FreeSurferFolder="$6". The FreeSurfer2CaretConvertAndRegisterNonlinear.sh script is invoked on line 127 of the PostFreeSurferPipeline.sh script, and the value that is passed in as the 6th command line parameter is the value of the FreeSurferFolder variable in the PostFreeSurferPipeline.sh script. In your case, that variable must have the value /100307/T1w/100307.

Back on line 119 of the PostFreeSurferPipeline.sh script, we see that the FreeSurferFolder variable gets the value "$T1wFolder"/"$FreeSurferFolder".


So we need to search further backward in the script for where T1wFolder and FreeSurferFolder have values set prior to this assignment.

Way back on line 80, FreeSurferFolder gets the value "$Subject". That likely accounts for the 100307 at the end of the value we are seeing (/100307/T1w/100307), meaning that the T1wFolder variable most likely has the value /100307/T1w.

So where does the T1wFolder variable get its value?

On line 116, T1wFolder is assigned a value as follows:


Recall that we have every reason to believe that your value for T1wFolder at this point is /100307/T1w.

Back on line 75, T1wFolder is assigned the value T1w, and you can bet that the Subject variable has the subject id number (100307) as its value. So the assignment of a new value for T1wFolder on line 116 would end up with a value of /100307/T1w in the case that the StudyFolder is an empty string or has no value.

So...where should StudyFolder be getting its value?

Line 50 of the PostFreeSurferPipeline.sh script reads:

   StudyFolder=`opts_GetOpt1 "--path" $@`

This line means that the StudyFolder variable gets its value from the --path=<path-to-study-folder> option used when invoking the PostFreeSurferPipeline.sh script. Since you are apparently getting an empty string value assigned to the StudyFolder variable, it seems that there some kind of problem with your --path=<path-to-study-folder> option. Perhaps it is missing. Perhaps it only has one hyphen in front of path (e.g. -path=<path-to-study-folder>). Perhaps (and this seems most likely to me) there is a space between the = and the path that you specified (e.g. --path= /my/study/directory). If there is a space after the =, then the StudyFolder variable will get assigned an empty string.

Please take a look at your invocation of the PostFreeSurferPipeline.sh script and see if the --path= option seems to be specified correctly.

Hope this is helpful,

On 10/13/2016 09:43 AM, 姚永成 wrote:
Dear HCP users,

I am a beginner of HCP Pipelines, and I have installed necessary tools including freesurfer_v5.3.0_HCP, fsl_v5.0.9(I can not find v5.0.6), HCP Workbench, HCP Pipelines scripts and other dependencies. I have also downloaded HCP example data to test structural processing part of HCP Pipelines, fallowing the guidance here(https://github.com/Washington-University/Pipelines/wiki/v3.4.0-Release-Notes,-Installation,-and-Usage).

However, I encounter errors when it comes to the 3rd part of structural processing: Post-freesurfer-processing. I checked the automatically generated file named xxx.sh.exxxx, and found out that only a file named PostFreeSurferPipeline.sh.e6340 contains errors messages, which mean that nothing wrong with the first two part.

The errors messages are :
mghRead(/100307/T1w/100307/mri/brain.finalsurfs.mgz, -1): could not open file mghRead(/100307/T1w/100307/mri/brain.finalsurfs.mgz, -1): could not open file mghRead(/100307/T1w/100307/mri/brain.finalsurfs.mgz, -1): could not open file /home/yoson/Applications/HCP_Pipelines/PostFreeSurfer/scripts/FreeSurfer2CaretConvertAndRegisterNonlinear.sh: line 63: /100307/T1w/100307/mri/c_ras.mat: No such file or directory

Nothing wrong with environment variables setting. I also have the privilege to read, write and execute all files.

Your generous help would be greatly appreciated.

Best regards,
YC Yao

HCP-Users mailing list

Timothy B. Brown
Business & Technology Application Analyst III
Pipeline Developer (Human Connectome Project)
The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

HCP-Users mailing list

Reply via email to