Hi everyone, I hope you are all doing well!
I am going to try and keep this as short as possible, but I want to include as much relevant detail as I can so people know where I am at. I am using the ADNI1 dataset and I want to apply registration using FSL Flirt. But I seem to be getting poor performance.
Back story, I am (very) new to this field/area, I am in my final year of college studying software development and my final year project is building model[s] to classify MRI images.
In my report about the project I wanted to show the performance of the registration using a sample of images to show as much detail as to what I am doing to the images etc. But in doing so I find my performance is not good. This could be down to poor implementation by myself in terms of registration metrics or something else?
The metrics I have selected are from research I have done online, the code implementation of these I will also attach for your convenience:
-
Mean squared error
-
Normalized Cross-Correlation value
-
skimage structural_similarity
-
skimage normalized_mutual_information
I was thinking on also using a histogram of intensity differences between the registered image and the reference image to give a visual graph metric.
The process I am using to register the images are as follows, I use fslreorient2std to reorient the ADNI1 images into FSL’s standard orientation.
fslreorient2std input_image.nii reoriented_image.nii
Next I use FSL Flirt for registration, also using FSL’s reference image “MNI152_T1_1mm.nii”
flirt -in reoriented_image.nii -ref MNI152_T1_1mm.nii -out reoriented__registered_image.nii
I have also played around with different cost functions and also dof paramaters such as 3, 6, 12.
Checking the performance of the registered image, the metrics are as follows: “{‘MSE’: 0.0560, ‘NCC’: 0.723, ‘SSIM’: 0.223, ‘NMI’: 1.104, ‘raw_NMI’: 0.104}”
below is the function for my metrics:
import nibabel as nib
from skimage.metrics import structural_similarity as ssim
from skimage.metrics import normalized_mutual_information as nmi
def calculate_metrics(moving_image_path, reference_image_path):
# Load NIfTI images
moving_img = nib.load(moving_image_path).get_fdata()
ref_img = nib.load(reference_image_path).get_fdata()
# Normalize images
moving_img = (moving_img - np.min(moving_img)) / (np.max(moving_img) - np.min(moving_img))
ref_img = (ref_img - np.min(ref_img)) / (np.max(ref_img) - np.min(ref_img))
# Compute metrics
mse_value = np.mean((moving_img - ref_img) ** 2)
ncc_value = np.corrcoef(moving_img.flatten(), ref_img.flatten())[0, 1]
ssim_value = ssim(moving_img, ref_img, data_range=1)
nmi_value = nmi(moving_img, ref_img)
raw_nmi = (nmi(moving_img, ref_img) - 1.0) / 1.0
return {
"MSE": mse_value,
"NCC": ncc_value,
"SSIM": ssim_value,
"NMI": nmi_value,
"raw_NMI": raw_nmi
}
Something I also want to note that could be relevant.
Using fslhd on the reference image the qform and sform orientation is
Right-to-Left
Posterior-to-Anterior
Inferior-to-Superior
But when using the fslreorient2std command to reorient the images the qform values are
Left-to-Right
Posterior-to-Anterior
Inferior-to-Superior
While the sform values are unknown.
Would this cause issues in the registration process?
Apologies if this post was longer than it needed to be, it’s just, I’ve been struggling to wrap my head around all of this and all I want to do is to correctly and accuracy register my dataset and show the performance of the registration on a sample set of images to make my report more comprehensive.
FSL version: 6.0.7.13
I really really appreciate anyone even willing to read my post, my dearest gratitude in willing to help!
Kind regards,
Josh.