0% found this document useful (0 votes)
153 views

Manual

MRIcroGL is an intuitive viewer for medical images. It supports the windows, OSX or Linux operating systems. It requires a graphics card that supports volume rendering, with the appropriate driver installed.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
153 views

Manual

MRIcroGL is an intuitive viewer for medical images. It supports the windows, OSX or Linux operating systems. It requires a graphics card that supports volume rendering, with the appropriate driver installed.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

MRIcroGL manual

By Chris Rorden Version 4 April 2011

1. Introduction
MRIcroGL is an intuitive viewer for medical images. This free and open source project provides tools for 2D and 3D display of images. The current version of MRIcroGL supports the Windows, OSX or Linux operating systems. However, it requires a graphics card that supports volume rendering, with the appropriate driver installed. Most modern discrete graphics cards from ATI and NVidia are acceptable, while most integrated chipsets from Intel do not support volume rendering. Chris Rorden's MRIcroGL is distributed under the BSD software license. The license is as follows: MRIcroGL, copyright 2009-2011, all rights reserved. Redistribution and use in binary forms, with or without modification, is permitted provided inclusion of the copyright notice, this list of conditions and the following disclaimer is provided with the distribution: Neither the name of the copyright owner nor the name of this project (MRIcroGL) may be used to endorse or promote products derived from this software without specific prior written permission. This software is provided by the copyright holder "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

2. Quick start
Double-click on the MRIcroGL program to launch the application. MRIcroGL can view NIfTI format images (these have the file extensions .hdr, .nii or .nii.gz). To view an image, simply drag-and-drop the image onto the program. There are two primary views for an image: a 3D rendering or 2D slice view (Figure 2.1). To switch between these views, choose Ctrl-G (or choose Render/GotoSlices to go from the rendering view to the slice view, or Slices/GotoRendering to switch from the 2D slice view to the rendering view). Figure 2.1 An example of the ch256 image that is distributed with MRIcroGL. On the left is the rendered view, while the right panel shows the slice views.

MRIcroGL user guide 1 of 15

To interact with the image, simply click and drag the image. In the 2D slice view, clicking will change the position of the slices, while in the rendering view you will change your viewpoint. You can also try selecting items from the menus. For example, when looking at a rendering you can choose whether to view an image in perspective mode (where closer regions appear larger) or not (so that viewing distance does not influence size), you can turn a frame on and off that is useful for reminding yourself of the objects left (red) and right (green) side, and you can turn maximum intensity rendering on or off (see Figure 2.2). Figure 2.2 An example of the chris_MRA image shown in Maximum Intensity mode (MIP, left) and normal mode (right). To switch between these modes, select the Maximum intensity item from the Render menu. In MIP mode, we always see the brightest object, regardless of depth, while the standard mode uses the selected image transparency (see next section) such that the surface is seen as opaque.

3. Adjusting color and transparency


Typical MRI scans and CT scans save data as a monochromatic intensity range. Crucially, different tissue types have different image intensities. For example, bones appear bright on a CT scan while soft tissue appears darker. Therefore, since different types of tissue have unique image intensities, you can choose to make some tissues invisible (transparent) while revealing other types of tissue. In addition, you can assign unique colors to specific image intensities, further helping to define different types of material. Figure 3.1 You can highlight different tissue using the color and transparency window. Both the top and bottom panels show the abdo256 image. The top panel uses a color range that hides the darker tissue, revealing the bones and kidneys. In contrast, the bottom panel uses a color mapping that shows the darker tissue, so one cannot see beneath the muscles. Note that the top panel has selected intensities between 114 and 302, while the lower panel is adjusting values in the range 100..246. Within this range the color schemes also differ in the colors used, with the top scheme using oranges while the bottom scheme has predominantly reds and yellows.

To adjust the color and transparency of an image, choose View/ColorTransparency. A new window appears, as shown in Figure 3.1. This window shows two histograms, one above the other. The bottom histogram shows the full intensity range available in the image. For example in Figure 3.1, the darkest voxels in our image have an intensity of 400 while the brightest have a value of 596. The upper histogram shows the portion of this full range that we are interested in. In Figure 3.1, you can see that to highlight the kidneys we have selected to manipulate voxels with color intensities in the range of 114 to 302. Any voxel darker than 114 (air and muscles) will be completely transparent, while values greater than 302 (mostly bones) will be shown as relatively opaque and white. Values between these two extremes will be shown in an orangish color and with intermediate transparency.

MRIcroGL user guide 2 of 15

