pma-python 2.0.0.182__tar.gz → 2.0.0.183__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 (20) hide show
  1. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/PKG-INFO +1 -1
  2. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/README.md +5 -5
  3. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python/core.py +27 -15
  4. pma_python-2.0.0.183/pma_python/version.py +1 -0
  5. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python.egg-info/PKG-INFO +1 -1
  6. pma_python-2.0.0.182/pma_python/version.py +0 -1
  7. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/long_desc.txt +0 -0
  8. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python/__init__.py +0 -0
  9. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python/control.py +0 -0
  10. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python/core_admin.py +0 -0
  11. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python/pma.py +0 -0
  12. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python/pma_core_client.py +0 -0
  13. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python/view.py +0 -0
  14. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python.egg-info/SOURCES.txt +0 -0
  15. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python.egg-info/dependency_links.txt +0 -0
  16. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python.egg-info/not-zip-safe +0 -0
  17. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python.egg-info/requires.txt +0 -0
  18. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/pma_python.egg-info/top_level.txt +0 -0
  19. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/setup.cfg +0 -0
  20. {pma_python-2.0.0.182 → pma_python-2.0.0.183}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pma_python
3
- Version: 2.0.0.182
3
+ Version: 2.0.0.183
4
4
  Summary: Universal viewing of digital microscopy, whole slide imaging and digital pathology data
5
5
  Home-page: https://github.com/pathomation/pma_python
6
6
  Author: Pathomation
@@ -1,8 +1,8 @@
1
1
  # pma_python
2
- pma_python is a Python wrapper library for PMA.start (http://free.pathomation.com),
2
+ pma_python is a Python wrapper library for PMA.core ([https://www.pathomation.com](https://www.pathomation.com)),
3
3
  a universal viewer by Pathomation for whole slide imaging and microscopy.
4
4
 
5
- YOU NEED TO HAVE PMA.START (OR PMA.CORE) RUNNING IN ORDER TO USE THIS
5
+ YOU NEED TO HAVE PMA.core (or PMA.START) RUNNING IN ORDER TO USE THIS
6
6
  LIBRARY. PMA_PYTHON IS NOT A STAND-ALONE LIBRARY FOR WSI.
7
7
 
8
8
  If you're working with
@@ -16,10 +16,10 @@ select those provided for you)
16
16
  just wish there was a way to now automatically evaluate it on
17
17
  100s of slides (batch processing)
18
18
 
19
- and you're doing all of this in Python, then PMA.start and
19
+ and you're doing all of this in Python, then PMA.core (or PMA.start) and
20
20
  pma_python are for you!
21
21
 
22
- PMA.start can be downloaded free of charge from http://free.pathomation.com
22
+ PMA.start can be downloaded from [https://www.pathomation.com/pmastart](https://www.pathomation.com/pmastart)
23
23
 
24
24
  With pma_python, you can inspect and navigate any type of
25
25
  microscopic imaging file format available. Whether you have
@@ -51,7 +51,7 @@ The following vendor formats are currently supported:
51
51
  * Perkin Elmer (.qptiff)
52
52
 
53
53
  The most up to date list with supported file formats can be found at
54
- http://free.pathomation.com/formats
54
+ [http://www.pathomation.com/formats](https://www.pathomation.com/formats)
55
55
 
56
56
  ## Installation from source
57
57
  To install from pypi
@@ -1901,7 +1901,30 @@ def get_annotation_distance(slideRef, layerID, annotationID, sessionID=None, ver
1901
1901
  # **************************************#
1902
1902
  # === Uploader === #
1903
1903
  # **************************************#
1904
+ FOUR_GB = 4 * 1024 * 1024 * 1024
1904
1905
  FIVE_GB = 5 * 1024 * 1024 * 1024
1906
+
1907
+ def _get_slide_package_size(slide_path: str) -> tuple[int, int]:
1908
+ """Return total bytes and maximum single-file bytes for a slide package."""
1909
+ total_size = 0
1910
+ max_size = 0
1911
+
1912
+ files = [slide_path]
1913
+ slide_name_no_ext = os.path.splitext(os.path.basename(slide_path))[0]
1914
+ slide_dir = os.path.join(os.path.dirname(slide_path), slide_name_no_ext)
1915
+
1916
+ if os.path.isdir(slide_dir):
1917
+ for root, _, filenames in os.walk(slide_dir):
1918
+ for filename in filenames:
1919
+ files.append(os.path.join(root, filename))
1920
+
1921
+ for filepath in files:
1922
+ size = os.stat(filepath).st_size
1923
+ total_size += size
1924
+ max_size = max(max_size, size)
1925
+
1926
+ return total_size, max_size
1927
+
1905
1928
  async def upload(
1906
1929
  *,
1907
1930
  pma_core_url: str,
@@ -1925,21 +1948,10 @@ async def upload(
1925
1948
  # ================================
1926
1949
  # CALCULATE TOTAL SLIDE SIZE
1927
1950
  # ================================
1928
- total_size = 0
1929
-
1930
- # main file size
1931
- total_size += os.stat(slide_path).st_size
1932
-
1933
- # possible slide folder (multi-files slides)
1934
- slide_name_no_ext = os.path.splitext(os.path.basename(slide_path))[0]
1935
- slide_dir = os.path.join(os.path.dirname(slide_path), slide_name_no_ext)
1936
-
1937
- if os.path.isdir(slide_dir):
1938
- for root, _, files in os.walk(slide_dir):
1939
- for f in files:
1940
- total_size += os.stat(os.path.join(root, f)).st_size
1951
+ total_size, max_file_size = _get_slide_package_size(slide_path)
1941
1952
 
1942
1953
  print("Total slide size:", round(total_size / (1024 ** 3), 2), "GB")
1954
+ print("Largest single file:", round(max_file_size / (1024 ** 3), 2), "GB")
1943
1955
 
1944
1956
  # ================================
1945
1957
  # CHECK UPLOAD TYPE (PRE-FLIGHT)
@@ -1981,8 +1993,8 @@ async def upload(
1981
1993
  progress_callback=progress_callback
1982
1994
  )
1983
1995
 
1984
- # Otherwise fallback to size logic
1985
- if total_size < FIVE_GB:
1996
+ # Otherwise choose based on total package size or safe single-request cap
1997
+ if total_size < FOUR_GB and max_file_size < FIVE_GB:
1986
1998
  print("Using SMALL file uploader")
1987
1999
 
1988
2000
  return upload_legacy(
@@ -0,0 +1 @@
1
+ __version__ = '2.0.0.183'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pma_python
3
- Version: 2.0.0.182
3
+ Version: 2.0.0.183
4
4
  Summary: Universal viewing of digital microscopy, whole slide imaging and digital pathology data
5
5
  Home-page: https://github.com/pathomation/pma_python
6
6
  Author: Pathomation
@@ -1 +0,0 @@
1
- __version__ = '2.0.0.182'
File without changes
File without changes