CT and MRI images
4 views (last 30 days)
Show older comments
Hello!
I am trying to co-register a CT image to a MRI image. On my way to doing this I have a lot of problems regarding the size of the 3D matrices I have from CT and MR
The CT is 512x275x370 with unknown slice thickness and the MRI image is 354x192x153 with a slice thickness of 2.6 (I think). My thinking is that I should resample the CT image so that it has the same size as the MR image (I have to have an unchanged MR image). Any idea to how that can be done?
Also I need to co-register the images afterwards, but I am thinking that it should be voxel-intesity-based registration wihich is a bit difficult since the intensities are completely different in the two modalities. Any suggestions?
Every little help is greatly appreciated!
0 Comments
Answers (4)
Image Analyst
on 4 Apr 2012
For a 2D image (like a slice of your 3D volume), you can use imresize().
2 Comments
Image Analyst
on 4 Apr 2012
Oh really? Then what happened here, where it appears to do just that:
% Script to enlarge an RGB image by 2 vertically and reduce it by 1.3 horizontally
clc; % Clear the command window.
workspace; % Make sure the workspace panel is showing.
fontSize = 20;
% Read in a standard MATLAB color demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
baseFileName = 'peppers.png';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
rgbImage = imread(fullFileName);
% Get the dimensions of the image. numberOfColorBands should be = 3.
[rows columns numberOfColorBands] = size(rgbImage);
% Display the original color image.
subplot(1, 2, 1);
imshow(rgbImage, []);
axis on;
title('Original Color Image', 'FontSize', fontSize);
% Enlarge image.
newRows = int32(rows * 2)
newCols = int32(columns / 1.3)
bigImage = imresize(rgbImage, [newRows newCols]);
% Display the original color image.
subplot(1, 2, 2);
imshow(bigImage, []);
axis on;
title('Larger Color Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
Image Analyst
on 3 Apr 2012
It's not easy, certainly not where someone can post code here to do it. There are a variety of methods and dozens or hundreds of papers on it. Start your research here: http://iris.usc.edu/Vision-Notes/bibliography/contentsmatch-pl.html#Registration,%20Matching%20and%20Recognition%20Using%20Points,%20Lines,%20Regions,%20Areas,%20Surfaces
Maybe you can find a good review paper there that compares different methods.
0 Comments
Ashish Uthama
on 4 Apr 2012
This is not a full answer, but a rough guide to how you could perform anisotropic resampling of your CT image. (Posting as an answer so that the code is readable)
You might have to look at the doc pages for the various functions used to get a better idea of whats going on. Once you do that, if you have more concerns, do post in a new question.
% IMPORTANT: assume both volumes represent the same physical space.
% synthetic data
ct = repmat(rgb2gray(imread('peppers.png')),[ 1 1 20]);
mr = repmat(imread('cameraman.tif'),[1 1 10]);
% Create an affine transform which captures the scale difference in each
% dimension.
yScale = size(mr,1)/size(ct,1);
xScale = size(mr,2)/size(ct,2);
zScale = size(mr,3)/size(ct,3);
t = [ yScale 0 0 0
0 xScale 0 0
0 0 zScale 0
0 0 0 1];
tform = maketform('affine',t);
% Resample ct image
R = makeresampler('linear', 'fill');
TDIMS_A = [1 2 3];
TDIMS_B = [1 2 3];
TSIZE_B = size(mr);
TMAP_B = [];
F = 0;
ct_r = tformarray(ct, tform, R, TDIMS_A, TDIMS_B, TSIZE_B, TMAP_B, F);
%%sanity check
figure(1);
for ind=1:size(mr,3)
disp(ind);
% Should have the same extents and the full original content ought to
% be visible.
subplot(1,2,1); imagesc(mr(:,:,ind)); axis image; title('MR');
subplot(1,2,2); imagesc(ct_r(:,:,ind)); axis image; title('CT original');
disp('Press any key');
pause
%pause(0.1);
end
0 Comments
See Also
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!