# Dwifslpreproc causes "studies in base image (199) does not match number of rows in diffusion gradient table (398)"

**URL:** <https://community.mrtrix.org/t/dwifslpreproc-causes-studies-in-base-image-199-does-not-match-number-of-rows-in-diffusion-gradient-table-398/4689>\
**Category:** Uncategorized\
**Created:** [March 23, 2021, 2:15am UTC](https://community.mrtrix.org/t/dwifslpreproc-causes-studies-in-base-image-199-does-not-match-number-of-rows-in-diffusion-gradient-table-398/4689 "2021-03-23T02:15:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CallowBrainProject](https://community.mrtrix.org/user_avatar/community.mrtrix.org/callowbrainproject/32/2370_2.png) [@CallowBrainProject](https://community.mrtrix.org/u/CallowBrainProject)\
**Post date:** [March 23, 2021, 2:15am UTC](https://community.mrtrix.org/t/dwifslpreproc-causes-studies-in-base-image-199-does-not-match-number-of-rows-in-diffusion-gradient-table-398/4689/1 "2021-03-23T02:15:00Z")

</div>

Hello,

I am trying to process some data from the aging human connectome project.

Before processing, I concatenate the 4 diffusion images they collected

mrcat dwi\_98\_AP.mif dwi\_99\_AP.mif dwi\_98\_PA.mif dwi\_99\_PA.mif dwi.mif

Then I run it through  
dwidenoise & mrdegibbs

I then use eddy current correction using the -rpe\_header verison

dwifslpreproc -force -eddyqc\_text QC -rpe\_header dwi\_denoised\_unringed.mif dwi\_prep.mif

This seems to work, however, when trying to run dwimask or dwibiascorrect afterwards I get the following errors.

dwi2mask: [100%] preloading data for “dwi\_prep.mif”

dwi2mask: **[ERROR] number of studies in base image (199) does not match number of rows in diffusion gradient table (398)**

dwi2mask: **[ERROR] unable to get valid diffusion gradient table for image "dwi\_prep.mif"**  
dwibiascorrect: **[ERROR] Unhandled Python exception:**

dwibiascorrect: **[ERROR]** _TypeError: can only concatenate str (not “int”) to str_

dwibiascorrect: **[ERROR] Traceback:**

dwibiascorrect: **[ERROR]** _/Applications/MRtrix3Tissue/bin/dwibiascorrect:49 (in execute())_

dwibiascorrect: **[ERROR]** _raise MRtrixError(‘DW gradient scheme contains different number of entries (’ + str(len(dwi\_header.keyval()[‘dw\_scheme’])) + ’ to number of volumes in DWIs (’ + dwi\_header.size()[3] + ‘)’)_

I am not sure what is causing this issue? Does it have something to do with the header information? This would be weird as eddy correction seemed to work and I imported all the information from the .json for all of the dwi\_98\_AP.mif files.

Let me know if you have any ideas on how to twouble shoot this issue.

Best,  
Daniel

---

<div class="post-metadata">

**Author:** ![rsmith](https://community.mrtrix.org/user_avatar/community.mrtrix.org/rsmith/32/2672_2.png) [@rsmith](https://community.mrtrix.org/u/rsmith)\
**Post date:** [March 23, 2021, 2:17am UTC](https://community.mrtrix.org/t/dwifslpreproc-causes-studies-in-base-image-199-does-not-match-number-of-rows-in-diffusion-gradient-table-398/4689/2 "2021-03-23T02:17:09Z")

</div>

Hi Daniel,

The issue is the use of software not supported by the _MRtrix3_ team, which does not contain the latest bug fixes. This particular issue was first reported on the forum [here](https://community.mrtrix.org/t/invalid-dwi-scheme-after-dwifslpreproc/3715), with the relevant fix to the code on GitHub [here](https://github.com/MRtrix3/mrtrix3/pull/2067), and it was mentioned in the `3.0.0` → `3.0.1` changelog [here](https://community.mrtrix.org/t/mrtrix-3-0-1-release/3854/2).

Cheers  
Rob

---

<div class="post-metadata">

**Author:** ![CallowBrainProject](https://community.mrtrix.org/user_avatar/community.mrtrix.org/callowbrainproject/32/2370_2.png) [@CallowBrainProject](https://community.mrtrix.org/u/CallowBrainProject)\
**Post date:** [March 23, 2021, 12:03pm UTC](https://community.mrtrix.org/t/dwifslpreproc-causes-studies-in-base-image-199-does-not-match-number-of-rows-in-diffusion-gradient-table-398/4689/3 "2021-03-23T12:03:14Z")

</div>

Thank you!
