batoolset 0.1.0__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 (171) hide show
  1. {batoolset-0.1.0 → batoolset-0.1.2}/PKG-INFO +4 -2
  2. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/PATH/tools.py +1 -1
  3. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/image2d.py +13 -2
  4. batoolset-0.1.2/batoolset/images/centralstore.py +126 -0
  5. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/img.py +34 -4
  6. batoolset-0.1.2/batoolset/pyqt/pleasewaitdialog.py +14 -0
  7. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/version.py +1 -1
  8. batoolset-0.1.2/batoolset/zarr/centralstorezarrstore.py +108 -0
  9. batoolset-0.1.2/batoolset/zip_tools/__init__.py +0 -0
  10. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset.egg-info/PKG-INFO +4 -2
  11. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset.egg-info/SOURCES.txt +4 -0
  12. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset.egg-info/requires.txt +3 -1
  13. {batoolset-0.1.0 → batoolset-0.1.2}/setup.py +3 -1
  14. {batoolset-0.1.0 → batoolset-0.1.2}/LICENSE +0 -0
  15. {batoolset-0.1.0 → batoolset-0.1.2}/README.md +0 -0
  16. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/GUI/__init__.py +0 -0
  17. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/GUI/list_gui.py +0 -0
  18. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/GUI/multi_image_display.py +0 -0
  19. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/GUI/open.py +0 -0
  20. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/GUI/overlay_hints.py +0 -0
  21. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/GUI/paint2.py +0 -0
  22. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/GUI/scrollablepaint.py +0 -0
  23. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/IJ_ROIs/__init__.py +0 -0
  24. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/IJ_ROIs/tools.py +0 -0
  25. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/PATH/__init__.py +0 -0
  26. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/SQLite_tools/__init__.py +0 -0
  27. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/SQLite_tools/tools.py +0 -0
  28. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/__init__.py +0 -0
  29. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/binary/__init__.py +0 -0
  30. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/binary/tools.py +0 -0
  31. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/binarytools/__init__.py +0 -0
  32. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/binarytools/cell_center_detector.py +0 -0
  33. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/clipboard_tools/__init__.py +0 -0
  34. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/clipboard_tools/tools.py +0 -0
  35. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/colors/__init__.py +0 -0
  36. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/colors/colorgen.py +0 -0
  37. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/colors/tools.py +0 -0
  38. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/command_line/__init__.py +0 -0
  39. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/command_line/tools.py +0 -0
  40. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/dialogs/__init__.py +0 -0
  41. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/dialogs/opensave.py +0 -0
  42. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/dicts/__init__.py +0 -0
  43. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/dicts/tools.py +0 -0
  44. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/dims/__init__.py +0 -0
  45. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/dims/tools.py +0 -0
  46. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/__init__.py +0 -0
  47. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/Position.py +0 -0
  48. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/__init__.py +0 -0
  49. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/automated_alignment_drawing_refactored.py +0 -0
  50. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/circle2d.py +0 -0
  51. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/compute_optimal_size_all_merged.py +0 -0
  52. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/ellipse2d.py +0 -0
  53. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/freehand2d.py +0 -0
  54. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/group.py +0 -0
  55. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/line2d.py +0 -0
  56. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/point2d.py +0 -0
  57. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/polygon2d.py +0 -0
  58. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/polyline2d.py +0 -0
  59. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/rect2d.py +0 -0
  60. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/rectangle2d.py +0 -0
  61. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/scalebar.py +0 -0
  62. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/serializablefont.py +0 -0
  63. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/serializableguiparams.py +0 -0
  64. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/square2d.py +0 -0
  65. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/textorientation.py +0 -0
  66. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/tools.py +0 -0
  67. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/transform2D.py +0 -0
  68. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/shapes/txt2d.py +0 -0
  69. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/widgets/__init__.py +0 -0
  70. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/widgets/col.py +0 -0
  71. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/widgets/image_group.py +0 -0
  72. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/widgets/image_organizer.py +0 -0
  73. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/widgets/paint.py +0 -0
  74. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/draw/widgets/vectorial.py +0 -0
  75. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/figure/__init__.py +0 -0
  76. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/figure/alignment.py +0 -0
  77. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/figure/column.py +0 -0
  78. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/figure/fig_tools.py +0 -0
  79. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/figure/minimal_debugger_scale_etc.py +0 -0
  80. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/figure/panel.py +0 -0
  81. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/figure/row.py +0 -0
  82. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/figure/user_selection.py +0 -0
  83. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/files/__init__.py +0 -0
  84. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/files/tools.py +0 -0
  85. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/images/__init__.py +0 -0
  86. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/images/tools.py +0 -0
  87. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/linux/__init__.py +0 -0
  88. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/linux/tools.py +0 -0
  89. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/lists/__init__.py +0 -0
  90. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/lists/tools.py +0 -0
  91. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/luts/__init__.py +0 -0
  92. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/luts/lut_minimal_test.py +0 -0
  93. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/matplolib/__init__.py +0 -0
  94. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/matplolib/tools.py +0 -0
  95. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/np_tools/__init__.py +0 -0
  96. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/np_tools/tools.py +0 -0
  97. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/np_tools/trash.py +0 -0
  98. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/pandas_tools/__init__.py +0 -0
  99. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/pandas_tools/tools.py +0 -0
  100. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/partials/__init__.py +0 -0
  101. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/partials/tools.py +0 -0
  102. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/plot_tools/__init__.py +0 -0
  103. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/plot_tools/tools.py +0 -0
  104. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/pyqt/__init__.py +0 -0
  105. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/pyqt/tools.py +0 -0
  106. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/re_tools/__init__.py +0 -0
  107. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/re_tools/tools.py +0 -0
  108. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/serialization/__init__.py +0 -0
  109. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/serialization/tools.py +0 -0
  110. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/sets/__init__.py +0 -0
  111. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/sets/tools.py +0 -0
  112. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/settings/__init__.py +0 -0
  113. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/settings/global_settings.py +0 -0
  114. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/strings/__init__.py +0 -0
  115. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/strings/tools.py +0 -0
  116. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/__init__.py +0 -0
  117. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/database/__init__.py +0 -0
  118. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/database/advanced_sql_plotter.py +0 -0
  119. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/database/my_qt_table.py +0 -0
  120. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/database/preview_and_edit_sqlite_db.py +0 -0
  121. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/database/sql.py +0 -0
  122. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/database/sql_column_name_dialog.py +0 -0
  123. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/measurements/TAmeasures.py +0 -0
  124. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/measurements/__init__.py +0 -0
  125. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/measurements/measurements3D/__init__.py +0 -0
  126. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/measurements/measurements3D/get_point_on_surface_if_centroid_is_bad.py +0 -0
  127. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/measurements/measurements3D/height_map_to_projection.py +0 -0
  128. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/measurements/measurements3D/measures3D.py +0 -0
  129. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/measurements/measurements3D/triangulate.py +0 -0
  130. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/measurements/nematic.py +0 -0
  131. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/measurements/nematic_measurements.py +0 -0
  132. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/segmentation/__init__.py +0 -0
  133. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/segmentation/neo_wshed.py +0 -0
  134. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/selections/__init__.py +0 -0
  135. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/selections/selection.py +0 -0
  136. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/tracking/__init__.py +0 -0
  137. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/tracking/last_tracking_based_on_matching_or_on_translation_from_mermaid_warp.py +0 -0
  138. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/tracking/local_to_track_correspondance.py +0 -0
  139. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/tracking/rapid_detection_of_vertices.py +0 -0
  140. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/tracking/registration.py +0 -0
  141. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/tracking/swap_detector_and_fixer.py +0 -0
  142. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/tracking/track_correction.py +0 -0
  143. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/tracking/tracking_error_detector_and_fixer.py +0 -0
  144. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/tracking/tracking_yet_another_approach_pyramidal_registration_n_neo_swapping_correction.py +0 -0
  145. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/utils/TA_tools.py +0 -0
  146. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/utils/__init__.py +0 -0
  147. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/ta/utils/rps_tools.py +0 -0
  148. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tests/__init__.py +0 -0
  149. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tests/rps_tools.py +0 -0
  150. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tests/tools.py +0 -0
  151. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tools/__init__.py +0 -0
  152. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tools/early_stopper_class.py +0 -0
  153. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tools/guided_data_recoverer.py +0 -0
  154. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tools/logger.py +0 -0
  155. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tools/mytimer.py +0 -0
  156. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tools/prompt_color.py +0 -0
  157. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/tools/qthandler.py +0 -0
  158. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/uitools/__init__.py +0 -0
  159. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/uitools/blinker.py +0 -0
  160. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/unsafe/__init__.py +0 -0
  161. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/unsafe/tools.py +0 -0
  162. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/utils/__init__.py +0 -0
  163. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/utils/commontools.py +0 -0
  164. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/utils/loadlist.py +0 -0
  165. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/xml/__init__.py +0 -0
  166. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/xml/tools.py +0 -0
  167. {batoolset-0.1.0/batoolset/zip_tools → batoolset-0.1.2/batoolset/zarr}/__init__.py +0 -0
  168. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset/zip_tools/tools.py +0 -0
  169. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset.egg-info/dependency_links.txt +0 -0
  170. {batoolset-0.1.0 → batoolset-0.1.2}/batoolset.egg-info/top_level.txt +0 -0
  171. {batoolset-0.1.0 → batoolset-0.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: batoolset
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: An aggregate of functions I find useful
5
5
  Home-page: https://github.com/baigouy/batoolset
6
6
  Author: Benoit Aigouy
@@ -15,7 +15,7 @@ License-File: LICENSE
15
15
  Requires-Dist: czifile
16
16
  Requires-Dist: Markdown
17
17
  Requires-Dist: matplotlib>=3.5.2
18
- Requires-Dist: numpy
18
+ Requires-Dist: numpy<1.26.4
19
19
  Requires-Dist: Pillow>=8.1.2
20
20
  Requires-Dist: PyQt6
21
21
  Requires-Dist: read-lif
@@ -40,6 +40,8 @@ Requires-Dist: Requests
40
40
  Requires-Dist: python-bioformats
41
41
  Requires-Dist: python-javabridge
42
42
  Requires-Dist: pyautogui
43
+ Requires-Dist: imagecodecs
44
+ Requires-Dist: zarr
43
45
 
44
46
  # batoolset
45
47
  An aggregate of functions I find useful
@@ -47,7 +47,7 @@ def add_epyseg_to_sys_path(file=None, print_only=False):
47
47
  else:
48
48
  epyseg_path = file
49
49
 
50
- batoolset_path = __file__.split('epyseg_pkg')[0] + 'batoolset_pkg/'
50
+ batoolset_path = __file__.split('epyseg_pkg')[0] + 'BAtools_pkg/'
51
51
  pyfigures_path = __file__.split('epyseg_pkg')[0] + 'pyfigures_pkg/'
52
52
  epyseg_path = __file__.split('epyseg_pkg')[0] + 'epyseg_pkg/'
53
53
  dev_path = __file__.split('epyseg_pkg')[0] + 'dev/'
@@ -311,6 +311,17 @@ class Image2D(Rectangle2D):
311
311
  self.px_to_unit_conversion_factor = 0
312
312
  # print()
313
313
 
314
+
315
+ def get_extra_dimensions(self, handle_proj=False):
316
+ if not isinstance(self.img, np.ndarray):
317
+ return None
318
+ guessed_dimensions = guess_dimensions(self.img)
319
+ extra_dims = guessed_dimensions.replace('h', '').replace('w', '').replace('c', '')
320
+ if extra_dims and handle_proj:
321
+ if self.projection is not None:
322
+ extra_dims = extra_dims[:-1]
323
+ return extra_dims
324
+
314
325
  def clip_by_frequency(self, lower_cutoff=None, upper_cutoff=0.05, channel_mode=True):
315
326
  '''
316
327
  Clips the values of an image based on frequency cutoffs.
@@ -463,7 +474,7 @@ class Image2D(Rectangle2D):
463
474
  if len(target_dims) > len(image_to_display.shape):
464
475
  target_dims = target_dims[len(target_dims)-len(image_to_display.shape):]
465
476
 
466
- # print('final redndering',image_to_display.shape)
477
+ # print('final rendering',image_to_display.shape)
467
478
  # print('checking img', image_to_display.shape, 'vs', self.img.shape)
468
479
  # if self.channels is not None and not self.channels == 'merge' and 'c' in target_dims:
469
480
  # if self.channels>=0 and self.channels < self.img.shape[-1]:
@@ -482,7 +493,6 @@ class Image2D(Rectangle2D):
482
493
  image_to_display = image_to_display[..., np.newaxis]
483
494
  target_dims+='c'
484
495
 
485
-
486
496
  if self.channels and 'c' in target_dims:
487
497
  # print('inside channels sel self.channels', self.channels)
488
498
  list_of_true_indices = bool_list_to_index_list(self.channels)
@@ -646,6 +656,7 @@ class Image2D(Rectangle2D):
646
656
  # print('~' * 30)
647
657
 
648
658
  del image_to_display
659
+ # del self.img # that would be great but then I would need tricks to know its parameters
649
660
 
650
661
  # print('----------'*32)
651
662
  # return qimage
@@ -0,0 +1,126 @@
1
+ import os.path
2
+ import traceback
3
+ import gc
4
+ import zarr
5
+
6
+ # from batoolset.img import Img
7
+ # pb the store should also store metadata -−> see how I can do that
8
+
9
+ __DEBUG__ = False
10
+
11
+ class ImageCentralStore:
12
+ store = None
13
+
14
+ @classmethod
15
+ def init(cls):
16
+ cls.store={}
17
+
18
+ @classmethod
19
+ def set_store(cls, store):
20
+ if __DEBUG__:
21
+ print('setting store', cls.store)
22
+ if store:
23
+ cls.store=store
24
+ else:
25
+ cls.store = {}
26
+
27
+ @classmethod
28
+ def get_store(cls):
29
+ if __DEBUG__:
30
+ print('getting store', cls.store)
31
+ return cls.store
32
+
33
+ @classmethod
34
+ def append(cls, image_id, data):
35
+ # Save the image data to the central store
36
+ if cls.store is not None:
37
+ if data is not None:
38
+ metadata = None
39
+ if hasattr(data, 'metadata'):
40
+ metadata = data.metadata
41
+ cls.store[image_id] = [metadata,data]
42
+ else:
43
+ try:
44
+ if __DEBUG__:
45
+ print('deleting image store entry because None')
46
+ del cls.store[image_id]
47
+ except:
48
+ pass
49
+ if __DEBUG__:
50
+ print(f"Image {image_id} added to central store.")
51
+
52
+ @classmethod
53
+ def load(cls, image_id):
54
+ if False:
55
+ # shall I do gc
56
+ # Check if central store is available and if the image exists in the store
57
+ # gc.collect()
58
+ # Print the number of objects that were garbage collected
59
+ print(f"{gc.collect():,} objects were garbage collected")
60
+ if cls.store is not None:
61
+ if image_id in cls.store:
62
+ metadata, img = cls.store[image_id]
63
+ if __DEBUG__:
64
+ print(f"Image {image_id} loaded from central store.")
65
+ return metadata,img
66
+ else:
67
+ metadata, img = cls.reload(image_id)
68
+ return metadata, img
69
+
70
+ if __DEBUG__:
71
+ print('No store found --> skipping loading from store for', image_id)
72
+ return None, None
73
+
74
+ # maybe put a relaod where the image is necessarily reloaded -−> force an update of the image from source file
75
+ @classmethod
76
+ def reload(cls, image_id):
77
+ from batoolset.img import Img
78
+ if __DEBUG__:
79
+ print('Img called for file', image_id)
80
+ img = Img(image_id,
81
+ prefer_store_if_available=False) # pb will this launch an infinite loop -−> maybe so make sure to prevent reload form it
82
+ metadata = None
83
+ if hasattr(img, 'metadata'):
84
+ metadata = img.metadata
85
+ # add image to the store
86
+ cls.append(image_id, img)
87
+ metadata, data = cls.store[image_id]
88
+ return metadata, img
89
+
90
+ @classmethod
91
+ def keys(cls):
92
+ if cls.store:
93
+ return cls.store.keys()
94
+ else:
95
+ return None
96
+
97
+ @classmethod
98
+ def clean_non_existing(cls):
99
+ keys = cls.keys()
100
+ if keys:
101
+ for file in keys:
102
+ if os.path.exists(file) and os.path.isfile(file):
103
+ pass
104
+ else:
105
+ del cls.store[file]
106
+ @classmethod
107
+ def clean(cls, sels):
108
+ cls.clean_non_existing()
109
+ keys = cls.keys()
110
+ if keys:
111
+ # delete entries in cls.store whose keys are not in sels
112
+ keys_to_delete = set(keys) - set(sels)
113
+ for key in keys_to_delete:
114
+ if __DEBUG__:
115
+ print('deleting entry from the store', key)
116
+ del cls.store[key]
117
+
118
+ # # add entries in sels that are not in cls.store
119
+ # keys_to_add = set(sels) - set(cls.store.keys())
120
+ # for key in keys_to_add:
121
+ # cls.store[key] = None # or some other default value
122
+
123
+
124
+
125
+
126
+
@@ -1,6 +1,7 @@
1
1
  from batoolset.tools.logger import TA_logger # logging
2
2
  logger = TA_logger() # logging_level=TA_logger.DEBUG
3
3
  from batoolset.files.tools import smart_name_parser
4
+ from batoolset.images.centralstore import ImageCentralStore
4
5
  import random
5
6
  import os
6
7
  import read_lif # read Leica .lif files (requires numexpr)
@@ -49,13 +50,15 @@ normalization_ranges = [[0, 1], [-1, 1]]
49
50
  def start_JVM():
50
51
  # NB BELOW IS MANDATORY TO HAVE SUPPORT FOR BIOFORMATS --> start_JVM SHOULD BE CALLED ONLY ONCE PER INSTANCE AND stop_JVM SHOULD BE CALLED ON LEAVE!
51
52
  try:
53
+ # raise Exception('test error') # force error
52
54
  # Start the JVM when the application launches
53
55
  import javabridge
54
56
  import bioformats
55
57
 
56
58
  javabridge.start_vm(class_path=bioformats.JARS, run_headless=True, max_heap_size='1G')
57
59
  except:
58
- pass
60
+ traceback.print_exc()
61
+ logger.error('Could not instantiate javabridge bioformats will not work')
59
62
 
60
63
  def stop_JVM():
61
64
  try:
@@ -71,7 +74,8 @@ def guess_dimensions(img):
71
74
 
72
75
  if hasattr(img, 'metadata'):
73
76
  if 'dimensions' in img.metadata:
74
- return img.metadata['dimensions']
77
+ if isinstance(img.metadata['dimensions'],str):
78
+ return img.metadata['dimensions']
75
79
 
76
80
  if len(img.shape) == 2:
77
81
  return 'hw'
@@ -2824,6 +2828,8 @@ def toQimage(img, autofix_always_display2D=True, normalize=True, z_behaviour=Non
2824
2828
  qimage = QImage(img.data.tobytes(), img.shape[1], img.shape[0], bytesPerLine,
2825
2829
  QImage.Format_Indexed8)
2826
2830
 
2831
+ del img
2832
+
2827
2833
  return qimage
2828
2834
 
2829
2835
 
@@ -3558,7 +3564,7 @@ class Img(np.ndarray): # subclass ndarray
3558
3564
  # TODO allow load list of images all specified as strings one by one
3559
3565
  # TODO allow virtual stack --> open only one image at a time from a series, can probably do that with text files
3560
3566
  def __new__(cls, *args, t=0, d=0, z=0, h=0, y=0, w=0, x=0, c=0, bits=8, serie_to_open=None, dimensions=None,
3561
- metadata=None, **kwargs) -> object:
3567
+ metadata=None, prefer_store_if_available=True, **kwargs) -> object:
3562
3568
  '''Creates a new instance of the Img class
3563
3569
 
3564
3570
  The image class is a numpy ndarray. It is nothing but a matrix of pixel values.
@@ -3628,8 +3634,22 @@ class Img(np.ndarray): # subclass ndarray
3628
3634
  # single image
3629
3635
  creation_time = get_file_creation_time(args[0])
3630
3636
  try:
3637
+ # if prefer_store_if_available: # see how I can handle that smartly... -−> not so easy
3638
+
3631
3639
  try:
3632
- meta, img = ImageReader.read(args[0], serie_to_open=serie_to_open)
3640
+ img = None
3641
+
3642
+ # print('entering here1')
3643
+
3644
+ if prefer_store_if_available:
3645
+ # prefer reload the image from store if available --> will speed up the loading process and spare more resources
3646
+ # print('entering here2')
3647
+ meta, img = ImageCentralStore.load(args[0]) # may work
3648
+
3649
+
3650
+ if img is None:
3651
+ # print('entering here3')
3652
+ meta, img = ImageReader.read(args[0], serie_to_open=serie_to_open)
3633
3653
  except:
3634
3654
  meta, img = read_file_with_bioformats(args[0])
3635
3655
  except:
@@ -3669,6 +3689,9 @@ class Img(np.ndarray): # subclass ndarray
3669
3689
  img.metadata = meta_data
3670
3690
  # img.metadata.update({'creation_time': creation_time})
3671
3691
  else:
3692
+
3693
+ # TODO --> I need also implement addition of a list to the store -> TODO
3694
+
3672
3695
  # series of images
3673
3696
  if isinstance(args[0], list):
3674
3697
  # the user directly provided a list --> just stack the images -−> can be useful --> there will be error if they don't have same size --> offer options for that but in a later step
@@ -5094,6 +5117,13 @@ class ImageReader:
5094
5117
 
5095
5118
 
5096
5119
  if __name__ == '__main__':
5120
+ if True:
5121
+ from batoolset.tools.logger import TA_logger
5122
+
5123
+
5124
+ print('bob')
5125
+ sys.exit(0)
5126
+
5097
5127
 
5098
5128
  if True:
5099
5129
  # tst = Img('/media/teamPrudhomme/EqpPrudhomme2/Vani/RNAi/Transvection_WT/Het/RNAi_het_20240312/26296_het_F1.tif')
@@ -0,0 +1,14 @@
1
+ from batoolset.settings.global_settings import set_UI # set the UI to qtpy
2
+ set_UI()
3
+ from qtpy.QtWidgets import QApplication, QDialog, QLabel, QVBoxLayout
4
+
5
+ class PleaseWaitDialog(QDialog):
6
+ def __init__(self, parent=None):
7
+ super().__init__(parent)
8
+ self.setWindowTitle("Please wait")
9
+ self.setModal(True)
10
+
11
+ label = QLabel("Please wait... The slow process is running.")
12
+ layout = QVBoxLayout()
13
+ layout.addWidget(label)
14
+ self.setLayout(layout)
@@ -1,6 +1,6 @@
1
1
  __MAJOR__ = 0
2
2
  __MINOR__ = 1
3
- __MICRO__ = 0
3
+ __MICRO__ = 2
4
4
  __RELEASE__ = '' # a #b # https://www.python.org/dev/peps/pep-0440/#public-version-identifiers --> alpha beta, ...
5
5
  __VERSION__ = ''.join([str(__MAJOR__), '.', str(__MINOR__), '.', str(__MICRO__)])
6
6
  __DESCRIPTION__= """An aggregate of functions I find useful"""
@@ -0,0 +1,108 @@
1
+ import traceback
2
+ import gc
3
+ import zarr
4
+
5
+ # from batoolset.img import Img
6
+ # pb the store should also store metadata -−> see how I can do that
7
+
8
+ __DEBUG__ = True
9
+
10
+ class ImageCentralStoreZarr:
11
+ store = None
12
+
13
+ @classmethod
14
+ def init(cls, folder_path=None):
15
+ try:
16
+ if folder_path is None:
17
+ # Create a Zarr store in memory
18
+ zarr_store = zarr.MemoryStore()
19
+ else:
20
+ zarr_store = zarr.DirectoryStore(folder_path) # just a single line is sufficient to handle the stuff
21
+ zarr_root = zarr.group(store=zarr_store)
22
+ cls.store = zarr_root
23
+ except:
24
+ traceback.print_exc()
25
+ print('Error zarr store could not be created')
26
+
27
+ @classmethod
28
+ def set_store(cls, store):
29
+ if __DEBUG__:
30
+ print('setting store', cls.store)
31
+ # Set the central store (zarr store)
32
+ if isinstance(store, str):
33
+ cls.store = zarr.open(store, mode='a')
34
+ else:
35
+ cls.store = store
36
+
37
+ @classmethod
38
+ def get_store(cls):
39
+ if __DEBUG__:
40
+ print('getting store', cls.store)
41
+ return cls.store
42
+
43
+ @classmethod
44
+ def append(cls, image_id, data):
45
+ # Save the image data to the central store
46
+ if cls.store is not None:
47
+ if data is not None:
48
+ cls.store[image_id] = data
49
+ else:
50
+ try:
51
+ if __DEBUG__:
52
+ print('deleting image store entry because None')
53
+ del cls.store[image_id]
54
+ except:
55
+ pass
56
+ if __DEBUG__:
57
+ print(f"Image {image_id} added to central store.")
58
+
59
+ if hasattr(data, 'metadata'):
60
+ cls.store.attrs[image_id] = data.metadata
61
+ else:
62
+ cls.store.attrs[image_id] = None # just in case there was already a metadata attribute --> make sure to have this
63
+ # else:
64
+ # if __DEBUG__:
65
+ # print("Central store is not set.")
66
+
67
+ @classmethod
68
+ def load(cls, image_id):
69
+ if False:
70
+ # shall I do gc
71
+ # Check if central store is available and if the image exists in the store
72
+ # gc.collect()
73
+ # Print the number of objects that were garbage collected
74
+ print(f"{gc.collect():,} objects were garbage collected")
75
+ if cls.store is not None:
76
+ if image_id in cls.store:
77
+ img = cls.store[image_id][:]
78
+ metadata = cls.store.attrs.get(image_id, None)
79
+ if __DEBUG__:
80
+ print(f"Image {image_id} loaded from central store.")
81
+ return metadata,img
82
+ else:
83
+ metadata, img = cls.reload(image_id)
84
+ return metadata, img
85
+
86
+ if __DEBUG__:
87
+ print('No store found --> skipping loading from store for', image_id)
88
+ return None, None
89
+
90
+ # maybe put a relaod where the image is necessarily reloaded -−> force an update of the image from source file
91
+ @classmethod
92
+ def reload(cls, image_id):
93
+ from batoolset.img import Img
94
+ if __DEBUG__:
95
+ print('Img called for file', image_id)
96
+ img = Img(image_id,
97
+ prefer_store_if_available=False) # pb will this launch an infinite loop -−> maybe so make sure to prevent reload form it
98
+ metadata = None
99
+ if hasattr(img, 'metadata'):
100
+ metadata = img.metadata
101
+ # add image to the store
102
+ cls.append(image_id, img)
103
+ del img
104
+
105
+ img = cls.store[image_id] # then we reload it from the store in order not to duplicate it # MEGA TODO -−> check
106
+ metadata = cls.store.attrs.get(image_id, None)
107
+
108
+ return metadata, img
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: batoolset
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: An aggregate of functions I find useful
5
5
  Home-page: https://github.com/baigouy/batoolset
6
6
  Author: Benoit Aigouy
@@ -15,7 +15,7 @@ License-File: LICENSE
15
15
  Requires-Dist: czifile
16
16
  Requires-Dist: Markdown
17
17
  Requires-Dist: matplotlib>=3.5.2
18
- Requires-Dist: numpy
18
+ Requires-Dist: numpy<1.26.4
19
19
  Requires-Dist: Pillow>=8.1.2
20
20
  Requires-Dist: PyQt6
21
21
  Requires-Dist: read-lif
@@ -40,6 +40,8 @@ Requires-Dist: Requests
40
40
  Requires-Dist: python-bioformats
41
41
  Requires-Dist: python-javabridge
42
42
  Requires-Dist: pyautogui
43
+ Requires-Dist: imagecodecs
44
+ Requires-Dist: zarr
43
45
 
44
46
  # batoolset
45
47
  An aggregate of functions I find useful
@@ -80,6 +80,7 @@ batoolset/figure/user_selection.py
80
80
  batoolset/files/__init__.py
81
81
  batoolset/files/tools.py
82
82
  batoolset/images/__init__.py
83
+ batoolset/images/centralstore.py
83
84
  batoolset/images/tools.py
84
85
  batoolset/linux/__init__.py
85
86
  batoolset/linux/tools.py
@@ -99,6 +100,7 @@ batoolset/partials/tools.py
99
100
  batoolset/plot_tools/__init__.py
100
101
  batoolset/plot_tools/tools.py
101
102
  batoolset/pyqt/__init__.py
103
+ batoolset/pyqt/pleasewaitdialog.py
102
104
  batoolset/pyqt/tools.py
103
105
  batoolset/re_tools/__init__.py
104
106
  batoolset/re_tools/tools.py
@@ -161,5 +163,7 @@ batoolset/utils/commontools.py
161
163
  batoolset/utils/loadlist.py
162
164
  batoolset/xml/__init__.py
163
165
  batoolset/xml/tools.py
166
+ batoolset/zarr/__init__.py
167
+ batoolset/zarr/centralstorezarrstore.py
164
168
  batoolset/zip_tools/__init__.py
165
169
  batoolset/zip_tools/tools.py
@@ -1,7 +1,7 @@
1
1
  czifile
2
2
  Markdown
3
3
  matplotlib>=3.5.2
4
- numpy
4
+ numpy<1.26.4
5
5
  Pillow>=8.1.2
6
6
  PyQt6
7
7
  read-lif
@@ -26,3 +26,5 @@ Requests
26
26
  python-bioformats
27
27
  python-javabridge
28
28
  pyautogui
29
+ imagecodecs
30
+ zarr
@@ -26,7 +26,7 @@ setuptools.setup(
26
26
  "czifile",
27
27
  "Markdown",
28
28
  "matplotlib>=3.5.2",
29
- "numpy",
29
+ "numpy<1.26.4", # <1.26.4 for compat with javabridge
30
30
  "Pillow>=8.1.2",
31
31
  "PyQt6",
32
32
  "read-lif",
@@ -51,6 +51,8 @@ setuptools.setup(
51
51
  "python-bioformats",
52
52
  "python-javabridge",
53
53
  "pyautogui",
54
+ "imagecodecs",
55
+ "zarr",
54
56
  ],
55
57
  python_requires='>=3.7, <3.11' # from 04/05/23 colab is using python 3.10.11
56
58
  )
File without changes
File without changes
File without changes