MrRx

From VISTA LAB WIKI

Jump to: navigation, search

mrRx ("mister prescrible") is a general-purpose tool for transforming volumes by applying an Affine Tranformation, and optionally, comparing the transformed volume to a reference volume.

mrRx was originally developed to allow Alignment between the inplane anatomies for a functional session and a high-resolution volume anatomy; however, it can operate independently of the mrVista functional tools, and can be used for a number of other applications. This page was set up to describe the different uses of mrRx.

The uses of mrRx include:

  • Aligning inplane and volume anatomies
  • Generally aligning two anatomies across different scanning sessions
  • Creating a test prescription on a volume prior to scanning
  • "Nudging" functional images onto inplane anatomies to correct for motion
  • Rotating, transforming, and resampling anatomies (incl. AC/PC alignment)

Contents

[edit] General Use of mrRx

[edit] Starting mrRx

mrRx can be invoked from the MATLAB command prompt by typing mrRx with one or more input arguments. The input arguments you provide depend on how you want to use it.

To transform an image in a 3D matrix vol (here referred to as the "transformed volume"), without reference to any other anatomy, and without changing the resolution, type:

 mrRx(vol); 

To transform vol, and compare it to another, reference volume ref (that is, to align vol to ref), type:

 mrRx(vol, ref); 

This works if vol and ref are the same size and resolution. However, mrRx can also compre these volumes if they don't cover the same physical extent, aren't the same size, or have different resolutions. To do this, type:

 mrRx(vol, ref, 'volVoxelSize', [volVoxelSize], 'refVoxelSize', [refVoxelSize], 'volDims', [volDims], 'refDims', [refDims]); 

volVoxelSize and refVoxelSize are 1x3 vectors specifying the size of each volume in mm; volDims and refDims are 1x3 vectors specifying the number of rows, columns, and slices in each.

In addition to the transformed volume and reference volume, mrRx keeps track of a third, notional volume, the "prescription". The prescription is the transformed volume after the affine transformation has been applied. After applying this transform, the volume may be sampled at a different resolution and size than either the original volume or the reference. (For instance, you could have an whole-brain anatomy at 1x1x1mm for the volume, and test a single slice at 0.5 x 0.5 x 0.5mm resolution for the prescription.) When aligning two volumes (e.g., both vol and ref are specified), the prescription matches the size and resolution of ref by default. However, a different resolution can also be specified. This can be achieved with the rxVoxelSize and rxDims flags:

 mrRx(vol, ref, 'rxVoxelSize', [rxVoxelSize], 'rxDims', [rxDims]); 

For instance, suppose you want to test a prescription on vol at a higher resolution: e.g., vol is at 1mm by you want to sample every 0.5 mm. You could invoke:

 mrRx(vol, ref, 'volVoxelSize', [1 1 1], 'rxVoxelSize', [.5 .5 .5]); 

[edit] mrRx windows

mrRx contains several windows which provide information on different aspects of the transformation and/or alignment.

  • The Control Window is the main window, located on top of the screen by default. It contains sliders for modifying the affine transform: 3 rotation sliders, 3 translation sliders, and 3 checkboxes to determine whether to flip along particular dimensions (this adds a +1 or -1 to the scale factors which are otherwise set by the voxel size of each volume; see above on starting mrRx). The control window also contains a slice slider for paging through slices of the prescription; a "slider step" slider, which determines how sensitive the 6 rotation and translation sliders are (small values of the slider step mean clicking the arrows in the other sliders will result in smaller changes to the prescription); two "nudge" buttons to "push" or "pull" the prescripton along the axis perpendicular to each slice (these nudge buttons are also sensitive to the "slider step" value); and a set of controls for storing and keeping track of different transformations on the left. All the main menus for mrRx are in the control window. In addition, the 'rx' struct variable, which contains all the information on a mrRx session, is kept as the 'UserData' property of this window.
  • The Prescribed Slice Window shows the slice in the prescription determined by the slice slider in the control window. This is the transformed volume, after the current affine transform has been applied, and sampled at the resolution specified by the 'rxVoxelSize' and 'rxDims'.
  • The Reference Slice Window shows the slice of the reference volume corresponding to the current slice in the prescription. This window does not work if no reference volume is provided.
  • The Rx/Ref Comparison Window overlays the prescribed and reference slices, using one of a number of methods, and provides statistics on how closely the two slices correspond. The 'Toggle' button in the lower right corner will cause the two slices to alternate back and forth three times to allow for a visual comparison.
  • The Screen Save Window displays a special 'Screen Save' window which is sometimes present for mrVista functional sessions, and useful for starting an alignment. It looks for a volume saved in Raw/Anatomy/SS relative to the current directory, and displays it if it exists.
  • The tSeries Navigator Window is a special window which only functions if a set of time series images is loaded. It allows the user to navigate across frames in the time series. The time series image for that frame is set as the transformed volume. (This was for manual nudging of outlier frames, and is rarely used.)
  • The Interpolated 3-View Window provides a view of the transformed volume along three slice orientations, as opposed to the single slice in the prescribed slice window, and allows the user to click on different points to navigate around the prescription. It contains some menu items for setting AC/PC points used to AC/PC rotate a volume.

[edit] Viewing ROIs saved in mrVista

[edit] Creating test prescriptions with mrRx

[edit] "Nudging" functionals onto inplanes

You can align the inplane to the closest functional scan by typing rxNudgeInplanesOntoFunctionals in the MATLAB command prompt. This function should be used if you think a subject moved in between the inplane and the first functional scan. You can pass in as an input argument which scan number you would like to align to the inplane. This default reference scan is '1'.

[edit] Rotating and modifying anatomies

[edit] Saving transformed volumes

To save the prescription as a separate volume, use the menu item File | Save | Transformed Volume. You will get a dialog to specify a save file path and format (only a few are supported, including NIFTI and ANALYZE). The prescription -- that is the volume after being scaled, rotated, and resampled at the specified resolution and dimensions -- will be saved in the path. The command line function for this is rxSaveVolume. Currently this method uses a fairly low-quality, linear interpolation to resample. (A higher-quality spline resampling using the SPM tools is possible, but depends on resolving a discrepancy between the way mrRx and SPM treat affine transform information.)

[edit] Updating NIFTI header information without modifying the data

Personal tools