by Matthew J. Hoptman, PhD (with additions by David P. Lewis, PhD)
MEDx is UNIX-based software designed for the processing and analysis of MR images. A licensed copy of MEDx is available at the CABI, on the workstation kryten. Technical questions/problems regarding MEDx should be addressed to Babak Ardekani.
A distinct advantage of MEDx over other image analysis programs is that it allows the viewing of three orthogonal image planes simultaneously. This allows the user to use data in one plane to inform decisions about tracings made in another plane. This is accomplished by toggling the display from the "lightbox" mode to the "orthogonal" mode under the Display menu. In addition, MEDx allows for reslicing of image sets in any orthogonal plane. This is accomplished by opening a set of images, creating a volume from them, and then reslicing that volume as desired. Reslicing can be done only in the orthogonal viewer.
MEDx has a hierarchical structure such that data are stored in "pages" within "folders." The pages and folders can contain any kind of information. At present, I am using the folders to store data from an entire study, and pages to store data from individual cases within that study. Alternatively, each case can have its own folder, with each page of the folder representing a sequence. Individual pages can be opened using the Page Manager (Page-->Page Manager).
1. Login to a workstation that has a MEDx license (currently just kryten in the Image Analysis Lab).
2. Open a terminal window
3. At the Linux/UNIX prompt, type "medx".
4. Accept the licensing agreement stating that the software is not designed for clinical use. You are now in MEDx and will see a MEDx menu bar.
If you are on a computer without a MEDx license, you can login remotely to a computer with a license and run it from there. First you will need to give the remote computer permission to display on the local computer. Then you can log in remotely with telnet or ssh and then run MEDx. If you use ssh, you will also need to set the DISPLAY variable on the remote computer so that MEDx will display on the local computer. (For most X Windows programs, ssh will set the DISPLAY variable; however, MEDx has a bug that makes this step necessary when you use ssh.)
For example, if you are logged into trillian and want to run MEDx on kryten, you can type
xhost kryten
telnet kryten
(input your username and password)
medx
or
xhost kryten
ssh kryten
(input your password)
export DISPLAY=trillian:0.0
medx
With the recent update of most of our Linux workstations to SuSE Linux 9.0, the following seems to work best:
ssh kryten
(input your username and password)
medx
Some users have run into problems that appear to be related to multiple instances of MEDx running simultaneously on one computer. For example, a user might login remotely to kryten and run MEDx while another user is running MEDx locally on kryten, and some users think it may cause problems. We suggest that before you run MEDx you see if someone else is running it; if so you can try it on the other licensed computer or run it later if possible. However, users often run MEDx simultaneously with no problems.
To see if someone else is running MEDx, type (on kryten)
ps -ef | grep medx | grep -v grep
This takes the list of all processes ("ps ef") and searches for the process containing the string "medx". (It will ignore any process containing the string "grep", which might otherwise show up since "grep medx" is itself a process.) It will list any MEDx processes running. If no MEDx process are running it will not print anything.
To create a folder, choose File --> New Folder on the MEDx menu bar and name a folder. When you do this, a new window (the "folder" window) will open. Images can be loaded into this folder by selecting Image--> Open Image on the folder menu bar, going to an appropriate image directory, and selecting the slice(s) that you wish to view. At this point, you can compose a volume from these image files (see below). When you compose the volume, you will be in the lightbox mode by default.
MEDx reads in images in exactly the order they appear in the directory. Thus, when images are listed as xxx69.ima, xxx7.ima, xxx70.ima, xx71.ima, . . ., the resulting volume will have a discontinuity in it. MEDx handles this problem through its TCL scripting language. To access this feature, choose File-->Execute script. In the list box, select RenameSiemens.tcl (for Siemens images) and then click on Apply. You will be asked for the file directory in which the scans are located. After you select the directory and click OK, the files will be renumbered to prevent this discontinuity. The files are renamed irreversibly, so if the original file names are important to you, back them up. After this step, you can read in the image files.
By default, MEDx automatically detects the format of the images you are reading in (Auto Detect option). However, if you use the Auto Detect option of the Format dialog box, the images will not necessarily come into MEDx in the proper 3D orientation. It is possible, for instance, that after creating a volume, you may find that the image in the sagittal window of the Orthogonal Viewer will be a coronal section lying on its side!
You can also import the files in their native format as a volume. This can be done by selecting the appropriate format option in the Format dialog box and then selecting the desired files. If you do this, your files will come out as a volume. You may have to do some reorienting even in this case. If you wish, you can read the files into multiple volumes by changing the value in the Options dialog box.
To open an existing folder, choose File -->Open Folder on the MEDx toolbar, locate the folder (directory), and open it normally. By default, you will be in the last Page you were viewing. The folder can be named using Folder-->Folder Properties. It is probably best to select the "Save Pages Locally" button if you wish to keep track of where your pages/images are.
Brightness and Contrast can be adjusted using "dials" that are located on the Folder menu bar. Click and drag each of the dials to change the brightness and contrast. The Folder menu bar also allows you to do fixed or variable zooms. On the Variable Zoom button, you can select "Bilinear" or "Nearest Neighbor" interpolation. The former gives a smoother view, the latter appears more pixelated. If this is done in the lightbox, the image set will revert to the first (most anterior) image in the set.
The left mouse button is used to select menus, image windows, etc. The middle button is used to move an image around within an image window. The right mouse button is used to relocate the crosshairs on an image. This last feature is particularly useful when you wish to view a location in the three orthogonal planes simultaneously. A RED border will surround the currently selected slice or image window. A BLUE border will surround the previously selected slice or image window.
To go to the orthogonal view, select Display-->Orthogonal from the folder menu bar. The image set can then be converted to a volume by clicking the Toolbox icon on the folder menu bar. It is probably best to click on the Toolbox bar and drag it to the side. You'll need it.
From the Toolbox, a volume can be composed by selecting Conversion--> Compose Volume. You will then be asked whether you wish to compose a volume. Select OK to proceed. Following this step, you can name the graphics page for that case by selecting Page-->Page Properties and naming the page as desired. Generally, the name should indicate the case number and orientation of the image.
As noted above, images that are not loaded in their native format will probably have to be oriented appropriately in all three dimensions. This is accomplished in the orthogonal viewer by pairs of clicks on the "S", "I", "A", "P", "L", and "R" buttons that surround each window in the orthogonal viewer. Thus, to invert the image, click on the "S" and then the "I" button. This will switch the volume along the Superior-Inferior axis. After each operation, a dialog box will ask you to verify the orientation of the image (if it is pulled in without a native format). Similar operations can be used to be used to "rotate" the image within a window (for instance, by clicking the "S" and then the "R" buttons). Be warned that the "L" and "R" labels on the windows only indicate that MEDx assumes that your images will be in radiological orientation (Left on the image is right on the viewer, and vice versa). Be sure to verify that what is indicated as left on the MEDx screen corresponds to true left. MEDx will prompt you for this verification.
After a volume has been created, it can be resliced by selecting Image-->Orthoslice-->(slice plane). This operation will probably take a few minutes to complete. Once the desired orientation has been achieved, 2D or 3D graphics can be drawn.
The toolbox bar can be toggled between 2D to 3D mode by clicking on the Dimensionality button (there is an identical button on the Folder menu bar). A different set of tools is available for the two dimensionalities, so be sure that you are in the right mode before drawing. Following this step, drawings can be made in either lightbox or orthogonal modes.
1. If necessary, position the image at the desired location within the image window using the middle mouse button.
2. Use the zoom buttons on the Folder menu bar to achieve the desired magnification.
3. Select the Pencil tool from the 2D palette. You can lock this tool as your default by clicking the "Lock Graphics Tool" button on the toolbox bar.
4. Draw the graphic you wish to make by left clicking the mouse and dragging around the region you wish to outline. For example, if you wish to use the pencil tool (2D graphics mode only), click on the pencil icon on the Toolbox, click in the appropriate image window, and draw by clicking the left mouse button and dragging the mouse around the region to be traced. When you release the button, a yellow box that has "handles" on it will surround the image. The next most recently drawn graphic will be surrounded by a blue box. The box around the graphic will disappear if you left click elsewhere in the image window.
5. [OPTIONAL] Name the graphic either by 1) selecting Measurement-->ROI Template Utility from the Toolbox menu bar and then Saving the graphic in an ROI template file, or by 2) selecting Graphic-->Graphics Properties on the Folder menu bar and providing a name for the graphic. A useful convention is to include "case" + case number + structure + side + slice + rater. Thus, the left amygdala on slice 145 of case 1 as drawn by rater 1 might be designated "case01_amygl135_01". If you do not name the graphic, it will be given a generic name (e.g., Polygon, Polygon.1, Polygon.2, . . .)
6. You can move from graphic to graphic by selecting Graphic-->Graphics Manager, selecting the graphic of image, and selecting the Go To Graphic button.
Other 2D graphic types include Box, Ellipse, etc.
1. Select the graphic you wish to measure by left clicking on it with the selection tool (arrow) from the Toolbox menu bar.
2. Select Measurement from the Toolbox menu bar. Clicking on the desired statistics from the right side window and then click the left-facing arrow to move those statistics into the left side window.
3. Click OK to get the measurements of interest. As you will see, you can select an output file to contain these measurements.
1. Go to the lightbox mode (Display-->Lightbox)
2. Select the 3D Toolbox mode
3. Select the Bitmap tool on the Toolbox menu bar
4. Draw a box around the image to be "bitmapped" using the left mouse button.
5. Release the mouse button, select Graphics-->Graphics properties and name the graphic. A useful convention might be to include case number, the letter "b" to indicate bitmap, the orientation, the slice number, and the rater number. Thus, the bitmap drawn by rater 1 on the sagittal view of slice 134 of case 1 might be named "case01_bsag134_01". At this point, you can also change the properties of the bitmap to make the dimensions of the cursor 1 pixel X 1 pixel and to vary the number of slices that the bitmap comprises.
6. Trace the bitmap using the left mouse button.
7. Go to the orthogonal view using Display-->Orthogonal. This will allow you to draw 2D graphics in the other planes.
8. Select 2D mode on the Toolbox menu bar, and draw a 2D graphic in the desired plane.
9. Obtain measurements and name graphic as desired.
3-D bitmaps can be very useful. They will appear as point markings in the other orthogonal planes and can thus be used to delimit the traced boundaries of ROIs.
Window Properties: By default, the properties of the window are to Apply Intensity Parameters, and to Apply Mensuration. An unselected option is to Show Display Pixel. These properties can be selected (or unselected) as follows. Select Display --> Window Properties on the Folder menu bar and click on the box to the left of each item. A yellow highlighted box indicates that the option has been selected.
Page Properties: By default, the properties of the page are to Show Graphics and Show Image. The name of the page can be specified here, as well (see above). To access these options, select Page --> Page Properties on the Folder menu bar.
Orthogonal Window Properties: By default, the properties are to Show Crosshairs and Show Orientation Axes. An option is also available to Show Grid. These options can be selected directly in the orthogonal viewer.
Folder Properties: By default, no name is given to the folder, and the folder is not set to save the Pages locally (i.e., in the same directory as the folder). You will want to save the pages locally and provide a logical name to the folder. This can be done by selecting the Folder-->Folder Properties on the Folder menu bar.
MEDx permits AC-PC, or any other, alignment of scans. To do
this, go into the Orthogonal Viewer, select 3D mode, and then
select the Toolbox. From this, choose Transformation-->Spatial
(3D) . . .
You can then select Interactive Centering and Rotation. This will
result in the appearance of a crosshair in each of the orthogonal
viewer windows. The crosshair can be moved by clicking and
dragging its center with the middle mouse button. Thus, the
crosshair can be located on the superior aspect of the anterior
commissure by iteratively moving it around in the three
orthogonal windows. The "levers" of the crosshair can
be used to tilt the scan so that the AC is aligned with the PC
using the left mouse button. Also use these levers to ensure that
the AC is aligned with the center of the sagittal fissure in both
the coronal and axial views.
The Interactive Centering and Rotation mode can only be done with
"Nearest Neighbor" interpolation. For this
reason, the image quality will be degraded with each change in
orientation. To remedy this situation following the AC-PC
alignment, deselect the Interactive Centering and Rotation
option, select "Subpixel" interpolation. Before
performing the AC-PC alignment, re-enter the X, Y, and Z
coordinates corresponding to the image center (these coordinates
will change when you move the crosshair to the AC during
Interactive Centering and Rotation). If this is not done, the
rotations applied by the Centering and Rotation process can
result in loss of image regions (e.g., at the front and back of
the brain). Then, select Apply. This will result in a
realignment of the volume along the AC-PC line with high image
quality.
1. Select File-->Exit All from the MEDx master menu bar.
2. You will be asked whether you wish to save/discard changes. Select the relevant option. This will exit MEDx and take you back to the Terminal Window.
You can logout from the workstation by right-clicking anywhere on the UNIX screen (aside from the Terminal Window), selecting logout, and following the instructions.
1. MEDx files, etc., can take up a lot of space. At present, we have a 1 GB/user quota for home directories and 5 GB quota for each data volume (i.e., the dv* directories). Be sure to monitor your space usage by entering 'fs listquota' or 'fs lq' at the command prompt. This will tell you how much space in KB you have used. Note that if you get a number like 999,999 for your home directory, you'll need to compress or delete something or you will be unable to login again.
2. If MEDx crashes, you can kill the procedure ("process" in UNIX-speak) you are working on as follows.
a. Open a Terminal Window as described above.
b. Find out which process you are using by typing "ps -ef | grep xc". This will provide you with a list of processes that are currently running, including the "grep" process you just entered. The process numbers will be indicated in the second column of the resulting display. The lowest numbered process is the one that will kill the MEDx session, as all other processes are built upon that one.
c. Kill the MEDx process by typing "kill -9" [process number], but be aware that you will lose any unsaved changes.
3. MEDx can save images in a variety of graphics formats (e.g., .TIFF) so that they can be imported into other graphics packages. Select Image-->Save As.. to perform this operation. Note that by default, .TIFF images are saved as 24-bit graphics, so that both the hardware you are using and the package you wish to read them into must have 24-bit capabilities.
MEDx has many other capabilities including pixel resampling, image segmentation, image filtering, functional MRI analysis, and 3-D surface rendering. An image calculator, located on the Folder menu bar, is reported to be helpful for many of these operations. For more information, consult the MEDx manual and/or other MEDx experts.
| This page was last updated on 12/5/2006. |