wsi-patching 0.5.0__tar.gz → 0.5.2__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.
Files changed (101) hide show
  1. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/.github/workflows/docs.yml +2 -2
  2. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/PKG-INFO +8 -8
  3. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/README.md +7 -7
  4. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/docs/installation.md +2 -2
  5. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/core/pipeline.py +15 -20
  6. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/.github/workflows/integration_tests.yaml +0 -0
  7. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/.github/workflows/publish.yaml +0 -0
  8. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/.github/workflows/unit_tests.yaml +0 -0
  9. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/.gitignore +0 -0
  10. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/LICENSE +0 -0
  11. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/docs/concepts.md +0 -0
  12. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/docs/extending.md +0 -0
  13. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/docs/index.md +0 -0
  14. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/docs/quickstart.md +0 -0
  15. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/docs/reference.md +0 -0
  16. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/examples/numpy_stream_writer_demo.py +0 -0
  17. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/examples/torch_stream_writer_demo.py +0 -0
  18. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/examples/webdataset_materialize_writer_demo.py +0 -0
  19. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/mkdocs.yml +0 -0
  20. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/pyproject.toml +0 -0
  21. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/__init__.py +0 -0
  22. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/annotations/__init__.py +0 -0
  23. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/annotations/add_cell_annotation_from_csv.py +0 -0
  24. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/assets/models/cellvit_tissue_detector.pt +0 -0
  25. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/backends/__init__.py +0 -0
  26. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/backends/cupy_numpy.py +0 -0
  27. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/backends/fastslide.py +0 -0
  28. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/backends/torch_device.py +0 -0
  29. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/core/__init__.py +0 -0
  30. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/core/chunking_and_batching.py +0 -0
  31. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/core/types/__init__.py +0 -0
  32. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/core/types/types.py +0 -0
  33. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/core/types/util_types.py +0 -0
  34. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/core/wsi_grid.py +0 -0
  35. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/custom_component/__init__.py +0 -0
  36. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/encoders/__init__.py +0 -0
  37. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/encoders/pngencoder.py +0 -0
  38. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/filtering/__init__.py +0 -0
  39. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/filtering/cellvit_tissue_classifier_filter.py +0 -0
  40. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/filtering/low_contrast_background_filter.py +0 -0
  41. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/filtering/otsu_filter.py +0 -0
  42. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/filtering/pen_artifact_filter.py +0 -0
  43. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/py.typed +0 -0
  44. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/regions_of_interest/__init__.py +0 -0
  45. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/regions_of_interest/attach_rois.py +0 -0
  46. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/regions_of_interest/roi_providers.py +0 -0
  47. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/regions_of_interest/rois.py +0 -0
  48. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/transforms/__init__.py +0 -0
  49. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/transforms/macenko_normalizer.py +0 -0
  50. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/transforms/reinhard_normalizer.py +0 -0
  51. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/utils/__init__.py +0 -0
  52. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/utils/logging_config.py +0 -0
  53. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/utils/meta_typing.py +0 -0
  54. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/utils/profiling.py +0 -0
  55. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/utils/wsi_thumbnail_visualization.py +0 -0
  56. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/__init__.py +0 -0
  57. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/materialize_writers/__init__.py +0 -0
  58. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/materialize_writers/materialize_writer_base.py +0 -0
  59. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/materialize_writers/webdataset/__init__.py +0 -0
  60. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/materialize_writers/webdataset/webdataset_loader.py +0 -0
  61. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/materialize_writers/webdataset/webdataset_writer.py +0 -0
  62. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/stream_writers/__init__.py +0 -0
  63. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/stream_writers/numpy_stream_writer.py +0 -0
  64. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/stream_writers/stream_writer_base.py +0 -0
  65. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/src/wsi_patching/writers/stream_writers/torch_stream_writer.py +0 -0
  66. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/benchmarks/conftest.py +0 -0
  67. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/benchmarks/test_benchmark_pipeline.py +0 -0
  68. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/benchmarks/test_benchmark_png_encoding.py +0 -0
  69. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/benchmarks/test_benchmark_tile_planning.py +0 -0
  70. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/integration/conftest.py +0 -0
  71. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/integration/test_materialize_pipeline.py +0 -0
  72. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/integration/test_resample_pipeline.py +0 -0
  73. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/integration/test_roi_pipeline.py +0 -0
  74. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/integration/test_streaming_pipeline.py +0 -0
  75. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/.gitkeep +0 -0
  76. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/annotations/test_add_cell_annotation_from_csv.py +0 -0
  77. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/backends/test_cupy_numpy.py +0 -0
  78. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/backends/test_fastslide.py +0 -0
  79. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/backends/test_torch_device.py +0 -0
  80. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/core/test_chunking_and_batching.py +0 -0
  81. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/core/test_pipeline.py +0 -0
  82. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/core/test_wsi_grid.py +0 -0
  83. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/filtering/test_cellvit_tissue_classifier_filter.py +0 -0
  84. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/filtering/test_low_contrast_background_filter.py +0 -0
  85. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/filtering/test_otsu_filter.py +0 -0
  86. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/filtering/test_pen_artifact_filter.py +0 -0
  87. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/regions_of_interest/test_attach_rois.py +0 -0
  88. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/regions_of_interest/test_roi_providers.py +0 -0
  89. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/regions_of_interest/test_rois.py +0 -0
  90. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/transforms/test_macenko_normalizer.py +0 -0
  91. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/transforms/test_reinhard_normalizer.py +0 -0
  92. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/utils/test_logging_config.py +0 -0
  93. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/utils/test_meta_typing.py +0 -0
  94. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/utils/test_profiling.py +0 -0
  95. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/writers/materialize_writers/test_materialize_writer_base.py +0 -0
  96. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/writers/materialize_writers/webdataset/test_webdataset_loader.py +0 -0
  97. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/writers/materialize_writers/webdataset/test_webdataset_writer.py +0 -0
  98. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/writers/stream_writers/test_numpy_stream_writer.py +0 -0
  99. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/writers/stream_writers/test_stream_writer_base.py +0 -0
  100. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/tests/unit/src/wsi_patching/writers/stream_writers/test_torch_stream_writer.py +0 -0
  101. {wsi_patching-0.5.0 → wsi_patching-0.5.2}/uv.lock +0 -0
