View source: R/mid_sagittal_align.R
| mid_sagittal_align | R Documentation | 
This function takes in an image, flips the image over the left/right plane, registers that flipped image to the original image, then applies the half transformation
mid_sagittal_align(
  file,
  opts = "",
  translation = TRUE,
  force_rpi = TRUE,
  verbose = TRUE
)
apply_mid_sagittal_align(
  file,
  file_mat,
  apply_opts = "",
  force_rpi = TRUE,
  verbose = TRUE
)
| file | (character) input filename or class nifti | 
| opts | (character) options passed to  | 
| translation | (logical) should the translation parameters be preserved (TRUE) or set to zero (FALSE) | 
| force_rpi | Should  | 
| verbose | (logical) print diagnostic messages | 
| file_mat | file name of mat file for half transform from [mid_sagittal_align] | 
| apply_opts | options to pass to [fslr::flirt_apply] | 
Filename of output or nifti depending on retimg
if (have.fsl()){
  mnifile = file.path(fsldir(), "data", "standard",
                      "MNI152_T1_2mm.nii.gz")
  aligned = mid_sagittal_align(mnifile)
  thresh = readnii(mnifile) > 0
  file_mat = attr(aligned, "half_transform")
  force_rpi = attr(aligned, "force_rpi")
  flipped_thresh = apply_mid_sagittal_align(
    file = thresh, 
    file_mat = file_mat,
    apply_opts = "-interp nearestneighbour",
    force_rpi = force_rpi
  )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.