pyisyntax 0.1.1__tar.gz → 0.1.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 (75) hide show
  1. {pyisyntax-0.1.1/pyisyntax.egg-info → pyisyntax-0.1.2}/PKG-INFO +7 -1
  2. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/README.md +6 -0
  3. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax/lowlevel/io_management.py +1 -1
  4. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax/lowlevel/libisyntax.py +9 -6
  5. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax/wrapper.py +8 -14
  6. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/builder.py +1 -1
  7. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/examples/isyntax_example.c +1 -3
  8. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/examples/isyntax_to_tiff.c +2 -2
  9. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax.c +11 -0
  10. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_reader.c +1 -1
  11. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_streamer.c +0 -15
  12. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/libisyntax.c +10 -6
  13. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/libisyntax.h +3 -2
  14. {pyisyntax-0.1.1 → pyisyntax-0.1.2/pyisyntax.egg-info}/PKG-INFO +7 -1
  15. pyisyntax-0.1.2/pyisyntax.egg-info/top_level.txt +1 -0
  16. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/pyproject.toml +2 -2
  17. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/tests/test_lowlevel.py +2 -6
  18. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/tests/test_wrapper.py +0 -4
  19. pyisyntax-0.1.1/pyisyntax.egg-info/top_level.txt +0 -2
  20. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/LICENSE +0 -0
  21. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/MANIFEST.in +0 -0
  22. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax/__init__.py +0 -0
  23. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax/lowlevel/__init__.py +0 -0
  24. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/__init__.py +0 -0
  25. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/pyisyntax.c +0 -0
  26. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/src/python_platform_utils.c +0 -0
  27. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/src/python_platform_utils.h +0 -0
  28. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/src/win32_utils.c +0 -0
  29. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/LICENSE.txt +0 -0
  30. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/README.md +0 -0
  31. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax.h +0 -0
  32. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_dwt.c +0 -0
  33. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_reader.h +0 -0
  34. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/isyntax/isyntax_streamer.h +0 -0
  35. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/arena.h +0 -0
  36. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/common.h +0 -0
  37. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/intrinsics.h +0 -0
  38. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/linux_platform.c +0 -0
  39. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/linux_utils.c +0 -0
  40. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/platform.c +0 -0
  41. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/platform.h +0 -0
  42. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/win32_utils.c +0 -0
  43. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/win32_utils.h +0 -0
  44. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/work_queue.c +0 -0
  45. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/platform/work_queue.h +0 -0
  46. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/third_party/ltalloc.cc +0 -0
  47. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/third_party/ltalloc.h +0 -0
  48. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/third_party/stb_ds.h +0 -0
  49. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/third_party/stb_image.h +0 -0
  50. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/third_party/stb_image_write.h +0 -0
  51. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/third_party/stb_sprintf.h +0 -0
  52. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/third_party/yxml.c +0 -0
  53. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/third_party/yxml.h +0 -0
  54. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/benaphore.c +0 -0
  55. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/benaphore.h +0 -0
  56. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/block_allocator.c +0 -0
  57. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/block_allocator.h +0 -0
  58. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/libtiff_api.h +0 -0
  59. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/mathutils.c +0 -0
  60. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/mathutils.h +0 -0
  61. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/memrw.c +0 -0
  62. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/memrw.h +0 -0
  63. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/stringutils.c +0 -0
  64. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/stringutils.h +0 -0
  65. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/timerutils.c +0 -0
  66. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/isyntax_build/vendor/libisyntax/src/utils/timerutils.h +0 -0
  67. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/pyisyntax.egg-info/SOURCES.txt +0 -0
  68. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/pyisyntax.egg-info/dependency_links.txt +0 -0
  69. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/pyisyntax.egg-info/not-zip-safe +0 -0
  70. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/pyisyntax.egg-info/requires.txt +0 -0
  71. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/setup.cfg +0 -0
  72. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/setup.py +0 -0
  73. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/tests/__init__.py +0 -0
  74. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/tests/conftest.py +0 -0
  75. {pyisyntax-0.1.1 → pyisyntax-0.1.2}/tests/data/DOWNLOAD.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyisyntax
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Python bindings for libisyntax
5
5
  Author-email: Aiden Nibali <dismaldenizen@gmail.com>
6
6
  License: MIT
@@ -23,6 +23,12 @@ Requires-Dist: typing_extensions; extra == "dev"
23
23
  A Python library for working with pathology images in the iSyntax file format,
