mincVectorTOallenVector: Rotates MINC data to Allen space

View source: R/allen_minc_vector_conversion.R

mincVectorTOallenVectorR Documentation

Rotates MINC data to Allen space

Description

MINC Data is stored as a 1-D array going from X=Left-to-Right, Y=Posterior-to-Anterior, Z=Inferior-to-Superior (dimensions written from fastest changing index to slowest) Allen Gene Expression is stored as a 1-D array going from X=Anterior-to-Posterior, Y=Superior-to-Inferior, and Z=Left-to-Right (dimensions written from fastest changing index to slowest) To compare Allen Gene expression data and MINC data, you have to rotate the Allen Gene Expression by 90 degrees about Z-axis and then 90 degrees about Y-axis This function rotates a 1-D MINC vector to 1-D allen space oriendation

Usage

mincVectorTOallenVector(minc.data, xyzDimSize = NULL, orientation.check = T)

Arguments

minc.data

data (either as array or 1D vector) in MINC Space Orientation

xyzDimSize

dimensions of MINC Space (in x,y,z). Default is c(58,67,41), the dimensions of Allen Gene Expression data

orientation.check

check orientation attribute.

Value

1-D vector in Allen space orientation

Examples

# Download gene expression files from the Allen Brain Institute
# In this example, I downloaded Pdyn expression energy (http://api.brain-map.org/grid_data/download/71717084)
# I included it in this library as an example

# Read Gene expression file
filename=system.file('extdata/Pdyn_P56_coronal_71717084_200um.zip',package="ABIgeneRMINC")
gene.expression.allen=read.raw.gene(filename)

# Rotate it to MINC Orientation
gene.expression.minc=allenVectorTOmincVector(gene.expression.allen)

# Rotate it back to Allen Orientation
gene.expression=mincVectorTOallenVector(gene.expression.minc)

# Going to minc orientation and back should NOT change any voxel values. Check that...
all(gene.expression == gene.expression.allen)
# TRUE

DJFernandes/ABIgeneRMINC documentation built on March 21, 2022, 12:05 p.m.