photon_mosaic.dataset_discovery#

Dataset discovery module.

This module provides a class-based approach to discover datasets using regex patterns. All filtering and transformations are handled through regex substitutions.

Classes

DatasetDiscoverer(base_path[, pattern, ...])

A class for discovering and organizing datasets with TIFF files.

DatasetInfo(original_name, transformed_name, ...)

Container for dataset information.

class photon_mosaic.dataset_discovery.DatasetInfo(original_name, transformed_name, tiff_files, subject_metadata, session_metadata)[source]#

Container for dataset information.

original_name: str#
transformed_name: str#
tiff_files: Dict[int, List[str]]#
subject_metadata: str#
session_metadata: Dict[int, str]#
class photon_mosaic.dataset_discovery.DatasetDiscoverer(base_path, pattern='.*', exclude_datasets=None, exclude_sessions=None, tiff_patterns=None, neuroblueprint_format=False)[source]#

A class for discovering and organizing datasets with TIFF files.

This class handles both NeuroBlueprint format and custom format datasets, providing methods to discover datasets, extract metadata, and organize TIFF files by sessions.

Attributes:
original_datasets

Get list of original dataset names.

session_metadata

Get session metadata by original dataset name and session.

subject_metadata

Get subject metadata by original dataset name.

tiff_files

Get TIFF files organized by original dataset name and session.

tiff_files_flat

Get flat list of all TIFF files.

transformed_datasets

Get list of transformed dataset names.

Methods

discover()

Discover datasets and their TIFF files in the directory.

get_session_name(dataset_idx, session_idx)

Get session name for given dataset and session indices.

property original_datasets: List[str]#

Get list of original dataset names.

property transformed_datasets: List[str]#

Get list of transformed dataset names.

property tiff_files: Dict[str, Dict[int, List[str]]]#

Get TIFF files organized by original dataset name and session.

property tiff_files_flat: List[str]#

Get flat list of all TIFF files.

property subject_metadata: Dict[str, str]#

Get subject metadata by original dataset name.

property session_metadata: Dict[str, Dict[int, str]]#

Get session metadata by original dataset name and session.

get_session_name(dataset_idx, session_idx)[source]#

Get session name for given dataset and session indices.

Parameters:
  • dataset_idx (int) – Index of the dataset in the discovered datasets list

  • session_idx (int) – Index of the session within the dataset

Returns:

Formatted session name like “ses-0_metadata” or “ses-1_date-20250225”

Return type:

str

discover()[source]#

Discover datasets and their TIFF files in the directory.

This method populates the datasets list and all related metadata. After calling this method, you can access the results through the class properties.

Return type:

None