Error in generate a study-specific unbiased FOD template

Hi, all,
I’m running a fixel-based analysis and have followed the steps in the documentation. Unfortunately I have problems running the next step “population_template”.

This is the command line/error output:

population_template sharefolder/study/template/fod_input -mask_dir sharefolder/study/template/mask_input sharefolder/study/template/wmfod_template.mif -voxel_size 1.3 

And the error:

population_template: [100%] Erasing temporary mask images
population_template: [  0%] Performing initial rigid registration to template... population_template: **ERROR] Command failed: mrregister /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1 /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1  -rigid_niter 0  -type rigid  -noreorientation  -rigid_init_translation mass  -datatype float32 -rigid linear_transforms_initial/1.txt (population_template:492)**
**population_template: Output of failed command:**
**population_template: Script failed while executing the command: mrregister /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1 /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1  -rigid_niter 0  -type rigid  -noreorientation  -rigid_init_translation mass  -datatype float32 -rigid linear_transforms_initial/1.txt**
****population_template: For debugging, inspect contents of temporary directory: /home/siying/population_template-tmp-WZ4837/**

Thanks in advance!
ZWM

Hi,

Not sure what is going on there as mrregister seems to fail without an error message (are you sure you copy pasted all of the output? ERROR] seems cropped.). What is the output of:

cd /home/siying/population_template-tmp-WZ4837/
mrinfo /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif
mrstats average_header.mif
mrstats /home/siying/sharefolder/study/template/mask_input/1.mif
mrstats /home/siying/sharefolder/study/template/fod_input/1.mif
mrregister /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1 /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1 -rigid_niter 0 -type rigid -noreorientation -rigid_init_translation mass -datatype float32 -rigid linear_transforms_initial/1.txt -debug &> out.txt

The all output as follows:

population_template: Generating a population-average template from 4 input images
population_template: SH series detected, performing FOD registration
population_template: initial alignment of images: mass
population_template: linear registration stages:
population_template: (00) rigid     scale: 0.3000, niter: 100, lmax: 2
population_template: (01) rigid     scale: 0.4000, niter: 100, lmax: 2
population_template: (02) rigid     scale: 0.6000, niter: 100, lmax: 2
population_template: (03) rigid     scale: 0.8000, niter: 100, lmax: 4
population_template: (04) rigid     scale: 1.0000, niter: 100, lmax: 4
population_template: (05) rigid     scale: 1.0000, niter: 100, lmax: 4
population_template: (06) affine    scale: 0.3000, niter: 500, lmax: 2
population_template: (07) affine    scale: 0.4000, niter: 500, lmax: 2
population_template: (08) affine    scale: 0.6000, niter: 500, lmax: 2
population_template: (09) affine    scale: 0.8000, niter: 500, lmax: 4
population_template: (10) affine    scale: 1.0000, niter: 500, lmax: 4
population_template: (11) affine    scale: 1.0000, niter: 500, lmax: 4
population_template: nonlinear registration stages:
population_template: (00) nonlinear scale: 0.3000, niter: 5, lmax: 2
population_template: (01) nonlinear scale: 0.4000, niter: 5, lmax: 2
population_template: (02) nonlinear scale: 0.5000, niter: 5, lmax: 2
population_template: (03) nonlinear scale: 0.6000, niter: 5, lmax: 2
population_template: (04) nonlinear scale: 0.7000, niter: 5, lmax: 2
population_template: (05) nonlinear scale: 0.8000, niter: 5, lmax: 2
population_template: (06) nonlinear scale: 0.9000, niter: 5, lmax: 2
population_template: (07) nonlinear scale: 1.0000, niter: 5, lmax: 2
population_template: (08) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (09) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (10) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (11) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (12) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (13) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (14) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (15) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: Generated temporary directory: /home/siying/population_template-tmp-WZ4837/
population_template: Changing to temporary directory (/home/siying/population_template-tmp-WZ4837/)
population_template: Generating initial template
Command:  mraverageheader -fill /home/siying/sharefolder/study/template/fod_input/1.mif /home/siying/sharefolder/study/template/fod_input/2.mif /home/siying/sharefolder/study/template/fod_input/3.mif /home/siying/sharefolder/study/template/fod_input/4.mif - | mrresize - -voxel 1.3,1.3,1.3 average_header.mif
population_template: [  0%] Importing input masks to average space for template population_template: [ 25%] Importing input masks to average space for template population_template: [ 50%] Importing input masks to average space for template population_template: [ 75%] Importing input masks to average space for template population_template: [100%] Importing input masks to average space for template population_template: [100%] Importing input masks to average space for template cropping
Command:  mrmath masks_transformed/1.mif masks_transformed/2.mif masks_transformed/3.mif masks_transformed/4.mif max mask_initial.mif
Command:  mrcrop average_header.mif -mask mask_initial.mif average_header_cropped.mif
Function: posix.remove('mask_initial.mif')
Function: posix.remove('average_header.mif')
Function: shutil.move('average_header_cropped.mif', 'average_header.mif')
population_template: [100%] Erasing temporary mask images
population_template: [  0%] Performing initial rigid registration to template..**. population_template: [ERROR] Command failed: mrregister /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1 /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1  -rigid_niter 0  -type rigid  -noreorientation  -rigid_init_translation mass  -datatype float32 -rigid linear_transforms_initial/1.txt (population_template:492)**
**population_template: Output of failed command:**
**population_template: Script failed while executing the command: mrregister /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1 /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1  -rigid_niter 0  -type rigid  -noreorientation  -rigid_init_translation mass  -datatype float32 -rigid linear_transforms_initial/1.txt**
**population_template: For debugging, inspect contents of temporary directory: /home/siying/population_template-tmp-WZ4837/**

Unfortunately, not more information in there so I’ll need the output of the commands I posted above.

Thanks. The commands as follows:
population_template sharefolder/study/template/fod_input -mask_dir sharefolder/study/template/mask_input sharefolder/study/template/wmfod_template.mif -voxel_size 1.3

Hi, sir. Am I wrong? I really need your advice.

What is the output in the terminal and in out.txt after running the commands posted here?

The output in the terminal as follows:
population_template: Generating a population-average template from 4 input images
population_template: SH series detected, performing FOD registration
population_template: initial alignment of images: mass
population_template: linear registration stages:
population_template: (00) rigid scale: 0.3000, niter: 100, lmax: 2
population_template: (01) rigid scale: 0.4000, niter: 100, lmax: 2
population_template: (02) rigid scale: 0.6000, niter: 100, lmax: 2
population_template: (03) rigid scale: 0.8000, niter: 100, lmax: 4
population_template: (04) rigid scale: 1.0000, niter: 100, lmax: 4
population_template: (05) rigid scale: 1.0000, niter: 100, lmax: 4
population_template: (06) affine scale: 0.3000, niter: 500, lmax: 2
population_template: (07) affine scale: 0.4000, niter: 500, lmax: 2
population_template: (08) affine scale: 0.6000, niter: 500, lmax: 2
population_template: (09) affine scale: 0.8000, niter: 500, lmax: 4
population_template: (10) affine scale: 1.0000, niter: 500, lmax: 4
population_template: (11) affine scale: 1.0000, niter: 500, lmax: 4
population_template: nonlinear registration stages:
population_template: (00) nonlinear scale: 0.3000, niter: 5, lmax: 2
population_template: (01) nonlinear scale: 0.4000, niter: 5, lmax: 2
population_template: (02) nonlinear scale: 0.5000, niter: 5, lmax: 2
population_template: (03) nonlinear scale: 0.6000, niter: 5, lmax: 2
population_template: (04) nonlinear scale: 0.7000, niter: 5, lmax: 2
population_template: (05) nonlinear scale: 0.8000, niter: 5, lmax: 2
population_template: (06) nonlinear scale: 0.9000, niter: 5, lmax: 2
population_template: (07) nonlinear scale: 1.0000, niter: 5, lmax: 2
population_template: (08) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (09) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (10) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (11) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (12) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (13) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (14) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (15) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: Generated temporary directory: /home/siying/population_template-tmp-WZ4837/
population_template: Changing to temporary directory (/home/siying/population_template-tmp-WZ4837/)
population_template: Generating initial template
Command: mraverageheader -fill /home/siying/sharefolder/study/template/fod_input/1.mif /home/siying/sharefolder/study/template/fod_input/2.mif /home/siying/sharefolder/study/template/fod_input/3.mif /home/siying/sharefolder/study/template/fod_input/4.mif - | mrresize - -voxel 1.3,1.3,1.3 average_header.mif
population_template: [ 0%] Importing input masks to average space for template population_template: [ 25%] Importing input masks to average space for template population_template: [ 50%] Importing input masks to average space for template population_template: [ 75%] Importing input masks to average space for template population_template: [100%] Importing input masks to average space for template population_template: [100%] Importing input masks to average space for template cropping
Command: mrmath masks_transformed/1.mif masks_transformed/2.mif masks_transformed/3.mif masks_transformed/4.mif max mask_initial.mif
Command: mrcrop average_header.mif -mask mask_initial.mif average_header_cropped.mif
Function: posix.remove(‘mask_initial.mif’)
Function: posix.remove(‘average_header.mif’)
Function: shutil.move(‘average_header_cropped.mif’, ‘average_header.mif’)
population_template: [100%] Erasing temporary mask images
population_template: [ 0%] Performing initial rigid registration to template… population_template: [ERROR] Command failed: mrregister /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1 /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1 -rigid_niter 0 -type rigid -noreorientation -rigid_init_translation mass -datatype float32 -rigid linear_transforms_initial/1.txt (population_template:492)
population_template: Output of failed command:
population_template: Script failed while executing the command: mrregister /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1 /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1 -rigid_niter 0 -type rigid -noreorientation -rigid_init_translation mass -datatype float32 -rigid linear_transforms_initial/1.txt
population_template: For debugging, inspect contents of temporary directory: /home/siying/population_template-tmp-WZ4837/

And unfortunately, I did not find the out.txt.

I am referring to the following commands:

I am very sorry. I am just beginning to learn Mrtrix, so I don’t quite understand what you mean.
Is the following correct?

siying@siying-vbox:~/population_template-tmp-WZ4837$ /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif mrstats 
/home/siying/sharefolder/study/template/fod_input/1.mif: line 1: mrtrix: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 2: dim:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 3: vox:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 4: layout:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 5: datatype:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 6: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 7: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 8: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 9: EchoTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 10: FlipAngle:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 11: RepetitionTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 12: syntax error near unexpected token `('
/home/siying/sharefolder/study/template/fod_input/1.mif: line 12: `command_history: dwidenoise "sharefolder/study/001_control" "sharefolder/study/001_control/den.mif"  (version=3.0_RC3_latest-5-g81036fcc)'
siying@siying-vbox:~/population_template-tmp-WZ4837$ average_header.mif mrstats /home/siying/sharefolder/study/template/mask_input/1.mif mrstats 
average_header.mif: command not found
siying@siying-vbox:~/population_template-tmp-WZ4837$ /home/siying/sharefolder/study/template/fod_input/1.mif mrregister
/home/siying/sharefolder/study/template/fod_input/1.mif: line 1: mrtrix: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 2: dim:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 3: vox:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 4: layout:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 5: datatype:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 6: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 7: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 8: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 9: EchoTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 10: FlipAngle:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 11: RepetitionTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 12: syntax error near unexpected token `('
/home/siying/sharefolder/study/template/fod_input/1.mif: line 12: `command_history: dwidenoise "sharefolder/study/001_control" "sharefolder/study/001_control/den.mif"  (version=3.0_RC3_latest-5-g81036fcc)'
siying@siying-vbox:~/population_template-tmp-WZ4837$ /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1 
/home/siying/sharefolder/study/template/fod_input/1.mif: line 1: mrtrix: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 2: dim:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 3: vox:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 4: layout:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 5: datatype:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 6: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 7: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 8: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 9: EchoTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 10: FlipAngle:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 11: RepetitionTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 12: syntax error near unexpected token `('
/home/siying/sharefolder/study/template/fod_input/1.mif: line 12: `command_history: dwidenoise "sharefolder/study/001_control" "sharefolder/study/001_control/den.mif"  (version=3.0_RC3_latest-5-g81036fcc)'
siying@siying-vbox:~/population_template-tmp-WZ4837$ /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1 -rigid_niter 0 -type rigid -noreorientation -rigid_init_translation mass -datatype float32 -rigid linear_transforms_initial/1.txt -debug 
/home/siying/sharefolder/study/template/mask_input/1.mif: line 1: mrtrix: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 2: dim:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 3: vox:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 4: layout:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 5: datatype:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 6: transform:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 7: transform:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 8: transform:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 9: EchoTime:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 10: FlipAngle:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 11: RepetitionTime:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 12: syntax error near unexpected token `('
/home/siying/sharefolder/study/template/mask_input/1.mif: line 12: `command_history: dwidenoise "sharefolder/study/001_control" "sharefolder/study/001_control/den.mif"  (version=3.0_RC3_latest-5-g81036fcc)'

Each line is one command. You might want to brush up on unix command line or get a colleague to help you out. Donald has compiled a very useful tutorial.

Thanks! Is that right?

siying@siying-vbox:~$ cd /home/siying/population_template-tmp-WZ4837/ mrinfo
siying@siying-vbox:~/population_template-tmp-WZ4837$ /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif mrstats
/home/siying/sharefolder/study/template/fod_input/1.mif: line 1: mrtrix: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 2: dim:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 3: vox:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 4: layout:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 5: datatype:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 6: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 7: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 8: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 9: EchoTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 10: FlipAngle:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 11: RepetitionTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 12: syntax error near unexpected token (' /home/siying/sharefolder/study/template/fod_input/1.mif: line 12:command_history: dwidenoise “sharefolder/study/001_control” “sharefolder/study/001_control/den.mif” (version=3.0_RC3_latest-5-g81036fcc)’
siying@siying-vbox:~/population_template-tmp-WZ4837$ average_header.mif mrstats /home/siying/sharefolder/study/template/mask_input/1.mif mrstats
average_header.mif: command not found
siying@siying-vbox:~/population_template-tmp-WZ4837$ /home/siying/sharefolder/study/template/fod_input/1.mif mrregister
/home/siying/sharefolder/study/template/fod_input/1.mif: line 1: mrtrix: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 2: dim:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 3: vox:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 4: layout:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 5: datatype:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 6: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 7: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 8: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 9: EchoTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 10: FlipAngle:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 11: RepetitionTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 12: syntax error near unexpected token (' /home/siying/sharefolder/study/template/fod_input/1.mif: line 12:command_history: dwidenoise “sharefolder/study/001_control” “sharefolder/study/001_control/den.mif” (version=3.0_RC3_latest-5-g81036fcc)’
siying@siying-vbox:~/population_template-tmp-WZ4837$ /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1
/home/siying/sharefolder/study/template/fod_input/1.mif: line 1: mrtrix: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 2: dim:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 3: vox:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 4: layout:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 5: datatype:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 6: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 7: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 8: transform:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 9: EchoTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 10: FlipAngle:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 11: RepetitionTime:: command not found
/home/siying/sharefolder/study/template/fod_input/1.mif: line 12: syntax error near unexpected token (' /home/siying/sharefolder/study/template/fod_input/1.mif: line 12:command_history: dwidenoise “sharefolder/study/001_control” “sharefolder/study/001_control/den.mif” (version=3.0_RC3_latest-5-g81036fcc)’
siying@siying-vbox:~/population_template-tmp-WZ4837$ /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1 -rigid_niter 0 -type rigid -
/home/siying/sharefolder/study/template/mask_input/1.mif: line 1: mrtrix: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 2: dim:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 3: vox:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 4: layout:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 5: datatype:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 6: transform:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 7: transform:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 8: transform:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 9: EchoTime:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 10: FlipAngle:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 11: RepetitionTime:: command not found
/home/siying/sharefolder/study/template/mask_input/1.mif: line 12: syntax error near unexpected token (' /home/siying/sharefolder/study/template/mask_input/1.mif: line 12:command_history: dwidenoise “sharefolder/study/001_control” “sharefolder/study/001_control/den.mif” (version=3.0_RC3_latest-5-g81036fcc)’
siying@siying-vbox:~/population_template-tmp-WZ4837$ noreorientation -rigid_init_translation mass -datatype float32 -rigid linear_transforms_initial/1.txt -debug
noreorientation: command not found

Sorry, sir. I understand you now and thanks for your suggestion.
The output in the terminal and in out.txt after running the commands posted as follows:

siying@siying-vbox:~$ cd /home/siying/population_template-tmp-WZ4837/
siying@siying-vbox:~/population_template-tmp-WZ4837$ mrinfo /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif
************************************************
Image:               "/home/siying/sharefolder/study/template/fod_input/1.mif"
************************************************
  Dimensions:        197 x 197 x 115 x 45
  Voxel size:        1.3 x 1.3 x 1.3 x ?
  Data strides:      [ -2 -3 4 1 ]
  Format:            MRtrix
  Data type:         32 bit float (little endian)
  Intensity scaling: offset = 0, multiplier = 1
  Transform:                    1          -0           0      -120.4
                               -0           1           0      -111.1
                               -0          -0           1      -83.46
  EchoTime:          0.0744
  FlipAngle:         90
  RepetitionTime:    10
  command_history:   dwidenoise "sharefolder/study/001_control" "sharefolder/study/001_control/den.mif"  (version=3.0_RC3_latest-5-g81036fcc)
  [8 entries]        mrdegibbs "sharefolder/study/001_control/den.mif" "sharefolder/study/001_control/unring.mif" "-axes" "0,1"  (version=3.0_RC3_latest-5-g81036fcc)
                     ...
                     dwi2fod "msmt_csd" "sharefolder/study/001_control/upsamped.mif" "sharefolder/study/001_control/ga-wm.txt" "sharefolder/study/001_control/wmfod.mif" "-mask" "sharefolder/study/001_control/mask.mif"  (version=3.0_RC3_latest-5-g81036fcc)
                     mtnormalise "sharefolder/study/001_control/wmfod.mif" "sharefolder/study/001_control/wmfod_norm.mif" "-mask" "sharefolder/study/001_control/mask.mif"  (version=3.0_RC3_latest-5-g81036fcc)
  comments:          lin yuan chang (geservice) [MR] Ax DTI 64 Directions
                     study: D02 [ ORIGINAL PRIMARY OTHER ]
                     DOS: 02/11/2017 22:19:36
  lognorm_scale:     1.03289974
  mrtrix_version:    3.0_RC3_latest-5-g81036fcc
  prior_dw_scheme:   0,0,0,0
  [69 entries]       0,0,0,0
                     ...
                     -0.7210977154,-0.6080824007,-0.3320449951,999.729
                     -0.2669847823,-0.9599452847,0.08499515541,1000.114
************************************************
Image:               "average_header.mif"
************************************************
  Dimensions:        121 x 172 x 163 x 45
  Voxel size:        1.3 x 1.3 x 1.3 x ?
  Data strides:      [ 1 2 3 4 ]
  Format:            MRtrix
  Data type:         32 bit float (little endian)
  Intensity scaling: offset = 0, multiplier = 1
  Transform:                    1           0           0      -66.75
                                0           1           0      -108.8
                                0           0           1      -96.35
  command_history:   /home/siying/mrtrix3/bin/mraverageheader "-fill" "/home/siying/sharefolder/study/template/fod_input/1.mif" "/home/siying/sharefolder/study/template/fod_input/2.mif" "/home/siying/sharefolder/study/template/fod_input/3.mif" "/home/siying/sharefolder/study/template/fod_input/4.mif" "-"  (version=3.0_RC3_latest-5-g81036fcc)
                     /home/siying/mrtrix3/bin/mrresize "-" "-voxel" "1.3,1.3,1.3" "average_header.mif"  (version=3.0_RC3_latest-5-g81036fcc)
                     /home/siying/mrtrix3/bin/mrcrop "average_header.mif" "-mask" "mask_initial.mif" "average_header_cropped.mif"  (version=3.0_RC3_latest-5-g81036fcc)
  mrtrix_version:    3.0_RC3_latest-5-g81036fcc
siying@siying-vbox:~/population_template-tmp-WZ4837$ mrstats average_header.mif
      volume       mean     median      stdev        min        max      count
       [ 0 ]          1          1          0          1          1    3392356
       [ 1 ]          0          0          0          0          0    3392356
       [ 2 ]          0          0          0          0          0    3392356
       [ 3 ]          0          0          0          0          0    3392356
       [ 4 ]          0          0          0          0          0    3392356
       [ 5 ]          0          0          0          0          0    3392356
       [ 6 ]          0          0          0          0          0    3392356
       [ 7 ]          0          0          0          0          0    3392356
       [ 8 ]          0          0          0          0          0    3392356
       [ 9 ]          0          0          0          0          0    3392356
      [ 10 ]          0          0          0          0          0    3392356
      [ 11 ]          0          0          0          0          0    3392356
      [ 12 ]          0          0          0          0          0    3392356
      [ 13 ]          0          0          0          0          0    3392356
      [ 14 ]          0          0          0          0          0    3392356
      [ 15 ]          0          0          0          0          0    3392356
      [ 16 ]          0          0          0          0          0    3392356
      [ 17 ]          0          0          0          0          0    3392356
      [ 18 ]          0          0          0          0          0    3392356
      [ 19 ]          0          0          0          0          0    3392356
      [ 20 ]          0          0          0          0          0    3392356
      [ 21 ]          0          0          0          0          0    3392356
      [ 22 ]          0          0          0          0          0    3392356
      [ 23 ]          0          0          0          0          0    3392356
      [ 24 ]          0          0          0          0          0    3392356
      [ 25 ]          0          0          0          0          0    3392356
      [ 26 ]          0          0          0          0          0    3392356
      [ 27 ]          0          0          0          0          0    3392356
      [ 28 ]          0          0          0          0          0    3392356
      [ 29 ]          0          0          0          0          0    3392356
      [ 30 ]          0          0          0          0          0    3392356
      [ 31 ]          0          0          0          0          0    3392356
      [ 32 ]          0          0          0          0          0    3392356
      [ 33 ]          0          0          0          0          0    3392356
      [ 34 ]          0          0          0          0          0    3392356
      [ 35 ]          0          0          0          0          0    3392356
      [ 36 ]          0          0          0          0          0    3392356
      [ 37 ]          0          0          0          0          0    3392356
      [ 38 ]          0          0          0          0          0    3392356
      [ 39 ]          0          0          0          0          0    3392356
      [ 40 ]          0          0          0          0          0    3392356
      [ 41 ]          0          0          0          0          0    3392356
      [ 42 ]          0          0          0          0          0    3392356
      [ 43 ]          0          0          0          0          0    3392356
      [ 44 ]          0          0          0          0          0    3392356
siying@siying-vbox:~/population_template-tmp-WZ4837$ mrstats /home/siying/sharefolder/study/template/mask_input/1.mif
      volume       mean     median      stdev        min        max      count
       [ 0 ]   0.154272          0   0.361209          0          1    4463035
siying@siying-vbox:~/population_template-tmp-WZ4837$ mrstats /home/siying/sharefolder/study/template/fod_input/1.mif
      volume       mean     median      stdev        min        max      count
       [ 0 ]  0.0434862          0   0.105995          0    2.56645    4463035
       [ 1 ] 8.81935e-05          0  0.0281385   -1.28843   0.660419    4463035
       [ 2 ] 0.000182661          0  0.0281531  -0.547882   0.721938    4463035
       [ 3 ] -0.00164242          0  0.0316931   -1.05066   0.566322    4463035
       [ 4 ] 0.000643814          0  0.0286158  -0.580784   0.824323    4463035
       [ 5 ] -0.00152697          0  0.0298275  -0.791108   0.868038    4463035
       [ 6 ] -0.00597829          0  0.0472077   -2.13826    1.35961    4463035
       [ 7 ] 0.00049116          0  0.0307039   -1.28812    1.20331    4463035
       [ 8 ] -0.00254696          0  0.0306594  -0.830143   0.664666    4463035
       [ 9 ] 0.00161189          0  0.0304129   -1.13738   0.887283    4463035
      [ 10 ] 0.00145269          0  0.0283685  -0.618416    1.50642    4463035
      [ 11 ] -0.00288342          0  0.0375411   -1.57604    1.05164    4463035
      [ 12 ] 0.00276685          0  0.0334135  -0.667346   0.798248    4463035
      [ 13 ] -0.000201019          0  0.0319238  -0.941905   0.955526    4463035
      [ 14 ] 0.00336465          0  0.0303689   -0.96729   0.957301    4463035
      [ 15 ] 0.00148196          0  0.0184386   -0.52444   0.782449    4463035
      [ 16 ] -0.00175365          0  0.0199365  -0.682199   0.701526    4463035
      [ 17 ] -0.000686545          0  0.0177621  -0.510572   0.686549    4463035
      [ 18 ] 0.00214737          0  0.0196325  -0.861786   0.758995    4463035
      [ 19 ] 0.00142313          0  0.0187015  -0.536706   0.555548    4463035
      [ 20 ] -0.000549965          0  0.0180521  -0.590082   0.719643    4463035
      [ 21 ] -8.85688e-05          0  0.0174927  -0.592256   0.957868    4463035
      [ 22 ] 0.00108068          0  0.0189456  -0.891356   0.606004    4463035
      [ 23 ] -0.000447615          0  0.0190823  -0.501529   0.657462    4463035
      [ 24 ] -0.00123491          0  0.0184513  -0.620752   0.590906    4463035
      [ 25 ] 0.000570479          0  0.0173091  -0.580179   0.392825    4463035
      [ 26 ] -0.000206837          0  0.0177055  -0.579236   0.917155    4463035
      [ 27 ] -0.000500276          0  0.0187025  -0.547967   0.622003    4463035
      [ 28 ] -0.000367727          0  0.0103515  -0.564327   0.489931    4463035
      [ 29 ] -0.000636858          0  0.0100267  -0.326211   0.273907    4463035
      [ 30 ] -0.0010157          0  0.0101194   -0.26245   0.264706    4463035
      [ 31 ] 0.00036333          0 0.00940278  -0.269023   0.252457    4463035
      [ 32 ] -0.000427559          0 0.00933055  -0.255775   0.227472    4463035
      [ 33 ] 0.000756488          0 0.00962527  -0.359634   0.371638    4463035
      [ 34 ] -0.000401412          0 0.00910601  -0.478204   0.239961    4463035
      [ 35 ] 3.74683e-05          0 0.00862521  -0.447015   0.442416    4463035
      [ 36 ] -0.000397719          0 0.00888562  -0.295855    0.40002    4463035
      [ 37 ] 0.000315914          0 0.00897516  -0.529644   0.298329    4463035
      [ 38 ] 0.000523777          0  0.0097987  -0.380983    0.36001    4463035
      [ 39 ] -0.000134201          0 0.00860429  -0.312581   0.244755    4463035
      [ 40 ] 7.23396e-05          0 0.00865034  -0.237124   0.258639    4463035
      [ 41 ] 0.000331303          0 0.00915974  -0.292847   0.321768    4463035
      [ 42 ] -0.000859654          0  0.0096552  -0.319278   0.291635    4463035
      [ 43 ] -0.00012253          0  0.0101246  -0.490538   0.292563    4463035
      [ 44 ] -0.00119899          0  0.0112418  -0.650806   0.296837    4463035
siying@siying-vbox:~/population_template-tmp-WZ4837$ mrregister /home/siying/sharefolder/study/template/fod_input/1.mif average_header.mif -mask1 /home/siying/sharefolder/study/template/mask_input/1.mif -rigid_scale 1 -rigid_niter 0 -type rigid -noreorientation -rigid_init_translation mass -datatype float32 -rigid linear_transforms_initial/1.txt -debug
mrregister: [DEBUG] No config file found at "/etc/mrtrix.conf"
mrregister: [DEBUG] No config file found at "/home/siying/.mrtrix.conf"
mrregister: [INFO] opening image "/home/siying/sharefolder/study/template/fod_input/1.mif"...
mrregister: [DEBUG] reading key/value file "/home/siying/sharefolder/study/template/fod_input/1.mif"...
mrregister: [DEBUG] sanitising image information...
mrregister: [INFO] image "/home/siying/sharefolder/study/template/fod_input/1.mif" opened with dimensions 197x197x115x45, voxel spacing 1.3x1.3x1.3xnan, datatype Float32LE
mrregister: [DEBUG] memory-mapping file "/home/siying/sharefolder/study/template/fod_input/1.mif"...
mrregister: [DEBUG] file "/home/siying/sharefolder/study/template/fod_input/1.mif" mapped at 0x7f4cde4d4000, size 803346300 (read-only)
mrregister: [DEBUG] image "/home/siying/sharefolder/study/template/fod_input/1.mif" loaded
mrregister: [DEBUG] image "/home/siying/sharefolder/study/template/fod_input/1.mif" initialised with strides = [ -45 -8865 1746405 1 ], start = 1746360, using indirect IO
mrregister: [DEBUG] initialising threads...
mrregister: [DEBUG] launching 2 threads "loop threads"...
mrregister: [DEBUG] waiting for completion of threads "loop threads"...
mrregister: [  0%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [  1%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [  2%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [  3%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [  4%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [  5%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [  6%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [  7%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [  8%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [  9%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 10%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 11%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 12%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 13%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 14%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 15%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 16%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 17%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 18%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 19%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 20%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 21%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 22%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 23%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 24%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 25%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 26%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 27%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 28%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 29%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 30%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 31%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 32%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 33%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 34%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 35%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 36%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 37%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 38%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 39%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 40%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 41%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 42%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 43%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 44%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 45%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 46%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 47%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 48%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 49%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 50%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 51%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 52%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 53%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 54%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 55%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 56%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 57%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 58%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 59%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 60%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 61%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 62%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 63%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 64%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 65%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 66%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 67%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 68%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 69%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 70%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 71%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 72%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 73%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 74%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 75%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 76%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 77%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 78%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 79%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 80%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 81%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 82%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 83%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 84%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 85%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 86%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 87%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 88%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 89%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 90%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 91%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 92%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 93%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 94%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 95%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 96%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 97%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 98%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [ 99%] preloading data for "/home/siying/sharefolder/study/template/mrregister: [100%] preloading data for "/home/siying/sharefolder/study/template/fod_input/1.mif"... 
mrregister: [DEBUG] threads "loop threads" completed OK
mrregister: [100%] preloading data for "/home/siying/sharefolder/study/template/fod_input/1.mif"
mrregister: [DEBUG] image "/home/siying/sharefolder/study/template/fod_input/1.mif" initialised with strides = [ -45 -8865 1746405 1 ], start = 1746360, using direct IO
mrregister: [INFO] opening image "average_header.mif"...
mrregister: [DEBUG] reading key/value file "average_header.mif"...
mrregister: [DEBUG] sanitising image information...
mrregister: [INFO] image "average_header.mif" opened with dimensions 121x172x163x45, voxel spacing 1.3x1.3x1.3xnan, datatype Float32LE
mrregister: [DEBUG] memory-mapping file "average_header.mif"...
mrregister: [DEBUG] file "average_header.mif" mapped at 0x7f4c4b9a9000, size 610624080 (read-only)
mrregister: [DEBUG] image "average_header.mif" loaded
mrregister: [DEBUG] image "average_header.mif" initialised with strides = [ 1 121 20812 3392356 ], start = 0, using indirect IO
mrregister: [DEBUG] initialising threads...
mrregister: [DEBUG] launching 2 threads "loop threads"...
mrregister: [DEBUG] waiting for completion of threads "loop threads"...
mrregister: [100%] preloading data for "average_header.mif"... 
mrregister: [DEBUG] threads "loop threads" completed OK
mrregister: [100%] preloading data for "average_header.mif"
mrregister: [DEBUG] image "average_header.mif" initialised with strides = [ 45 5445 936540 1 ], start = 0, using direct IO
mrregister: [INFO] opening image "/home/siying/sharefolder/study/template/mask_input/1.mif"...
mrregister: [DEBUG] reading key/value file "/home/siying/sharefolder/study/template/mask_input/1.mif"...
mrregister: [DEBUG] sanitising image information...
mrregister: [INFO] image "/home/siying/sharefolder/study/template/mask_input/1.mif" opened with dimensions 197x197x115, voxel spacing 1.3x1.3x1.3, datatype Bit
mrregister: [DEBUG] memory-mapping file "/home/siying/sharefolder/study/template/mask_input/1.mif"...
mrregister: [DEBUG] file "/home/siying/sharefolder/study/template/mask_input/1.mif" mapped at 0x7f4d104af000, size 557880 (read-only)
mrregister: [DEBUG] image "/home/siying/sharefolder/study/template/mask_input/1.mif" loaded
mrregister: [DEBUG] image "/home/siying/sharefolder/study/template/mask_input/1.mif" initialised with strides = [ -1 -197 38809 ], start = 38808, using indirect IO
mrregister: running rigid registration
mrregister: initialising translation and centre of rotation using centre of mass
mrregister: [DEBUG] centre of mass of /home/siying/sharefolder/study/template/fod_input/1.mif:  5.6452739972990846  8.6928643736261897 -4.2816489071712409
mrregister: [DEBUG] centre of mass of average_header.mif: 11.252000000074563 2.3473999999859569 8.9453999997569902
mrregister: [DEBUG] centre: 8.4486369986868244 5.5201321868060731 2.3318755462928746
mrregister: [INFO] Transformation before registration:
mrregister: [INFO] transformation:
                 1,                  0,                  0, -5.606726002775479
                 0,                  1,                  0,  6.345464373640233
                 0,                  0,                  1, -13.22704890692823
mrregister: [INFO] transformation_half:
                 1,                  0,                  0, -2.803363001387739
                 0,                  1,                  0,  3.172732186820117
                 0,                  0,                  1, -6.613524453464116
mrregister: [INFO] transformation_half_inverse:
                 1,                  0,                  0,  2.803363001387739
                 0,                  1,                  0, -3.172732186820117
                 0,                  0,                  1,  6.613524453464116
mrregister: [INFO] centre: 8.44863699869 5.52013218681 2.33187554629
mrregister: [INFO] Linear registration stage parameters:
mrregister: [INFO] scale factor 1, lmax 0, GD max_iter 0, optimiser: BBGD 
mrregister: [DEBUG] compute_average_voxel2scanner num_images:2
mrregister: [DEBUG] compute_minimum_average_header header_out.spacing: 1.3, 1.3, 1.3
mrregister: [DEBUG] compute_minimum_average_header header_out.size: 199, 199, 165
mrregister: linear stage 1/1, scale factor 1, GD max_iter 0, optimiser: BBGD 
mrregister: [INFO] smoothing image 1
mrregister: [DEBUG] creating scratch image for smoothing input image...
mrregister: [DEBUG] sanitising image information...
mrregister: [DEBUG] allocating scratch buffer for image "scratch image"...
mrregister: [DEBUG] unmapping file "/home/siying/sharefolder/study/template/mask_input/1.mif"
mrregister: [DEBUG] image "/home/siying/sharefolder/study/template/mask_input/1.mif" unloaded
mrregister: [DEBUG] unmapping file "average_header.mif"
mrregister: [DEBUG] image "average_header.mif" unloaded
mrregister: [DEBUG] unmapping file "/home/siying/sharefolder/study/template/fod_input/1.mif"
mrregister: [DEBUG] image "/home/siying/sharefolder/study/template/fod_input/1.mif" unloaded
mrregister: **[ERROR] Error allocating memory for scratch buffer**

  • I really hope to learn this software, please give me more advice ! Thanks !

You are running out of RAM. If this is a virtual machine or compute cluster environment, you might be able to change its settings to allocate more memory. You can find out your RAM size with the command free -h. Note that the final steps of the FBA analysis pipeline will require substantially more RAM than the registration!

If you cannot increase the size of the memory, judging by the size of your input image and the relatively empty mask image, you can reduce the memory footprint by cropping the images to their mask. Furthermore, you could remove all but the first 15 volumes in all FOD images if you do not exceed an l_max of 4, which is the default in population_template. For example:

mrconvert -coord 3 0:14 /home/siying/sharefolder/study/template/fod_input/1.mif - | mrcrop - -mask $(maskfilter /home/siying/sharefolder/study/template/mask_input/1.mif dilate - -npass 2 ) /home/siying/sharefolder/study/template/fod_input_small/1.mif

(do this for all images)

Then use fod_input_small as you input FOD folder for population_template instead of fod_input.

1 Like

Thanks for your suggestion. I have allocatede more memory. But there is a new error:

siying@siying-vbox:~$ population_template sharefolder/study/template/fod_input -mask_dir sharefolder/study/template/mask_input sharefolder/study/template/wmfod_template.mif -voxel_size 1.3
population_template: Generating a population-average template from 4 input images
population_template: SH series detected, performing FOD registration
population_template: initial alignment of images: mass
population_template: linear registration stages:
population_template: (00) rigid     scale: 0.3000, niter: 100, lmax: 2
population_template: (01) rigid     scale: 0.4000, niter: 100, lmax: 2
population_template: (02) rigid     scale: 0.6000, niter: 100, lmax: 2
population_template: (03) rigid     scale: 0.8000, niter: 100, lmax: 4
population_template: (04) rigid     scale: 1.0000, niter: 100, lmax: 4
population_template: (05) rigid     scale: 1.0000, niter: 100, lmax: 4
population_template: (06) affine    scale: 0.3000, niter: 500, lmax: 2
population_template: (07) affine    scale: 0.4000, niter: 500, lmax: 2
population_template: (08) affine    scale: 0.6000, niter: 500, lmax: 2
population_template: (09) affine    scale: 0.8000, niter: 500, lmax: 4
population_template: (10) affine    scale: 1.0000, niter: 500, lmax: 4
population_template: (11) affine    scale: 1.0000, niter: 500, lmax: 4
population_template: nonlinear registration stages:
population_template: (00) nonlinear scale: 0.3000, niter: 5, lmax: 2
population_template: (01) nonlinear scale: 0.4000, niter: 5, lmax: 2
population_template: (02) nonlinear scale: 0.5000, niter: 5, lmax: 2
population_template: (03) nonlinear scale: 0.6000, niter: 5, lmax: 2
population_template: (04) nonlinear scale: 0.7000, niter: 5, lmax: 2
population_template: (05) nonlinear scale: 0.8000, niter: 5, lmax: 2
population_template: (06) nonlinear scale: 0.9000, niter: 5, lmax: 2
population_template: (07) nonlinear scale: 1.0000, niter: 5, lmax: 2
population_template: (08) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (09) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (10) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (11) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (12) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (13) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (14) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: (15) nonlinear scale: 1.0000, niter: 5, lmax: 4
population_template: Generated temporary directory: /home/siying/population_template-tmp-JJEVPR/
population_template: Changing to temporary directory (/home/siying/population_template-tmp-JJEVPR/)
population_template: Generating initial template
Command:  mraverageheader -fill /home/siying/sharefolder/study/template/fod_input/1.mif /home/siying/sharefolder/study/template/fod_input/2.mif /home/siying/sharefolder/study/template/fod_input/3.mif /home/siying/sharefolder/study/template/fod_input/4.mif - | mrresize - -voxel 1.3,1.3,1.3 average_header.mif
population_template: 
**population_template: [ERROR] Command failed: mraverageheader -fill /home/siying/sharefolder/study/template/fod_input/1.mif /home/siying/sharefolder/study/template/fod_input/2.mif /home/siying/sharefolder/study/template/fod_input/3.mif /home/siying/sharefolder/study/template/fod_input/4.mif - | mrresize - -voxel 1.3,1.3,1.3 average_header.mif (population_template:442)**
**population_template: Output of failed command:**
**                     mrresize: [ERROR] no filename supplied to standard input (broken pipe?)**
**                     mrresize: [ERROR] error opening image "-"**
**population_template:** 
population_template: Changing back to original directory (/home/siying)
population_template: Script failed while executing the command: mraverageheader -fill /home/siying/sharefolder/study/template/fod_input/1.mif /home/siying/sharefolder/study/template/fod_input/2.mif /home/siying/sharefolder/study/template/fod_input/3.mif /home/siying/sharefolder/study/template/fod_input/4.mif - | mrresize - -voxel 1.3,1.3,1.3 average_header.mif
population_template: For debugging, inspect contents of temporary directory: /home/siying/population_template-tmp-JJEVPR/

I suspect mraverageheader gets killed. Are you sure you did not decrease the memory? What is the output of the two commands:

free -h
mraverageheader -fill /home/siying/sharefolder/study/template/fod_input/1.mif /home/siying/sharefolder/study/template/fod_input/2.mif /home/siying/sharefolder/study/template/fod_input/3.mif /home/siying/sharefolder/study/template/fod_input/4.mif average_header.mif -debug
mrresize average_header.mif -voxel 1.3,1.3,1.3 average_header.mif -debug

Thanks for your suggestion. I did not decrease the memory.
The output of the two commands as follows:

siying@siying-vbox:~$ free -h
              total        used        free      shared  buff/cache   available
Mem:           5.8G        756M        4.5G         16M        594M        4.8G
Swap:          1.9G          0B        1.9G
siying@siying-vbox:~$ mraverageheader -fill /home/siying/sharefolder/study/template/fod_input/1.mif /home/siying/sharefolder/study/template/fod_input/2.mif /home/siying/sharefolder/study/template/fod_input/3.mif /home/siying/sharefolder/study/template/fod_input/4.mif average_header.mif -debug
mraverageheader: [DEBUG] No config file found at "/etc/mrtrix.conf"
mraverageheader: [DEBUG] No config file found at "/home/siying/.mrtrix.conf"
mraverageheader: [INFO] padding in template voxels: 0 0 0
mraverageheader: [INFO] template voxel subsampling: 1
mraverageheader: [INFO] opening image "/home/siying/sharefolder/study/template/fod_input/1.mif"...
mraverageheader: [DEBUG] reading key/value file "/home/siying/sharefolder/study/template/fod_input/1.mif"...
mraverageheader: [DEBUG] sanitising image information...
mraverageheader: [INFO] image "/home/siying/sharefolder/study/template/fod_input/1.mif" opened with dimensions 197x197x115x45, voxel spacing 1.3x1.3x1.3xnan, datatype Float32LE
mraverageheader: [INFO] opening image "/home/siying/sharefolder/study/template/fod_input/1.mif"...
mraverageheader: [DEBUG] reading key/value file "/home/siying/sharefolder/study/template/fod_input/1.mif"...
mraverageheader: [DEBUG] sanitising image information...
mraverageheader: [INFO] image "/home/siying/sharefolder/study/template/fod_input/1.mif" opened with dimensions 197x197x115x45, voxel spacing 1.3x1.3x1.3xnan, datatype Float32LE
mraverageheader: [INFO] opening image "/home/siying/sharefolder/study/template/fod_input/1.mif"...
mraverageheader: [DEBUG] reading key/value file "/home/siying/sharefolder/study/template/fod_input/1.mif"...
mraverageheader: [DEBUG] sanitising image information...
mraverageheader: [INFO] image "/home/siying/sharefolder/study/template/fod_input/1.mif" opened with dimensions 197x197x115x45, voxel spacing 1.3x1.3x1.3xnan, datatype Float32LE
mraverageheader: [INFO] opening image "/home/siying/sharefolder/study/template/fod_input/2.mif"...
mraverageheader: [DEBUG] reading key/value file "/home/siying/sharefolder/study/template/fod_input/2.mif"...
mraverageheader: [DEBUG] sanitising image information...
mraverageheader: [INFO] image "/home/siying/sharefolder/study/template/fod_input/2.mif" opened with dimensions 197x197x115x45, voxel spacing 1.3x1.3x1.3xnan, datatype Float32LE
mraverageheader: [INFO] opening image "/home/siying/sharefolder/study/template/fod_input/3.mif"...
mraverageheader: [DEBUG] reading key/value file "/home/siying/sharefolder/study/template/fod_input/3.mif"...
mraverageheader: [DEBUG] sanitising image information...
mraverageheader: [INFO] image "/home/siying/sharefolder/study/template/fod_input/3.mif" opened with dimensions 197x197x115x45, voxel spacing 1.3x1.3x1.3xnan, datatype Float32LE
mraverageheader: [INFO] opening image "/home/siying/sharefolder/study/template/fod_input/4.mif"...
mraverageheader: [DEBUG] reading key/value file "/home/siying/sharefolder/study/template/fod_input/4.mif"...
mraverageheader: [DEBUG] sanitising image information...
mraverageheader: [INFO] image "/home/siying/sharefolder/study/template/fod_input/4.mif" opened with dimensions 197x197x115x45, voxel spacing 1.3x1.3x1.3xnan, datatype Float32LE
mraverageheader: [DEBUG] compute_average_voxel2scanner num_images:4
mraverageheader: [DEBUG] compute_minimum_average_header header_out.spacing: 1.3, 1.3, 1.3
mraverageheader: [DEBUG] compute_minimum_average_header header_out.size: 207, 231, 164
mraverageheader: [INFO] creating image "average_header.mif"...
mraverageheader: [DEBUG] sanitising image information...
mraverageheader: [DEBUG] creating empty file "average_header.mif"
mraverageheader: [DEBUG] resizing file "average_header.mif" to 44111779
mraverageheader: [DEBUG] sanitising image information...
mraverageheader: [INFO] image "average_header.mif" created with dimensions 207x231x164x45, voxel spacing 1.3x1.3x1.3xnan, datatype Bit
mraverageheader: [DEBUG] memory-mapping file "average_header.mif"...
mraverageheader: [DEBUG] file "average_header.mif" mapped at 0x7fe7923d5000, size 44111183 (read-write)
mraverageheader: [DEBUG] image "average_header.mif" loaded
mraverageheader: [DEBUG] image "average_header.mif" initialised with strides = [ 1 207 47817 7841988 ], start = 0, using direct IO

mraverageheader: [SYSTEM FATAL CODE: SIGBUS (7)] Bus error: Accessing invalid address (out of storage space?)
siying@siying-vbox:~$ mrresize average_header.mif -voxel 1.3,1.3,1.3 average_header.mif -debug
mrresize: [DEBUG] No config file found at "/etc/mrtrix.conf"
mrresize: [DEBUG] No config file found at "/home/siying/.mrtrix.conf"
mrresize: [INFO] opening image "average_header.mif"...
mrresize: [DEBUG] reading key/value file "average_header.mif"...
mrresize: [ERROR] invalid first line for key/value file "average_header.mif" (expected "mrtrix image")
mrresize: [ERROR] error opening image "average_header.mif"

You’re running out of disk storage. Delete temporary folders /home/siying/population_template-tmp-* and if you do not have enough disk space in /home/siying/, change the temporary folder location via population_template -tempdir /path/to/tmp/ <your arguments here>.

Thanks for your helpful suggestion.

Hi, Sir !
I follow the step 21 for statistics.
The error: fixelcfestats: [ 5% ] pre-computing fixel-fixel connectivity… Killed
The RAM of my compute is 18G, what can I do ?