# Mrregister ,number of volumes error

#1

Dear Mrtrix Community!

I have some problem in my analysing steps. I was registering all the fod images to template(IIT HARDI) using mrregister command. and it returned an error message “input images do not have the same number of volumes in the 4th dimension”
I understand the problem that is the different volume between subject’s and template. but I don’t know how to cope with this problem exactly. please let me know how to do this !
it could be a massive help for me

Jinsu

#2

Hi Jinsu,

The issue is that the FODs represented within these images have different harmonic degrees: `template.mif` has 28 volumes and so has a maximum spherical harmonic degree of 6, whereas `s01/wmfod.mif` has 45 volumes and so has a maximum spherical harmonic degree of 8. While I think it could potentially be made possible in the future for `mrregister` to appropriately handle this situation, it’s clearly currently resulting in an outright error due to a stringent requirement for these two values to match.

To me there are two possible solutions for you:

1. Pad the template image with zeroes, so that it has enough coefficients to represent a maximum spherical harmonic degree of 8 but just doesn’t actually include any information beyond degree 6:
``````# Generate a 3D image matching the template image that consists entirely of zeroes:
mrconvert template.mif - -coord 3 0 | mrcalc - inf -gt template_zerofill.mif
# Pad template image from 28 to 45 volumes, with volumes 0-27 coming from template.mif and volumes 28-44 containing just zeroes:
mrcat template.mif \$(printf "%0.s template_zerofill.mif" {1..17}) template_lmax8.mif -axis 3
``````
1. Crop the subject image to a maximum spherical harmonic degree of 6:
``````mrconvert s01/wmfod.mif s01/wmfod_lmax6.mif -coord 3 0:27
``````

Note that if the WM FODs were generated with a hard non-negativity constraint at lmax=8, and you then discard the l=8 coefficients like this, then the resulting lmax=6 FODs are no longer guaranteed to be strictly non-negative. But this is probably not important in the context of your registration task.

Rob

#3

thanks for your kind response !
I am going to try that way.

Thank you guy!

#4

By default, registration does not use l_max > 4 so there should be no difference between cropping and padding the l=8 coefficients. If the individual images originate from a different acquisition and preprocessing pipeline as the template, you might want to check if their intensity ranges differ.