Note that the color and transparency window has a pull-down menu that allows you to select from several predefined color schemes. For example, the top panel of Figure 3.1 shows the CT_Kidneys color scheme, while the lower panel shows the CT_Muscles color scheme. However, you can also manually change the color scheme. You can manually edit the intensity range you are interested in. For example, note that the kidney color scheme is selecting a color range of 114..302 while the muscle color scheme includes darker material (-100..246). Also, note that the color schemes are composed of nodes. For example, the muscle color scheme has a node that makes some tissue intensities to appear yellow. To change the color of a node, double click on the node. For example, you could make this muscle node appear blue instead of yellow. You can also use the mouse to drag the node to a new location. Dragging the node to the left or right will change the image intensity selected by that node, while dragging the node up and down changes the transparency of the selected image intensity. For example, Figure 3.2 shows how you can make the kidneys invisible. You can delete nodes by shift-clicking, and add new nodes by control-clicking. Figure 3.2 You can change the transparency of your image. With MRIcroGL, the transparency is shown on the vertical axis labeled Alpha. The top panel shows the abdo256 image with the default CT_Kidneys color scheme. The lower panel is identical, except we have dragged the middle (orange) node to the bottom of the graph. Notice that in the lower panel the kidneys are now completely transparent.

4. Colorbars
An intensity colorbar is useful for recognizing the range of intensities displayed. Selecting View/Colorbar brings up a window that allows you to change the appearance of the colorbar. Note that when viewing overlays, you will see one colorbar for each overlay image (e.g. see Figure 7.1). Figure 4.1 An example of the ch256 image with a colorbar visible on the lower right. The colorbar positioning window is open on the right, allowing the user to interactively position and size the colorbar.

MRIcroGL user guide 3 of 15

5. Clipping
As mentioned earlier, MRIcroGL can either show 3D renderings or 2D slices of an image. However, the clipping tool allows the best of both worlds showing a 2D slice cut through a rendered image. Further, while MRIcroGLs 2D slices are always orthogonal planes (e.g. cut perpendicular to the image, yielding sagittal, coronal or axial views), the clipping tool allows oblique cutting angles. To see the clipping tool, open an image in the rendering mode (if you are in the 2D slices mode, Ctrl-G on the image to go to the 3D rendering view). Choose Render/Clip to see the Clipping window. Adjust the trackbar to set the depth of the clipping plane. Note that the clipping occurs in the plane you are viewing the image. However, once you stop moving the clipping trackbar, the clip plane is set in the current orientation. You can now rotate the image and see the clipped slice from a different angle. Figure 5.1 An example of the ch256 image with a clipping plane applied. To see this view, drop the clip.gls script onto MRIcroGL.

6. Cutouts
The clipping option described in the previous section allows us to cleave off a 2D slice from the image. The cutout option removes a 3D cube from our image, allowing us to see inside. To see the cutout tool, open an image in the rendering mode (if you are in the 2D slices mode, choose CtrlG to go to the 3D rendering view). Choose Render/Cutout to see the Cutout window, as shown in Figure 5.1. There are six trackbars that adjust the position and size of the cutout. The top two adjust the left-right position, the middle two adjust the anterior-posterior location, and the bottom two adjust the superior-inferior dimension. A good place to start is to press the nearest hemiquadrant button, which removes the chunk of the image facing you. This is useful, as now you can see any changes made as you adjust the trackbars. Figure 6.1 An example of a cutout applied to the visible human image (from cutoutdemo2.gls).

MRIcroGL user guide 4 of 15

7. Overlays
The overlay function allows you to superimpose images on top of your background image. A common usage is to load statistical maps that show brain activity on top of anatomical scans. To add an overlay, first open the overlay window, by choosing File/OpenOverlay, and then choose File/AddOverlay in the Overlays window. As shown in Figure 7.1, you can load multiple overlays and set a unique colorscheme and intensity range for each. You can also use the Transparency menu to control how opaque the overlays appear relative to each other and to the background. Figure 7.1 An example of the ch256 image with the attention and saccade statistical maps shown as overlays. In this example, we are only showing voxels with Z-scores above 1, with Z-scores above 5 being shown with the maximum color rnage. The attention image is shown with a red color scheme, and the saccades image is shown using green. Areas that appear yellow are mutual to both color schemes. This is from the overlay.gls script. The overlay window has several menu commands that allow you to adjust how multiple overlays interact with each other and with the background image. Examples are given in Figure 7.2. Figure 7.2 The overlay menus include different controls for adjusting how overlays are displayed. (A, B) contrasts the Transparency/OnBackground of 50% (A) versus 0% (B). (B,C) contrasts the appearance of an overlay loaded when Options/SmoothWhenLoading is unchecked (B) versus checked (A): note that the smoothed image can appear less jagged, but thresholded statistical maps often appear with a dark edge (as the edge values are being interpolated with values that were truncated by the thresholding). (D,E) compare the effects of the Transparency/OnOtherOverlays, with (D) showing the two maps combined additively, where (E) shows a 50% blend. (F,G) contrast the influence of the Options/BackgroundMasksOverlays command. When this is unchecked we can see the overlay even when the background is transparent (F), while when checked (G) the overlay only appears where the background is visible (from the glassbrain.gls demo).

