Skip to content

Commit

Permalink
Sc 33 region props (#152)
Browse files Browse the repository at this point in the history
* SC_33 calculate intensity

* SC_33 unit tests

* SC_33 add test zarr

* SC_33 align masks

* SC_33 unit test align mask

* SC_33 typo

* SC_33 support for appending

* SC_33 update docs

* SC_33 update toml and tox
  • Loading branch information
ArneDefauw authored Oct 23, 2023
1 parent 9102bd3 commit a24d31c
Show file tree
Hide file tree
Showing 43 changed files with 1,623 additions and 266 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ logs

notebooks

# test data
src/napari_sparrow/_tests/test_data/*
!src/napari_sparrow/_tests/test_data/20272_slide1_A1-1_DAPI_4288_2144.tiff
!src/napari_sparrow/_tests/test_data/20272_slide1_A1-1_results_4288_2144.txt
!src/napari_sparrow/_tests/test_data/dummy_markers.csv

# Add exection for example configs for resolve and vizgen
!configs/allocate/resolve_liver.yaml
!configs/allocate/vizgen_example.yaml
Expand Down
3 changes: 3 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Operations on images.
im.segment
im.transcript_density
im.combine
im.align_labels_layers
```

## Shape
Expand Down Expand Up @@ -86,6 +87,8 @@ Operations on tables (`AnnData` object).
tb.correct_marker_genes
tb.cluster_cleanliness
tb.nhood_enrichment
tb.allocate_intensity
tb.add_regionprop_features
```

## Plotting
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ build-backend = "setuptools.build_meta"

# pyproject.toml file content
[tool.coverage.run]
omit = ["src/napari_sparrow/_tests/*", "experiments/*"]
omit = ["src/napari_sparrow/_tests/*", "experiments/*", "src/napari_sparrow/widgets/*" ]
10 changes: 10 additions & 0 deletions src/napari_sparrow/_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from hydra.core.global_hydra import GlobalHydra
from hydra.core.hydra_config import HydraConfig
from omegaconf import DictConfig
from spatialdata import read_zarr


@pytest.fixture(scope='function')
Expand Down Expand Up @@ -48,3 +49,12 @@ def cfg_pipeline(cfg_pipeline_global, tmp_path) -> DictConfig:
yield cfg

GlobalHydra.instance().clear()


@pytest.fixture
def sdata_multi_c():
root = str(pyrootutils.setup_root(os.getcwd(), dotenv=True, pythonpath=True))
path = f"{root}/src/napari_sparrow/_tests/test_data/multi_channel_zarr"
sdata_path = os.path.join(path, "sdata.zarr")
sdata = read_zarr(sdata_path)
yield sdata
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
{
"channels_metadata": {
"channels": [
{
"label": 0
},
{
"label": 1
},
{
"label": 2
},
{
"label": 3
},
{
"label": 4
},
{
"label": 5
},
{
"label": 6
},
{
"label": 7
},
{
"label": 8
},
{
"label": 9
},
{
"label": 10
},
{
"label": 11
},
{
"label": 12
},
{
"label": 13
},
{
"label": 14
},
{
"label": 15
},
{
"label": 16
},
{
"label": 17
},
{
"label": 18
},
{
"label": 19
},
{
"label": 20
},
{
"label": 21
}
]
},
"multiscales": [
{
"axes": [
{
"name": "c",
"type": "channel"
},
{
"name": "y",
"type": "space"
},
{
"name": "x",
"type": "space"
}
],
"coordinateTransformations": [
{
"input": {
"axes": [
{
"name": "c",
"type": "channel"
},
{
"name": "y",
"type": "space",
"unit": "unit"
},
{
"name": "x",
"type": "space",
"unit": "unit"
}
],
"name": "cyx"
},
"output": {
"axes": [
{
"name": "c",
"type": "channel"
},
{
"name": "y",
"type": "space",
"unit": "unit"
},
{
"name": "x",
"type": "space",
"unit": "unit"
}
],
"name": "global"
},
"type": "identity"
}
],
"datasets": [
{
"coordinateTransformations": [
{
"scale": [
1.0,
1.0,
1.0
],
"type": "scale"
}
],
"path": "0"
}
],
"name": "/images/raw_image",
"version": "0.4"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"chunks": [
22,
512,
512
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dimension_separator": "/",
"dtype": "<f4",
"fill_value": 0.0,
"filters": null,
"order": "C",
"shape": [
22,
512,
512
],
"zarr_format": 2
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"labels": [
"masks_whole",
"masks_whole",
"masks_nuclear",
"masks_nuclear_aligned",
"masks_nuclear_aligned",
"masks_nuclear_aligned",
"masks_nuclear_aligned",
"masks_nuclear_aligned",
"masks_nuclear_aligned",
"masks_nuclear_aligned",
"masks_nuclear_aligned",
"masks_nuclear_aligned"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"image-label": {
"version": "0.4"
},
"multiscales": [
{
"axes": [
{
"name": "y",
"type": "space"
},
{
"name": "x",
"type": "space"
}
],
"coordinateTransformations": [
{
"input": {
"axes": [
{
"name": "y",
"type": "space",
"unit": "unit"
},
{
"name": "x",
"type": "space",
"unit": "unit"
}
],
"name": "yx"
},
"output": {
"axes": [
{
"name": "y",
"type": "space",
"unit": "unit"
},
{
"name": "x",
"type": "space",
"unit": "unit"
}
],
"name": "global"
},
"type": "identity"
}
],
"datasets": [
{
"coordinateTransformations": [
{
"scale": [
1.0,
1.0
],
"type": "scale"
}
],
"path": "0"
}
],
"name": "masks_nuclear",
"version": "0.4"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"chunks": [
512,
512
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dimension_separator": "/",
"dtype": "<i4",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
512,
512
],
"zarr_format": 2
}
Binary file not shown.
Loading

0 comments on commit a24d31c

Please sign in to comment.