Hello,
I am trying to compare the position of the 95th percentile of the electric field between different participants.
To do this I convert all the grey matter voxels to MNI space by multiplying the position of all the grey matter voxels by mri2mni, please see the code below:
mappingFile = [dirName fileName '_seg8.mat'];
load(mappingFile,'image','Affine');
mni2mri = inv(image(1).mat)*inv(Affine);
mri2mni = inv(mni2mri);
% Convert grey matter coords to MNI space
greyCoords(4, :) = 1;
for i = 1:size(greyCoords, 2)
mniGreyCoords(:, i) = [greyCoords(:, i)' * mri2mni]';
end"greyCoords" is a 4 x N matrix where N is the number of grey matter voxels. Each row corresponds to the x, y and z positions. The final row is all equal to 1.
However, I am finding that the MNI space voxels are not well aligned between participants, so making comparisons is difficult. The image attached exaggerates the problem as the voxels in red do go much further into the blue brain. In reality, the scans are roughly the same size, but are a cm or two misaligned. Ideally, I would like to convert the results to MNI space, find the 95th percentile of voxels by magnitude and compute the DICE coefficient to see how the electric fields overlap for different participants.

But the overlap is very small, and often 0 because the scans aren't aligned. Do you have any advice on where I might be going wrong?
Thank you!
Kind regards,
Jake