# Error with dwipreproc

**URL:** https://community.mrtrix.org/t/error-with-dwipreproc/982
**Category:** Uncategorized
**Created:** [June 19, 2017, 1:32pm UTC](https://community.mrtrix.org/t/error-with-dwipreproc/982 "2017-06-19T13:32:31Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Max\_Wichmann](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/m/ecd19e/32.png) [@Max\_Wichmann](https://community.mrtrix.org/u/Max_Wichmann)
#### Post date: [June 19, 2017, 1:32pm UTC](https://community.mrtrix.org/t/error-with-dwipreproc/982/1 "2017-06-19T13:32:31Z")

</div>

Hello Mrtrixers, I have problems with preproc command. It shows me always following error message:

Error: unrecognized arguments: -pe\_dir  
Usage: dwipreproc [options] pe\_dir input output  
Usage: (Run dwipreproc -help for more information)

I typed following command: dwipreproc -rpe\_none -fslgrad bvec.bvec bval.bval -export\_grad\_fsl bvec\_new.bvec bval\_new.bval -pe\_dir AP dwi.nii dwi\_preprocessed.nii

I use mrtrix3 and fsl, python are up to date.  
I checked already the Forum for comparable error messages but could not get a solution.  
Thank you for any kind of help.  
Best  
Max

---

<div class="post-metadata">

### Author: ![Antonin\_Skoch](https://community.mrtrix.org/user_avatar/community.mrtrix.org/antonin_skoch/32/358_2.png) [@Antonin\_Skoch](https://community.mrtrix.org/u/Antonin_Skoch)
#### Post date: [June 19, 2017, 2:34pm UTC](https://community.mrtrix.org/t/error-with-dwipreproc/982/2 "2017-06-19T14:34:00Z")

</div>

Dear @Max_Wichmann,

could you try your command without `-pe_dir`? i.e.

`dwipreproc -rpe_none -fslgrad bvec.bvec bval.bval -export_grad_fsl bvec_new.bvec bval_new.bval AP dwi.nii dwi_preprocessed.nii`

According to the `usage`, phase-encoding direction is not specified using `-pe_dir` option, but as a stand-alone command line argument.

---

<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: [June 19, 2017, 11:42pm UTC](https://community.mrtrix.org/t/error-with-dwipreproc/982/3 "2017-06-19T23:42:06Z")

</div>

Max

It looks to me like you’re using an out-of-date _MRtrix3_ installation. From the `3.0_RC1` version tag, the phase-encoding direction is optionally provided as a command-line option; previously, it was a compulsory argument. This is why the script complains that it doesn’t recognise the option `-pe_dir`, but in the example usage, “`pe_dir`” is specified as the first compulsory option.

If you’ve updated _MRtrix3_ but are still encountering this problem, you need to make sure that all traces of the previous installation are gone, and that you’re not unwittingly invoking another version of _MRtrix3_ installed elsewhere on your system (use “`which dwipreproc`” to check).

Cheers  
Rob

---

<div class="post-metadata">

### Author: ![Max\_Wichmann](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/m/ecd19e/32.png) [@Max\_Wichmann](https://community.mrtrix.org/u/Max_Wichmann)
#### Post date: [June 20, 2017, 10:57am UTC](https://community.mrtrix.org/t/error-with-dwipreproc/982/4 "2017-06-20T10:57:35Z")

</div>

Dear @Antonin_Skoch, dear @rsmith, thank you for your quick reply and help.

I first tried your suggestion Antonin and it works, after that I wanted to try option 2 (Reversed phase encode b=0 pair(s)) but an error occurs again. So I guess I have to reinstall mrtrix, like you said @rsmith?

first I did it the way (merge the b0 images via mrcat) it supposed to do in the documentation. But then it said

Error: argument -rpe\_pair: expected 2 arguments  
Usage: dwipreproc [options] pe\_dir input output  
Usage: (Run dwipreproc -help for more information)

After that I gave it both different single phase encoding images  
Here is my command line code:

dwipreproc -rpe\_pair blipup.nii blipdown.nii -se\_epi -fslgrad bvec.bvec bval.bval -export\_grad\_fsl bvec\_new.bvec bval\_new.bval AP dwi.nii dwi\_preprocessed.nii

Error: unrecognized arguments: -se\_epi  
Usage: dwipreproc [options] pe\_dir input output  
Usage: (Run dwipreproc -help for more information)

Thank you again  
Best  
Max Wichmann

---

<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: [June 21, 2017, 12:02am UTC](https://community.mrtrix.org/t/error-with-dwipreproc/982/5 "2017-06-21T00:02:45Z")

</div>

Max

If you are running an out-of-date _MRtrix3_, but referring to the online documentation (which by default refers to the most up-to-date code version), you will encounter issues due to the changes that have been made to the command-line interface to the script. For instance: If you run: “`dwipreproc -help`”, and compare that information with the [online documentation](http://mrtrix.readthedocs.io/en/latest/reference/scripts/dwipreproc.html#dwipreproc), you should see noticeable differences in the example usage and the available command-line options. This also means that the new dedicated `dwipreproc` [tutorial page](http://mrtrix.readthedocs.io/en/latest/dwi_preprocessing/dwipreproc.html) - which is designed specifically to highlight the changes from previous _MRtrix3_ versions to the `3.0_RC1` update - will not be applicable for your code version.

If you are able to update your _MRtrix3_ installation (it’s [really easy](https://github.com/MRtrix3/mrtrix3#keeping-mrtrix3-up-to-date)), that will most likely sort out the confusion. If however you are restricted to using the existing installation, it will be necessary to rely on the command / script help pages, and/or the documentation that corresponds to the version that you are using (e.g. [here](http://mrtrix.readthedocs.io/en/0.3.15/) is the documentation for version 0.3.15).

Rob

---

<div class="post-metadata">

### Author: ![Max\_Wichmann](https://community.mrtrix.org/letter_avatar_proxy/v4/letter/m/ecd19e/32.png) [@Max\_Wichmann](https://community.mrtrix.org/u/Max_Wichmann)
#### Post date: [June 21, 2017, 10:44am UTC](https://community.mrtrix.org/t/error-with-dwipreproc/982/6 "2017-06-21T10:44:12Z")

</div>

> [@rsmith](#):
>
> 3.0\_RC1

Thank you so much! I will try to update.

Thank you both

Cheers  
Max

---

<div class="post-metadata">

### Author: ![Yixin\_Ma](https://community.mrtrix.org/user_avatar/community.mrtrix.org/yixin_ma/32/2696_2.png) [@Yixin\_Ma](https://community.mrtrix.org/u/Yixin_Ma)
#### Post date: [November 18, 2018, 10:08pm UTC](https://community.mrtrix.org/t/error-with-dwipreproc/982/7 "2018-11-18T22:08:58Z")

</div>

Hi,

I’m writing to ask about the dwipreproc the -pe\_dir input. (-pe\_dir is needed if I don’t have the header information in the up to date MRtrix3 version)

dwipreproc -rpe\_none -fslgrad bvecs bvals -export\_grad\_fsl bvecs\_Eddy bvals\_Eddy -pe\_dir j -readout\_time 0.030115 dTI\_denoised.nii DTI\_Eddy.nii -force

I used the notation of i, j an k. (which I think it means 1st, 2nd and 3rd dimension of the volume, am I right?) But it takes forever to run the code. (More than 12 hours, does it mean that I miss some parameters and make it unable to converge?)

Thanks a lot for your help. Sincerely,

Yixin

---

<div class="post-metadata">

### Author: ![jdtournier](https://community.mrtrix.org/user_avatar/community.mrtrix.org/jdtournier/32/2594_2.png) [@jdtournier](https://community.mrtrix.org/u/jdtournier)
#### Post date: [November 20, 2018, 4:43pm UTC](https://community.mrtrix.org/t/error-with-dwipreproc/982/8 "2018-11-20T16:43:18Z")

</div>

> [@Yixin\_Ma](#):
>
> But it takes forever to run the code. (More than 12 hours, does it mean that I miss some parameters and make it unable to converge?)

This might be due to there being lots of _b_=0 images, which `topup` takes ages to process – see [this recent thread](https://community.mrtrix.org/t/dwipreproc-topup-with-many-b0-up-down-reverse-phase-pairs/2047) on this issue.
