learningMatlab

imaging-01

In this unit we complete a simple interactive viewer program for displaying 3d (or even 4d) imaging data. Matlab has powerful functions / toolboxes to make this quite straightforward and I hope I’ll be able to show you that in less than 50-100 lines of code you can build a pretty cool little utility. Building the whole thing from scratch takes a bit more than a couple of sessions, so the aim here is to concentrate on a couple of key functions.

Specification for image viewer

The user starts the program from the Matlab command line by typing sliceview(), which then automatically loads in an image from a file in the current folder. By default, the program then opens a figure window, selects a 2d slice half-way through the 3d image in a particular orientation and displays it as a grayscale image (with a color scheme/range that stays fixed) and a colorbar to show how image intensities map to colors.

==============================================
 Press the following buttons to:
up/down change slice
o/O change orientation
c/C change cursor
q/Esc quit
==============================================

Data

The image to be displayed in stored in a MAT file called anatomy.mat in the current folder The MAT file contains two variables:

Picture of image viewer

Helpful commands / concepts

The following information should help tackle the problem:

Future features (things to think about)

Aim

In this unit we complete the sliceview() program so that it can work like the solution I have provided. In order to get this to work, you’ll need to write a function called returnSlice() that does the following:

s = returnSlice(array, sliceNum, orientation)

What are the things to worry about / check to make sure this function is robust and does the right thing?

Notes