CT and MRI images

6 views (last 30 days)
Julie
Julie on 3 Apr 2012
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!

Answers (4)

Image Analyst
Image Analyst on 4 Apr 2012
For a 2D image (like a slice of your 3D volume), you can use imresize().
  2 Comments
Julie
Julie on 4 Apr 2012
Thanks. This is a great function but it is too simple for what I want. It can only reduce the size of the images equally on the x and y- axis and not for example expand the x axis times 1.3 and reduce the y axus by a factor 2....
Image Analyst
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]);

Sign in to comment.


Image Analyst
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.

Julie
Julie on 3 Apr 2012
Thanks for the answer... But the registration method I think I will have to study more, but what about making the two matrices the same size? Is that possible in MATLAB?
  3 Comments
Sean de Wolski
Sean de Wolski on 3 Apr 2012
look at griddedInterpolant rather than interp3
Julie
Julie on 3 Apr 2012
griddedInterpolant only works for the 2012a version. I have the 2011a - is there something similar in that version?

Sign in to comment.


Ashish Uthama
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

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!