neuralib.atlas.ccf.core

class neuralib.atlas.ccf.core.AbstractCCFDir[source]
ANIMAL_001/ (root)
    ├── raw/ (optional)
    ├── zproj/
    │    └── ANIMAL_001_g*_s*_{channel}.tif
    ├── roi/
    │    └── ANIMAL_001_g*_s*_{channel}.roi
    ├── roi_cpose/
    │    └── ANIMAL_001_g*_s*_{channel}.roi
    ├── resize/ (src for the allenccf, if sagittal slice, could be resize_contra and resize_ipsi)
    │    ├── ANIMAL_001_g*_s*_resize.tif
    │    └── processed/
    │           ├── ANIMAL_001_g*_s*_resize_processed.tif
    │           └── transformations/
    │                 ├── ANIMAL_001_g*_s*_resize_processed_transformed.tif
    │                 ├── ANIMAL_001_g*_s*_resize_processed_transform_data.mat
    │                 └── labelled_regions/
    │                       ├── {*channel}_roitable.csv
    │                       └── parsed_data /
    │                             └── parsed_csv_merge.csv
    ├── resize_*_overlap/ (optional, same structure as **resize**, for dual channels labeling)
    │
    └── output_files/ (for generate output fig)
static __new__(cls, root, with_overlap_sources=True, plane_type='coronal', hemisphere_type=None, auto_mkdir=True)[source]
Parameters:
  • root (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader)

  • with_overlap_sources (bool)

  • plane_type (Literal['coronal', 'sagittal', 'transverse'])

  • hemisphere_type (Literal['ipsi', 'contra', 'both'] | None)

  • auto_mkdir (bool)

