### Install Lazarus and Dependencies in Docker Source: https://github.com/rordenlab/mricrogl/blob/master/DOCKER.md Installs Lazarus IDE, Free Pascal compiler, Git, and necessary libraries within a Docker container. This prepares the environment for compiling MRIcroGL. ```bash cd ~ wget --no-check-certificate https://sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.0.4/lazarus-project_2.0.4-0_amd64.deb wget --no-check-certificate https://sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.0.4/fpc-src_3.0.4-2_amd64.deb wget --no-check-certificate https://sourceforge.net/projects/lazarus/files/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.0.4/fpc-laz_3.0.4-1_amd64.deb apt-get update apt -yq install ./fpc-src_3.0.4-2_amd64.deb apt -yq install ./fpc-laz_3.0.4-1_amd64.deb apt -yq install ./lazarus-project_2.0.4-0_amd64.deb apt-get -yq install git apt-get -yq install libgl1-mesa-dev apt-get install build-essential ``` -------------------------------- ### Launch MRIcroGL with a Python script from Python Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md This example demonstrates launching MRIcroGL and executing a Python script using the subprocess module in Python. Adjust the path to the MRIcroGL executable as necessary. ```python import subprocess subprocess.call(['/Users/rorden/tst/MRIcroGL12/MRIcroGL.app/Contents/MacOS/MRIcroGL','myscript.py']) ``` -------------------------------- ### Launch MRIcroGL with a Python script from Matlab Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md This example shows how to execute a Python script using MRIcroGL from a Matlab environment. Ensure the MRIcroGL executable is in your system's PATH or provide the full path. ```matlab script = 'myscript.py'; exe = 'mricrogl'; if ~exist(exe,'file'), error('Unable to find application "%s"', exe); end cmd = sprintf('%s "%s"', exe, script); system(cmd); ``` -------------------------------- ### Choose Rendering Shader Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Selects the shading algorithm for rendering. For example, 'mip' renders a maximum intensity projection. ```python shadername(name) ``` -------------------------------- ### Compile MRIcroGL with Command Line (Linux/Windows) Source: https://github.com/rordenlab/mricrogl/blob/master/README.md Commands to clone the MRIcroGL repository and compile it using lazbuild for Linux (QT5) or Windows. Ensure Lazarus 2.0.6 or later is installed and lazbuild is available. ```bash git clone https://github.com/rordenlab/MRIcroGL.git lazbuild --build-ide= --add-package lazopenglcontext ./Python27-for-Lazarus/python4lazarus/python4lazarus_package.lpk cd MRIcroGL lazbuild -B MRIcroGL.lpr ``` -------------------------------- ### Run Interactive MRIcroGL Docker Container Source: https://github.com/rordenlab/mricrogl/blob/master/DOCKER.md Starts an interactive Docker container, allowing direct access to a bash shell within the jgoerzen/debian-base-standard environment. Use this to perform compilation steps. ```bash docker run -it jgoerzen/debian-base-standard /bin/bash ``` -------------------------------- ### Get MRIcroGL Version Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Returns a string representing the current version of the MRIcroGL application. ```python version() ``` -------------------------------- ### Compile MRIcroGL with Command Line (macOS) Source: https://github.com/rordenlab/mricrogl/blob/master/README.md Commands to clone the MRIcroGL repository and compile it using lazbuild for macOS, specifying the modern Cocoa widgetset. Ensure Lazarus 2.0.6 or later is installed and lazbuild is available. ```bash git clone https://github.com/rordenlab/MRIcroGL.git cd MRIcroGL lazbuild -B --ws=cocoa MRIcroGL.lpi ``` -------------------------------- ### Set Shader Light Azimuth and Elevation Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Positions the light source used for rendering. For example, `shaderlightazimuthelevation(0,45)` places light 45 degrees above. ```python shaderlightazimuthelevation(a,e) ``` -------------------------------- ### Mosaic View - Single Rendering Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Displays multiple slices of the brain simultaneously using the mosaic view. This example loads a background image and overlays, then configures the mosaic layout. ```python import gl gl.resetdefaults() #open background image gl.loadimage('spm152') #open overlay: show positive regions gl.overlayload('spmMotor') gl.minmax(1, 4, 4) gl.opacity(1,50) #open overlay: show negative regions gl.overlayload('spmMotor') gl.minmax(2, -4, -4) gl.colorname (2,"3blue") gl.mosaic("A L+ H -0.1 -24 -16 16 40; 48 56 S X R 0") ``` -------------------------------- ### Convert Colormap to .clut Format Source: https://github.com/rordenlab/mricrogl/blob/master/more_colormaps/README.md Use this command to convert a specific colormap (e.g., 'davos') from the 'cmap' library into an MRIcroGL-compatible .clut file. Ensure 'cmap' is installed. ```bash pip install cmap python color2clut.py davos ``` -------------------------------- ### Run Detached MRIcroGL Docker Container Source: https://github.com/rordenlab/mricrogl/blob/master/DOCKER.md Starts a Docker container in detached mode, named 'name', and configures it to stop with SIGPWR. This container is based on the jgoerzen/debian-base-standard image. ```bash docker run -td --stop-signal=SIGPWR --name=name jgoerzen/debian-base-standard ``` -------------------------------- ### Configure zlib for macOS Source: https://github.com/rordenlab/mricrogl/blob/master/x86_64-darwin/README.txt Run the configure script to prepare the build environment. Edit the Makefile to specify the minimum macOS version. ```bash ./configure ``` ```bash edit makefile for "-mmacosx-version-min=10.8" ``` -------------------------------- ### Load Images with Command Line Options Source: https://github.com/rordenlab/mricrogl/blob/master/README.md Specify images, colormaps, and display ranges directly from the command line when launching MRIcroGL. Options are similar to fsleyes. ```bash MRIcroGL -std -dr 2000 6000 motor -cm actc -dr 2 4 ``` -------------------------------- ### Load Background and Overlays Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Loads a background image and two overlays, one for positive and one for negative regions. Adjusts min/max values, opacity, and color for each overlay. Uncomment the last line to view 2D slices. ```python import gl gl.resetdefaults() #open background image gl.loadimage('spm152') #open overlay: show positive regions gl.overlayload('spmMotor') gl.minmax(1, 4, 4) gl.opacity(1,50) #open overlay: show negative regions gl.overlayload('spmMotor') gl.minmax(2, -4, -4) gl.colorname (2,"3blue") #gl.orthoviewmm(37,-14,47) ``` -------------------------------- ### Adjust Shader Property Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Sets the level of a specific shader property. For example, 'gl.shaderadjust('edgethresh', 0.6)' adjusts the edge threshold. ```python shaderadjust(sliderName, sliderValue) ``` -------------------------------- ### Set Color Scheme Range from Zero Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Determines if the color scheme for a layer starts from zero (1) or a threshold value (0). ```python colorfromzero(layer, isFromZero) ``` -------------------------------- ### Compile zlib Source: https://github.com/rordenlab/mricrogl/blob/master/x86_64-darwin/README.txt Execute the make command to compile the zlib library with the specified CFLAGS. ```bash make ``` -------------------------------- ### Window Positioning and Sizing Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Set the position and dimensions of the application window. ```APIDOC ## windowposition ### Description Set the left, top, width, and height for the application window. ### Method windowposition(l,t,w,h) ### Parameters - **l** (integer) - The left position of the window. - **t** (integer) - The top position of the window. - **w** (integer) - The width of the window. - **h** (integer) - The height of the window. ``` -------------------------------- ### Load Overlay Image Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Loads an image as an overlay on top of the existing background or other overlays. Specify the filename. ```python overlayload(filename) ``` -------------------------------- ### Create MRIcroGL Distribution Source: https://github.com/rordenlab/mricrogl/blob/master/DOCKER.md Creates a distribution directory and copies the compiled MRIcroGL executable and its resources into it. This prepares MRIcroGL for deployment. ```bash mkdir ~/distro mkdir ~/distro/MRIcroGL cp ./MRIcroGL ~/distro/MRIcroGL/MRIcroGL cp -a ./Resources/ ~/distro/MRIcroGL ``` -------------------------------- ### Compile zlib object files (Basic) Source: https://github.com/rordenlab/mricrogl/blob/master/x86_64-win64/README.txt Compiles individual C source files for zlib into object files using GCC with -O3 optimization. This is a standard compilation process for creating object files. ```bash gcc -O3 -c -o adler32.o adler32.c ``` ```bash gcc -O3 -c -o crc32.o crc32.c ``` ```bash gcc -O3 -c -o deflate.o deflate.c -msse4 ``` ```bash gcc -O3 -c -o inffast.o inffast.c ``` ```bash gcc -O3 -c -o inflate.o inflate.c ``` ```bash gcc -O3 -c -o inftrees.o inftrees.c ``` ```bash gcc -O3 -c -o trees.o trees.c ``` ```bash gcc -O3 -c -o zutil.o zutil.c ``` ```bash gcc -O3 -c -o adler32_simd.o adler32_simd.c ``` ```bash gcc -O3 -c -o crc32_simd.o crc32_simd.c ``` ```bash gcc -O3 -c -o inffast_chunk.o inffast_chunk.c ``` -------------------------------- ### Specify LLVMgold.so Plugin with FPC Options Source: https://github.com/rordenlab/mricrogl/blob/master/MRIcroGL_llvm_linux.txt Pass linker options to the Free Pascal Compiler (FPC) to specify the LLVMgold.so plugin. This ensures the correct LLVM version is used for LTO processing. ```bash -k-plugin -k/usr/lib/llvm-10/lib/LLVMgold.so ``` -------------------------------- ### Reset Settings to Defaults Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Reverts all application settings to their default values. Useful for troubleshooting. ```python resetdefaults() ``` -------------------------------- ### Download MRIcroGL Latest Version (Windows) Source: https://github.com/rordenlab/mricrogl/blob/master/README.md Use this command to download the latest version of MRIcroGL for Windows. ```bash curl -fLO https://github.com/rordenlab/MRIcroGL/releases/latest/download/MRIcroGL_windows.zip ``` -------------------------------- ### Compile zlib object files (with SIMD and specific flags) Source: https://github.com/rordenlab/mricrogl/blob/master/x86_64-win64/README.txt Compiles individual C source files for zlib into object files using GCC with -O3 optimization and various SIMD (SSE4, SSSE3, SSE2) and other specific flags. These flags enable advanced instruction sets for performance. ```bash gcc -O3 -c -o adler32.o adler32.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o crc32.o crc32.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o deflate.o deflate.c -msse4 -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o inffast.o inffast.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o inflate.o inflate.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o inftrees.o inftrees.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o trees.o trees.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o zutil.o zutil.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o adler32_simd.o adler32_simd.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o crc32_simd.o crc32_simd.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` ```bash gcc -O3 -c -o inffast_chunk.o inffast_chunk.c -DHAS_PCLMUL -mpclmul -DHAS_SSE42 -msse4.2 -DADLER32_SIMD_SSSE3 -mssse3 -DINFLATE_CHUNK_SIMD_SSE2 -msse2 -DINFLATE_CHUNK_READ_64LE -O3 -DHAVE_HIDDEN ``` -------------------------------- ### Save Screen Display as Bitmap Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Saves the current view as a bitmap image file. Specify the desired filename (e.g., 'test.png'). ```python savebmp(pngName) ``` -------------------------------- ### Download MRIcroGL Latest Version (Linux) Source: https://github.com/rordenlab/mricrogl/blob/master/README.md Use this command to download the latest version of MRIcroGL for Linux. ```bash curl -fLO https://github.com/rordenlab/MRIcroGL/releases/latest/download/MRIcroGL_linux.zip ``` -------------------------------- ### Build Lazarus Packages Source: https://github.com/rordenlab/mricrogl/blob/master/DOCKER.md Builds the Python-for-Lazarus package and the lazopenglcontext package using lazbuild. These are required for MRIcroGL functionality. ```bash lazbuild --add-package ~/Python-for-Lazarus/python4lazarus/python4lazarus_package.lpk --build-ide= lazbuild --add-package lazopenglcontext --build-ide= ``` -------------------------------- ### Load Background Image Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Closes any currently open images and loads a new image as the background layer. Specify the image file name. ```python loadimage(imageName) ``` -------------------------------- ### Jagged vs. Blurry Interpolation Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Demonstrates the difference between nearest-neighbor (jagged) and trilinear (blurry) interpolation when re-slicing overlays to match background resolution. Prints a note indicating which surface is jagged. ```python import gl gl.resetdefaults() #open background image gl.loadimage('spm152') #open overlay: show positive regions gl.overlayloadsmooth(1); gl.overlayload('spmMotor') gl.minmax(1, 4, 4) gl.opacity(1,50) #open overlay: show negative regions gl.overlayloadsmooth(0); gl.overlayload('spmMotor') gl.minmax(2, -4, -4) gl.colorname (2,"3blue") gl.overlayloadsmooth(1); print("n.b. Blue surface is jagged (smoothing off)") ``` -------------------------------- ### Run Python Script with MRIcroGL Source: https://github.com/rordenlab/mricrogl/blob/master/README.md Execute a Python script to control MRIcroGL. This allows for automation and precise results. ```bash mricrogl myscript.py ``` -------------------------------- ### List mricrogl Python Functions Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Prints all built-in Python functions available in the gl module, along with their docstrings. This is useful for discovering available commands and their usage. ```python import gl print(gl.__doc__) for key in dir( gl ): if not key.startswith('_'): x = getattr( gl, key ).__doc__ print(key+' (built-in function): ') print(x) ``` -------------------------------- ### Image and Overlay Management Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Functions for loading, saving, and managing images and overlays. ```APIDOC ## loadimage ### Description Closes all open images and loads a new background image. ### Method `loadimage(imageName)` ### Parameters - **imageName** (string) - The path to the image file. ## overlaycloseall ### Description Closes all currently open overlays. ### Method `overlaycloseall()` ## overlayload ### Description Loads an image as an overlay on top of existing images. ### Method `overlayload(filename)` ### Parameters - **filename** (string) - The path to the overlay image file. ## overlayloadsmooth ### Description Determines whether future `overlayload()` calls use smooth or jagged interpolation. ### Method `overlayloadsmooth(v)` ### Parameters - **v** (int) - 1 to use smooth interpolation, 0 for jagged interpolation. ## overlaymaskwithbackground ### Description Controls whether overlay voxels that are transparent in the background image are hidden. ### Method `overlaymaskwithbackground(v)` ### Parameters - **v** (int) - 1 to hide transparent voxels, 0 to show them. ## savebmp ### Description Saves the current screen display as a bitmap image. ### Method `savebmp(pngName)` ### Parameters - **pngName** (string) - The desired filename for the bitmap image (e.g., 'test.png'). ``` -------------------------------- ### Overlay Management Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Functions to manage open overlays, including closing all, counting them, and loading new ones. ```APIDOC ## overlaycloseall ### Description Close all open overlays. ### Method overlaycloseall() ``` ```APIDOC ## overlaycount ### Description Return the number of overlays currently open. ### Method overlaycount() -> integer ``` ```APIDOC ## overlayload ### Description Load an image as an overlay on top of prior images. ### Method overlayload(filename) ### Parameters - **filename** (string) - The path to the image file to load. ``` -------------------------------- ### View Modes Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Set the display mode for the rendered volume. ```APIDOC ## view ### Description Set the display mode for the volume. Can display Axial (1), Coronal (2), Sagittal (4), Flipped Sagittal (8), MPR (16), Mosaic (32), or Rendering (64). Multiple modes can be combined using bitwise OR. ### Method view(v) ### Parameters - **v** (integer) - A bitmask representing the desired view mode(s). ``` -------------------------------- ### Utility and Application Functions Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Miscellaneous functions for user interaction, application control, and information retrieval. ```APIDOC ## colorbarposition ### Description Sets the position of the color bar. ### Method `colorbarposition(p)` ### Parameters - **p** (int) - Position code: 0=off, 1=top, 2=right. ## colorbarsize ### Description Changes the width of the color bar. ### Method `colorbarsize(p)` ### Parameters - **p** (float) - Fraction of screen width used by the color bar (0.01 to 0.5). ## cutout ### Description Removes a sector from the volume. ### Method `cutout(L, A, S, R, P, I)` ### Parameters - **L** (float) - Parameter L. - **A** (float) - Parameter A. - **S** (float) - Parameter S. - **R** (float) - Parameter R. - **P** (float) - Parameter P. - **I** (float) - Parameter I. ## extract ### Description Removes haze from the volume. ### Method `extract(Otsu, Dil, One)` ### Parameters - **Otsu** (float) - Otsu threshold value. - **Dil** (int) - Dilation value. - **One** (int) - Parameter One. ## hiddenbycutout ### Description Determines if the cutout operation hides or shows a layer. ### Method `hiddenbycutout(layer, isHidden)` ### Parameters - **layer** (int) - The target layer (0 for background). - **isHidden** (int) - 1 to hide, 0 to show. ## linewidth ### Description Sets the thickness of crosshairs used on 2D slices. ### Method `linewidth(wid)` ### Parameters - **wid** (float) - The desired thickness of the crosshairs. ## modalmessage ### Description Shows a message in a dialog box and pauses script execution until the user presses 'OK'. ### Method `modalmessage(msg)` ### Parameters - **msg** (string) - The message to display. ## mosaic ### Description Creates a series of 2D slices. ### Method `mosaic(mosString)` ### Parameters - **mosString** (string) - String defining the mosaic parameters. ## overlaymaskwithbackground ### Description Hides (1) or shows (0) overlay voxels that are transparent in the background image. ### Method `overlaymaskwithbackground(v)` ### Parameters - **v** (int) - 1 to hide, 0 to show. ## quit ### Description Terminates the MRIcroGL application. ### Method `quit()` ## resetdefaults ### Description Reverts all settings to their default values. ### Method `resetdefaults()` ## scriptformvisible ### Description Shows or hides the scripting window. ### Method `scriptformvisible(visible)` ### Parameters - **visible** (int) - 1 to show the scripting window, 0 to hide it. ## toolformvisible ### Description Shows or hides the tool panel. ### Method `toolformvisible(visible)` ### Parameters - **visible** (int) - 1 to show the tool panel, 0 to hide it. ## version ### Description Returns the current version of MRIcroGL. ### Method `version()` ### Returns - **string**: The version string of MRIcroGL. ``` -------------------------------- ### Compile MRIcroGL Source: https://github.com/rordenlab/mricrogl/blob/master/DOCKER.md Compiles the MRIcroGL application using lazbuild. This command builds the main MRIcroGL project file. ```bash cd MRIcroGL12 lazbuild -B ./MRIcroGL.lpr ``` -------------------------------- ### Batch Convert Default Colormaps Source: https://github.com/rordenlab/mricrogl/blob/master/more_colormaps/README.md Run the conversion script without arguments to batch-convert a default set of colormaps. The optional '-t' argument can adjust interpolation tolerance for balancing node count and color precision. ```bash python color2clut.py ``` -------------------------------- ### Clone MRIcroGL and Related Repositories Source: https://github.com/rordenlab/mricrogl/blob/master/DOCKER.md Clones the MRIcroGL source code and other necessary repositories (Metal-Demos, Python-for-Lazarus) into the Docker container. This step is crucial for compilation. ```bash git clone https://github.com/rordenlab/MRIcroGL12.git git clone https://github.com/neurolabusc/Metal-Demos git clone https://github.com/Alexey-T/Python-for-Lazarus.git ``` -------------------------------- ### Linux MRIcroGL Deployment Paths Source: https://github.com/rordenlab/mricrogl/blob/master/README.md Specifies the order of directories MRIcroGL searches for its Resources folder on Linux systems when not found in the same directory as the executable or via the MRICROGL_DIR environment variable. ```bash /opt/MRIcroGL/Resources /opt/MRIcroGL /opt/MRIcroGL/Resources /opt/MRIcroGL /usr/local/MRIcroGL/Resources /usr/local/MRIcroGL /usr/local/MRIcroGL/Resources /usr/local/MRIcroGL /usr/local/share/MRIcroGL/Resources /usr/local/share/MRIcroGL /usr/local/share/MRIcroGL/Resources /usr/local/share/MRIcroGL ``` -------------------------------- ### Set Overlay Blending Mode Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Chooses the blending mode for overlaying images. Use additive (1) or multiplicative (0) blending. ```python overlayadditiveblending(v) ``` -------------------------------- ### Download MRIcroGL Latest Version (macOS) Source: https://github.com/rordenlab/mricrogl/blob/master/README.md Use this command to download the latest version of MRIcroGL for macOS. ```bash curl -fLO https://github.com/rordenlab/MRIcroGL/releases/latest/download/MRIcroGL_macOS.dmg ``` -------------------------------- ### Mosaic View - Multiple Renderings Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Configures the mosaic view to show multiple renderings simultaneously, including axial, coronal, and sagittal views with different rendering options. Sets a white background and positions the color bar. ```python import gl gl.resetdefaults() gl.backcolor(255, 255, 255) #open background image gl.loadimage('spm152') #open overlay: show positive regions gl.overlayload('spmMotor') gl.minmax(1, 4, 4) gl.opacity(1,50) #open overlay: show negative regions gl.overlayload('spmMotor') gl.minmax(2, -4, -4) gl.colorname (2,"3blue") gl.colorbarposition(0) #"a"xial, "c"oronal and "s"agittal "r"enderings gl.mosaic("A R 0 C R 0 S R 0; A R -0 C R -0 S R -0") ``` -------------------------------- ### Image Loading and Display Functions Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Functions for loading and displaying images. ```APIDOC ## loadimage ### Description Closes all open images and loads a new background image. ### Method `loadimage(imageName)` ### Parameters - **imageName** (string) - The path to the image file to load. ``` ```APIDOC ## mosaic ### Description Creates a series of 2D slices arranged in a mosaic. ### Method `mosaic(mosString)` ### Parameters - **mosString** (string) - A string defining the mosaic layout. ``` -------------------------------- ### Control Scripting Window Visibility Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Shows (1) or hides (0) the scripting window, allowing more space for the main viewer. ```python scriptformvisible (visible) ``` -------------------------------- ### Instance Synchronization Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Synchronize the view across multiple instances of MRIcroGL. ```APIDOC ## yoke ### Description Synchronize (1) or de-synchronize (0) instances so that different instances show the same view. ### Method yoke(v) ### Parameters - **v** (integer) - 1 to yoke instances, 0 to de-synchronize. ``` -------------------------------- ### Image Saving Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Save the current display or background image to various file formats. ```APIDOC ## savebmp ### Description Save the current screen display as a bitmap image. ### Method savebmp(pngName) ### Parameters - **pngName** (string) - The filename (e.g., 'test.png') to save the bitmap as. ``` ```APIDOC ## saveimg ### Description Save the background image (layer 0) to disk. The file extension determines the format. ### Method saveimg(filename) ### Parameters - **filename** (string) - The desired filename, including the extension (e.g., 'test.nii', 'test.osp', 'test.bvox'). Supported extensions: .nii (NIfTI), .osp (ospray), .bvox (blender). ``` -------------------------------- ### Color and Appearance Functions Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Functions to control background color, color schemes, and overlay blending. ```APIDOC ## backcolor ### Description Changes the background color. ### Method `backcolor(r, g, b)` ### Parameters - **r** (int) - Red component (0-255). - **g** (int) - Green component (0-255). - **b** (int) - Blue component (0-255). ## colorfromzero ### Description Determines if the color scheme display range starts from zero or a threshold value. ### Method `colorfromzero(layer, isFromZero)` ### Parameters - **layer** (int) - The target layer (0 for background). - **isFromZero** (int) - 1 to start from zero, 0 to start from threshold. ## colorname ### Description Sets the colorscheme for a specified overlay to a named scheme. ### Method `colorname(layer, colorName)` ### Parameters - **layer** (int) - The target layer (0 for background layer). - **colorName** (string) - The name of the colorscheme. ## linecolor ### Description Sets the color of the crosshairs. ### Method `linecolor(r, g, b)` ### Parameters - **r** (int) - Red component (0-255). - **g** (int) - Green component (0-255). - **b** (int) - Blue component (0-255). ## minmax ### Description Sets the color range for an overlay. ### Method `minmax(layer, min, max)` ### Parameters - **layer** (int) - The target layer (0 for background). - **min** (float) - The minimum value for the color range. - **max** (float) - The maximum value for the color range. ## opacity ### Description Adjusts the transparency of a layer. ### Method `opacity(layer, opacityPct)` ### Parameters - **layer** (int) - The target layer (0 for background, 1 for 1st overlay). - **opacityPct** (int) - Opacity percentage (0=transparent, 100=opaque). ## overlayadditiveblending ### Description Merges overlays using additive or multiplicative blending. ### Method `overlayadditiveblending(v)` ### Parameters - **v** (int) - 1 for additive blending, 0 for multiplicative blending. ``` -------------------------------- ### Set Overlay Colorscheme by Name Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Applies a named colorscheme to a specified overlay. Layer 0 refers to the background. ```python colorname(layer, colorName) ``` -------------------------------- ### Set Layer Opacity Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Adjusts the transparency of a layer. 0 is fully transparent, 100 is fully opaque. Layer 0 is the background. ```python opacity(layer, opacityPct) ``` -------------------------------- ### Graph and Data Loading Functions Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Functions for loading and scaling graph data. ```APIDOC ## graphscaling ### Description Sets the scaling type for the vertical axis of a graph. ### Method `graphscaling(type)` ### Parameters - **type** (number) - Scaling type: 0=raw, 1=demeaned, 2=normalized -1..1, 3=normalized 0..1, 4=percent. ``` ```APIDOC ## loadgraph ### Description Loads a graph from a text file. ### Method `loadgraph(graphName, add)` ### Parameters - **graphName** (string) - The name of the graph file (e.g., AFNI .1D, FSL .par, SPM rp_.txt). - **add** (number, optional) - If 1, the new graph is added to the existing graph; otherwise, it replaces it (default is 0). ``` -------------------------------- ### Cutout with OverlaySurface Shader Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Loads a background image and overlays, then applies a cutout box and the 'OverlaySurface' shader to only display overlays beneath the brain's surface. Sets a white background color. ```python import gl gl.resetdefaults() #open background image gl.loadimage('spm152') gl.overlayloadsmooth(1) #open overlay: show positive regions gl.overlayload('spmMotor') gl.minmax(1, -2,-5) gl.colorname(1,'8redyell') gl.colorfromzero(1,1) gl.overlayload('spmMotor') gl.minmax(2, 2,5) gl.colorname(2,'5winter') gl.colorfromzero(2,1) gl.hiddenbycutout(1,1) gl.cutout(0.5,0.5,0.5,0,1,1) gl.shadername('OverlaySurface') gl.backcolor(255,255,255) ``` -------------------------------- ### Scripting Window Visibility Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Control the visibility of the scripting window. ```APIDOC ## scriptformvisible ### Description Show (1) or hide (0) the scripting window. ### Method scriptformvisible(visible) ### Parameters - **visible** (integer) - 1 to show the scripting window, 0 to hide it. ``` -------------------------------- ### Control Tool Panel Visibility Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Shows (1) or hides (0) the tool panel, which contains various editing and manipulation tools. ```python toolformvisible(visible) ``` -------------------------------- ### Specify LLVMgold.so Plugin for Linker Source: https://github.com/rordenlab/mricrogl/blob/master/MRIcroGL_llvm_linux.txt Manually override the LTO plugin location by passing the plugin path to the linker. This is useful when the default symlink points to an incompatible LLVM version. ```bash -plugin /usr/lib/llvm-10/lib/LLVMgold.so ``` -------------------------------- ### Rendering and Camera Functions Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Functions to control the 3D rendering camera and view. ```APIDOC ## azimuthelevation ### Description Sets the render camera's azimuthal and elevation angles. ### Method `azimuthelevation(azi, elev)` ### Parameters - **azi** (number) - The azimuthal angle. - **elev** (number) - The elevation angle. ``` ```APIDOC ## cameradistance ### Description Sets the viewing distance from the object. ### Method `cameradistance(z)` ### Parameters - **z** (number) - The viewing distance. ``` ```APIDOC ## clipazimuthelevation ### Description Sets a view-point independent clip plane. ### Method `clipazimuthelevation(depth, azi, elev)` ### Parameters - **depth** (number) - The depth of the clip plane. - **azi** (number) - The azimuthal angle for the clip plane. - **elev** (number) - The elevation angle for the clip plane. ``` ```APIDOC ## clipthick ### Description Sets the thickness of the clip plane slab. ### Method `clipthick(thick)` ### Parameters - **thick** (number) - The thickness of the clip plane (0..1). ``` ```APIDOC ## orthoviewmm ### Description Displays three orthogonal slices of the brain at specified millimeter coordinates. ### Method `orthoviewmm(x, y, z)` ### Parameters - **x** (number) - The x-coordinate in millimeters. - **y** (number) - The y-coordinate in millimeters. - **z** (number) - The z-coordinate in millimeters. ``` -------------------------------- ### Shader Adjustments Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Adjust shader properties and select rendering shaders. ```APIDOC ## shaderadjust ### Description Set the level of a specific shader property. ### Method shaderadjust(sliderName, sliderValue) ### Parameters - **sliderName** (string) - The name of the shader property to adjust (e.g., 'edgethresh'). - **sliderValue** (float) - The desired value for the shader property (e.g., 0.6). ``` ```APIDOC ## shadermatcap ### Description Set the material capture file for the 'matcap' shader. ### Method shadermatcap(name) ### Parameters - **name** (string) - The name of the matcap file to use (e.g., 'mc01'). ``` ```APIDOC ## shadername ### Description Choose the rendering shader function. ### Method shadername(name) ### Parameters - **name** (string) - The name of the shader to apply (e.g., 'mip' for maximum intensity projection). ``` ```APIDOC ## shaderquality1to10 ### Description Set the rendering quality level, balancing speed and visual fidelity. ### Method shaderquality1to10(i) ### Parameters - **i** (integer) - The quality level from 1 (fastest) to 10 (highest quality). A value of 6 offers a balance. ``` ```APIDOC ## shaderupdategradients ### Description Recalculate volume properties, often needed after changes to rendering settings. ### Method shaderupdategradients() ``` -------------------------------- ### Display Modal Message Box Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Shows a message to the user in a dialog box. The script pauses until the user clicks 'OK'. ```python modalmessage(msg) ``` -------------------------------- ### Tool Panel Visibility Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Control the visibility of the tool panel. ```APIDOC ## toolformvisible ### Description Show (1) or hide (0) the tool panel. ### Method toolformvisible(visible) ### Parameters - **visible** (integer) - 1 to show the tool panel, 0 to hide it. ``` -------------------------------- ### Overlay Interpolation Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Configure the interpolation method for future overlay loading operations. ```APIDOC ## overlayloadsmooth ### Description Set whether future `overlayload()` calls should use smooth (1) or jagged (0) interpolation. ### Method overlayloadsmooth(value) ### Parameters - **value** (integer) - 1 for smooth interpolation, 0 for jagged interpolation. ``` -------------------------------- ### Application Version Source: https://github.com/rordenlab/mricrogl/blob/master/COMMANDS.md Retrieve the current version of MRIcroGL. ```APIDOC ## version ### Description Return the version of MRIcroGL. ### Method version() -> string ``` -------------------------------- ### View and Rendering Control Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Functions to adjust rendering quality, shaders, and view orientation. ```APIDOC ## bmpzoom ### Description Changes the resolution of `savebmp()` output. ### Method `bmpzoom(z)` ### Parameters - **z** (float) - Zoom factor for bitmap resolution. ## orthoviewmm ### Description Shows three orthogonal slices of the brain specified in millimeters. ### Method `orthoviewmm(x, y, z)` ### Parameters - **x** (float) - X-coordinate in millimeters. - **y** (float) - Y-coordinate in millimeters. - **z** (float) - Z-coordinate in millimeters. ## shaderadjust ### Description Sets the level of a specific shader property. ### Method `shaderadjust(sliderName, sliderValue)` ### Parameters - **sliderName** (string) - The name of the shader property to adjust. - **sliderValue** (float) - The desired value for the property. ## shaderlightazimuthelevation ### Description Positions the light source that illuminates the rendering. ### Method `shaderlightazimuthelevation(a, e)` ### Parameters - **a** (float) - Azimuth angle of the light. - **e** (float) - Elevation angle of the light. ## shadername ### Description Chooses the rendering shader function. ### Method `shadername(name)` ### Parameters - **name** (string) - The name of the shader function (e.g., 'mip'). ## shaderquality1to10 ### Description Sets the rendering quality. ### Method `shaderquality1to10(i)` ### Parameters - **i** (int) - Rendering quality level from 1 (fast) to 10 (high quality). ## shaderupdategradients ### Description Recalculates volume properties for shaders. ### Method `shaderupdategradients()` ## sharpen ### Description Applies an unsharp mask to the background volume to enhance edges. ### Method `sharpen()` ## viewaxial ### Description Sets the camera position for axial view. ### Method `viewaxial(SI)` ### Parameters - **SI** (int) - 1 for superior, 0 for inferior. ## viewcoronal ### Description Sets the camera position for coronal view. ### Method `viewcoronal(AP)` ### Parameters - **AP** (int) - 1 for posterior, 0 for anterior. ## viewsagittal ### Description Sets the camera position for sagittal view. ### Method `viewsagittal(LR)` ### Parameters - **LR** (int) - 1 for left, 0 for right. ``` -------------------------------- ### Remove Haze from Image Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Applies a haze removal algorithm to the image. Requires three parameters. ```python extract(Otsu,Dil,One) ``` -------------------------------- ### Terminate Application Source: https://github.com/rordenlab/mricrogl/blob/master/PYTHON.md Exits the MRIcroGL application. Use with caution as unsaved changes may be lost. ```python quit() ```