8. Mosaics
The mosaic function allows you to show multiple 2D slices at once. The easiest way to create a mosaic is by using the mosaic designer form (though you can also use scripting). To see the mosaic designer form, you need to be in the 2D slices mode if you are viewing a 3D rendering, Ctrl-G to switch to the 2D slices mode. Next, select Slices/MosaicDesigner. You can then set the number of rows and columns, as well as the horizontal and vertical overlap. As you adjust these controls, you will see the selected image as well as the corresponding script. You can edit the script and then press Run script for more control. For example, you could arbitrarily switch between axial, sagittal and coronal orientation between rows. MRIcroGL user guide 5 of 15

Figure 8.1 A mosaic created from the chris_T1mri image. Note that this mosaic shows both axial and sagittal slices, and that the rows and columns have been set to overlap a little. This was created with the following script A L+ H -0.300 V -0.300 0.1667 0.3333 0.5000;0.6667 0.8333 L- X S 0.5, as described in the scripting section.

9. Edge enhancement
Often the relevant parts of an image are the tissue boundaries. For example, when looking at a brain we want to see boundary between the brain and air. These surfaces provide the landmarks we are interested in, whereas it is actually preferable to make voxels that are not on the surface transparent (so we can see deeper boundaries). MRIcroGL includes an interactive Edge Enhancement tool that allows you to interactively weight the importance of these edges. Simply select View/EdgeEnhancement. A new window appears with two sliders, named bias and gain. With low bias values, there is nothing special about the edges, whereas with high levels only the sharpest edges are visible. Bias effectively sets the threshold for the edge intensity you are interested in. You can usually ignore the gain slider.

Figure 9.1 A demonstration of how edge enhancement can be interactively adjusted to emphasize surfaces while making other tissue transparent (from the edgefmri.gls demo). The horizontal axis of the graph shows increasingly high-contrast edges, whereas the vertical axis shows increasing opacity (the grayscale icons show these dimensions graphically). Note that shaper edges are always more opaque than less defined edges (the graph always goes up from left to right), but the midpoint and steepness of this effect is influenced by the bias and gain settings (respectively). As shown in Figure 9.1, one powerful use for edge enhancement is for overlays, where you can make the background image translucent, allowing you to visualize both near and distant portions of the overlay map. When doing this, it is useful to make sure the Overlay windows menu item Options/BackgroundMasksOverlay is unchecked. Otherwise the background images surfaces modulate both the background image as well as the overlay.

MRIcroGL user guide 6 of 15

Figure 9.2 An explanation for edge enhancement. On the left is the source image. The second image has been slightly blurred (using a cubic B-spline that approximates Gaussian smoothing). The third image is an absolute difference image between the first two images, and is a noisy edge map. The right image shows the blurred edge map. Regions that are bright in this image are regions with rapid changes in image intensity. This smoothed edge map is used to modulate the source image. This is referred to as an unsharp mask.

10. GLSL Shaders


MRIcroGL includes text files in a folder called shaders (for OSX users, you will have to select the application and choose show package contents to see this folder). If you have this version of MRIcroGL, you will see a menu item named Shaders in the Render menu. Choosing this command will allow you to choose between the installed shaders and also allow you to adjust the settings for many of these programs. Power users can edit the shader text files to create unique effects. The shader minimal.txt shows how a shader can be created with less than 50 lines of code. Here are some useful hints: MRIcroGL chooses the initial default shader based on alphabetically sorted filenames. So if you prefer the phong.txt shader to basic.txt, you could simply rename it aphong.txt. Most shader text files start with a pref section that provides the user with adjustable values. You can easily edit these to make the default shader settings more to your liking. For example, the basic.txt shader has a preference lightAmount|float|0.0|0.2|1 which means that the user will see a slider that allows them to adjust the amount of light from 0 to 100%, with a starting point of 20% (the first number is the minimum, the second is the default, the third is the maximum). If you prefer more lighting hints, you could edit the middle number, e.g. if you prefer 50% light you would set this to lightAmount|float|0.0|0.5|1 You can copy shader files and give each a different file name, this would allow you to set custom preferences. You can adjust MRIcroGLs ini file to set default shader settings: RayCastQuality1to10 allows you to choose the quality of raycasting from 1 (fast but poor quality) to 10 (slow but excellent quality). Changing RayCastViewCenteredLight=0 will have the lighting specified relative to the object, not the viewer. Figure 10.1 GLSL shaders are compact programs that can harness the capabilities of your graphics card. To select and tune a shader, choose Render/Shader to view the shader form. The drop down list at the top of the form allows you to select from the shader plug-ins (in this case the 'phong' shader which provides illumination cues). Some shaders will provide additional user adjustable settings, for example this shader has the 'specular' trackbar that allows the user to interactively adjust the glint of the final image. This image is from the shader.gls demonstration scripts.

MRIcroGL user guide 7 of 15

Individual shaders work by combining different properties of the image. The table below shows a few popular properties. Property Example Notes Brightness depends on image intensity. Volume

Ambient Light

Constant brightness, independent of all other factors.

Diffuse Light

Illumination based on surface orientation with respect to light. Surfaces pointing toward light are brighter than those facing away. (Lambertian reflection).

Specular Light

Illumination based on reflection between light source and viewpoint. Emulates glossy, reflective material. Includes additional adjustment shininess: mirrors have small intense specular highlights, while duller surfaces have larger highlights Edges parallel to viewing direction are made darker. This emphasizes edges. Only depends on viewpoint (independent of light position).

Edge Shading

Boundary Opacity

Regions where image intensity is varying are made opaque, whereas regions with consistent image intensity appear transparent. A simple way to create a glass brain (see also edge enhancement).

MRIcroGL comes with several shaders to choose from. The table below describes the properties for the different shaders. Some shaders have unique properties, while others have identical properties (e.g. marcus and edge_phong) but different default settings and algorithms. As all shaders are text files, it is easy to create new shaders with your preferred properties and default settings. Shader Property Volume Lighting Shadin Opacity Other g Volume Ambient Diffuse Specular Edge Boundary Other default + + + + edge + + + + edge_phong + + + + + + marcus + + + + gradient minimal + phong + + + + phong_sh + + + + Spherical Harmonics special_fx + + + + Gooch, Toon, Dither

MRIcroGL user guide 8 of 15

11. Extract Objects


Medical images are often noisy. In terms of volume rendering, noise in the air around an object can make the image appear a bit hazy. MRIcroGLs Extract Objects command attempts to make all the air around an object transparent, providing a clear view of the object surface. To try this feature, simply load an image and choose Extract Objects from the View menu. You will be asked to specify a few options, but the default settings are usually pretty good. After a few seconds you will be shown the extracted object. Usually it is that simple. However, the images on this page show how adjusting the options for this command can tune the extraction process. You are asked to specify a level of Otsu thresholding from 1..5, with the default value being 5. Large values lead to larger extracted objects. In the image below you can see what happens to an original image with the default Otsu level (5) versus an Otsu level of 1. I suggest starting with the default level, and if you are unhappy try re-opening your original image and running the extraction again with a smaller value. For those interested, this selection changes the number of levels specified by the Otsu threshold and the number of resulting levels treated as air: 1= 3/4, 2=2/3, 3= 1/2, 4=1/3, 5=1/4. In other words,selecting a level of 2 computes a threshold with 3levels of gray (e.g. each voxel will be classified as being one of three shades of gray: white, medium-gray, black) and assumes the darkest two compartments are air that should be transparent (e.g. the black and medium gray will both be set to transparent). With most medical images a default value of 5 is about right, for example with a T1-weighted MRI you can think of air, bone and water as black, gray matter as dark gray, white matter as light gray and the fat of the scalp as white: in this case we only want to remove the darkest tissue type. It should be noted that only external voxels are eliminated.

You can specify a number of voxels for dilation after the Otsu threshold. The default setting is 2, but you can choose a range of 0..12. One problem with the straight Otsu threshold is that it leaves sharp edges that can appear jagged. The problem is that many of the voxels on the surface of the object suffer from partial volume effects: in other words these voxels include a bit of the scalp and some air, but appear as dark as much of the noise seen in the air. Therefore, once we determine the edge of an object, it is often useful to grow the edge by a voxel or two to include some of these superficial voxels. Selecting a value of 0 often leads to a jagged looking volume rendering, while the Dilate = 6 image above shows the consequence of choosing 6 voxels worth of dilation note that there is a halo of noise around the object, as noisy air voxels are not attenuated near the scalp surface.

MRIcroGL user guide 9 of 15

