sarcasm.core

Classes

SarcAsM

Base class for sarcomere structural and functional analysis.

Module Contents

class sarcasm.core.SarcAsM(filepath: str | os.PathLike, restart: bool = False, channel: int | None | Literal['RGB'] = None, auto_save: bool = True, use_gui: bool = False, device: torch.device | Literal['auto', 'mps', 'cuda', 'cpu'] = 'auto', **info: Dict[str, Any])[source]

Base class for sarcomere structural and functional analysis.

Parameters:
  • filepath (str | os.PathLike) – Path to the TIFF file for analysis.

  • restart (bool, optional) – If True, deletes existing analysis and starts fresh (default: False).

  • channel (int, None or Literal['RGB'], optional) – Specifies the channel with sarcomeres in multicolor stacks (default: None).

  • auto_save (bool, optional) – Automatically saves analysis results when True (default: True).

  • use_gui (bool, optional) – Indicates GUI mode operation (default: False).

  • device (Union[torch.device, Literal['auto']], optional) – Device for PyTorch computations. ‘auto’ selects CUDA/MPS if available (default: ‘auto’).

  • **info (Any) – Additional metadata as keyword arguments (e.g. cell_line=’wt’).

filepath

Absolute path to the input TIFF file.

Type:

str

base_dir

Base directory for analysis of the TIFF file.

Type:

str

data_dir

Directory for processed data storage.

Type:

str

analysis_dir

Directory for analysis results.

Type:

str

device

Active computation device for PyTorch operations.

Type:

torch.device

Dynamic Attributes (loaded on demand)
zbands

Z-band mask

Type:

ndarray

zbands_fast_movie

High-temporal resolution Z-band mask

Type:

ndarray

mbands

Sarcomere M-band mask

Type:

ndarray

orientation

Sarcomere orientation map

Type:

ndarray

cell_mask

Binary cell mask

Type:

ndarray

sarcomere_mask

Binary sarcomere mask

Type:

ndarray

meta_data_handler: sarcasm.meta_data_handler.MetaDataHandler
metadata: dict[str, Any]
filepath = b'.'
auto_save = True
channel = None
use_gui = False
restart = False
info
base_dir
data_dir
analysis_dir
file_zbands
file_zbands_fast_movie
file_mbands
file_orientation
file_cell_mask
file_sarcomere_mask
__getattr__(name: str) Any[source]

Dynamic loading of analysis result TIFFs

__dir__() list[str][source]

Augment autocomplete with dynamic attributes

__str__()[source]

Returns a pretty, concise string representation of the SarcAsM object.

open_base_dir()[source]

Opens the base directory of the tiff file in the file explorer.

property model_dir: str

Returns the path to the model directory.

read_imgs(frames: str | int | List[int] = None)[source]

Load tif file, and optionally select channel

remove_intermediate_tiffs() None[source]

Removes intermediate TIFF files while preserving the original input.