24
24
  powered by [libisyntax](https://github.com/amspath/libisyntax).
25
25
 
26
+ ## Installation
27
+
28
+ ```console
29
+ $ pip install pyisyntax
30
+ ```
31
+
26
32
  ## Usage
27
33
 
28
34
  Read and display a region of the WSI via
@@ -3,6 +3,12 @@
3
3
  A Python library for working with pathology images in the iSyntax file format,
4
4
  powered by [libisyntax](https://github.com/amspath/libisyntax).
5
5
 
6
+ ## Installation
7
+
8
+ ```console
9
+ $ pip install pyisyntax
10
+ ```
11
+
6
12
  ## Usage
7
13
 
8
14
  Read and display a region of the WSI via
@@ -3,7 +3,7 @@ from dataclasses import dataclass
3
3
  from io import BufferedIOBase, RawIOBase
4
4
  from typing import Generic, NewType, TypeVar
5
5
 
6
- from _pyisyntax import ffi, lib
6
+ from isyntax._pyisyntax import ffi, lib
7
7
 
8
8
  VoidPtr = NewType("VoidPtr", object)
9
9
  T = TypeVar("T")
@@ -3,8 +3,7 @@ from enum import IntEnum
3
3
  from pathlib import Path
4
4
  from typing import TYPE_CHECKING, NewType
5
5
 
6
- from _pyisyntax import ffi, lib
7
-
6
+ from isyntax._pyisyntax import ffi, lib
8
7
  from isyntax.lowlevel.io_management import init_python_io_hooks, register_io
9
8
 
10
9
  if TYPE_CHECKING:
@@ -108,12 +107,16 @@ def get_tile_height(isyntax: ISyntaxPtr) -> int:
108
107
  return lib.libisyntax_get_tile_height(isyntax)
109
108
 
110
109
 
111
- def get_wsi_image_index(isyntax: ISyntaxPtr) -> int:
112
- return lib.libisyntax_get_wsi_image_index(isyntax)
110
+ def get_wsi_image(isyntax: ISyntaxPtr) -> ISyntaxImagePtr:
111
+ return lib.libisyntax_get_wsi_image(isyntax)
112
+
113
+
114
+ def get_label_image(isyntax: ISyntaxPtr) -> ISyntaxImagePtr:
115
+ return lib.libisyntax_get_label_image(isyntax)
113
116
 
114
117
 
115
- def get_image(isyntax: ISyntaxPtr, wsi_image_index: int) -> ISyntaxImagePtr:
116
- return lib.libisyntax_get_image(isyntax, wsi_image_index)
118
+ def get_macro_image(isyntax: ISyntaxPtr) -> ISyntaxImagePtr:
119
+ return lib.libisyntax_get_macro_image(isyntax)
117
120
 
118
121
 
119
122
  def image_get_level_count(wsi_image: ISyntaxImagePtr) -> int:
@@ -78,18 +78,19 @@ class ISyntaxImage:
78
78
 
79
79
 
80
80
  class ISyntax:
81
- def __init__(self, f: RawIOBase | BufferedIOBase, n_bytes: int) -> None:
81
+ def __init__(self, f: RawIOBase | BufferedIOBase, n_bytes: int, cache_size: int = 2000) -> None:
82
82
  self.io_handle = register_io(f, n_bytes)
83
83
  self.ptr = libisyntax.open_from_registered_handle(self.io_handle, is_init_allocators=False)
84
84
  self.closed = False
85
+ self._cache_size = cache_size
85
86
  self._cache = None
86
87
 
87
88
  @classmethod
88
- def open(cls: type["ISyntax"], filename: str | Path) -> "ISyntax":
89
+ def open(cls: type["ISyntax"], filename: str | Path, cache_size: int = 2000) -> "ISyntax":
89
90
  filename = Path(filename)
90
91
  f = filename.open("rb")
91
92
  n_bytes = os.fstat(f.fileno()).st_size
92
- return cls(f, n_bytes)
93
+ return cls(f, n_bytes, cache_size)
93
94
 
94
95
  def close(self) -> None:
95
96
  if self.closed:
@@ -105,20 +106,13 @@ class ISyntax:
105
106
  def tile_height(self) -> int:
106
107
  return libisyntax.get_tile_height(self.ptr)
107
108
 
108
- @property
109
- def wsi_index(self) -> int:
110
- return libisyntax.get_wsi_image_index(self.ptr)
111
-
112
- def get_image(self, image_index: int) -> ISyntaxImage:
113
- return ISyntaxImage(libisyntax.get_image(self.ptr, image_index))
114
-
115
109
  @property
116
110
  def wsi(self) -> ISyntaxImage:
117
- return self.get_image(self.wsi_index)
111
+ return ISyntaxImage(libisyntax.get_wsi_image(self.ptr))
118
112
 
119
113
  def get_cache(self) -> ISyntaxCache:
120
114
  if self._cache is None:
121
- self._cache = ISyntaxCache(cache_size=2000)
115
+ self._cache = ISyntaxCache(cache_size=self._cache_size)
122
116
  self._cache.inject(self)
123
117
  return self._cache
124
118
 
@@ -180,14 +174,14 @@ class ISyntax:
180
174
  except libisyntax.LibISyntaxFatalError:
181
175
  return None
182
176
 
183
- def read_icc_profile(self, image_index: int) -> memoryview | None:
177
+ def read_icc_profile(self) -> memoryview | None:
184
178
  """Reads the ICC color profile for an image.
185
179
 
186
180
  Returns:
187
181
  The ICC color profile, or None if it can't be read.
188
182
  """
189
183
  try:
190
- return libisyntax.read_icc_profile(self.ptr, self.get_image(image_index).ptr)
184
+ return libisyntax.read_icc_profile(self.ptr, self.wsi.ptr)
191
185
  except libisyntax.LibISyntaxFatalError:
192
186
  return None
193
187
 
@@ -43,7 +43,7 @@ def create_ffibuilder() -> FFI:
43
43
  libraries = []
44
44
 
45
45
  ffibuilder.set_source(
46
- "_pyisyntax",
46
+ "isyntax._pyisyntax",
47
47
  resources.read_text(isyntax_build, "pyisyntax.c"),
48
48
  sources=paths_to_strings(
49
49
  libisyntax_src/"libisyntax.c",
@@ -15,9 +15,7 @@
15
15
  #define LOG_VAR(fmt, var) printf("%s: %s=" fmt "\n", __FUNCTION__, #var, var)
16
16
 
17
17
  void print_isyntax_levels(isyntax_t* isyntax) {
18
- int wsi_image_idx = libisyntax_get_wsi_image_index(isyntax);
19
- LOG_VAR("%d", wsi_image_idx);
20
- const isyntax_image_t* wsi_image = libisyntax_get_image(isyntax, wsi_image_idx);
18
+ const isyntax_image_t* wsi_image = libisyntax_get_wsi_image(isyntax);
21
19
 
22
20
  for (int i = 0; i < libisyntax_image_get_level_count(wsi_image); ++i) {
23
21
  const isyntax_level_t* level = libisyntax_image_get_level(wsi_image, i);
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  BSD 2-Clause License
3
3
 
4
- Copyright (c) 2019-2023, Pieter Valkema, Alexandr Virodov, Jonas Teuwen
4
+ Copyright (c) 2019-2024, Pieter Valkema, Alexandr Virodov, Jonas Teuwen
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without
7
7
  modification, are permitted provided that the following conditions are met:
@@ -445,7 +445,7 @@ int main(int argc, char **argv) {
445
445
  return -1;
446
446
  }
447
447
 
448
- const isyntax_image_t *image = libisyntax_get_image(isyntax, 0);
448
+ const isyntax_image_t *image = libisyntax_get_wsi_image(isyntax);
449
449
 
450
450
  // Check if the page we selected actually exists.
451
451
  int32_t level_count = libisyntax_image_get_level_count(image);
@@ -3327,6 +3327,17 @@ bool isyntax_open(isyntax_t* isyntax, const char* filename, bool init_allocators
3327
3327
  isyntax->is_block_allocator_owned = false;
3328
3328
  }
3329
3329
 
3330
+ // Initialize dummy blocks with 'background' coefficients, to use for filling in margins at the edges (in case the neighboring codeblock doesn't exist)
3331
+ if (!isyntax->black_dummy_coeff) {
3332
+ isyntax->black_dummy_coeff = (icoeff_t*)calloc(1, isyntax->block_width * isyntax->block_height * sizeof(icoeff_t));
3333
+ }
3334
+ if (!isyntax->white_dummy_coeff) {
3335
+ isyntax->white_dummy_coeff = (icoeff_t*)malloc(isyntax->block_width * isyntax->block_height * sizeof(icoeff_t));
3336
+ for (i32 i = 0; i < isyntax->block_width * isyntax->block_height; ++i) {
3337
+ isyntax->white_dummy_coeff[i] = 255;
3338
+ }
3339
+ }
3340
+
3330
3341
  success = true;
3331
3342
 
3332
3343
  free(read_buffer);
@@ -128,7 +128,7 @@ static void isyntax_openslide_load_tile_coefficients_ll_or_h(isyntax_cache_t* ca
128
128
 
129
129
  isyntax_hulsken_decompress(codeblock_data, codeblock->block_size,
130
130
  isyntax->block_width, isyntax->block_height,
131
- codeblock->coefficient, 1,
131
+ codeblock->coefficient, wsi->compressor_version,
132
132
  is_ll ? tile->color_channels[color].coeff_ll : tile->color_channels[color].coeff_h);
133
133
  free(codeblock_data);
134
134
  }
@@ -51,19 +51,6 @@ static void submit_tile_completed(isyntax_streamer_t* streamer, void* tile_pixel
51
51
 
52
52
  }
53
53
 
54
- static void isyntax_init_dummy_codeblocks(isyntax_t* isyntax) {
55
- // Blocks with 'background' coefficients, to use for filling in margins at the edges (in case the neighboring codeblock doesn't exist)
56
- if (!isyntax->black_dummy_coeff) {
57
- isyntax->black_dummy_coeff = (icoeff_t*)calloc(1, isyntax->block_width * isyntax->block_height * sizeof(icoeff_t));
58
- }
59
- if (!isyntax->white_dummy_coeff) {
60
- isyntax->white_dummy_coeff = (icoeff_t*)malloc(isyntax->block_width * isyntax->block_height * sizeof(icoeff_t));
61
- for (i32 i = 0; i < isyntax->block_width * isyntax->block_height; ++i) {
62
- isyntax->white_dummy_coeff[i] = 255;
63
- }
64
- }
65
- }
66
-
67
54
  static i32 isyntax_load_all_tiles_in_level(isyntax_streamer_t* streamer, i32 scale) {
68
55
  i32 tiles_loaded = 0;
69
56
  i32 tile_index = 0;
@@ -125,8 +112,6 @@ static void isyntax_do_first_load(isyntax_streamer_t* streamer) {
125
112
  i32 tiles_loaded = 0;
126
113
  isyntax->total_rgb_transform_time = 0.0f;
127
114
 
128
- isyntax_init_dummy_codeblocks(isyntax);
129
-
130
115
  i32 scale = wsi->max_scale;
131
116
  isyntax_level_t* current_level = wsi->levels + scale;
132
117
  i32 codeblocks_per_color = isyntax_get_chunk_codeblocks_per_color_for_level(scale, true); // most often 1 + 4 + 16 (for scale n, n-1, n-2) + 1 (LL block)
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  BSD 2-Clause License
3
3
 
4
- Copyright (c) 2019-2023, Pieter Valkema
4
+ Copyright (c) 2019-2024, Pieter Valkema
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without
7
7
  modification, are permitted provided that the following conditions are met:
@@ -42,7 +42,7 @@
42
42
 
43
43
  #define CHECK_LIBISYNTAX_OK(_libisyntax_call) do { \
44
44
  isyntax_error_t result = _libisyntax_call; \
45
- assert(result == LIBISYNTAX_OK); \
45
+ ASSERT(result == LIBISYNTAX_OK); \
46
46
  } while(0);
47
47
 
48
48
  static platform_thread_info_t thread_infos[MAX_THREAD_COUNT];
@@ -249,12 +249,16 @@ int32_t libisyntax_get_tile_height(const isyntax_t* isyntax) {
249
249
  return isyntax->tile_height;
250
250
  }
251
251
 
252
- int32_t libisyntax_get_wsi_image_index(const isyntax_t* isyntax) {
253
- return isyntax->wsi_image_index;
252
+ const isyntax_image_t* libisyntax_get_wsi_image(const isyntax_t* isyntax) {
253
+ return isyntax->images + isyntax->wsi_image_index;
254
254
  }
255
255
 
256
- const isyntax_image_t* libisyntax_get_image(const isyntax_t* isyntax, int32_t wsi_image_index) {
257
- return &isyntax->images[wsi_image_index];
256
+ const isyntax_image_t* libisyntax_get_label_image(const isyntax_t* isyntax) {
257
+ return isyntax->images + isyntax->label_image_index;
258
+ }
259
+
260
+ const isyntax_image_t* libisyntax_get_macro_image(const isyntax_t* isyntax) {
261
+ return isyntax->images + isyntax->label_image_index;
258
262
  }
259
263
 
260
264
  int32_t libisyntax_image_get_level_count(const isyntax_image_t* image) {
@@ -47,8 +47,9 @@ void libisyntax_close(isyntax_t* isyntax);
47
47
  //== Getters API ==
48
48
  int32_t libisyntax_get_tile_width(const isyntax_t* isyntax);
49
49
  int32_t libisyntax_get_tile_height(const isyntax_t* isyntax);
50
- int32_t libisyntax_get_wsi_image_index(const isyntax_t* isyntax);
51
- const isyntax_image_t* libisyntax_get_image(const isyntax_t* isyntax, int32_t wsi_image_index);
50
+ const isyntax_image_t* libisyntax_get_wsi_image(const isyntax_t* isyntax);
51
+ const isyntax_image_t* libisyntax_get_label_image(const isyntax_t* isyntax);
52
+ const isyntax_image_t* libisyntax_get_macro_image(const isyntax_t* isyntax);
52
53
  int32_t libisyntax_image_get_level_count(const isyntax_image_t* image);
53
54
  const isyntax_level_t* libisyntax_image_get_level(const isyntax_image_t* image, int32_t index);
54
55
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyisyntax
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Python bindings for libisyntax
5
5
  Author-email: Aiden Nibali <dismaldenizen@gmail.com>
6
6
  License: MIT
@@ -23,6 +23,12 @@ Requires-Dist: typing_extensions; extra == "dev"
23
23
  A Python library for working with pathology images in the iSyntax file format,
24
24
  powered by [libisyntax](https://github.com/amspath/libisyntax).
25
25
 
26
+ ## Installation
27
+
28
+ ```console
29
+ $ pip install pyisyntax
30
+ ```
31
+
26
32
  ## Usage
27
33
 
28
34
  Read and display a region of the WSI via
@@ -0,0 +1 @@
1
+ isyntax
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyisyntax"
3
- version = "0.1.1"
3
+ version = "0.1.2"
4
4
  description = "Python bindings for libisyntax"
5
5
  readme = { content-type = "text/markdown", file = "README.md" }
6
6
  authors = [{ name = "Aiden Nibali", email = "dismaldenizen@gmail.com" }]
@@ -72,7 +72,7 @@ env_list = lint, type, py{310,311,312}
72
72
  deps =
73
73
  pytest
74
74
  pytest-mock
75
- commands = pytest {posargs:tests}
75
+ commands = pytest --import-mode=importlib {posargs:tests}
76
76
 
77
77
  [testenv:lint]
78
78
  skip_install = true
@@ -23,7 +23,7 @@ def isyntax(sample_isyntax_file: Path) -> Iterator[ISyntaxPtr]:
23
23
 
24
24
  @pytest.fixture()
25
25
  def wsi_image(isyntax: ISyntaxPtr) -> ISyntaxImagePtr:
26
- return libisyntax.get_image(isyntax, 0)
26
+ return libisyntax.get_wsi_image(isyntax)
27
27
 
28
28
 
29
29
  @pytest.fixture()
@@ -59,10 +59,6 @@ def test_libisyntax_get_tile_height(isyntax: ISyntaxPtr) -> None:
59
59
  assert libisyntax.get_tile_height(isyntax) == expected
60
60
 
61
61
 
62
- def test_libisyntax_get_wsi_image_index(isyntax: ISyntaxPtr) -> None:
63
- assert libisyntax.get_wsi_image_index(isyntax) == 0
64
-
65
-
66
62
  def test_libisyntax_image_get_level_count(wsi_image: ISyntaxImagePtr) -> None:
67
63
  expected = 8
68
64
  assert libisyntax.image_get_level_count(wsi_image) == expected
@@ -159,7 +155,7 @@ def test_libisyntax_read_macro_image_jpeg(isyntax: ISyntaxPtr, mocker: MockerFix
159
155
 
160
156
  def test_libisyntax_read_icc_profile(isyntax: ISyntaxPtr, mocker: MockerFixture) -> None:
161
157
  free_spy = mocker.spy(libisyntax, "free")
162
- wsi_image = libisyntax.get_image(isyntax, 0)
158
+ wsi_image = libisyntax.get_wsi_image(isyntax)
163
159
  buf = libisyntax.read_icc_profile(isyntax, wsi_image)
164
160
  version_major = buf[8]
165
161
  version_minor = buf[9] >> 4
@@ -22,10 +22,6 @@ class TestISyntax:
22
22
  expected = 256
23
23
  assert isyntax.tile_height == expected
24
24
 
25
- def test_wsi_index(self, isyntax: ISyntax) -> None:
26
- expected = 0
27
- assert isyntax.wsi_index == expected
28
-
29
25
  def test_level_count(self, isyntax: ISyntax) -> None:
30
26
  expected = 8
31
27
  assert isyntax.level_count == expected
@@ -1,2 +0,0 @@
1
- _pyisyntax
2
- isyntax
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes