Fourier mellin image registration for medical images of brain tumor
6 次查看(过去 30 天)
显示 更早的评论
i am having mri brain tumor image and i want to apply fourier mellin registration on it. anyone have code for this?
0 个评论
回答(1 个)
Umeshraja
2024-9-17
编辑:Umeshraja
2024-9-21
I've found a useful resource for image registration using the Fourier-Mellin Transform:
Below is a demonstration on how to use the 'RegisterFourierMellin' function mentioned in the above link for registering two Brain MRI images.
close all;
% Changes made in Register.m file
% Change 1: Changed the Image used for Analysis
load mri
% The MRI data is stored in a 3D array called 'D'
% Extract the image data from the structure
mriImage = squeeze(D);
% Extract the first slice of the MRI image
Brainmri = mriImage(:,:,1);
I1 = im2single(Brainmri);
[h, w] = size(I1);
h2 = floor(h/2);
w2 = floor(w/2);
% Create a second, rotated/scaled/translated image
It = zeros(size(I1), 'single');
% Change 2: Portion of the image extracted was changed
It(10:60, 50:100) = I1(10:60, 50:100); % Crop and translation
Ir = imrotate(It, -20, 'bicubic', 'crop'); % Rotation
Is = imresize(Ir, 0.9); % Scale
I2 = zeros(size(I1), 'single');
[hs, ws] = size(Is);
hs2 = floor(hs/2);
ws2 = floor(ws/2);
I2(h2-hs2+1:h2+hs-hs2, w2-ws2+1:w2+ws-ws2) = Is; % Ensure scaling is applied relative to the image center
% Registration with Fourier-Mellin
[Theta, Scale, Tx, Ty] = RegisterFourierMellin(I1, I2);
% Transformation matrix (rotation, translation and scaling)
T = [ 1 0 -Tx;
0 1 -Ty;
0 0 1 ];
Thrad = Theta * pi / 180;
R = [ cos(Thrad) -sin(Thrad) 0;
sin(Thrad) cos(Thrad) 0;
0 0 1 ];
S = [Scale 0 0;
0 Scale 0;
0 0 1 ];
A = T * R * S;
% Fill-in pixel coordinates for interp2
% Rotation/scale is relative to the image center
[y, x] = ndgrid(-h2:h-h2-1, -w2:w-w2-1);
xx = (x + A(1,3)) .* A(1,1) + (y + A(2,3)) .* A(2,1);
yy = (x + A(1,3)) .* A(1,2) + (y + A(2,3)) .* A(2,2);
% Align I2 to I1
Ireg = interp2(I2, xx + w2 + 1, yy + h2 + 1);
% Change 3: Plot in different section
% Plot Figures
figure;
subplot(1, 3, 1);
imshow(I1, []);
title('Original Image (I_1)');
subplot(1, 3, 2);
imshow(I2, []);
title('Transformed Image (I_2)');
subplot(1, 3, 3);
imshow(Ireg + I1 / 4, []); % visually compare and overlay the registered image Ireg with the original image I1
title('Registered Image (I_{reg})');
For a comprehensive understanding of the Fourier-Mellin transform-based image registration method, please refer to the research paper by B. S. Reddy and B. N. Chatterji, titled "An FFT-based Technique for Translation, Rotation, and Scale-Invariant Image Registration."
Hope it helps!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!