# Dwipreproc - register fieldmap to dwi, other questions

**URL:** https://community.mrtrix.org/t/dwipreproc-register-fieldmap-to-dwi-other-questions/621
**Category:** Uncategorized
**Created:** [December 15, 2016, 9:47pm UTC](https://community.mrtrix.org/t/dwipreproc-register-fieldmap-to-dwi-other-questions/621 "2016-12-15T21:47:40Z")
**Posts on this page:** 4
**Page:** 1

<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: [December 15, 2016, 9:47pm UTC](https://community.mrtrix.org/t/dwipreproc-register-fieldmap-to-dwi-other-questions/621/1 "2016-12-15T21:47:41Z")

</div>

Dear experts,

I would like to discuss several aspect of preprocessing of my dwi data and dwipreproc script internals:

1. 

Some of my DWI data are acquired only at one phase encoding direction. However, I also have 2 additional series of epi B=0 only data acquired at both AP and PA directions. These are with different voxel sizes that main DWI series.

I was thinking to achieve distortion correction by resampling the additional B=0 series to resolution of main DWI and use them with -rpe\_pair option. I was looking to the dwipreproc code how this functionality is implemented and it seems that there is no registration of -rpe\_pair series to main DWI done to correct for possible subject movement.

The user guide of eddy says in context of --field option (but I think that this also applies for this case):

[https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/UsersGuide#A--field](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/eddy/UsersGuide#A--field)

_“If the first volume input to topup is the same as the first volume in --imain to eddy, the fieldmap will automatically be in the reference space of eddy. When using the --field option the user is responsible for making sure the fieldmap is registered to the eddy data.”_

So it seems to me that if the -rpe\_pair option is used, the first volume of the first file of -rpe\_pair has to be identical to the first volume of main DWI, otherwise it would not work correctly in case of subject movement.

Could you please comment on?

1. 

I also tried to do the processing by hand by fullfilling the “identical volume” condition I mentioned in previous paragraph. But this time I am not sure how to correctly use dwidenoise tool in combination with eddy. I can use dwidenoise only for main DWI data, since additional AP-PA B=0 series has to be resampled first (due to different voxel size wrt main dwi) and dwidenoise cannot be used before resampling due to low number of volumes (three for each direction). Therefore, I concatenated resampled B=0 AP and PA series (without dwidenoise) with main DWI (with dwidenoise) to one volume and processed by eddy, together with output of topup done on B=0 AP and PA series. However, I am not sure if it is not the problem for eddy to process data with varying noise level. What do you think?

1. 

In other my data, I also have DWI only at one phase encoding direction. But, this time, I have gradient echo-based fieldmap. Do you plan to incorporate also this type of distortion correction to dwipreproc script?

1. 

In [https://github.com/BIDS-Apps/MRtrix3\_connectome](https://github.com/BIDS-Apps/MRtrix3_connectome) repository I noticed the -rpe\_header and -topup\_images options of dwipreproc script. However, I did not find any of these parameters in current dwipreproc code in mrtrix3 repository. Where they came from and what is their significance?

Regards,

Antonin

---

<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: [December 16, 2016, 3:41am UTC](https://community.mrtrix.org/t/dwipreproc-register-fieldmap-to-dwi-other-questions/621/2 "2016-12-16T03:41:22Z")

</div>

Hi Antonin (and all),

This `dwipreproc` script is going to be the death of me :-/

1. Need to split into two halves:

2. This is probably a question for the FSL forum rather than here. Given variation in noise would only be between _b_=0 volumes, and not between volumes within _b_!=0 shells, I wouldn’t expect the GP predictor to be _biased_, so my intuition is that it should be fine; but don’t trust me.

3. Yes, I would like to add support for this at some point, even though I very much encourage acquisition of reversed-phase-encode images rather than field maps. Partly I want to make the BIDS apps applicable to a wider range of input data, and partly we have a number of historical cohorts that would be nice to process. The re-write of `dwipreproc` in the coming update will in fact simplify implementation of such, and therefore make it more likely to (eventually) happen.

4. These options (well, `-topup_images` has been renamed to `-se_epi`) are only available in the coming updated version of `dwipreproc`. Their functionality, usage, and relationship to existing options, will be explained between the script [help page](http://mrtrix.readthedocs.io/en/tag_0.3.16/reference/scripts/dwipreproc.html) and [new documentation tutorial page](http://mrtrix.readthedocs.io/en/tag_0.3.16/tutorials/dwipreproc.html) (links to previews of the coming updates for anyone interested).

Cheers  
Rob

---

<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: [December 20, 2016, 11:13pm UTC](https://community.mrtrix.org/t/dwipreproc-register-fieldmap-to-dwi-other-questions/621/3 "2016-12-20T23:13:26Z")

</div>

Dear Rob,

I very much appreciate your efforts. I have already also spent many days on this ☹ and more and more vote for acquiring the DWI data as recommended. However, the acquisition is not always in my hands and I have to handle also some older data.

> [@rsmith](#):
>
> therefore eddy would handle any misalignment between the DWI volumes input to eddy, and the topup-corrected image volume relative to which the inhomogeneity field is defined

I think that definitely this is not handled in eddy.  
I have communicated with Jesper Andersson from FSL group and his recommendation in situation where the reverse phase-encoding b=0 data for inhomogeneity field estimation in topup do not originate from the main DWI volume (and possibly are of different geometry) is following:

1. Upsample the additional b0 that was acquired with a blip-direction opposite to the dwi:s to the same resolution as the dwi:s.
2. Create a 4D file containing the first b0 from the dwi and the upsampled additional b0, in that order.
3. Make an acqparams.txt file. Now is is very important to get the readout-times right since they are potentially different for the two volumes.
4. Run topup as usual.
5. Run eddy. The index.txt will be all ones. Don’t include the additional b0.

The prerequisite is that the TE (i.e. T2 contrast between DWI and additional b=0 volumes) does not differ too much.

This assure the field estimated by topup is in register with DWI input to eddy.

Antonin

---

<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: [December 23, 2016, 6:11am UTC](https://community.mrtrix.org/t/dwipreproc-register-fieldmap-to-dwi-other-questions/621/4 "2016-12-23T06:11:52Z")

</div>

OK, thanks for the additional info. I’ll need to think long and hard about how best to deal with this issue in the script, since there’s a lot of different acquisition scenarios to consider.

For now, the main scenario that users should be critical of is cases where you acquire e.g. a _b_=0 image with A\>\>P, a _b_=0 image with P\>\>A, then all of the DWIs with A\>\>P: if there’s substantial subject motion between the first A\>\>P _b_=0 image and the start of the DWIs, the inhomogeneity correction may be wrong. For data not yet processed, if the A\>\>P _b_=0 image has the same TE / voxel grid / bandwidth as the DWIs, it may be preferable to _discard_ this volume, extract the first _b_=0 volume from the DWIs using `mrconvert`, and use _that_ as the first input image to the `-rpe_pair` option.
