I have two NIfTI images that are magnetic field maps (3D) of the same brain obtained from two different pipelines. They are essentially supposed to be identical but they are not. Let’s denote them as ‘ref_img.nii.gz’ and ‘src_img.nii.gz’.
I would like to compare them and find what should be done on the src_img to make it look like the ref_img. I thought I’d first compare the two images and I learned that Nistats has a module called “nistats.reporting.compare_niimgs” that may serve the purpose. However, as I pass the central slices of the two images-- to pass 2D images-- I have not been successful to fix the errors I get as follows:
TypeError: Cannot slice image objects; consider using
img.slicer[slice] to generate a sliced image (see documentation for caveats) or slicing image array data with
As one of the arguments of compare_niimgs, one has to pass a NiftiMasker. I also don’t know how to obtain this masker. Is this masker the same as the brain mask I can obtain for my images simply by finding their nonzero matrix elements of the images data?
Any help is much appreciated.