@@ -6,8 +6,8 @@ on:
6
6
  paths:
7
7
  - docs/**
8
8
  - mkdocs.yml
9
- # tags:
10
- # - "v*.*.*"
9
+ tags:
10
+ - "v*.*.*"
11
11
 
12
12
  permissions:
13
13
  contents: write
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wsi-patching
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: A High Performance Patching Library for Digital Pathology AI dataset creation.
5
5
  Project-URL: Homepage, https://github.com/amspath/wsi-patching-pipeline
6
6
  Project-URL: Repository, https://github.com/amspath/wsi-patching-pipeline
@@ -79,23 +79,23 @@ A pragmatic pipeline for streaming whole-slide image (WSI) patches with region p
79
79
  Python ≥3.10 <3.14 is recommended. 3.14 is yet unsupported.
80
80
  ```
81
81
  # CPU install
82
- pip install "wsi-patching @ git+https://github.com/amspath/wsi-patching-pipeline.git"
82
+ pip install wsi-patching
83
83
 
84
84
  # GPU install
85
- pip install "wsi-patching[gpu] @ git+https://github.com/amspath/wsi-patching-pipeline.git"
85
+ pip install wsi-patching[gpu]
86
86
  ```
87
87
  > For some stages, GPUs are required, and thus the GPU install is required.
88
88
 
89
89
 
90
90
  ## 2) Checkout the examples
91
- `numpy_mem_writer_demo.py` shows you how to build a basic pipeline for patching up a wsi in memory, without the need of writing to disk (RAM heavy for larger datasets, obviously).
91
+ `torch_stream_writer_demo.py` shows you how to build a basic pipeline for patching up a wsi in memory, without the need of writing to disk (RAM heavy for larger datasets, obviously).
92
92
  ```python
93
93
  p = (
94
- WSIGrid(slides=slides, resolution=0, unit="level", use_gpu=True)
95
- .then(PatchExtractor(tile_size=256, stride=256, max_batch_size=800, num_workers=4))
96
- .then(LowContrastBackgroundFilter(range_threshold=0.2))
94
+ WSIGrid(slides=slides, resolution=2, unit="level", use_gpu=True)
95
+ .then(PatchExtractor(tile_size=256, stride=256))
96
+ .then(PenArtifactFilter())
97
97
  .then(ReinhardNormalizer())
98
- .to(NumpyMemoryWriter(layout="NCHW"))
98
+ .to(TorchStreamWriter(layout="NCHW"))
99
99
  )
100
100
  stream = p.stream(num_workers=4)
101
101
  for wsi_id, final_images, final_coords, meta in stream:
@@ -17,23 +17,23 @@ A pragmatic pipeline for streaming whole-slide image (WSI) patches with region p
17
17
  Python ≥3.10 <3.14 is recommended. 3.14 is yet unsupported.
18
18
  ```
19
19
  # CPU install
20
- pip install "wsi-patching @ git+https://github.com/amspath/wsi-patching-pipeline.git"
20
+ pip install wsi-patching
21
21
 
22
22
  # GPU install
23
- pip install "wsi-patching[gpu] @ git+https://github.com/amspath/wsi-patching-pipeline.git"
23
+ pip install wsi-patching[gpu]
24
24
  ```
25
25
  > For some stages, GPUs are required, and thus the GPU install is required.
26
26
 
27
27
 
28
28
  ## 2) Checkout the examples
29
- `numpy_mem_writer_demo.py` shows you how to build a basic pipeline for patching up a wsi in memory, without the need of writing to disk (RAM heavy for larger datasets, obviously).
29
+ `torch_stream_writer_demo.py` shows you how to build a basic pipeline for patching up a wsi in memory, without the need of writing to disk (RAM heavy for larger datasets, obviously).
30
30
  ```python
31
31
  p = (
32
- WSIGrid(slides=slides, resolution=0, unit="level", use_gpu=True)
33
- .then(PatchExtractor(tile_size=256, stride=256, max_batch_size=800, num_workers=4))
34
- .then(LowContrastBackgroundFilter(range_threshold=0.2))
32
+ WSIGrid(slides=slides, resolution=2, unit="level", use_gpu=True)
33
+ .then(PatchExtractor(tile_size=256, stride=256))
34
+ .then(PenArtifactFilter())
35
35
  .then(ReinhardNormalizer())
36
- .to(NumpyMemoryWriter(layout="NCHW"))
36
+ .to(TorchStreamWriter(layout="NCHW"))
37
37
  )
38
38
  stream = p.stream(num_workers=4)
39
39
  for wsi_id, final_images, final_coords, meta in stream:
@@ -5,13 +5,13 @@ Python **≥ 3.10, < 3.14** is required. Python 3.14 is not yet supported.
5
5
  ## CPU
6
6
 
7
7
  ```bash
8
- pip install "wsi-patching @ git+https://github.com/amspath/wsi-patching-pipeline.git"
8
+ pip install wsi-patching
9
9
  ```
10
10
 
11
11
  ## GPU
12
12
 
13
13
  ```bash
14
- pip install "wsi-patching[gpu] @ git+https://github.com/amspath/wsi-patching-pipeline.git"
14
+ pip install wsi-patching[gpu]
15
15
  ```
16
16
 
17
17
  The `[gpu]` extra adds `torch`, `torchvision`, and `cupy-cuda12x` (Linux only). The following components require it:
@@ -46,6 +46,16 @@ def _tname(t: Any) -> str:
46
46
  return str(t)
47
47
 
48
48
 
49
+ def _signal_end_of_queue(queue: Queue, stop_event: Event) -> None:
50
+ while True:
51
+ try:
52
+ queue.put(EndOfQueue(), block=True, timeout=0.5)
53
+ return
54
+ except Full:
55
+ if stop_event.is_set():
56
+ return
57
+
58
+
49
59
  class Stage(ContextAware, metaclass=StageMeta):
50
60
  input_type: Any = object
51
61
  output_type: Any = object
@@ -228,18 +238,12 @@ class Pipeline(Stage):
228
238
  except GeneratorExit:
229
239
  self.log.info("Consumer stopped early; terminating producers.")
230
240
  stop_event.set()
231
- try:
232
- producer_queue.put(EndOfQueue(), block=True, timeout=0.5)
233
- except Exception:
234
- pass
241
+ _signal_end_of_queue(producer_queue, stop_event)
235
242
  stop_all()
236
243
  raise
237
244
  except Exception:
238
245
  stop_event.set()
239
- try:
240
- producer_queue.put(EndOfQueue(), block=True, timeout=0.5)
241
- except Exception:
242
- pass
246
+ _signal_end_of_queue(producer_queue, stop_event)
243
247
  stop_all()
244
248
  raise
245
249
  finally:
@@ -273,10 +277,7 @@ class Pipeline(Stage):
273
277
  self.log.info("Materialization completed.")
274
278
  except Exception:
275
279
  stop_event.set()
276
- try:
277
- producer_queue.put(EndOfQueue(), block=True, timeout=0.5)
278
- except Exception:
279
- pass
280
+ _signal_end_of_queue(producer_queue, stop_event)
280
281
  stop_all()
281
282
  raise
282
283
  finally:
@@ -378,10 +379,7 @@ class Pipeline(Stage):
378
379
  def stop_all():
379
380
  with kill_lock:
380
381
  stop_event.set()
381
- try:
382
- queue.put(EndOfQueue(), block=True, timeout=0.5)
383
- except Exception:
384
- pass
382
+ _signal_end_of_queue(queue, stop_event)
385
383
 
386
384
  def supervisor():
387
385
  try:
@@ -414,10 +412,7 @@ class Pipeline(Stage):
414
412
  received += 1
415
413
  finally:
416
414
  # Always signal writer; avoid blocking forever
417
- try:
418
- queue.put(EndOfQueue(), block=True, timeout=0.5)
419
- except Exception:
420
- pass
415
+ _signal_end_of_queue(queue, stop_event)
421
416
 
422
417
  sup = Thread(target=supervisor, name="supervisor", daemon=True)
423
418
  sup.start()
File without changes
File without changes
File without changes
File without changes
File without changes