dsa-helpers 1.0.5.dev0__tar.gz → 1.0.6.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.0.5.dev0/dsa_helpers.egg-info → dsa_helpers-1.0.6.dev0}/PKG-INFO +1 -1
- dsa_helpers-1.0.6.dev0/dsa_helpers/utils.py +66 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0/dsa_helpers.egg-info}/PKG-INFO +1 -1
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/pyproject.toml +1 -1
- dsa_helpers-1.0.5.dev0/dsa_helpers/utils.py +0 -35
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/.gitignore +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/.readthedocs.yaml +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/LICENSE +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/README.md +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/app.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/docs/requirements.txt +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/docs/source/conf.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/docs/source/index.rst +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/__init__.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/cli_utils.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/dash/__init__.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/dash/dash_paperdragon_utils.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/dash/header.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/dash/header_callbacks.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/girder_utils.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/image_utils.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/imread.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/imwrite.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/__init__.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/callbacks.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/datasets/SegFormerSegmentationDataset.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/datasets/__init__.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/datasets/utils.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/evaluate.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/metrics.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/object_detection/__init__.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/object_detection/get_pearce_roi_images.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/object_detection/tile_image.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/object_detection/utils.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/segformer_semantic_segmentation/__init__.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/segformer_semantic_segmentation/inference.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/transforms/__init__.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/transforms/segformer_transforms.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/mongo_utils.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/tile_utils.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/tiling.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers.egg-info/SOURCES.txt +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers.egg-info/dependency_links.txt +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers.egg-info/requires.txt +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers.egg-info/top_level.txt +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/setup.cfg +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/tests/app/Dockerfile +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/tests/app/app.py +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/tests/docker-compose.yaml +0 -0
- {dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/tests/test.ipynb +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dsa_helpers
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.6.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,66 @@
|
|
|
1
|
+
"""Utility functions for DSA Helpers.
|
|
2
|
+
|
|
3
|
+
This module provides various miscellaneous utility functions that are
|
|
4
|
+
not grouped into their own modules.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from shapely.geometry import Polygon
|
|
8
|
+
import numpy as np
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def remove_small_holes(
|
|
12
|
+
polygon: Polygon, hole_area_threshold: float
|
|
13
|
+
) -> Polygon:
|
|
14
|
+
"""Remove small holes from a shapely polygon.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
polygon (shapely.geometry.Polygon): Polygon to remove holes
|
|
18
|
+
from.
|
|
19
|
+
hole_area_threshold (float): Minimum area of a hole to keep it.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
shapely.geometry.Polygon: Polygon with small holes removed.
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
if not polygon.interiors: # if there are no holes, return as is
|
|
26
|
+
return polygon
|
|
27
|
+
|
|
28
|
+
# Filter out small holes
|
|
29
|
+
new_holes = [
|
|
30
|
+
hole
|
|
31
|
+
for hole in polygon.interiors
|
|
32
|
+
if Polygon(hole).area > hole_area_threshold
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
# Create a new polygon with only large holes
|
|
36
|
+
return Polygon(polygon.exterior, new_holes)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def convert_to_json_serializable(
|
|
40
|
+
data: int | float | str | list | dict,
|
|
41
|
+
) -> int | float | str | list | dict:
|
|
42
|
+
"""Convert a list, integer, float, or dictionary into a JSON
|
|
43
|
+
serializable version of the object. Uses recursion to make sure the
|
|
44
|
+
entire input data structure is converted to a JSON serializable
|
|
45
|
+
version.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
data: Object to convert to JSON serializable.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
JSON serializable version of the object.
|
|
52
|
+
"""
|
|
53
|
+
if isinstance(data, np.ndarray):
|
|
54
|
+
return data.tolist()
|
|
55
|
+
elif isinstance(data, np.integer):
|
|
56
|
+
return int(data)
|
|
57
|
+
elif isinstance(data, np.floating):
|
|
58
|
+
return float(data)
|
|
59
|
+
elif isinstance(data, dict):
|
|
60
|
+
return {
|
|
61
|
+
key: convert_to_json_serializable(value)
|
|
62
|
+
for key, value in data.items()
|
|
63
|
+
}
|
|
64
|
+
elif isinstance(data, list):
|
|
65
|
+
return [convert_to_json_serializable(item) for item in data]
|
|
66
|
+
return data
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dsa_helpers
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.6.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,35 +0,0 @@
|
|
|
1
|
-
"""Utility functions for DSA Helpers.
|
|
2
|
-
|
|
3
|
-
This module provides various miscellaneous utility functions that are
|
|
4
|
-
not grouped into their own modules.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from shapely.geometry import Polygon
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def remove_small_holes(
|
|
11
|
-
polygon: Polygon, hole_area_threshold: float
|
|
12
|
-
) -> Polygon:
|
|
13
|
-
"""Remove small holes from a shapely polygon.
|
|
14
|
-
|
|
15
|
-
Args:
|
|
16
|
-
polygon (shapely.geometry.Polygon): Polygon to remove holes
|
|
17
|
-
from.
|
|
18
|
-
hole_area_threshold (float): Minimum area of a hole to keep it.
|
|
19
|
-
|
|
20
|
-
Returns:
|
|
21
|
-
shapely.geometry.Polygon: Polygon with small holes removed.
|
|
22
|
-
|
|
23
|
-
"""
|
|
24
|
-
if not polygon.interiors: # if there are no holes, return as is
|
|
25
|
-
return polygon
|
|
26
|
-
|
|
27
|
-
# Filter out small holes
|
|
28
|
-
new_holes = [
|
|
29
|
-
hole
|
|
30
|
-
for hole in polygon.interiors
|
|
31
|
-
if Polygon(hole).area > hole_area_threshold
|
|
32
|
-
]
|
|
33
|
-
|
|
34
|
-
# Create a new polygon with only large holes
|
|
35
|
-
return Polygon(polygon.exterior, new_holes)
|
|
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.0.5.dev0 → dsa_helpers-1.0.6.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
|
{dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.dev0}/dsa_helpers/ml/object_detection/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.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
|
{dsa_helpers-1.0.5.dev0 → dsa_helpers-1.0.6.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
|
|
File without changes
|