dsa-helpers 1.1.6.dev0__tar.gz → 1.1.7.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dsa_helpers-1.1.6.dev0/dsa_helpers.egg-info → dsa_helpers-1.1.7.dev0}/PKG-INFO +1 -1
- dsa_helpers-1.1.7.dev0/docker/Dockerfile +6 -0
- dsa_helpers-1.1.7.dev0/docker/README.md +4 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/__init__.py +1 -1
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/segformer_semantic_segmentation/inference.py +2 -2
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/tiling.py +31 -25
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0/dsa_helpers.egg-info}/PKG-INFO +1 -1
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers.egg-info/SOURCES.txt +2 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/pyproject.toml +4 -1
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/.gitignore +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/.readthedocs.yaml +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/LICENSE +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/README.md +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/app.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dev.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/docs/requirements.txt +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/docs/source/conf.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/docs/source/index.rst +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/cli_utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/dash/__init__.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/dash/dash_paperdragon_utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/dash/header.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/dash/header_callbacks.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/girder_utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/gpd_utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/image_utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/imread.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/imwrite.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/__init__.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/callbacks.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/datasets/SegFormerSegmentationDataset.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/datasets/__init__.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/datasets/utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/evaluate.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/metrics.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/object_detection/__init__.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/object_detection/get_pearce_roi_images.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/object_detection/tile_image.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/object_detection/utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/segformer_semantic_segmentation/__init__.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/segformer_semantic_segmentation/datasets.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/segformer_semantic_segmentation/evaluate.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/segformer_semantic_segmentation/train.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/segformer_semantic_segmentation/transforms.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/segformer_semantic_segmentation/utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/transforms/__init__.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/transforms/segformer_transforms.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/mongo_utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/tile_utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/utils.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers.egg-info/dependency_links.txt +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers.egg-info/requires.txt +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers.egg-info/top_level.txt +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/setup.cfg +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/tests/app/Dockerfile +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/tests/app/app.py +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/tests/docker-compose.yaml +0 -0
- {dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/tests/test.ipynb +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dsa_helpers
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.7.dev0
|
|
4
4
|
Summary: Utility functions for working with the DSA girder client.
|
|
5
5
|
Author-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
|
|
6
6
|
Maintainer-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
FROM pytorch/pytorch:2.7.0-cuda11.8-cudnn9-runtime
|
|
2
|
+
|
|
3
|
+
# Dependencies for OpenCV.
|
|
4
|
+
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
|
|
5
|
+
RUN pip install --no-cache-dir dsa-helpers
|
|
6
|
+
RUN pip install large-image[all] --find-links https://girder.github.io/large_image_wheels
|
|
@@ -10,8 +10,8 @@ import geopandas as gpd
|
|
|
10
10
|
from shapely.affinity import scale
|
|
11
11
|
import pandas as pd
|
|
12
12
|
|
|
13
|
-
from
|
|
14
|
-
from
|
|
13
|
+
from ...image_utils import label_mask_to_polygons
|
|
14
|
+
from ...gpd_utils import remove_gdf_overlaps
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def inference(
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
1
|
"""Functions for tiling images.
|
|
3
2
|
|
|
4
3
|
Functions:
|
|
@@ -7,6 +6,7 @@ Functions:
|
|
|
7
6
|
- tile_image_with_mask: Tile an image and its corresponding mask.
|
|
8
7
|
|
|
9
8
|
"""
|
|
9
|
+
|
|
10
10
|
import large_image
|
|
11
11
|
import cv2 as cv
|
|
12
12
|
import numpy as np
|
|
@@ -24,12 +24,12 @@ def _proccess_tile_with_masks_from_dsa_annotations(
|
|
|
24
24
|
gdf,
|
|
25
25
|
ts,
|
|
26
26
|
prepend_name,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
scan_x,
|
|
28
|
+
scan_y,
|
|
29
29
|
scan_tile_size,
|
|
30
30
|
tile_size,
|
|
31
31
|
mag,
|
|
32
|
-
|
|
32
|
+
scan_to_mag_sf,
|
|
33
33
|
img_dir,
|
|
34
34
|
mask_dir,
|
|
35
35
|
edge_value,
|
|
@@ -38,12 +38,13 @@ def _proccess_tile_with_masks_from_dsa_annotations(
|
|
|
38
38
|
ignore_existing,
|
|
39
39
|
ignore_id,
|
|
40
40
|
ignore_value,
|
|
41
|
-
|
|
41
|
+
label_col,
|
|
42
|
+
ignore_labels,
|
|
42
43
|
):
|
|
43
44
|
"""Processing tiles with masks, used in multiprocessing only."""
|
|
44
45
|
# Calcualte the x and y at magnification desired.
|
|
45
|
-
x_mag = int(
|
|
46
|
-
y_mag = int(
|
|
46
|
+
x_mag = int(scan_x * scan_to_mag_sf)
|
|
47
|
+
y_mag = int(scan_y * scan_to_mag_sf)
|
|
47
48
|
|
|
48
49
|
# Format the filepath to save the tile.
|
|
49
50
|
fn = f"{prepend_name}x{x_mag}y{y_mag}.png"
|
|
@@ -57,10 +58,10 @@ def _proccess_tile_with_masks_from_dsa_annotations(
|
|
|
57
58
|
# Get the tile.
|
|
58
59
|
img = ts.getRegion(
|
|
59
60
|
region={
|
|
60
|
-
"left":
|
|
61
|
-
"top":
|
|
62
|
-
"right":
|
|
63
|
-
"bottom":
|
|
61
|
+
"left": scan_x,
|
|
62
|
+
"top": scan_y,
|
|
63
|
+
"right": scan_x + scan_tile_size,
|
|
64
|
+
"bottom": scan_y + scan_tile_size,
|
|
64
65
|
},
|
|
65
66
|
format=large_image.constants.TILE_FORMAT_NUMPY,
|
|
66
67
|
scale={"magnification": mag},
|
|
@@ -99,10 +100,19 @@ def _proccess_tile_with_masks_from_dsa_annotations(
|
|
|
99
100
|
tile_gdf, (h, w), default_value=background_id
|
|
100
101
|
).copy()
|
|
101
102
|
|
|
102
|
-
if
|
|
103
|
+
if ignore_labels is not None and len(ignore_labels):
|
|
104
|
+
ignore_gdf = tile_gdf[tile_gdf[label_col].isin(ignore_labels)].copy()
|
|
105
|
+
ignore_gdf["idx"] = [1] * len(ignore_gdf)
|
|
106
|
+
|
|
107
|
+
# Create a mask of the ignore labels.
|
|
108
|
+
ignore_mask = draw_gdf_on_array(
|
|
109
|
+
ignore_gdf,
|
|
110
|
+
(h, w),
|
|
111
|
+
).copy()
|
|
112
|
+
|
|
103
113
|
# Apply the ignore ids to the image and mask.
|
|
104
|
-
img[np.
|
|
105
|
-
mask[np.
|
|
114
|
+
img[np.where(ignore_mask == 1)] = ignore_value
|
|
115
|
+
mask[np.where(ignore_mask == 1)] = ignore_id
|
|
106
116
|
|
|
107
117
|
# Save the tile image and mask.
|
|
108
118
|
imwrite(img_fp, img)
|
|
@@ -192,11 +202,6 @@ def tile_wsi_with_masks_from_dsa_annotations(
|
|
|
192
202
|
if isinstance(ignore_labels, str):
|
|
193
203
|
ignore_labels = [ignore_labels]
|
|
194
204
|
|
|
195
|
-
if ignore_labels is not None:
|
|
196
|
-
ignore_ids = [label2id[label] for label in ignore_labels]
|
|
197
|
-
else:
|
|
198
|
-
ignore_ids = None
|
|
199
|
-
|
|
200
205
|
# Read the tile source.
|
|
201
206
|
ts = large_image.getTileSource(wsi_fp)
|
|
202
207
|
|
|
@@ -242,10 +247,10 @@ def tile_wsi_with_masks_from_dsa_annotations(
|
|
|
242
247
|
gdf["idx"] = gdf[label_col].map(label2id)
|
|
243
248
|
|
|
244
249
|
# Get the top left corner of every tile in the WSI, at scan mag.
|
|
245
|
-
|
|
246
|
-
(
|
|
247
|
-
for
|
|
248
|
-
for
|
|
250
|
+
scan_xys = [
|
|
251
|
+
(scan_x, scan_y)
|
|
252
|
+
for scan_x in range(0, ts_metadata["sizeX"], scan_stride)
|
|
253
|
+
for scan_y in range(0, ts_metadata["sizeY"], scan_stride)
|
|
249
254
|
]
|
|
250
255
|
|
|
251
256
|
# Create directory to save tile images and masks.
|
|
@@ -277,10 +282,11 @@ def tile_wsi_with_masks_from_dsa_annotations(
|
|
|
277
282
|
ignore_existing,
|
|
278
283
|
ignore_id,
|
|
279
284
|
ignore_value,
|
|
280
|
-
|
|
285
|
+
label_col,
|
|
286
|
+
ignore_labels,
|
|
281
287
|
),
|
|
282
288
|
)
|
|
283
|
-
for xy in
|
|
289
|
+
for xy in scan_xys
|
|
284
290
|
]
|
|
285
291
|
|
|
286
292
|
tile_info = []
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dsa_helpers
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.7.dev0
|
|
4
4
|
Summary: Utility functions for working with the DSA girder client.
|
|
5
5
|
Author-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
|
|
6
6
|
Maintainer-email: "Juan C. Vizcarra" <jvizcar@emory.edu>
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
[tool.setuptools]
|
|
2
|
+
packages = ["dsa_helpers"]
|
|
3
|
+
|
|
1
4
|
[build-system]
|
|
2
5
|
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]"]
|
|
3
6
|
build-backend = "setuptools.build_meta"
|
|
@@ -38,7 +41,7 @@ classifiers = [
|
|
|
38
41
|
"License :: OSI Approved :: MIT License",
|
|
39
42
|
]
|
|
40
43
|
keywords = ["dsa", "girder", "girder_client"]
|
|
41
|
-
version = "v1.1.
|
|
44
|
+
version = "v1.1.7dev0"
|
|
42
45
|
|
|
43
46
|
[project.urls]
|
|
44
47
|
Repository = "https://github.com/Gutman-Lab/dsa-python-utils"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/dash/dash_paperdragon_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/object_detection/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/object_detection/tile_image.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dsa_helpers-1.1.6.dev0 → dsa_helpers-1.1.7.dev0}/dsa_helpers/ml/transforms/segformer_transforms.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|