__init__(root, with_overlap_sources=True, plane_type='coronal', hemisphere_type=None, auto_mkdir=True)[source]
Parameters:
  • root (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – Root path (i.e., */ANIMAL_001)

  • with_overlap_sources (bool) – If there is overlap channel labeling (for dir making).

  • plane_type (Literal['coronal', 'sagittal', 'transverse']) – {‘coronal’, ‘sagittal’, ‘transverse’}

  • hemisphere_type (Literal['ipsi', 'contra', 'both'] | None) – {‘ipsi’, ‘contra’, ‘both’}

  • auto_mkdir (bool) – If auto make folder structure for the pipeline.

slice_name: str = None
abstract glob(glass_id, slice_id, glob_type, hemisphere=None, channel=None)[source]
Parameters:
  • glass_id (int) – Glass slide number

  • slice_id (int) – Slice sequencing under a glass slide (i.e., zigzag from upper left -> bottom left ->-> bottom right)

  • glob_type (Literal['zproj', 'roi', 'roi_cpose', 'resize', 'resize_overlap', 'processed', 'transformation_matrix', 'transformation_img', 'transformation_img_overlap'])

  • hemisphere (Literal['i', 'c'] | None)

  • channel (Literal['r', 'g', 'b', 'merge', 'overlap'] | None)

Returns:

Return type:

Path

abstract property resize_folder: Path
property default_iter_dir: Iterable[Path]
property animal: str
property raw_folder: Path
property roi_folder: Path
property cpose_roi_folder: Path
property zproj_folder: Path
property resize_overlap_folder: Path | None
property processed_folder_overlap: Path | None
property transformed_folder_overlap: Path | None
property labelled_roi_folder_overlap: Path | None
property processed_folder: Path
property transformed_folder: Path
property labelled_roi_folder: Path
property parsed_data_folder: Path
property parse_csv: Path
property output_folder: Path
figure_output(*suffix, sep='_')[source]
Return type:

Path

csv_output(*suffix, sep='_')[source]
Return type:

Path

property roi_atlas_output: Path
property roi_atlas_ibl_output: Path
get_slice_id(glass_id, slice_id, hemisphere=None, channel=None)[source]
Parameters:
  • glass_id (int)

  • slice_id (int)

  • hemisphere (Literal['i', 'c'] | None)

  • channel (Literal['r', 'g', 'b', 'merge', 'overlap'] | None)

Return type:

str

get_transformation_matrix(glass_id, slice_id, plane_type)[source]
Parameters:
  • glass_id (int)

  • slice_id (int)

  • plane_type (Literal['coronal', 'sagittal', 'transverse'])

Return type:

CCFTransMatrix

class neuralib.atlas.ccf.core.CoronalCCFDir[source]

Base folder structure for 2dccf pipeline

property resize_folder: Path
glob(glass_id, slice_id, glob_type, *, hemisphere=None, channel=None)[source]
Parameters:
  • glass_id (int) – Glass slide number

  • slice_id (int) – Slice sequencing under a glass slide (i.e., zigzag from upper left -> bottom left ->-> bottom right)

  • glob_type (Literal['zproj', 'roi', 'roi_cpose', 'resize', 'resize_overlap', 'processed', 'transformation_matrix', 'transformation_img', 'transformation_img_overlap'])

  • hemisphere (Literal['i', 'c'] | None)

  • channel (Literal['r', 'g', 'b', 'merge', 'overlap'] | None)

Returns:

Return type:

Path | None

class neuralib.atlas.ccf.core.CoronalCCFOverlapDir[source]

2dccf Folder structure for multiple sources overlap labeling For example: Dual tracing with different fluorescence protein, and tend to see the overlap channel counts

property resize_overlap_folder: Path

for double labeling channel since maximal 2 channels for roi detection, then need extra folder use pseudo-color

property processed_folder_overlap: Path
property transformed_folder_overlap: Path
property labelled_roi_folder_overlap: Path
glob(glass_id, slice_id, glob_type, *, hemisphere=None, channel=None)[source]
Parameters:
  • glass_id (int) – Glass slide number

  • slice_id (int) – Slice sequencing under a glass slide (i.e., zigzag from upper left -> bottom left ->-> bottom right)

  • glob_type (Literal['zproj', 'roi', 'roi_cpose', 'resize', 'resize_overlap', 'processed', 'transformation_matrix', 'transformation_img', 'transformation_img_overlap'])

  • hemisphere (Literal['i', 'c'] | None)

  • channel (Literal['r', 'g', 'b', 'merge', 'overlap'] | None)

Returns:

Return type:

Path | None

class neuralib.atlas.ccf.core.SagittalCCFDir[source]
glob(glass_id, slice_id, glob_type, hemisphere=None, channel=None)[source]
Parameters:
  • glass_id (int) – Glass slide number

  • slice_id (int) – Slice sequencing under a glass slide (i.e., zigzag from upper left -> bottom left ->-> bottom right)

  • glob_type (Literal['zproj', 'roi', 'roi_cpose', 'resize', 'resize_overlap', 'processed', 'transformation_matrix', 'transformation_img', 'transformation_img_overlap'])

  • hemisphere (Literal['i', 'c'] | None)

  • channel (Literal['r', 'g', 'b', 'merge', 'overlap'] | None)

Returns:

Return type:

Path | None

property resize_folder: Path
class neuralib.atlas.ccf.core.SagittalCCFOverlapDir[source]
property resize_overlap_folder: Path

for double labeling channel since maximal 2 channels for roi detection, then need extra folder use pseudo-color

property processed_folder_overlap: Path
property transformed_folder_overlap: Path
property labelled_roi_folder_overlap: Path
glob(glass_id, slice_id, glob_type, *, hemisphere=None, channel=None)[source]
Parameters:
  • glass_id (int) – Glass slide number

  • slice_id (int) – Slice sequencing under a glass slide (i.e., zigzag from upper left -> bottom left ->-> bottom right)

  • glob_type (Literal['zproj', 'roi', 'roi_cpose', 'resize', 'resize_overlap', 'processed', 'transformation_matrix', 'transformation_img', 'transformation_img_overlap'])

  • hemisphere (Literal['i', 'c'] | None)

  • channel (Literal['r', 'g', 'b', 'merge', 'overlap'] | None)

Returns:

Return type:

Path | None

class neuralib.atlas.ccf.core.CCFTransMatrix[source]
slice_id: str
matrix: MatMatrix
plane_type: Literal['coronal', 'sagittal', 'transverse']
resolution: int
property slice_index: int
__init__(slice_id, matrix, plane_type, *, resolution=10)

Method generated by attrs for class CCFTransMatrix.

Parameters:
  • slice_id (str)

  • matrix (MatMatrix)

  • plane_type (Literal['coronal', 'sagittal', 'transverse'])

  • resolution (int)

Return type:

None

property delta_xy: tuple[int, int]

map delta value to xy slice view

get_slice_plane()[source]
Return type:

SlicePlane

matrix_info(to_polars=True)[source]
Parameters:

to_polars (bool)

Return type:

dict[str, Any] | DataFrame

neuralib.atlas.ccf.core.load_transform_matrix(filepath, plane_type, resolution=10, default_name='test')[source]

matrix for image transformation

Parameters:
  • filepath (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – transformation matrix .mat file

  • plane_type (Literal['coronal', 'sagittal', 'transverse']) – PLANE_TYPE {‘coronal’, ‘sagittal’, ‘transverse’}

  • resolution (int) – atlas resolution

  • default_name (str) – name of the CCFTransMatrix

Returns:

CCFTransMatrix

Return type:

CCFTransMatrix