Metadata-Version: 2.4
Name: arcadia-microscopy-tools
Version: 0.2.2
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
Requires-Dist: scikit-image>=0.25.2
Requires-Dist: scikit-learn>=1.7.1
Requires-Dist: torch>=2.7.1
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'
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 native ND2 file format via [nd2](https://github.com/tlambert03/nd2). LIF file support is in progress and will use [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
# Load a Leica LIF file
image = MicroscopyImage.from_lif_path(Path("path/to/image.lif"))
```

### 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).