You are also allowed to select if there is only a single object in your image or if there are multiple objects. Many brain scans only include a single object (the head), and therefore only the largest single object is extracted by default. However, if your image is of multiple items you can choose to select each of these. The image below shows a Magnetic Resonance Angiography scan of the arterial blood supply to the head. Note that the original image is noisy. If one conducts the default object extraction, only the largest single object survives. The resulting extraction leaves the largest contiguous object: in this case the anterior, middle and posterior cerebral arteries. However, if one selects to extract multiple objects than several of the other arteries are preserved.

12. New Features


Version 10/2011 : Thanks to Martins Upitis, David V. Smith & McKell Carter for suggestions/code View/ObjectExtract command attenuates noise in air surrounding an object. View/BrainExtract attempts to remove scalp signal (Unix only requires FSL installation). View/EdgeEnhance. New feature to generate 'glass brain' images. 'V' column in Overlays window allows user to toggle each overlay from visible to invisible. When viewing multiple overlays, click on the overlay's filename in the overlays window to change stacking order of overlays (Note: this feature has no influence if you have selected Transparency/OnOtherOverlays/Additive) Scripting: "overlayvisible" command added Overlay window's File/Open allows you to select multiple overlays simultaneously. Mixing algorithm for multiple overlays are loaded has changed. Transparency modulated by image intensity when Overlay's Option/BackgroundMasksOverlay is unchecked. If the file /script/startup.gls exists, this script will be launched when the program starts. To disable this feature, edit the mricrogl.ini file and change "StartupScript=1" to read "StartupScript=0" If you are having problems running MRIcroGL, launch the program with the shift key down (OSX and Windows) or with the right mouse button depressed (Linux). You can then restore the default settings. You will also be given the option of disabling the volume rendering (if your graphics card can not support that feature) and enabling power-of-two upsampling (e.g. if you load an image with 192 voxels in one dimension, it will be loaded as 256 voxels, this can dramatically improve performance on older {~2006] graphics cards, but will be slightly deleterious for newer graphics cards) Shaders: see shader section for more details.

MRIcroGL user guide 10 of 15

12. Scripting
New users can drag-and-drop the script files from MRIcroGLs script folder onto the program to learn about some of the useful features of this software. Advanced users can develop their own macros to automate repetitive tasks or create nice demos. Pascal is used as the scripting language. To write a script, simply select View/Scripting to open the script engine. Type your commands into the text window and select Script/Compile to execute your script. You can also save and open scripts using the File menu. Here is a very simple script. It does one thing, which is to open the file named ch256.
Program Simple Begin LOADIMAGE(ch256); End.

Note that MRIcroGL is pretty intelligent. It will use files named ch256.nii, ch256.nii.gz, and ch256.hdr in the program folder and the scripts folder. If no file is found, a dialog box allows the user to find the file. You could also be more explicit by running Loadimage(c:\mri\dataset.hdr), but this is not required. Below is a list of all of the commands that are specific to this program, but one can also use regular Pascal commands (like for loops, variables and constants). Here we use the constant ktime to specify the delay (100 msec between steps), and the variable i to loop through a series of views, creating an animation of a rotating image:
Program Advanced; const ktime = 100; var i: integer; Begin LOADIMAGE('abdo256'); COLORNAME('ct_kidneys'); CHANGENODE(1, 100, 255, 100, 100,64); For i := 1 to 63 Do Begin AZIMUTH(10); WAIT(ktime); End; End.

Figure 12.1 Scripts can allow a number of impressive effects. These images are from the carp.gls and glassbrain.gls demonstration scripts.

MRIcroGL user guide 11 of 15

