iblatlas.flatmaps

Techniques to project the brain volume onto 2D images for visualisation purposes.

Functions

circles

param N:

number of circles

swanson

FIXME Document! Which publication to reference? Are these specifically for flat maps?

swanson_json

Vectorized version of the swanson bitmap file.

Classes

FlatMap

The Allen Atlas flatmap.

class FlatMap(flatmap='dorsal_cortex', res_um=25)[source]

Bases: AllenAtlas

The Allen Atlas flatmap.

FIXME Document! How are these flatmaps determined? Are they related to the Swansan atlas or is

that something else?

plot_flatmap(depth=0, volume='annotation', mapping='Allen', region_values=None, ax=None, **kwargs)[source]

Displays the 2D image corresponding to the flatmap.

If there are several depths, by default it will display the first one.

Parameters:
  • depth (int) – Index of the depth to display in the flatmap volume (the last dimension).

  • volume ({'image', 'annotation', 'boundary', 'value'}) –

    • ‘image’ - Allen image volume.

    • ’annotation’ - Allen annotation volume.

    • ’boundary’ - outline of boundaries between all regions.

    • ’volume’ - custom volume, must pass in volume of shape BrainAtlas.image.shape as

      regions_value argument.

  • mapping (str, default='Allen') – The brain region mapping to use.

  • region_values (numpy.array) – An array the shape of the brain atlas image containing custom region values. Used when volume value is ‘volume’.

  • ax (matplotlib.pyplot.Axes, optional) – A set of axes to plot to.

  • **kwargs – See matplotlib.pyplot.imshow.

Returns:

The plotted image axes.

Return type:

matplotlib.pyplot.Axes

extent_flmap()[source]

Returns the boundary coordinates of the flat map.

Returns:

The bounding coordinates of the flat map image, specified as (left, right, bottom, top).

Return type:

numpy.array

circles(N=5, atlas=None, display='flat')[source]
Parameters:
  • N – number of circles

  • atlas – brain atlas at 25 m

  • display – “flat” or “pyramid”

Returns:

2D map of indices, ap_coordinate, ml_coordinate

swanson(filename='swanson2allen.npz')[source]
FIXME Document! Which publication to reference? Are these specifically for flat maps?

Shouldn’t this be made into an Atlas class with a mapping or scaling applied?

Parameters:

filename

swanson_json(filename='swansonpaths.json', remap=True)[source]

Vectorized version of the swanson bitmap file. The vectorized version was generated from swanson() using matlab contour to find the paths for each region. The paths for each region were then simplified using the Ramer Douglas Peucker algorithm https://rdp.readthedocs.io/en/latest/

Parameters:
  • filename

  • remap