mrttransform not work before concatinete two dwi series

Dear expert
I’m new for mrtrix. Sorry for my biginner’question.
I’ve two separate dwi series, which are only scan polarity is inverted (AP and PA) for TOPUP, to concatenate.
dwi PA is acquired using FOV rotated comparing with dwi AP (caused by some technical error at console setting). mview shows leftward rotated dwi PA.mif.
dwifslpreproc was nicely run, and TOPUP correct susceptibility artifact despite this position error.

There is dwiAP_den_unr_preproc.mif(strait) and dwiPA_den_unr_preproc.mif (rotated).

I tried commands below.

dwiextract dwiAP_den_unr_preproc.mif --bzero | mrmath – mean_dwiAP_den_unr_preproc_b0.mif -axis 3

dwiextract dwiPA_den_unr_preproc.mif --bzero | mrmath – mean_dwiPA_den_unr_preproc_b0.mif -axis 3

flirt -in mean_dwiPA_den_unr_preproc_b0.mif -ref mean_dwiAP_den_unr_preproc_b0.mif -out r_mean_dwiPA_den_unr_preproc_b0.mif -omat AP2PA.mat

transformconvert AP2PA.mat mean_dwiPA_den_unr_preproc_b0.mif mean_dwiAP_den_unr_preproc_b0.mif flirt_import AP2PA_mrtrix.txt

mrtransport dwiPA_den_unr_preproc.mif -linear AP2PA_mrtrix.txt r_ dwiPA_den_unr_preproc.mif

mrtransport works without error. But r_dwiPA_den_unr_preproc.mif is still rotated despite well posisioned r_mean_dwiPA_den_unr_preproc_b0.mif…

How can I corregister dwiAP.mif and dwiPA.mif?

I appreciate any kind of advice.
Scenery

Masaki

mriinfo of
dwi_denAP_unr_preproc_unbiased_b0.mif
dwi_denPA_unr_preproc_unbiased_b0.mif
r_dwi_denPA_unr_preproc_unbiased_b0.mif
r_dwi_denPA_unr_preproc_unbiased.mif
are attached bilow


Image name: “NODDI_denAP_unr_preproc_unbiased_b0.mif”