SCRIPTING COMMANDS
ADDNODE(INTENSITY, R,G,B,A: byte) This command adds a new point to the color table. Consider the default color table that has only two nodes - black is node zero and white is node one. Running ADDNODE(192,255,0,0,64) would make images with 75% intensity (192/255) appear bright red, and be 25% opaque (64/255). AZIMUTH (DEG: integer) This command rotates the rendering. For example, AZIMUTH(-20) rotates the image 20 degrees counter-clockwise AZIMUTHELEVATION (AZI, ELEV: integer). Sets the viewer location. For example, AZIMUTHELEVATION(90,10) will show a sagittal (right side) view from a slightly inclined viewpoint. Zero degrees azimuth refers to posterior, while 180 degress is directly anterior. Note that these values are absolute, while the AZIMUTH and ELEVATION commands refer to relative changes in viewpoint. BACKCOLOR (R,G,B: byte) Changes the background color, for example BACKCOLOR(255, 0, 0) will show images on a bright red background CAMERADISTANCE (Z: single) Sets the viewing distance from the object. Values near zero will appear inside the object (near the center of the object), values near 1 will appear at a reasonably close distance, and larger values will make the object appear quite small. CHANGENODE(INDEX, INTENSITY, R,G,B,A: byte) This command adjusts a point in the color table. Consider the default color table that has only two nodes - black is node zero and white is node one. Running CHANGENODE(1,255,255,0,0,128) would change the formerly black-to-white color table to be black to bright red. Note that node zero can only have an intensity of zero and the final node must have an intensity of 255. CLIP (DEPTH: single) Creates a clip plane that hides information close to the viewer. FOr example, CLIP(0.5) will hide all surfaces on the nearest half of the image. CLIPFORMVISIBLE (VISIBLE: boolean) Shows or hides the clipping form. For example CLIPFORMVISIBLE(TRUE) shows the form, CLIPFORMVISIBLE(FALSE) hides the form. COLORBARCOORD (L,T,R,B: single). Sets the position of the colorbar based on the Left, Top, Right and Bottom coordinates. The left and right coordinates are in the range 0..1 from the left to right of the screen, while the top and bottom components range from 0 near the bottom to 1 near the top. If the distance between L-R is greater than T-B then a horizontal colorbar will be shown, else a vertical colorbar is displayed. COLORBARFORMVISIBLE (VISIBLE: boolean) Shows or hides the window that allows the user to interactively control the size and location of the colorbar. For example COLORBARFORMVISIBLE (TRUE) shows the form, COLORBARFORMVISIBLE (FALSE) hides the form. COLORBARTEXT (VISIBLE: boolean). If set to true, then colorbars will include text that indicates intensity range. For example COLORBARTEXT(true). COLORBARVISIBLE (VISIBLE: boolean). Shows a colorbar on the main images. COLORNAME (Filename: string) Loads the requested colorscheme for the background image. For example, running COLORNAME(CT_KIDNEY) will apply the kidney color scheme. CONTRASTFORMVISIBLE (VISIBLE: boolean) Shows or hides the contrast and color window. For example CONTRASTFORMVISIBLE (TRUE) shows the form, CONTRASTFORMVISIBLE (FALSE) hides the form. CONTRASTMINMAX (MIN,MAX: single); Sets the minumum nd maximum value for the color lookup table. For example, consider CONTRASTMINMAX(-200,500). In this case, a voxel with the value of -200 will be displayed with the darkest value in the color table, and voxel with a value of 500 will be shown with the brightest value CUTOUT (L,A,S,R,P,I: single) Selects a sector to remove from rendering view. For example CUTOUT(0,0,0,0.5,0.5,0.5) will hide the left-anterior-superior hemiquadrant. CUTOUTFORMVISIBLE (VISIBLE: boolean) Shows or hides the cutout window. For example CUTOUTFORMVISIBLE (TRUE) shows the form, CUTOUTFORMVISIBLE (FALSE) hides the form. EDGEDETECT (THRESH: single; DILATECYCLES: integer) This procedure attempts to hide regions of consistent color from your image. Therefore, only the edges will remain. Thresh adjusts the erosion, and is a value greater than zero values near zero will only leave the most salient edges, while values around 10 will only erode regions with a very consistent intensity. After the initial erosion, surviving edges can be regrown by using DILATECYCLES. For example, 2 dilate cycles will add two voxels on all sides of ach edge. Deprecated: The EDGEENHANCE function is superior.

MRIcroGL user guide 12 of 15

