Hi everyone!
I generated a peaks.nii.gz
file using sh2peaks
. Then, I calculated the amplitude of the first peak using the following MRtrix command:mrconvert peaks.nii.gz -coord 3 0:2 - | mrmath - rms -axis 3 peak1_amplitude.nii.gz
Next, I tried to extract this amplitude value at specific voxel coordinates in Python using nibabel:
dir = ‘113619’
img = nib.load(f’/home/gyx/sata/TUTR_res/{dir}/data/peak1_amplitude.nii.gz’)
data = img.get_fdata()
value = data[60, 90, 74]
After that, I tried to calculate the amplitude manually by loading the original peaks.nii.gz
file and computing the norm of the first three components at the same voxel:
img = nib.load(f’/home/gyx/sata/TUTR_res/{dir}/data/peaks.nii.gz’)
data = img.get_fdata()
vec = data[60, 90, 74, :]
peak1 = vec[0:3]
norm = np.linalg.norm(peak1)
However, the value I get from the manual norm calculation is completely different from the value extracted from peak1_amplitude.nii.gz
What caused this problem?
Thank you a lot for your help,
Best regards