cuisto.atlas
atlas module, part of cuisto.
Contains functions to generate atlas outlines in sagittal, cornal and horizontal views, with each regions of the Allen Brain Atlas in a single HDF5 file.
check_outlines_file(filename, atlas_name)
#
Check if the outline file exists, if not, attempt to download it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
Full path to the file to check. |
required |
atlas_name
|
str
|
Brainglobe atlas name. |
required |
Returns:
Name | Type | Description |
---|---|---|
file_not_found |
bool
|
True if the file does not exist and could not be downloaded. |
Source code in cuisto/atlas.py
download_file(url, filename)
#
Download a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
Full URL to address the HTTP request. |
required |
filename
|
str
|
Path to the destination file. |
required |
Returns:
Name | Type | Description |
---|---|---|
tf |
bool
|
True if the file was downloaded, False otherwise. |
Source code in cuisto/atlas.py
download_outline(filename, atlas_name)
#
Download outline file if available.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
Full path to the destination file. |
required |
atlas_name
|
str
|
Brainglobe atlas name. |
required |
Returns:
Name | Type | Description |
---|---|---|
result |
bool
|
True if the file was downloaded, False otherwise. |
Source code in cuisto/atlas.py
generate_outlines(atlas_name, output_file=None)
#
Generate brain regions contours outlines from Brainglobe atlases masks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atlas_name
|
str
|
Name of Brainglobe atlas. |
required |
output_file
|
str
|
Destination file. If it exists already, nothing is done. If None, the file is created at $HOME/.cuisto/{atlas_name}.h5. |
None
|
Source code in cuisto/atlas.py
get_default_filename(atlas_name)
#
Get the file name $HOME/.cuisto/{atlas_name}.h5
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atlas_name
|
str
|
Name of a Brainglobe atlas. |
required |
Returns:
Name | Type | Description |
---|---|---|
filename |
str
|
Path to the default file location. |
Source code in cuisto/atlas.py
get_structure_contour(mask, axis=2)
#
Get structure contour.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mask
|
ndarray
|
3D mask of structure. |
required |
axis
|
int
|
Axis, determines the projection. 2 is sagittal. Default is 2. |
2
|
Returns:
Name | Type | Description |
---|---|---|
contour |
list
|
List of 2D array with contours (in pixels). |
Source code in cuisto/atlas.py
outlines_to_group(grp, acronym, outlines, resolution=(10, 10), fliplr=False)
#
Write arrays to hdf5 group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grp
|
h5py group
|
Group in hdf5 file |
required |
acronym
|
str
|
Subgroup name |
required |
outlines
|
list
|
List of 2D ndarrays |
required |
resolution
|
tuple
|
Resolution (row, columns) in the 2D projection, before flipping. Default is (10, 10). |
(10, 10)
|
fliplr
|
bool, Defaults to False
|
|
False
|