image.txt HELP ON IMAGE LOADING I. Main Image Axes II. Sagittal Locator Image III. Coronal/Axial Locator Image IV. Callbacks V. Image File Formats VI. Image Registration and Segmentation: ".otl" files ********************************************************************** I. Main Image Axes The big set of axes in the center of the screen are called the ImageAxes, and the image object displayed on them is called the ImageDisplay. A. Pathname The data for ImageDisplay is loaded from the following file: ROOTDIR////. , the name of the image file, is loaded from the rightmost of the four popup-menus at the bottom center of the mrcat window. To load a new file, you can: 1. select a filename from this popup-menu, or 2. choose "Next Image" or "Last Image" from the "Image" pulldown-menu on the overhead menu-bar. is a directory name which describes the image type. It is expected that this directory name should be the same as the image file extension (i.e. 'tiff' or 'tif' for a directory storing TIFF images), but this need not be the case. This directory can be changed by selecting a new directory from the third filename menu. mrcat also looks for an ".otl" file corresponding to each image in the subdirectory =otl; see section VI. is a directory name which describes the image plane: it is usually 'a' (for axial), 's' (for sagittal), or 'c' (for coronal). This directory can be changed by selecting a new directory from the second filename menu. is a directory name which describes the image series. This directory can be changed by selecting a new directory from the leftmost of the four main popup-menus. ROOTDIR is set when mrcat first opens. It can be changed by changing the global matlab variable ROOTDIR, or by moving to a different directory, and re-starting mrcat; see the file "Help on starting mrcat" (starting.txt). If you want to access properties of one of the four main popup-menus via the command line, you can get a handle by typing (e.g. for ImageFile): h = findobj(gcf, 'Tag', 'ImageFile') B. Brightness You can change the brightness of the main image by clicking the "Bright" and "Dark" buttons on the main button bar, to the right of the image, or by choosing 'Brighten' or 'Darken' from the 'Image' pulldown-menu on the overhead menu-bar. ************************************************************************** II. Sagittal Locator Image A. Pathname The "sagittal locator image" is shown in the upper left corner of the mrcat window. The image file is loaded from //// ROOTDIR is a global matlab variable, as described above. is the same image type as the main image. , , and are analogous to , , and . When mrcat starts, it tries to set to and to 's'; if it fails, it will look for any which has an 's' subdirectory containing images. See the file "Help on starting mrcat" (starting.txt). B. Brightness You can change the brightness of the sagittal locator image by clicking the "Bright" and "Dark" buttons below the image. C. Locator and Zoom Lines A yellow line drawn over the locator image shows the position of the main image. If the main image is zoomed, cyan lines on the locator image show the boundaries of the zoomed main image. All of these lines can be turned off, or turned on again, by clicking the yellow "off" button below the image. The positions of the locator and zoom lines are calculated using registration information which is provided either in the header of a GE 5.x "MR" file, or in the header of the auxiliary ".otl" file -- see section VI. If this information is not available, mrcat will try to guess the positions of these lines, but will usually fail. ***************************************************************************** III. Coronal or Axial Locator Image The lower left image is the "coronal or axial locator image." This image file is loaded from //// The menus and buttons beneath this image are analogous to the menus and buttons beneath the sagittal locator image. ***************************************************************************** IV. Callbacks Most of the callbacks and creation functions associated with the images are located in the function LodImage.m. The syntax of this function is specified in its helpfile; type 'help LodImage' at the command prompt for details. ***************************************************************************** V. Image File Formats mrcat will read any of the image formats readable using the matlab 'imread' function, but the native format of mrcat is the GE 5.x "MR" format. This format stores 16-bit grayscale images using (by default) a lossless DPCM-compression algorithm, which requires a little more than 8 bits per pixel. See the "Medical Image Format FAQ" (ftp://rtfm.mit.edu/alt/image/medical/) for more information on this and other medical image formats. The most useful feature of the GE MR format is that the header includes information about the absolute position of each image slice, in a 3D coordinate system defined relative to the inside of the scanner. mrcat depends on this coordinate information to accurately display Locator and Zoom lines on the locator images. If you are not using an MR file, you will need to specify this information in the header of the ".otl" file for each image; see section VI. If your images come from a GE SIGNA MRI scanner, you can extract MR-format image files from the SIGNA database using the /usr/g/insite/bin/ximg command. A few useful ways to use this command: /usr/g/insite/bin/ximg -h - 'help', print a list of options /usr/g/insite/bin/ximg -g - print out the image format file, imageFileOffsets.h /usr/g/insite/bin/ximg -i E35461S5Iall -s - extract all images in series 5 of exam 35461; do not strip off subject identifiers. Images are extracted to /usr/g/insite/tmp, e.g. /usr/g/insite/tmp/E35461S5I1.MR /usr/g/insite/tmp/E35461S5I2.MR /usr/g/insite/tmp/E35461S5I3.MR .... The function "geread.m" reads the MR header information. Unfortunately, GE changes the header information frequently, so you may have to adjust the order of commands in geread.m. All entries in readge.m correspond to information in the image header imageFileOffsets.h, so if you use GE's ximg utility to print out ImageFileOffsets.h for the scanner you are using, you should be able to quickly spot the important differences between your file format and the one I'm using (see the Medical Image Format FAQ for more information). geread.m is pretty slow, but you can speed it up by compiling the included image decompression subroutine: type >> mex geread_i.c The function "gewrite.m" writes a simple "MR" file. The arguments are an image, an image file name, and a partially specified GE header structure, which may contain nothing other than the "corners" information. Type "help gewrite" for more information. ***************************************************************************** VI. Image Registration and Segmentation: ".otl" files In order to make use of the image registration features of mrcat, you need to tell it the position of each image in an absolute 3D coordinate space. mrcat can read this information from one of two places: - The header of an MR-format image file. - The header of an OTL-format outline file. If your images are already in JPG format, you probably don't want to convert them to MR format -- it's slower, takes more space, and since your images have already been clipped to 8 bits per pixel, you don't win anything by storing them at 16 bits per pixel. Instead, you should create an OTL header with the necessary information, and save it using otlwrite.m. Here are the steps: A. Save Your Work If you've already edited ANY regions of interest in this image, you should load them using the otlread command. First, press 'Save OTL' in the mrcat GUI, if it is open. Then type: >> global ROOTDIR; >> ImageSeries = (put your series name here) >> ImagePlane = (put your plane here) >> ImageFile = (put your image filename here, without the extension) >> [ X, H ] = otlread(sprintf('%s/otl/%s/%s/%s.otl', ROOTDIR, ImageSeries, ImagePlane, ImageFile)); If otlread says "file not found," then you can create it by typing: >> otlwrite( sprintf('%s/otl/%s/%s/%s.otl', ROOTDIR, ImageSeries, ImagePlane, ImageFile), [] ); >> [ X, H ] = otlread(sprintf('%s/otl/%s/%s/%s.otl', ROOTDIR, ImageSeries, ImagePlane, ImageFile)); B. Modify the Header Add a field to the header specifying the thickness of the image slice, e.g. if the image slice thickness is 3mm, type >> H.slice_thickness = 3; Add fields which specify where the image is located in any suitable three-dimensional coordinate space. I prefer GE's RAS coordinate system, in which the first coordinate specifies millimeters right of the origin, the second specifies millimeters anterior to the origin, and the third specifies millimeters superior to the origin. The field names you need to specify are as follows (the example coordinates specify an axial image with a 240x240 mm field of view, with subject's right displayed at the left edge of the image): >> H.top_left_hand_corner = [ 128 189.3 25 ]; >> H.top_right_hand_corner = [ -112 189.3 25 ]; >> H.bottom_right_hand_corner = [ -112 -50.7 25 ]; C. Save the Modified Header, Along With the Original Data >> otlwrite( sprintf('%s/otl/%s/%s/%s.otl', ROOTDIR, ImageSeries, ImagePlane, ImageFile), X, H ); *****************************************************************************