Metadata-Version: 2.4
Name: arcadia-microscopy-tools
Version: 0.3.0
Summary: Python package for processing large-scale microscopy datasets generated by Arcadia's imaging suite
License: MIT License
        
        Copyright (c) 2024 Arcadia Science
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: arcadia-pycolor>=0.6.5
Requires-Dist: colour-science>=0.4.7
Requires-Dist: liffile>=2025.12.12
Requires-Dist: nd2>=0.10.3
Requires-Dist: numpy>=2.4.1
Requires-Dist: pandas>=2.3.3
Requires-Dist: pydantic>=2.11.7
Requires-Dist: scikit-image>=0.25.2
Provides-Extra: all
Requires-Dist: cellpose>=4.0.6; extra == 'all'
Requires-Dist: modal; extra == 'all'
Provides-Extra: compute
Requires-Dist: modal; extra == 'compute'
Provides-Extra: segmentation
Requires-Dist: cellpose>=4.0.6; extra == 'segmentation'
Requires-Dist: torch>=2.7.1; extra == 'segmentation'
Description-Content-Type: text/markdown

# arcadia-microscopy-tools

[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)

This repository contains a Python package called `arcadia_microscopy_tools`. The purpose of this Python package is for facilitating analysis of large-scale microscopy datasets generated by Arcadia's imaging suite which includes several microscopes:
- Nikon ECLIPSE Ti2-E (Hina)
- Nikon ECLIPSE Ni-E (Babu Frik)
- Leica Stellaris 8 (The Borg)

This package provides tooling for image preprocessing, cell/particle segmentation, morphology analysis, fluorescence quantification, and batch processing pipelines. Supports ND2 files from Nikon microscopes via [nd2](https://github.com/tlambert03/nd2) and LIF files from Leica microscopes via [liffile](https://github.com/nimne/liffile). The package integrates with popular scientific Python libraries for streamlined high-content screening and quantitative microscopy workflows.

## Installation

### Basic installation

Install the core package with essential dependencies:

```bash
pip install arcadia-microscopy-tools
```

### Optional dependencies

Install with optional features using extras:

- `[segmentation]` - Cellpose for cell/particle segmentation
- `[compute]` - Modal for cloud-based processing
- `[all]` - All optional dependencies

```bash
# Example: install with segmentation support
pip install "arcadia-microscopy-tools[segmentation]"

# Or install all optional dependencies
pip install "arcadia-microscopy-tools[all]"
```

## Usage

### Loading microscopy images

Load ND2 files from Nikon microscopes:

```python
from pathlib import Path
from arcadia_microscopy_tools.microscopy import MicroscopyImage

# Load a Nikon ND2 file
example_nd2_path = Path("src/arcadia_microscopy_tools/tests/data/example-multichannel.nd2")
image = MicroscopyImage.from_nd2_path(example_nd2_path)

# Access basic properties
image.shape          # Array shape: (4, 256, 256)
image.sizes          # Dimension mapping: {'C': 4, 'Y': 256, 'X': 256}
image.channels       # List of Channel objects: [Channel(name='BRIGHTFIELD', ...), ...]
image.num_channels   # Number of channels: 4
```

Load LIF files from Leica microscopes:

```python
from arcadia_microscopy_tools.leica import list_image_names

# LIF files can contain multiple images — list them first
lif_path = Path("path/to/image.lif")
print(list_image_names(lif_path))  # e.g. ['Series001', 'Series002']

# Load a specific image by name
image = MicroscopyImage.from_lif_path(lif_path, image_name="Series001")
```

### Working with channels

Extract intensity data for specific channels:

```python
from arcadia_microscopy_tools.channels import DAPI

# Get intensity data for a specific channel
dapi_intensities = image.get_intensities_from_channel(DAPI)

# The returned array preserves temporal/spatial dimensions
dapi_intensities.shape  # (256, 256)
```

For more examples, see the [docs/examples](docs/examples) directory.


## Contributing

See how we recognize [feedback and contributions to our code](https://github.com/Arcadia-Science/arcadia-software-handbook/blob/main/guides-and-standards/guide--credit-for-contributions.md).
