# API

```{eval-rst}

Import Harpy as::

    import harpy as hp

.. module:: harpy
```

## IO

I/O.

```{eval-rst}

.. module:: harpy.io
.. currentmodule:: harpy

.. autosummary::
    :toctree: generated

    io.macsima
    io.merscope
    io.xenium
    io.visium
    io.visium_hd
    io.read_transcripts
    io.read_resolve_transcripts
    io.read_merscope_transcripts
    io.read_stereoseq_transcripts
    io.convert_to_zarr_2

```

## Image

Operations on image and labels elements.

```{eval-rst}

.. module:: harpy.im
.. currentmodule:: harpy

.. autosummary::
    :toctree: generated

    im.add_image
    im.add_labels
    im.get_dataarray
    im.map_image
    im.tiling_correction
    im.enhance_contrast
    im.normalize
    im.min_max_filtering
    im.gaussian_filtering
    im.transcript_density
    im.combine
    im.segment
    im.segment_points
    im.cellpose_callable
    im.instanseg_callable
    im.baysor_callable
    im.add_grid_labels
    im.expand_labels
    im.align_labels
    im.map_labels
    im.filter_labels
    im.merge_labels
    im.match_labels_to_reference
    im.rasterize
    im.pixel_clustering_preprocess
    im.flowsom
```

## Shape

Operations on shapes (polygons) elements.

```{eval-rst}

.. module:: harpy.sh
.. currentmodule:: harpy

.. autosummary::
    :toctree: generated

    sh.vectorize
    sh.add_shapes
    sh.filter_shapes
    sh.create_voronoi_boundaries
```

## Table

Operations on table (`AnnData` object) elements.

```{eval-rst}

.. module:: harpy.tb
.. currentmodule:: harpy

.. autosummary::
    :toctree: generated

    tb.add_table
    tb.allocate
    tb.bin_counts
    tb.allocate_intensity
    tb.add_regionprops
    tb.add_feature_matrix
    tb.extract_instances
    tb.ZarrIterableInstances
    tb.ZarrDataLoader
    tb.featurize
    tb.preprocess_transcriptomics
    tb.preprocess_proteomics
    tb.filter_on_size
    tb.leiden
    tb.kmeans
    tb.score_genes
    tb.score_genes_iter
    tb.correct_marker_genes
    tb.cluster_cleanliness
    tb.nhood_enrichment
    tb.nhood_kmeans
    tb.cluster_intensity
    tb.cluster_intensity_SOM
    tb.spatial_pixel_neighbors
    tb.cell_clustering_preprocess
    tb.flowsom
    tb.weighted_channel_expression
```

## Points

Operations on points (`Dask` `DataFrame` object) elements.

```{eval-rst}

.. module:: harpy.pt
.. currentmodule:: harpy

.. autosummary::
    :toctree: generated

    pt.add_points
```

## Externals

External integrations.

```{eval-rst}

.. module:: harpy.externals
.. currentmodule:: harpy

.. autosummary::
    :toctree: generated

    externals.ilastik.run_object_classification
```

## Quality Control

Quality control functions.

```{eval-rst}

.. module:: harpy.qc
.. currentmodule:: harpy.qc

.. autosummary::
    :toctree: generated

    image_histogram
    segmentation_coverage
    segmentation_histogram
    analyse_genes_left_out
    metric_histogram
    metrics_histogram
    obs_scatter
```

## Plotting

Plotting functions.

### General plots

```{eval-rst}

.. module:: harpy.pl
.. currentmodule:: harpy.pl

.. autosummary::
    :toctree: generated

    plot_sdata
    plot_sdata_genes
    plot_instance_density
```

### Proteomics plots

```{eval-rst}

.. currentmodule:: harpy.pl

.. autosummary::
    :toctree: generated

    cluster_intensity_heatmap

    pixel_clusters
    pixel_clusters_heatmap

    snr_ratio
    group_snr_ratio
    snr_clustermap
    signal_clustermap
    clustermap
```

### Transcriptomics plots

```{eval-rst}

.. currentmodule:: harpy.pl

.. autosummary::
    :toctree: generated

    plot_transcript_density
```

## Utils

Utility functions.

```{eval-rst}

.. module:: harpy.utils
.. currentmodule:: harpy

.. autosummary::
    :toctree: generated

    utils.RasterAggregator
    utils.Featurizer
    utils.kronos_embedding
    utils.bounding_box_query
```

## Datasets

Dataset loaders.

```{eval-rst}

.. module:: harpy.datasets
.. currentmodule:: harpy

.. autosummary::
    :toctree: generated

    datasets.cluster_blobs
    datasets.multisample_blobs
    datasets.pixie_example
    datasets.macsima_example
    datasets.macsima_colorectal_carcinoma
    datasets.macsima_colorectal_carcinoma_course
    datasets.macsima_tonsil
    datasets.codex_example
    datasets.mibi_example
    datasets.vectra_example
    datasets.resolve_example
    datasets.merscope_mouse_liver
    datasets.xenium_human_lung_cancer
    datasets.xenium_human_ovarian_cancer
    datasets.xenium_human_ovarian_cancer_course
    datasets.visium_hd_example
    datasets.visium_hd_example_custom_binning
    datasets.get_registry
    datasets.get_spatialdata_registry
```
