pdnl-process 0.1__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.
@@ -0,0 +1,29 @@
1
+ name: Upload Python Package to PyPI when a Release is Created
2
+
3
+ # build the documentation whenever there are new commits on main
4
+ on:
5
+ push:
6
+
7
+ jobs:
8
+ pypi-publish:
9
+ name: Publish release to PyPI
10
+ runs-on: ubuntu-latest
11
+ environment:
12
+ name: pypi
13
+ url: https://pypi.org/p/pdnl_wildcat
14
+ permissions:
15
+ id-token: write
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v4
20
+ with:
21
+ python-version: "3.x"
22
+ - name: Install dependencies
23
+ run: |
24
+ python -m pip install --upgrade pip
25
+ pip install build
26
+ - name: Build package
27
+ run: python -m build
28
+ - name: Publish package distributions to PyPI
29
+ uses: pypa/gh-action-pypi-publish@release/v1
File without changes
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: pdnl_process
3
+ Version: 0.1
4
+ Summary: PDNL Process
5
+ Project-URL: Homepage, https://github.com/PennCompPathology/pdnl_process
6
+ Author-email: Noah Capp <noahmcapp@gmail.com>
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
13
+ Requires-Python: >=3.9
14
+ Requires-Dist: pdnl-sana
File without changes
@@ -0,0 +1 @@
1
+ from .main import main
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env python3
2
+
3
+ import os
4
+ import sys
5
+ import argparse
6
+ import json
7
+
8
+ import numpy as np
9
+ import pdnl_sana.image
10
+ import pdnl_sana.process
11
+ import pdnl_sana.logging
12
+ import pdnl_sana.filter
13
+
14
+ from matplotlib import pyplot as plt
15
+
16
+ def main():
17
+
18
+ parser = argparse.ArgumentParser()
19
+ parser.add_argument('-i', '--input_file', help="path to image file to process", required=True)
20
+ parser.add_argument('-o', '--output_file', help="path to write outputs to", required=True)
21
+ parser.add_argument('-m', '--mask_file', help="path to mask file to apply to the image", default=None)
22
+ parser.add_argument('-s', '--staining_code', help="stain protocol used to stain the input image", default='H-DAB')
23
+ parser.add_argument('-p', '--parameters_file', help=".json file containing processing parameters", default=None)
24
+ parser.add_argument('--debug', action='store_true', help="plots an output image to analyze")
25
+ args = parser.parse_args()
26
+
27
+ frame = pdnl_sana.image.Frame(args.input_file)
28
+ if args.mask_file:
29
+ mask = pdnl_sana.image.Frame(args.mask_file)
30
+ else:
31
+ mask = None
32
+ if args.parameters_file:
33
+ params = json.load(open(args.parameters_file))
34
+ else:
35
+ params = {}
36
+ print(params)
37
+
38
+ file_name = os.path.splitext(os.path.basename(args.input_file))[0]
39
+ debug_level = 'full' if args.debug else 'normal'
40
+ logger = pdnl_sana.logging.Logger(debug_level, os.path.splitext(args.output_file)[0]+'.pkl')
41
+ print(debug_level)
42
+
43
+ if args.staining_code == 'H-DAB':
44
+ processor = pdnl_sana.process.HDABProcessor(
45
+ logger, frame, main_mask=mask,
46
+ apply_smoothing=params.get('apply_smoothing', False),
47
+ normalize_background=params.get('normalize_background', False),
48
+ stain_vector=params.get('stain_vector', None)
49
+ )
50
+
51
+ out = processor.run(
52
+ triangular_strictness=params.get('triangular_strictness', 0.0),
53
+ minimum_threshold=params.get('minimum_threshold', 0),
54
+ od_threshold=params.get('od_threshold', None),
55
+ morphology_filters=[pdnl_sana.filter.MorphologyFilter(**filter_params) for filter_params in params.get('morphology_filters', [])],
56
+ )['positive_dab']
57
+
58
+ plt.show()
59
+
60
+ out.save(args.output_file)
61
+
62
+ if __name__ == "__main__":
63
+ main()
@@ -0,0 +1,30 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pdnl_process"
7
+ version = "0.1"
8
+ authors = [
9
+ { name="Noah Capp", email="noahmcapp@gmail.com" },
10
+ ]
11
+ description = "PDNL Process"
12
+ dependencies = [
13
+ "pdnl_sana"
14
+ ]
15
+ readme = "README.md"
16
+ requires-python = ">=3.9"
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ "Intended Audience :: Science/Research",
22
+ "Development Status :: 4 - Beta",
23
+ "Topic :: Scientific/Engineering :: Medical Science Apps."
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/PennCompPathology/pdnl_process"
28
+
29
+ [project.scripts]
30
+ pdnl_process = "pdnl_process:main"