EDGEENHANCE(BIAS,GAIN: integer) This function hides regions of consistent color from your rendering. Therefore, only the edges will remain, enhancing the boundaries between different tissues. This can create a translucent appearance. BIAS is a value from 0 to 100 that sets edge threshold: values near zero have no enhancement, whereas values near 100 yield an image where only tissue near sharp edges is visible. GAIN is a value from 0 to 100 that controls the slope of the GAIN function. In general, one only needs to adjust the BIAS value (set the GAIN to around 75). BIAS and GAIN are analogous to window center and window width (though for edges rather than brightness). For example EDGEENHANCE(50,75) should create a translucent image. EDGEENHANCEFORMVISIBLE(VISIBLE: boolean) Shows or hides a window that allows the user to interactively control the edge enhancement values . For example FRAMEVISIBLE(false) will hide the frame. EDGEENHANCEFORMVISIBLE(VISIBLE: boolean) Shows or hides a window that allows the user to interactively control the edge enhancement values . For example FRAMEVISIBLE(false) will hide the frame. EXTRACT(LEVELS,DILATEVOX:integer; ONEOBJECT: boolean); Attempts to remove noise speckles from dark regions (air) around object. Levels=1..5 (larger for larger surviving image), Dilate=0..12 (larger for larger surround). You can also specify if there is a single object or multiple objects. Default values are 5,2,true. ELEVATION (DEG: integer) changes the render camera up or down. For example, Elevation(20) moves the viewpoint 20-degrees above the object. FRAMEVISIBLE (VISIBLE: boolean) Shows or hides the cube that appears around the rendered object. For example FRAMEVISIBLE(false) will hide the frame. LOADIMAGE (lFilename: string) Opens a NIfTI format image to view. For example, LOADIMAGE('c:\mri\image.nii') will open the file named 'image.nii'. MAXIMUMINTENSITY (MIP_ON: boolean) Changes the rendering mode between standard (which highlights surfaces of objects) and Maximum Intensity Projection that shows the brightest object, regardless of depth. For example MAXIMUMINTENSITY(false) switches to standard rendering. MODALMESSAGE (STR: string) Displays a dialog box with a message. The script will wait until the user responds prior to continuing. MODELESSMESSAGE (STR: string) A text message is shown on the main window. This message requires no response from the user, and the script does not pause for a response. The message is visible until the script sends a MODELMESSAGE() or until the application is restarted. MOSAIC(Str: string) Shows a series of 2D slices. For example MOSAIC(V 0.1 H 0.2 A 0.3, 0.6, 0.9; A 0.5 S 0.5 C 0.5) shows two rows of images, each with three columns - the top row shows three axial views, while the bottom shows an axial, coronal and vertical slice. The vertical slices overlap 10% (V 0.1) and the horizontal slices overlap 20% (H 0.2). A: subsequent slices in axial orientation C: subsequent slices in coronal orientation H: Horizontal overlay, e.g. H 0.5 means each slice has 50% overlap. Values can range from 1 to 1. L: turns on (L+) or off (L-) text labes for slices S: subsequent slices in sagittal orientation V: Vertical overlap, from 1 to 1, e.g. V 0 means no vertical overlap Z: mirrored sagittal slice Numbers are used for each slice, with semicolons denoting new rows, so 0.1 0.2 0.6; 0.8 0.9 is a mosaic with five images, three in the first row and two in the second. MOSAICFORMVISIBLE (VISIBLE: boolean) Shows or hides the mosaic designer window. For example CLIPFORMVISIBLE(TRUE) shows the form, CLIPFORMVISIBLE(FALSE) hides the form. ORTHOVIEW (X,Y,Z: single) Shows a 2D projection view of the brain, with an axial slice at the Z coordinate, a coronal slice at the Y value, a sagittal slice at the X coordinate. For example ORTHOVIEW(0.5,0.5,0.5) shows a slice inthe middle of the brain. OVERLAYCLOSEALL. This function has no parameters. All open overlays will be closed. The background image (if any) will remain opened. OVERLAYCOLORFROMZERO(FROMZERO: Boolean). If set to false, then the full color range is used to show the overlay.If set to false, then the color range spans from zero to the most intense color. For example, consider an overlay with a color scheme that goes from black to bright red and a OVERLAYMINMAX(1,2). With colorfromzero set to false, a voxel with an intensity of 1 will appear

MRIcroGL user guide 13 of 15

