next up previous contents
Next: Basic EMMA MATLAB Functions Up: EMMA: Extensible MATLAB Medical Previous: Introduction

Basic Concepts

To a programmer, the interface to EMMA should be very familiar. Simply open a data set contained in a MINC file by calling the openimage function. This returns a handle which is used in all subsequent calls to EMMA functions. The user does not need to worry about the underlying mechanisms. For example, to open an image file, read in the the first frame of the second slice, and then close the image file, you could type:

     data_handle = openimage ('arnaud_20547.mnc');
     image = getimages (data_handle, 2, 1); 
     closeimage (data_handle);

In this example, data_handle is a handle to the data contained in the MINC file arnaud_20547.mnc. After the data file has been opened with openimage, the name of the MINC file is not needed by the user of EMMA; only the handle for the data is used. Therefore, getimages is passed the handle for the data, as well as the slice number and frame number. Once you have finished working with the image, always remember to call closeimage. This cleans up global variables created in the MATLAB workspace.

Because EMMA uses handles, the user never needs to worry about the interface between MATLAB and the MINC file. You simply call EMMA functions with the handle, and the underlying structure takes care of the details.

However, the user does need to have some familiarity with MATLAB, and a good understanding of how EMMA functions deal with images. In particular, the inherent two-dimensionality of MATLAB means that a full four-dimensional MINC file is ``flattened'' in some way when read into MATLAB.

Generally, EMMA functions deal with images transformed from their natural two-dimensional form (well-suited to a matrix representation) to a one-dimensional vector form. For example, a single 128 $\times$128 image will become a column vector of dimension 16384 $\times$ 1. We can put several such vectors together in a matrix. For example, we can form a 16384 $\times$ 15 matrix from 15 slices. Thus, in an ``image matrix''--which is a two-dimensional MATLAB matrix representing three-dimensional image data--the individual columns correspond to whole images. MATLAB functions that use EMMA to perform analysis should always expect image data in this format, as shown in Section 4 and the document ``rCBF Analysis Using MATLAB.''

Also, keep in mind that EMMA makes it deliberately difficult to deal simultaneously with the full four dimensions allowed in a MINC image variable. The reasoning for this is two-fold: first, collapsing three dimensions into two via the ``image matrix'' concept is fairly convenient and easy to work with; however, attempting to similarly collapse four dimensions would add another layer of complications, making both the implementation and use of EMMA functions more difficult. Second is the question of memory usage: MATLAB is capable of using up enormous amounts of memory if care is not taken, and restricting the user of EMMA to three image dimensions at a time means that it is somewhat more difficult to blindly read in massive amounts of image data with a single MATLAB command.


next up previous contents
Next: Basic EMMA MATLAB Functions Up: EMMA: Extensible MATLAB Medical Previous: Introduction
Mark Wolforth <wolforth@bic.mni.mcgill.ca>
Greg Ward <greg@bic.mni.mcgill.ca>
Sean Marrett <sean@bic.mni.mcgill.ca>