neuralib.atlas.util
- neuralib.atlas.util.ALLEN_CCF_10um_BREGMA = array([540, 0, 570])
allen CCF 10um volume coordinates, refer to allenCCF/Browsing Functions/allenCCFbregma.m
- class neuralib.atlas.util.SourceCoordinates[source]
SourceCoordinates(source, coordinates)
- source: str
Alias for field number 0
- coordinates: ndarray
AP, DV, ML coordinates. Array[float, [N, 3]]
- property ap: ndarray
- property dv: ndarray
- property ml: ndarray
- static __new__(_cls, source, coordinates)
Create new instance of SourceCoordinates(source, coordinates)
- Parameters:
source (str)
coordinates (ndarray)
- neuralib.atlas.util.iter_source_coordinates(file, *, only_areas=None, region_col=None, hemisphere='both', to_brainrender=True, source_order=None)[source]
Load allen ccf roi output (merged different color channels).
- Parameters:
file (Path) – parsed csv file after
only_areas (str | list[str] | None) – only show rois in region(s)
region_col (str | None) – if None, auto infer, and check the lowest merge level contain all the regions specified
hemisphere (Literal['ipsi', 'contra', 'both']) – which brain hemisphere
to_brainrender (bool) – convert the coordinates to brain render
source_order (tuple[str, ...] | None) – whether specify the source generator order
- Returns:
Iterable of
SourceCoordinates- Return type:
Iterable[SourceCoordinates]
- neuralib.atlas.util.get_margin_merge_level(df, areas, margin)[source]
Get the lowest or highest merge level (i.e., parsed_csv) containing all the regions
- Parameters:
df (DataFrame) – parsed csv
areas (list[str] | str) – an area or a list of areas
margin (Literal['lowest', 'highest']) – get the either lowest of highest merge level for a given area
- Returns:
col name if parsed csv
- Return type:
str
- neuralib.atlas.util.allen_to_brainrender_coord(data)[source]
Convert coordinates space of
AllenCCFtoBrainrendercoordinates- Parameters:
data (DataFrame | DataFrame | ndarray) – Dataframe with ‘AP_location’, ‘DV_location’, ‘ML_location’ headers. Or numpy array with Array[float, [N, 3]] or Array[float, 3]
- Returns:
brainrender coordinates. Array[float, [N, 3]] with AP, DV, ML coordinates
- Return type:
ndarray
- neuralib.atlas.util.as_coords_array(data)[source]
Convert dataframe/1D numpy array to coordinates numpy array
- Parameters:
data (DataFrame | DataFrame | ndarray) – Dataframe with ‘AP_location’, ‘DV_location’, ‘ML_location’ headers. Or numpy array with Array[float, [N, 3]] or Array[float, 3]
- Returns:
Array[float, [N, 3]] with AP, DV, ML coordinates
- Return type:
ndarray
- neuralib.atlas.util.roi_points_converter(dat, to_brainrender=True)[source]
DEPRECATED. convert coordinates of allenccf roi points from parsed dataframe
- Parameters:
dat (DataFrame | DataFrame | ndarray) – Dataframe with ‘AP_location’, ‘DV_location’, ‘ML_location’ headers. Or numpy array with Array[float, [N, 3]] or Array[float, 3]
to_brainrender (bool) – coordinates to brainrender
- Returns:
Array[float, [N, 3]], N: number of roi; 3: AP, DV, ML
- Return type:
ndarray