black (minimum in the range 1..2). On the other hand, if colorfromzero is true, then this same voxel will appear dark red (as 1 is half way between 0 and 2). Note that in this case voxels darker than 1 will still be invisible (as they must exceed the 1..2 threshold set by overlayminmax). OVERLAYCOLORNAME (lOverlay: integer; lFilename: string); Set the colorscheme for the target overlay to a specified name. For example OVERLAYCOLORNAME(1, CT_Kidneys) will make the first overlay show intermediate brightness regions as red and very bright regions as white. OVERLAYCOLORNUMBER (lOverlay,lLUTIndex: integer) Sets the color scheme for a overlay. For example, consider that you load a single overlay and want it to make it appear blue, you could call OVERLAYCOLORNUMBER(1,2). The LUTindex refers to the order of the colorscheme in the overlay menus drop down menu, such that 0=grayscale, 1=red, 2=blue, etc. OVERLAYFORMVISIBLE (VISIBLE: boolean) Shows or hides the overlay window. For example OVERLAYFORMVISIBLE (TRUE) shows the form, OVERLAYFORMVISIBLE (FALSE) hides the form. OVERLAYLOAD (lFilename: string): integer; Will add the overlay named filename and return the number of the overlay. Will return zero if unable to find the file or if there are too many overlays already loaded. OVERLAYLOADSMOOTH (SMOOTH: boolean) Determines whether overlays are interpolated using trilinear interpolation (SMOOTH = true) or nearest neighbor (SMOOTH= false). Smoothed images will not appear jagged, but a thresholded map (where values below say Z=2.3 are set to zero) may appear to have dark edges. Note the this command does not influence currently loaded images, rather it sets how future images will be smoothed when overlayload is called. OVERLAYMASKEDBYBACKGROUND (MASK: BOOLEAN). If true, than a overlay will be transparent on any voxel where the background image is transparent. If false, the overlay will always be shown, regardless of the background image. Sometimes it is nice to mask an overlay, so for example brain activity does not appear outside the brain. On the other hand, consider the glassbrain script, where we want to see overlays that are inside the brains shell. In this case, we would want to use set this value to false. OVERLAYMINMAX (lOverlay: integer; lMin,lMax: single) Sets the color range for the overlay. Values outside this range but closer to zero will not be displayed, voxels with more extreme values will appear with the maximum color from the color scheme For example OVERLAYMINMAX(1,2 9) will set the first overlay to have an intensity range of 2..9. OVERLAYTRANSPARENCYONBACKGROUND (lPct: integer). Controls the opacity of the overlays on the background. For example, setting this to 50 will equally blend the overlays with the background, while 90 means that the overlays will be barely visible. Use 1 for an additive mixture (where the largest red, green and blue components are taken from each image). OVERLAYTRANSPARENCYONOVERLAY (lPct: integer); Controls the opacity of the overlays on other overlays. For example, setting this to 50 will equally blend the overlays, while 90 means that the top overlay will be barely visible against a lower overlay. Use 1 for an additive mixture (where the largest red, green and blue components are taken from each image). PERSPECTIVE (USEPERSPECTIVE: boolean) Toggles the usage of perspective on or off. If set on, closer objects will appear larger than more distant objects in the rendering window. If off, an orthographic projection is used (where size is not influenced by distance from viewer). RESETDEFAULTS. Sets all of the user adjustable settings to their default values. Calling this at the beginning of a script ensures that an image will always look identical, regardless of user-implemented changes. SAVEBMP (lFilename: string) Saves the currently viewed image as a PNG format compressed bitmap image. SCRIPTFORMVISIBLE (VISIBLE: boolean) Shows or hides the scripting window. For example CLIPFORMVISIBLE(TRUE) shows the form, CLIPFORMVISIBLE(FALSE) hides the form. SETCOLORTABLE (TABLENUM: integer) Changes the color scheme used to display an image. For example, SETCOLORTABLE(0) applies the default gray-scale color scheme. To determine the color scheme number, open the Color and Transparency Window and check the pull-down menu. For example, the first item is the default table, so it has a value of zero, while Kidneys is the second item and has a value of 1. SHADERFORMVISIBLE(VISIBLE: boolean) Shows or hides the GLSL shader control window. Only available on the GLSL raycasting version of MRIcroGL. SHADERNAME(lFilename: string). Will load the named GLSL shader and set the shaders default variables. For example, shadername(phong) will load the Phong shader (assuming phong.txt is in your shader folder). Only available on the GLSL raycasting version of MRIcroGL.

MRIcroGL user guide 14 of 15

SHADERADJUST(Property: string; Val: single). Some shaders allow the user to interactively adjust settings (using the shader form) this command allows you to change these settings via a script. For example, shaderadjust('specular',1.0) would set the value specular to 1. Some shader properties are integers or floats (both shown as trackbars), whereas others are Boolean (which are displayed as checkboxes). For Boolean values, shaderadjust(name,0) sets the value name to false, whereas any other value (shaderadjust(name,1)) will set the property to true. Only available on the GLSL raycasting version of MRIcroGL. SLICETEXT (VISIBLE: boolean) If true, the 2D slices will be displayed with text indicating which side is left and numbers indicating slice coordinates. VIEWAXIAL (STD: boolean) creates rendering from an axial viewpoint. VIEWAXIAL(true) shows a bird's eye view (from directly above), while VIEWAXIAL(false) shows an image from directly below. VIEWCORONAL (STD: boolean) creates rendering from a coronal viewpoint. VIEWCORONAL(true) shows a view from directly in front, while VIEWCORONAL(false) shows an image from directly behind. VIEWSAGITTAL (STD: boolean) creates rendering from an sagittal viewpoint. VIEWAXIAL(true) shows a profile view with the anterior dimension on the right side, while VIEWSAGITTAL(false) has the anterior dimension on the left side. WAIT (MSEC: integer) The program pauses for the specified duration. For example WAIT(1000) delays the script for one second.

MRIcroGL user guide 15 of 15

You might also like