[FIXED] Dwiintensitynorm: Error at population_template

Hi there,

I’m trying to run a FBA on a few subjects using MRTRIX3. All steps upto dwibiascorrect have worked.

Unfortunately I have problems running the next step ‘dwiintensitynorm’.
I have created the necessary folders (dwi_input, mask_input) as described in the documentation and this is the troublesome script:

dwiintensitynorm $localOutputsDir/dwiintensitynorm/dwi_input/ $localOutputsDir/dwiintensitynorm/mask_input/ $localOutputsDir/dwiintensitynorm/dwi_output/ $localOutputsDir/dwiintensitynorm/fa_template.mif $localOutputsDir/dwiintensitynorm/fa_template_wm_mask.mif -force

The symbolic links created to the mask_input and dwi_output work fine.
The dwiintensitynorm script gets upto population_template step and then crashes, and thus the fa_template files are not created.

This is the command line/error output:

Command: mrtransform /RDSMount/PRJ-STILNeuro/PROJECTS/iSpotD_tract_density/dwiintensitynorm-tmp-M62TU6/fa/STI66100137.mif -template linear_template6.mif -linear linear_transforms_7/STI66100137.txt input_transformed/STI66100137.mif -datatype float32 -force
Command: mrmath input_transformed/STI66100081.mif input_transformed/STI66100137.mif input_transformed/STI66100058.mif mean linear_template7.mif -force
Function: shutil.copy2(linear_transforms_7/STI66100081.txt, linear_transforms)
Traceback (most recent call last):
File “/opt/mrtrix/mrtrix3/bin/population_template”, line 631, in
run.function(copy, os.path.join(‘linear_transforms_%i’ % level, filename), ‘linear_transforms’)
File “/opt/mrtrix/mrtrix3/lib/mrtrix3/run.py”, line 246, in function
result = fn(*args)
File “/usr/lib/python2.7/shutil.py”, line 131, in copy2
copystat(src, dst)
File “/usr/lib/python2.7/shutil.py”, line 98, in copystat
os.utime(dst, (st.st_atime, st.st_mtime))
OSError: [Errno 1] Operation not permitted: 'linear_transforms/STI66100081.txt’
dwiintensitynorm: Changing back to original directory (/RDSMount/PRJ-STILNeuro/PROJECTS/iSpotD_tract_density)
dwiintensitynorm: Script failed while executing the command: population_template fa -mask_dir /RDSMount/PRJ-STILNeuro/PROJECTS/iSpotD_tract_density/dwiintensitynorm-tmp-M62TU6/mask_input fa_template.mif -type rigid_affine_nonlinear -rigid_scale 0.25,0.5,0.8,1.0 -affine_scale 0.7,0.8,1.0,1.0 -nl_scale 0.5,0.75,1.0,1.0,1.0 -nl_niter 5,5,5,5,5 -tempdir population_template -linear_no_pause -nocleanup

Any help/advice is much appreciated!

Thanks in advance!

Matt

Fixed the problem,

Python crashed when trying to copy the transform files in dwiintensitynorm because it can’t set the access time and modified time on the destination file. This was because the drive we were using was actually a windows platform, so can’t set the time regardless of who owns the file or directory.

The solution was to just run the script on a non windows drive.

1 Like

Glad you fixed the problem. For reference, it might be this python bug.