Dimensions: 116 x 116 x 78
Voxel size: 1.93103 x 1.93103 x 1.9
Data strides: [ -1 2 -3 ]
Format: MRtrix
Data type: 32 bit float (little endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 0.9946 0.08579 -0.05803 -117.1
-0.08986 0.9934 -0.07151 -104.8
0.05151 0.07634 0.9958 -76.86
command_history: mrconvert NODDI_AP/NODDI_AP.nii NODDI_AP.mif -fslgrad NODDI_AP/NODDI_AP.bvec NODDI_AP/NODDI_AP.bval -datatype float32 (version=3.0.2)
[7 entries] dwidenoise NODDI_AP.mif NODDI_AP_den.mif -noise NODDI_AP_noise.mif -nthreads 8 (version=3.0.2)

dwiextract NODDI_denAP_unr_preproc_unbiased.mif - -bzero (version=3.0.2)
mrmath - mean NODDI_denAP_unr_preproc_unbiased_b0.mif -axis 3 (version=3.0.2)
comments: TE=95;sec=61397.8675;phaseDir=+;dwell=0.375
mrtrix_version: 3.0.2
prior_dw_scheme: 0,0,0,0
[8 entries] 0,0,0,0

0,0,0,0
0,0,0,0
prior_pe_scheme: 0.0,-1.0,0.0,0.032
[68 entries] 0.0,-1.0,0.0,0.032

0.0,-1.0,0.0,0.032
0.0,-1.0,0.0,0.032


Image name: “NODDI_denPA_unr_preproc_unbiased_b0.mif”


Dimensions: 116 x 116 x 78
Voxel size: 1.93103 x 1.93103 x 1.9
Data strides: [ -1 2 -3 ]
Format: MRtrix
Data type: 32 bit float (little endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 0.9946 -0.08579 -0.05803 -98.21
0.08158 0.9941 -0.07151 -123.7
0.06382 0.06639 0.9958 -77.12
command_history: mrconvert NODDI_PA/NODDI_PA.nii NODDI_PA.mif -fslgrad NODDI_PA/NODDI_PA.bvec NODDI_PA/NODDI_PA.bval -datatype float32 (version=3.0.2)
[7 entries] dwidenoise NODDI_PA.mif NODDI_PA_den.mif -noise NODDI_PA_noise.mif -nthreads 8 (version=3.0.2)

dwiextract NODDI_denPA_unr_preproc_unbiased.mif - -bzero (version=3.0.2)
mrmath - mean NODDI_denPA_unr_preproc_unbiased_b0.mif -axis 3 (version=3.0.2)
comments: TE=95;sec=61687.5975;phaseDir=-;dwell=0.375
mrtrix_version: 3.0.2
prior_dw_scheme: -0,0,0,0
[9 entries] 0,0,0,0

-0,0,0,0
0,0,0,0
prior_pe_scheme: 0.0,1.0,0.0,0.032
[69 entries] 0.0,1.0,0.0,0.032

0.0,1.0,0.0,0.032
0.0,1.0,0.0,0.032


Image name: “r_NODDI_denPA_unr_preproc_unbiased_b0.nii.gz”


Dimensions: 116 x 116 x 78
Voxel size: 1.93103 x 1.93103 x 1.9
Data strides: [ -1 2 -3 ]
Format: NIfTI-1.1 (GZip compressed)
Data type: 32 bit float (little endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 0.9946 0.08579 -0.05803 -117.1
-0.08986 0.9934 -0.07151 -104.8
0.05151 0.07634 0.9958 -76.86
comments: 6.0.4:ddd0a010


Image name: “r_NODDI_denPA_unr_preproc_unbiased.mif”


Dimensions: 116 x 116 x 78 x 69
Voxel size: 1.93103 x 1.93103 x 1.9 x 3.7
Data strides: [ -1 2 -3 4 ]
Format: MRtrix
Data type: 32 bit float (little endian)
Intensity scaling: offset = 0, multiplier = 1
Transform: 0.9942 -0.08963 -0.05909 -97.81
0.08572 0.9942 -0.06567 -124.2
0.06463 0.06022 0.9961 -76.89
command_history: mrconvert NODDI_PA/NODDI_PA.nii NODDI_PA.mif -fslgrad NODDI_PA/NODDI_PA.bvec NODDI_PA/NODDI_PA.bval -datatype float32 (version=3.0.2)
[6 entries] dwidenoise NODDI_PA.mif NODDI_PA_den.mif -noise NODDI_PA_noise.mif -nthreads 8 (version=3.0.2)

/home/masaki/miniconda3/bin/dwibiascorrect ants NODDI_denPA_unr_preproc.mif NODDI_denPA_unr_preproc_unbiased.mif -bias NODDI_PA_bias.mif (version=3.0.2)
mrtransform NODDI_denPA_unr_preproc_unbiased.mif -linear AP2PA_mrtrix.txt r_NODDI_denPA_unr_preproc_unbiased.mif -inverse -force (version=3.0.2)
comments: TE=95;sec=61687.5975;phaseDir=-;dwell=0.375
transform modified
dw_scheme: -0,0,0,0
[69 entries] 0.9718375813,-0.185413392,0.1454432761,700

0.6760369552,-0.6177393531,-0.4017116368,2000
0,0,0,0
mrtrix_version: 3.0.2
prior_pe_scheme: 0.0,1.0,0.0,0.032
[69 entries] 0.0,1.0,0.0,0.032

0.0,1.0,0.0,0.032
0.0,1.0,0.0,0.032

Without having checked in too much detail (your commands posted do not appear to be exactly what you ran: mrtransport should be mrtransform, flirt does not work with .mif images), I’d suspect the transformation worked but mrview shows you the rotated image.

Do the images look aligned when one is shown as an overlay? mrview mean_dwiAP_den_unr_preproc_b0.mif -overlay.load r_dwiPA_den_unr_preproc.mif -overlay.opacity 0.3 If so, everything is aligned in scanner space. Note, you can but don’t need to resample one image onto the grid of the other via mrtransform 's-template` option.

If the overlay is not aligned with the main image, please check that the transformed moving image produced by flirt is aligned with the target image and double-check that the commands including and after the flirt call are what you ran and we’ll have another look.