physimals / oxasl

Python based ASL pipeline based on oxford_asl
https://oxasl.readthedocs.io/
Apache License 2.0
5 stars 6 forks source link

Crash reported on VE data - failed to invert structural->std space transformation #4

Closed mcraig-ibme closed 5 years ago

mcraig-ibme commented 5 years ago

From Winok::

ERROR: 0-dimensional array given. Array must be at least two-dimensional
Traceback (most recent call last):
  File "/home/fs0/winokl/Programmes/oxasl/oxasl/oxford_asl.py", line 160, in main
    oxasl(wsp)
  File "/home/fs0/winokl/Programmes/oxasl/oxasl/oxford_asl.py", line 180, in oxasl
    oxasl_preproc(wsp)
  File "/home/fs0/winokl/Programmes/oxasl/oxasl/oxford_asl.py", line 249, in oxasl_preproc
    calib.calculate_m0(wsp)
  File "/home/fs0/winokl/Programmes/oxasl/oxasl/calib.py", line 66, in calculate_m0
    wsp.calibration.m0 = get_m0_refregion(wsp)
  File "/home/fs0/winokl/Programmes/oxasl/oxasl/calib.py", line 440, in get_m0_refregion
    get_tissrefmask(wsp)
  File "/home/fs0/winokl/Programmes/oxasl/oxasl/calib.py", line 617, in get_tissrefmask
    reg.reg_struc2std(wsp)
  File "/home/fs0/winokl/Programmes/oxasl/oxasl/reg.py", line 234, in reg_struc2std
    wsp.reg.std2struc = np.linalg.inv(wsp.reg.struc2std)
  File "/opt/fmrib/fsltmp/fsl_3a805695/fslpython/envs/fslpython/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 522, in inv
    _assertRankAtLeast2(a)
  File "/opt/fmrib/fsltmp/fsl_3a805695/fslpython/envs/fslpython/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 201, in _assertRankAtLeast2
    'at least two-dimensional' % a.ndim)
numpy.linalg.linalg.LinAlgError: 0-dimensional array given. Array must be at least two-dimensional
mcraig-ibme commented 5 years ago

Output log is below

WARNING: mkdir - Directory /vols/Scratch/winokl/TEPHRA/MRI_subjects/TPH-005_V1/nifti/ASL/oxasl already exists
WARNING: mkdir - Directory /vols/Scratch/winokl/TEPHRA/MRI_subjects/TPH-005_V1/nifti/ASL/oxasl/input already exists
OXASL version: 0.0.7
 - Found plugin: oxasl_ve (version 0.0.7.dev2)

Input ASL data: asldata
Data shape                    : (64, 64, 24, 96)
Label type                    : Vessel encoded
Encoding cycles               : 8
Labelling                     : CASL/pCASL
PLDs (s)                      : [0.25, 0.5, 0.75, 1.0, 1.25, 1.5]
Repeats at each TI            : [2, 2, 2, 2, 2, 2]
Bolus durations (s)           : [1.4, 1.4, 1.4, 1.4, 1.4, 1.4]
Time per slice (s)            : 0.0452

Initialising structural data
WARNING: mkdir - Directory /vols/Scratch/winokl/TEPHRA/MRI_subjects/TPH-005_V1/nifti/ASL/oxasl/structural already exists
 - Using FSL_ANAT output directory for structural data: ../T1/T1.anat
 - Using bias-corrected structural images

Getting structural segmentation
 - Using FSL_ANAT output
 - Bias field extracted sucessfully

Applying preprocessing corrections
 - Pre-processing image: calib
   - Removing first volume to ensure data is in steady state
   - Motion correcting
   - Taking mean across time axis
 - Pre-processing image: cref
   - Removing first volume to ensure data is in steady state
   - Motion correcting
   - Taking mean across time axis
 - Data transformations
   - No corrections to apply

No motion correction

Applying preprocessing corrections
 - Pre-processing image: calib
   - Removing first volume to ensure data is in steady state
   - Motion correcting
   - Taking mean across time axis
 - Pre-processing image: cref
   - Removing first volume to ensure data is in steady state
   - Motion correcting
   - Taking mean across time axis
 - Data transformations
   - No corrections to apply

Getting the ASL image to use for registration)
 - Registration reference is calibration image (brain extracted)
Registering calibration image to ASL image
 - Registering image: regfrom using FLIRT

Registering ASL data to structural data
 - Registering image: regfrom using FLIRT
 - ASL->Structural transform
[[ 9.98116476e-01  6.12630109e-02  3.20986720e-03 -2.45859146e+01]
 [-6.02284967e-02  9.88521462e-01 -1.38555949e-01  2.23674167e+01]
 [-1.16613771e-02  1.38101647e-01  9.90349402e-01  3.47698993e+01]
 [ 0.00000000e+00  0.00000000e+00  0.00000000e+00  1.00000000e+00]]
 - Structural->ASL transform
[[ 9.98116516e-01 -6.02285026e-02 -1.16613781e-02  2.62922284e+01]
 [ 6.12630133e-02  9.88521559e-01  1.38101660e-01 -2.54062472e+01]
 [ 3.20986720e-03 -1.38555950e-01  9.90349410e-01 -3.12562931e+01]
 [ 0.00000000e+00  0.00000000e+00  0.00000000e+00  1.00000000e+00]]

No fieldmap images for distortion correction

No CBLIP images provided for distortion correction

Calculating Sensitivity correction
 - Sensitivity image calculated from calibration and reference images

Applying preprocessing corrections
 - Pre-processing image: calib
   - Removing first volume to ensure data is in steady state
   - Motion correcting
   - Taking mean across time axis
 - Pre-processing image: cref
   - Removing first volume to ensure data is in steady state
   - Motion correcting
   - Taking mean across time axis
 - Data transformations
   - No corrections to apply
 - Applying sensitivity correction

Generated ASL data mask
 - Mask generated from brain extracting structural image and registering to ASL space

Calibration - calculating M0
 - Doing reference region calibration
 - Acquisition: TE=0.000000, TR=3.200000, Readout time (TAQ)=0.000000
 - Using tissue reference type: csf
 - T1r: 4.300000; T2r: 750.000000; T2b: 150.000000; Part co-eff: 1.150000
 - Doing automatic ventricle selection using standard atlas
mcraig-ibme commented 5 years ago

This was partly fixed by 7b76d0b503409069c7e56103523c046df1a9c45b which had not yet been released. The problem was that transformations from an FSL_ANAT folder were not being loaded as images/matrices, instead they were just being passed as filenames - which causes the above error when attempting to invert.

However another issue prevented nonlinear transformations from FSL_ANAT from being used - this has now been fixed by 0273b4abba003f680206796e65f57d2a7f154c17

Should now be fixed on master. Updated release required.

mcraig-ibme commented 5 years ago

Fix confirmed, will be in next release.

mcraig-ibme commented 5 years ago

v0.1.0