Error in dwiextract -pe (with four values (direction & total readout time))

dwiextract can’t find images present in input mif.

This is the error:

dwiextract dwi.mif -pe 0,-1,0,0.0383 test.mif
dwiextract: [ERROR] No dwi volumes present

However, these are present in the dwi.mif (see output below of mrinfo):

pe_scheme: 0,1,0,0.0518
[203 entries] 0,1,0,0.0518

0,-1,0,0.0383
0,-1,0,0.0383

Furthermore, works well:

dwiextract dwi.mif -pe 0,-1,0 test.mif
dwiextract: [100%] extracting volumes

Also works:

dwiextract dwi.mif -pe 0,1,0,0.0518 test.mif
dwiextract: [100%] extracting volumes

Might have to do with 2 different total_readout_times present? Or a rounding error? Since dwi.mif was made using -json file with:

“TotalReadoutTime”: 0.0382626

I’d suspect the rounding error… Although the code says it will try to match to within a precision of 0.005, so not sure. Have you tried with the full precision value as per your json file?

Why is there a break on line 111 in the code ?
I do understand the break on line 105, i.e. if one of the 3 axes is wrong mark the volume as false to keep.
This breaks the for loop checking all volumes on line 100

1 Like

Good point… These break statements probably ought to be continue statements. What do you reckon, @rsmith?

Hi @rsmith, any thoughts on this?
Thanks in advance,
Kindest regards,
Stefan.

Stefan, did you try modifying the break statement on line 111 as suggested, see if that fixes it? If so, I’ll modify accordingly upstream too.

All you need to do is edit the code on your system, then issue the usual ./build to have it all re-compiled, and try again. Unless you’ve installed through homebrew on macOS or something…?

Hi,

I confirm it works!

Commented the line // break
Did ./build

Result:

dwiextract dwi_orig.mif -pe 0,-1,0,0.0383 test.mif
dwiextract: [100%] extracting volumes

and also

dwiextract dwi_orig.mif -pe 0,1,0,0.0518 test2.mif
dwiextract: [100%] extracting volumes

Checked with mrinfo

(version=3.0_RC3-100-g16090b5b-dirty)
dwiextract “dwi_orig.mif” “-pe” “0,-1,0,0.0383” “test.mif” (version=3.0_RC3-100-g16090b5b-dirty)
dw_scheme: -0.01303927249,-0.9983439074,-0.05603004989,2400
[107 entries] -0.01303927249,-0.9983439074,-0.05603004989,4000

1.91526229e-08,-0.707106525,0.7071070691,0.5
-0.7071063111,-0.7071063967,3.513618996e-07,0.5
mrtrix_version: 3.0_RC3-100-g16090b5b-dirty

and for second extract

(version=3.0_RC3-100-g16090b5b-dirty)
dwiextract “dwi_orig.mif” “-pe” “0,1,0,0.0518” “test2.mif” (version=3.0_RC3-100-g16090b5b-dirty)
dw_scheme: -8.610985768e-09,-1.000000166,-1.653934599e-07,0.5
[96 entries] -0.9999999579,9.817170965e-09,-4.497719371e-08,0.5

-0.4119527934,-0.3999468937,0.8187418643,2400
-0.5773497523,-0.5773503343,0.5773506025,0.5
mrtrix_version: 3.0_RC3-100-g16090b5b-dirty

So nicely extracts volumes as intended.

1 Like