Rat brain atlas module

pip install brainatlas==1.0


A python interface to the rat brain atlas

Using the rat brain atlas...
1) construct 3d point clouds of various brain regions
2) lookup the area for a given location (ML, DV, AP coordinate)
3) grab the containing section image for a given location
4) plot a location on a flattened cortical surface

Installation details
Due to copyright reasons, this module does not contain the eps files
from the cd that comes with the rat brain atlas. These files are 
however required for the module to function.

You can either pass in the path of the eps files to the necessary
functions (such as Section.__init__) or copy the eps files
(of at least the coronal sections) to ~/.atlas/eps.

How to

get the section index for the containing section
>>> section 6.5 3.5 -7

plot a location on a section (show and save the plot)
>>> section 6.5 3.5 -7 -ps

get the area for a location
>>> area 6.5 3.5 -7

get a point cloud of an area (saved to meshes/<area>.asc) [takes a while]
>>> points V2L -m

plot a location on a flattened cortex
>>> cortex 6.5 3.5 -7 -ps

Several calls to plot on a flattened cortical surface will go much faster
if the area points are recomputed like so
>>> area -p area.p
>>> cortex <ML> <DV> <AP> -A area.p

this is buggy and hacky as all heck

what I wanted was to generate a 3d mesh of a selected brain area from a stack of labeled brain atlas images

1) take eps files of a brain atlas
2) find location of a selected area label within each eps file
3) render eps file to bitmap format
4) find pixels that correspond to the border of the selected area
5) map image to brain coordinates
6) output 3d brain coordinates for border of selected area at each slice
7) use meshlab to generate mesh from points

this is terribly hacky and relied on:
3) manually generating the mesh using ball-pivoting in meshlab

what I would really like is to
2) make a more flexible mapping for all atlas slices
3) automatically generate mesh

1) load in a points file for an area (ex: V1.asc)
2) simplify the points:
    Filter -> Cleaning -> Merge: ~.05 world units
3) save as mesh (ex: .ply)
4) reload
3) mesh the points:
    Filter -> Remeshing -> Surface Reconstruction (ball pivoting): ~.5 world units (or .7 for V2L)
5) close holes
5) smooth:
    Filter -> Smoothing -> Laplace Smooth: 2 iterations
6) save as mesh (ex: .ply)