spacr 0.3.52__tar.gz → 0.3.60__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 (280) hide show
  1. {spacr-0.3.52/spacr.egg-info → spacr-0.3.60}/PKG-INFO +1 -1
  2. spacr-0.3.60/notebooks/spacr_computer_vision.ipynb +150 -0
  3. {spacr-0.3.52 → spacr-0.3.60}/setup.py +1 -1
  4. {spacr-0.3.52 → spacr-0.3.60}/spacr/gui_elements.py +1 -1
  5. {spacr-0.3.52 → spacr-0.3.60}/spacr/gui_utils.py +0 -111
  6. {spacr-0.3.52 → spacr-0.3.60}/spacr/io.py +114 -140
  7. {spacr-0.3.52 → spacr-0.3.60}/spacr/measure.py +10 -11
  8. {spacr-0.3.52 → spacr-0.3.60}/spacr/ml.py +55 -41
  9. {spacr-0.3.52 → spacr-0.3.60}/spacr/plot.py +24 -293
  10. {spacr-0.3.52 → spacr-0.3.60}/spacr/sequencing.py +13 -9
  11. {spacr-0.3.52 → spacr-0.3.60}/spacr/settings.py +15 -9
  12. {spacr-0.3.52 → spacr-0.3.60}/spacr/submodules.py +19 -19
  13. {spacr-0.3.52 → spacr-0.3.60}/spacr/timelapse.py +16 -16
  14. {spacr-0.3.52 → spacr-0.3.60}/spacr/toxo.py +15 -15
  15. {spacr-0.3.52 → spacr-0.3.60}/spacr/utils.py +72 -164
  16. {spacr-0.3.52 → spacr-0.3.60/spacr.egg-info}/PKG-INFO +1 -1
  17. {spacr-0.3.52 → spacr-0.3.60}/spacr.egg-info/SOURCES.txt +6 -5
  18. {spacr-0.3.52 → spacr-0.3.60}/.readthedocs.yaml +0 -0
  19. {spacr-0.3.52 → spacr-0.3.60}/LICENSE +0 -0
  20. {spacr-0.3.52 → spacr-0.3.60}/MANIFEST.in +0 -0
  21. {spacr-0.3.52 → spacr-0.3.60}/README.rst +0 -0
  22. {spacr-0.3.52 → spacr-0.3.60}/deploy_docs.sh +0 -0
  23. {spacr-0.3.52 → spacr-0.3.60}/docs/requirements.txt +0 -0
  24. {spacr-0.3.52 → spacr-0.3.60}/docs/source/Makefile +0 -0
  25. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/doctrees/environment.pickle +0 -0
  26. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/index.html +0 -0
  27. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/app_annotate.html +0 -0
  28. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/app_classify.html +0 -0
  29. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/app_make_masks.html +0 -0
  30. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/app_mask.html +0 -0
  31. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/app_measure.html +0 -0
  32. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/app_sequencing.html +0 -0
  33. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/app_umap.html +0 -0
  34. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/core.html +0 -0
  35. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/deep_spacr.html +0 -0
  36. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/graph_learning.html +0 -0
  37. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/gui.html +0 -0
  38. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/gui_core.html +0 -0
  39. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/gui_elements.html +0 -0
  40. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/gui_utils.html +0 -0
  41. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/io.html +0 -0
  42. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/logger.html +0 -0
  43. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/measure.html +0 -0
  44. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/plot.html +0 -0
  45. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/sequencing.html +0 -0
  46. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/settings.html +0 -0
  47. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/sim.html +0 -0
  48. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/timelapse.html +0 -0
  49. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_modules/spacr/utils.html +0 -0
  50. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_sources/index.rst.txt +0 -0
  51. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_sources/modules.rst.txt +0 -0
  52. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_sources/spacr.rst.txt +0 -0
  53. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/_sphinx_javascript_frameworks_compat.js +0 -0
  54. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/basic.css +0 -0
  55. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/badge_only.css +0 -0
  56. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/Roboto-Slab-Bold.woff +0 -0
  57. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/Roboto-Slab-Bold.woff2 +0 -0
  58. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/Roboto-Slab-Regular.woff +0 -0
  59. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/Roboto-Slab-Regular.woff2 +0 -0
  60. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/fontawesome-webfont.eot +0 -0
  61. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/fontawesome-webfont.svg +0 -0
  62. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/fontawesome-webfont.ttf +0 -0
  63. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/fontawesome-webfont.woff +0 -0
  64. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/fontawesome-webfont.woff2 +0 -0
  65. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/lato-bold-italic.woff +0 -0
  66. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/lato-bold-italic.woff2 +0 -0
  67. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/lato-bold.woff +0 -0
  68. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/lato-bold.woff2 +0 -0
  69. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/lato-normal-italic.woff +0 -0
  70. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/lato-normal-italic.woff2 +0 -0
  71. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/lato-normal.woff +0 -0
  72. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/fonts/lato-normal.woff2 +0 -0
  73. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/css/theme.css +0 -0
  74. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/doctools.js +0 -0
  75. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/documentation_options.js +0 -0
  76. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/file.png +0 -0
  77. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/jquery.js +0 -0
  78. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/js/badge_only.js +0 -0
  79. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/js/html5shiv-printshiv.min.js +0 -0
  80. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/js/html5shiv.min.js +0 -0
  81. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/js/theme.js +0 -0
  82. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/language_data.js +0 -0
  83. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/minus.png +0 -0
  84. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/plus.png +0 -0
  85. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/pygments.css +0 -0
  86. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/searchtools.js +0 -0
  87. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/_static/sphinx_highlight.js +0 -0
  88. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/genindex.html +0 -0
  89. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/index.html +0 -0
  90. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/modules.html +0 -0
  91. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/objects.inv +0 -0
  92. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/py-modindex.html +0 -0
  93. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/search.html +0 -0
  94. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/searchindex.js +0 -0
  95. {spacr-0.3.52 → spacr-0.3.60}/docs/source/_build/html/spacr.html +0 -0
  96. {spacr-0.3.52 → spacr-0.3.60}/docs/source/conf.py +0 -0
  97. {spacr-0.3.52 → spacr-0.3.60}/docs/source/index.rst +0 -0
  98. {spacr-0.3.52 → spacr-0.3.60}/docs/source/make.bat +0 -0
  99. {spacr-0.3.52 → spacr-0.3.60}/docs/source/modules.rst +0 -0
  100. {spacr-0.3.52 → spacr-0.3.60}/docs/source/spacr.rst +0 -0
  101. {spacr-0.3.52 → spacr-0.3.60}/environment.yaml +0 -0
  102. {spacr-0.3.52 → spacr-0.3.60}/fonts/OpenSans-Regular.ttf +0 -0
  103. {spacr-0.3.52/notebooks → spacr-0.3.60/notebooks/old}/cv_scoring_nb.ipynb +0 -0
  104. {spacr-0.3.52/notebooks → spacr-0.3.60/notebooks/old}/deep_learning_spacr.ipynb +0 -0
  105. {spacr-0.3.52/notebooks → spacr-0.3.60/notebooks/old}/machine_learning_spacr_nb.ipynb +0 -0
  106. {spacr-0.3.52/notebooks → spacr-0.3.60/notebooks/old}/spacr_0.1_all_settings_git.ipynb +0 -0
  107. {spacr-0.3.52/notebooks → spacr-0.3.60/notebooks/old}/spacr_0.1_minimal.ipynb +0 -0
  108. {spacr-0.3.52 → spacr-0.3.60}/path/home/carruthers/datasets/plate1/measurements/measurements.db +0 -0
  109. {spacr-0.3.52 → spacr-0.3.60}/path/home/carruthers/datasets/plate1/settings/measure_crop_settings.csv +0 -0
  110. {spacr-0.3.52 → spacr-0.3.60}/path/settings/preprocess_generate_masks_settings.csv +0 -0
  111. {spacr-0.3.52 → spacr-0.3.60}/requirements.txt +0 -0
  112. {spacr-0.3.52 → spacr-0.3.60}/settings/measure_crop_settings.csv +0 -0
  113. {spacr-0.3.52 → spacr-0.3.60}/setup.cfg +0 -0
  114. {spacr-0.3.52 → spacr-0.3.60}/setup_docs.sh +0 -0
  115. {spacr-0.3.52 → spacr-0.3.60}/source/conf.py +0 -0
  116. {spacr-0.3.52 → spacr-0.3.60}/source/index.rst +0 -0
  117. {spacr-0.3.52 → spacr-0.3.60}/source/modules.rst +0 -0
  118. {spacr-0.3.52 → spacr-0.3.60}/source/setup.rst +0 -0
  119. {spacr-0.3.52 → spacr-0.3.60}/source/spacr.rst +0 -0
  120. {spacr-0.3.52 → spacr-0.3.60}/spacr/__init__.py +0 -0
  121. {spacr-0.3.52 → spacr-0.3.60}/spacr/__main__.py +0 -0
  122. {spacr-0.3.52 → spacr-0.3.60}/spacr/app_annotate.py +0 -0
  123. {spacr-0.3.52 → spacr-0.3.60}/spacr/app_classify.py +0 -0
  124. {spacr-0.3.52 → spacr-0.3.60}/spacr/app_make_masks.py +0 -0
  125. {spacr-0.3.52 → spacr-0.3.60}/spacr/app_mask.py +0 -0
  126. {spacr-0.3.52 → spacr-0.3.60}/spacr/app_measure.py +0 -0
  127. {spacr-0.3.52 → spacr-0.3.60}/spacr/app_sequencing.py +0 -0
  128. {spacr-0.3.52 → spacr-0.3.60}/spacr/app_umap.py +0 -0
  129. {spacr-0.3.52 → spacr-0.3.60}/spacr/cellpose.py +0 -0
  130. {spacr-0.3.52 → spacr-0.3.60}/spacr/chat_bot.py +0 -0
  131. {spacr-0.3.52 → spacr-0.3.60}/spacr/core.py +0 -0
  132. {spacr-0.3.52 → spacr-0.3.60}/spacr/deep_spacr.py +0 -0
  133. {spacr-0.3.52 → spacr-0.3.60}/spacr/gui.py +0 -0
  134. {spacr-0.3.52 → spacr-0.3.60}/spacr/gui_core.py +0 -0
  135. {spacr-0.3.52 → spacr-0.3.60}/spacr/logger.py +0 -0
  136. {spacr-0.3.52 → spacr-0.3.60}/spacr/mediar.py +0 -0
  137. {spacr-0.3.52 → spacr-0.3.60}/spacr/openai.py +0 -0
  138. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/.gitignore +0 -0
  139. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/LICENSE +0 -0
  140. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/README.md +0 -0
  141. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/SetupDict.py +0 -0
  142. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/config/baseline.json +0 -0
  143. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/config/mediar_example.json +0 -0
  144. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/config/pred/pred_mediar.json +0 -0
  145. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/config/step1_pretraining/phase1.json +0 -0
  146. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/config/step1_pretraining/phase2.json +0 -0
  147. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/config/step2_finetuning/finetuning1.json +0 -0
  148. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/config/step2_finetuning/finetuning2.json +0 -0
  149. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/config/step3_prediction/base_prediction.json +0 -0
  150. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/config/step3_prediction/ensemble_tta.json +0 -0
  151. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/BasePredictor.py +0 -0
  152. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/BaseTrainer.py +0 -0
  153. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/Baseline/Predictor.py +0 -0
  154. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/Baseline/Trainer.py +0 -0
  155. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/Baseline/__init__.py +0 -0
  156. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/Baseline/utils.py +0 -0
  157. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/MEDIAR/EnsemblePredictor.py +0 -0
  158. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/MEDIAR/Predictor.py +0 -0
  159. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/MEDIAR/Trainer.py +0 -0
  160. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/MEDIAR/__init__.py +0 -0
  161. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/MEDIAR/utils.py +0 -0
  162. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/__init__.py +0 -0
  163. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/core/utils.py +0 -0
  164. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/evaluate.py +0 -0
  165. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/generate_mapping.py +0 -0
  166. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/image/examples/img1.tiff +0 -0
  167. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/image/examples/img2.tif +0 -0
  168. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/image/failure_cases.png +0 -0
  169. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/image/mediar_framework.png +0 -0
  170. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/image/mediar_model.PNG +0 -0
  171. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/image/mediar_results.png +0 -0
  172. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/main.py +0 -0
  173. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/predict.py +0 -0
  174. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/requirements.txt +0 -0
  175. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/__init__.py +0 -0
  176. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/data_utils/__init__.py +0 -0
  177. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/data_utils/custom/CellAware.py +0 -0
  178. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/data_utils/custom/LoadImage.py +0 -0
  179. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/data_utils/custom/NormalizeImage.py +0 -0
  180. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/data_utils/custom/__init__.py +0 -0
  181. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/data_utils/custom/modalities.pkl +0 -0
  182. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/data_utils/datasetter.py +0 -0
  183. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/data_utils/transforms.py +0 -0
  184. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/data_utils/utils.py +0 -0
  185. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/measures.py +0 -0
  186. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/models/MEDIARFormer.py +0 -0
  187. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/models/__init__.py +0 -0
  188. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/MEDIAR/train_tools/utils.py +0 -0
  189. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/data/lopit.csv +0 -0
  190. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/data/toxoplasma_metadata.csv +0 -0
  191. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/OFL.txt +0 -0
  192. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/OpenSans-Italic-VariableFont_wdth,wght.ttf +0 -0
  193. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/OpenSans-VariableFont_wdth,wght.ttf +0 -0
  194. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/README.txt +0 -0
  195. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-Bold.ttf +0 -0
  196. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-BoldItalic.ttf +0 -0
  197. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-ExtraBold.ttf +0 -0
  198. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-ExtraBoldItalic.ttf +0 -0
  199. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-Italic.ttf +0 -0
  200. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-Light.ttf +0 -0
  201. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-LightItalic.ttf +0 -0
  202. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-Medium.ttf +0 -0
  203. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-MediumItalic.ttf +0 -0
  204. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-Regular.ttf +0 -0
  205. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-SemiBold.ttf +0 -0
  206. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans-SemiBoldItalic.ttf +0 -0
  207. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-Bold.ttf +0 -0
  208. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-BoldItalic.ttf +0 -0
  209. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-ExtraBold.ttf +0 -0
  210. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-ExtraBoldItalic.ttf +0 -0
  211. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-Italic.ttf +0 -0
  212. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-Light.ttf +0 -0
  213. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-LightItalic.ttf +0 -0
  214. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-Medium.ttf +0 -0
  215. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-MediumItalic.ttf +0 -0
  216. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-Regular.ttf +0 -0
  217. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-SemiBold.ttf +0 -0
  218. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_Condensed-SemiBoldItalic.ttf +0 -0
  219. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Bold.ttf +0 -0
  220. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-BoldItalic.ttf +0 -0
  221. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-ExtraBold.ttf +0 -0
  222. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-ExtraBoldItalic.ttf +0 -0
  223. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Italic.ttf +0 -0
  224. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Light.ttf +0 -0
  225. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-LightItalic.ttf +0 -0
  226. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Medium.ttf +0 -0
  227. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-MediumItalic.ttf +0 -0
  228. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-Regular.ttf +0 -0
  229. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-SemiBold.ttf +0 -0
  230. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/font/open_sans/static/OpenSans_SemiCondensed-SemiBoldItalic.ttf +0 -0
  231. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/abort.png +0 -0
  232. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/annotate.png +0 -0
  233. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/cellpose_all.png +0 -0
  234. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/cellpose_masks.png +0 -0
  235. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/classify.png +0 -0
  236. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/convert.png +0 -0
  237. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/default.png +0 -0
  238. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/dna_matrix.mp4 +0 -0
  239. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/download.png +0 -0
  240. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/logo.pdf +0 -0
  241. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/logo_spacr.png +0 -0
  242. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/logo_spacr_1.png +0 -0
  243. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/make_masks.png +0 -0
  244. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/map_barcodes.png +0 -0
  245. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/mask.png +0 -0
  246. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/measure.png +0 -0
  247. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/ml_analyze.png +0 -0
  248. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/plaque.png +0 -0
  249. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/recruitment.png +0 -0
  250. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/regression.png +0 -0
  251. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/run.png +0 -0
  252. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/sequencing.png +0 -0
  253. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/settings.png +0 -0
  254. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/train_cellpose.png +0 -0
  255. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/icons/umap.png +0 -0
  256. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/images/plate1_E01_T0001F001L01A01Z01C02.tif +0 -0
  257. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/images/plate1_E01_T0001F001L01A02Z01C01.tif +0 -0
  258. {spacr-0.3.52 → spacr-0.3.60}/spacr/resources/images/plate1_E01_T0001F001L01A03Z01C03.tif +0 -0
  259. {spacr-0.3.52 → spacr-0.3.60}/spacr/sim.py +0 -0
  260. {spacr-0.3.52 → spacr-0.3.60}/spacr/version.py +0 -0
  261. {spacr-0.3.52 → spacr-0.3.60}/spacr.egg-info/dependency_links.txt +0 -0
  262. {spacr-0.3.52 → spacr-0.3.60}/spacr.egg-info/entry_points.txt +0 -0
  263. {spacr-0.3.52 → spacr-0.3.60}/spacr.egg-info/requires.txt +0 -0
  264. {spacr-0.3.52 → spacr-0.3.60}/spacr.egg-info/top_level.txt +0 -0
  265. {spacr-0.3.52 → spacr-0.3.60}/tests/test_annotate_app.py +0 -0
  266. {spacr-0.3.52 → spacr-0.3.60}/tests/test_core.py +0 -0
  267. {spacr-0.3.52 → spacr-0.3.60}/tests/test_gui_classify_app.py +0 -0
  268. {spacr-0.3.52 → spacr-0.3.60}/tests/test_gui_mask_app.py +0 -0
  269. {spacr-0.3.52 → spacr-0.3.60}/tests/test_gui_measure_app.py +0 -0
  270. {spacr-0.3.52 → spacr-0.3.60}/tests/test_gui_sim_app.py +0 -0
  271. {spacr-0.3.52 → spacr-0.3.60}/tests/test_gui_utils.py +0 -0
  272. {spacr-0.3.52 → spacr-0.3.60}/tests/test_io.py +0 -0
  273. {spacr-0.3.52 → spacr-0.3.60}/tests/test_mask_app.py +0 -0
  274. {spacr-0.3.52 → spacr-0.3.60}/tests/test_measure.py +0 -0
  275. {spacr-0.3.52 → spacr-0.3.60}/tests/test_plot.py +0 -0
  276. {spacr-0.3.52 → spacr-0.3.60}/tests/test_sim.py +0 -0
  277. {spacr-0.3.52 → spacr-0.3.60}/tests/test_timelapse.py +0 -0
  278. {spacr-0.3.52 → spacr-0.3.60}/tests/test_train.py +0 -0
  279. {spacr-0.3.52 → spacr-0.3.60}/tests/test_umap.py +0 -0
  280. {spacr-0.3.52 → spacr-0.3.60}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spacr
3
- Version: 0.3.52
3
+ Version: 0.3.60
4
4
  Summary: Spatial phenotype analysis of crisp screens (SpaCr)
5
5
  Home-page: https://github.com/EinarOlafsson/spacr
6
6
  Author: Einar Birnir Olafsson
@@ -0,0 +1,150 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "335dcd14",
7
+ "metadata": {
8
+ "scrolled": true
9
+ },
10
+ "outputs": [],
11
+ "source": [
12
+ "# use this cell to generate train and test folders: datasets/train/nc and pc and datasets/test/nc and pc\n",
13
+ "from spacr.io import generate_training_dataset\n",
14
+ "\n",
15
+ "settings = {'src':'path', # (path) path to source folder (where origional images were stored)\n",
16
+ " 'dataset_mode':'annotation', # (string) annotation, measurement, metadata\n",
17
+ " 'tables':['cell'],# (list of strings) The tabels present in the database, excluding png_list\n",
18
+ " 'test_split':0.1, # (float) Fraction of images used for the test set\n",
19
+ " 'annotation_column':'test', # (Optional, string) If using mode annotation, The annotation column in the database\n",
20
+ " 'annotated_classes':[1], # (Optional, list of integers) If using mode annotation, The interger in annotation_column, if len(annotated_classes) is 1, class 2 will be generated from a random selection of images.\n",
21
+ " 'metadata_type_by':'column_name', # (Optional, strin) If using mode medatada, If using mode medatada,the column class_metadata elements are in\n",
22
+ " 'class_metadata':[['c15'],['c19']], # (Optional, list of lists of strings) If using mode medatada, the elements that deffine each class \n",
23
+ " 'png_type':'cell_png', # (Optional, string) string in the path of each image (used to filter images)\n",
24
+ " 'nuclei_limit':False, # (Optional, bool) if cell and nucleus in tables, filter for number of nuclei per cell\n",
25
+ " 'pathogen_limit':0, # (Optional, integer) if cell and pathogen in tables, filter for number of pathogen per cell\n",
26
+ " 'uninfected':True, # (Optional, bool) if cell and pathogen in tables, bool for uninfected cells (cells)\n",
27
+ " 'size':None # (Optional, integer or NoneType) limit for number of images to include in total (test + train) per class\n",
28
+ " }\n",
29
+ "\n",
30
+ "generate_training_dataset(settings)"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "code",
35
+ "execution_count": null,
36
+ "id": "b4431164",
37
+ "metadata": {},
38
+ "outputs": [],
39
+ "source": [
40
+ "# train a torch model\n",
41
+ "from spacr.deep_spacr import train_test_model\n",
42
+ "\n",
43
+ "settings = {'src':'path', # (path) path to source folder (ends with datasets/training)\n",
44
+ " 'train':True, # (bool) - Train\n",
45
+ " 'test': False, # (bool) - Test\n",
46
+ " 'custom_model':False, # (path) - path to a custom model\n",
47
+ " 'classes':['nc','pc'], # (list) - list of classes (folder names in dataset/training/train or test)\n",
48
+ " 'model_type':'maxvit_t', # (string) - Name of torch model architecture\n",
49
+ " 'optimizer_type':'adamw', # (string) - type of optimizer\n",
50
+ " 'schedule':'reduce_lr_on_plateau', # (string) - type of scheduler (reduce_lr_on_plateau or step_lr)\n",
51
+ " 'loss_type':'focal_loss', # (string) - Loss function (binary_cross_entropy_with_logits or focal_loss)\n",
52
+ " 'normalize':True, # (bool) - Apply ImageNet normalization to images before training.\n",
53
+ " 'image_size':224, # (int) - Size of images, height and width.\n",
54
+ " 'batch_size':64, # (int) - Nr. of images per batch\n",
55
+ " 'epochs':10, # (int) - Nr. of epochs for training\n",
56
+ " 'val_split':0.1, # (float) - Fraction of images in validation dataset\n",
57
+ " 'learning_rate':0.0001, # (float) - Learning rate per epoch\n",
58
+ " 'weight_decay':0.00001, # (float) - Fraction of random weights decay (regularization)\n",
59
+ " 'dropout_rate':0.1, # (float) - Fraction of weights to omit per epoch (regularization)\n",
60
+ " 'init_weights':True, # (bool) - Initiate model with ImageNet weights\n",
61
+ " 'amsgrad':True, # (bool) - guard against exploding gradients\n",
62
+ " 'use_checkpoint':True, # (bool) - checkpoint gradient calculations to save VRAM at the expence of computation\n",
63
+ " 'gradient_accumulation':True, # (bool) - Accumulate gradients to mimic larger batches\n",
64
+ " 'gradient_accumulation_steps':4, # (int) - Epochs to accumulate gradients\n",
65
+ " 'intermedeate_save':True, # Save intermediate states of the model\n",
66
+ " 'pin_memory':True, # (bool) - Whether to pin memory for the data loader\n",
67
+ " 'n_jobs':30, # (int) - Number of threads to use\n",
68
+ " 'train_channels':['r','g','b'], # (list of 'r', 'g', and/or 'b') - PNG channels to use for training\n",
69
+ " 'augment':False, # (bool) - Augment the dataset, vertical, horizontal flip and rotate each image to artificially expand the dataset 8 fold.\n",
70
+ " 'verbose':True}\n",
71
+ "\n",
72
+ "train_test_model(settings)"
73
+ ]
74
+ },
75
+ {
76
+ "cell_type": "code",
77
+ "execution_count": null,
78
+ "id": "5770fb79",
79
+ "metadata": {
80
+ "scrolled": true
81
+ },
82
+ "outputs": [],
83
+ "source": [
84
+ "# generate a tar dataset\n",
85
+ "\n",
86
+ "from spacr.io import generate_dataset\n",
87
+ "\n",
88
+ "settings = {'src':'path', # (path) path to source folder (where origional images were stored)\n",
89
+ " 'file_metadata':'cell_png', # (Optional, string) string in the path of each image (used to filter images)\n",
90
+ " 'experiment':'test', # (string) - Name of dataset\n",
91
+ " 'sample':10000} # (Optional, integer or NoneType) limit for number of images to include in the dataset\n",
92
+ "\n",
93
+ "generate_dataset(settings)"
94
+ ]
95
+ },
96
+ {
97
+ "cell_type": "code",
98
+ "execution_count": null,
99
+ "id": "086fcefb",
100
+ "metadata": {},
101
+ "outputs": [],
102
+ "source": [
103
+ "# apply a model to a tar dataset\n",
104
+ "\n",
105
+ "from spacr.deep_spacr import apply_model_to_tar\n",
106
+ "\n",
107
+ "settings = {'dataset':'path.tar', # (path) - path to tar dataset (ends with .tar) \n",
108
+ " 'model_path':'path.pth', # (path) - path to model (ends with .pth) \n",
109
+ " 'file_type':'cell_png', # (Optional, string) string in the path of each image (used to filter images)\n",
110
+ " 'image_size':224, # (int) - Size of images, height and width\n",
111
+ " 'batch_size':64, # (int) - Nr. of images per batch\n",
112
+ " 'normalize':True, # (bool) - Apply ImageNet normalization to images before training.\n",
113
+ " 'score_threshold':0.5, # (float) - Score to byass the classes\n",
114
+ " 'n_jobs':30, # (int) - Number of threads to use\n",
115
+ " 'verbose':True}\n",
116
+ "\n",
117
+ "result_df = apply_model_to_tar(settings)"
118
+ ]
119
+ },
120
+ {
121
+ "cell_type": "code",
122
+ "execution_count": null,
123
+ "id": "28debecd",
124
+ "metadata": {},
125
+ "outputs": [],
126
+ "source": []
127
+ }
128
+ ],
129
+ "metadata": {
130
+ "kernelspec": {
131
+ "display_name": "spacr",
132
+ "language": "python",
133
+ "name": "spacr"
134
+ },
135
+ "language_info": {
136
+ "codemirror_mode": {
137
+ "name": "ipython",
138
+ "version": 3
139
+ },
140
+ "file_extension": ".py",
141
+ "mimetype": "text/x-python",
142
+ "name": "python",
143
+ "nbconvert_exporter": "python",
144
+ "pygments_lexer": "ipython3",
145
+ "version": "3.9.19"
146
+ }
147
+ },
148
+ "nbformat": 4,
149
+ "nbformat_minor": 5
150
+ }
@@ -69,7 +69,7 @@ dependencies = [
69
69
 
70
70
  setup(
71
71
  name="spacr",
72
- version="0.3.52",
72
+ version="0.3.60",
73
73
  author="Einar Birnir Olafsson",
74
74
  author_email="olafsson@med.umich.com",
75
75
  description="Spatial phenotype analysis of crisp screens (SpaCr)",
@@ -706,7 +706,7 @@ class spacrProgressBar(ttk.Progressbar):
706
706
 
707
707
  def set_label_position(self):
708
708
  if self.label and self.progress_label:
709
- row_info = self.grid_info().get('row', 0)
709
+ row_info = self.grid_info().get('row_name', 0)
710
710
  col_info = self.grid_info().get('column', 0)
711
711
  col_span = self.grid_info().get('columnspan', 1)
712
712
  self.progress_label.grid(row=row_info + 1, column=col_info, columnspan=col_span, pady=5, padx=5, sticky='ew')
@@ -106,32 +106,6 @@ def parse_list(value):
106
106
  except (ValueError, SyntaxError) as e:
107
107
  raise ValueError(f"Invalid format for list: {value}. Error: {e}")
108
108
 
109
- def parse_list_v1(value):
110
- """
111
- Parses a string representation of a list and returns the parsed list.
112
-
113
- Args:
114
- value (str): The string representation of the list.
115
-
116
- Returns:
117
- list: The parsed list, which can contain integers, floats, or strings.
118
-
119
- Raises:
120
- ValueError: If the input value is not a valid list format or contains mixed types or unsupported types.
121
- """
122
- try:
123
- parsed_value = ast.literal_eval(value)
124
- if isinstance(parsed_value, list):
125
- # Check if all elements are homogeneous (either all int, float, or str)
126
- if all(isinstance(item, (int, float, str)) for item in parsed_value):
127
- return parsed_value
128
- else:
129
- raise ValueError("List contains mixed types or unsupported types")
130
- else:
131
- raise ValueError(f"Expected a list but got {type(parsed_value).__name__}")
132
- except (ValueError, SyntaxError) as e:
133
- raise ValueError(f"Invalid format for list: {value}. Error: {e}")
134
-
135
109
  # Usage example in your create_input_field function
136
110
  def create_input_field(frame, label_text, row, var_type='entry', options=None, default_value=None):
137
111
  """
@@ -696,91 +670,6 @@ def ensure_after_tasks(frame):
696
670
  if not hasattr(frame, 'after_tasks'):
697
671
  frame.after_tasks = []
698
672
 
699
- def display_gif_in_plot_frame_v1(gif_path, parent_frame):
700
- """Display and zoom a GIF to fill the entire parent_frame, maintaining aspect ratio, with lazy resizing and caching."""
701
- # Clear parent_frame if it contains any previous widgets
702
- for widget in parent_frame.winfo_children():
703
- widget.destroy()
704
-
705
- # Load the GIF
706
- gif = Image.open(gif_path)
707
-
708
- # Get the aspect ratio of the GIF
709
- gif_width, gif_height = gif.size
710
- gif_aspect_ratio = gif_width / gif_height
711
-
712
- # Create a label to display the GIF and configure it to fill the parent_frame
713
- label = tk.Label(parent_frame, bg="black")
714
- label.grid(row=0, column=0, sticky="nsew") # Expands in all directions (north, south, east, west)
715
-
716
- # Configure parent_frame to stretch the label to fill available space
717
- parent_frame.grid_rowconfigure(0, weight=1)
718
- parent_frame.grid_columnconfigure(0, weight=1)
719
-
720
- # Cache for storing resized frames (lazily filled)
721
- resized_frames_cache = {}
722
-
723
- # Last frame dimensions
724
- last_frame_width = 0
725
- last_frame_height = 0
726
-
727
- def resize_and_crop_frame(frame_idx, frame_width, frame_height):
728
- """Resize and crop the current frame of the GIF to fit the parent_frame while maintaining the aspect ratio."""
729
- # If the frame is already cached at the current size, return it
730
- if (frame_idx, frame_width, frame_height) in resized_frames_cache:
731
- return resized_frames_cache[(frame_idx, frame_width, frame_height)]
732
-
733
- # Calculate the scaling factor to zoom in on the GIF
734
- scale_factor = max(frame_width / gif_width, frame_height / gif_height)
735
-
736
- # Calculate new dimensions while maintaining the aspect ratio
737
- new_width = int(gif_width * scale_factor)
738
- new_height = int(gif_height * scale_factor)
739
-
740
- # Resize the GIF to fit the frame
741
- gif.seek(frame_idx)
742
- resized_gif = gif.copy().resize((new_width, new_height), Image.Resampling.LANCZOS)
743
-
744
- # Calculate the cropping box to center the resized GIF in the frame
745
- crop_left = (new_width - frame_width) // 2
746
- crop_top = (new_height - frame_height) // 2
747
- crop_right = crop_left + frame_width
748
- crop_bottom = crop_top + frame_height
749
-
750
- # Crop the resized GIF to exactly fit the frame
751
- cropped_gif = resized_gif.crop((crop_left, crop_top, crop_right, crop_bottom))
752
-
753
- # Convert the cropped frame to a Tkinter-compatible format
754
- frame_image = ImageTk.PhotoImage(cropped_gif)
755
-
756
- # Cache the resized frame
757
- resized_frames_cache[(frame_idx, frame_width, frame_height)] = frame_image
758
-
759
- return frame_image
760
-
761
- def update_frame(frame_idx):
762
- """Update the GIF frame using lazy resizing and caching."""
763
- # Get the current size of the parent_frame
764
- frame_width = parent_frame.winfo_width()
765
- frame_height = parent_frame.winfo_height()
766
-
767
- # Only resize if the frame size has changed
768
- nonlocal last_frame_width, last_frame_height
769
- if frame_width != last_frame_width or frame_height != last_frame_height:
770
- last_frame_width, last_frame_height = frame_width, frame_height
771
-
772
- # Get the resized and cropped frame image
773
- frame_image = resize_and_crop_frame(frame_idx, frame_width, frame_height)
774
- label.config(image=frame_image)
775
- label.image = frame_image # Keep a reference to avoid garbage collection
776
-
777
- # Move to the next frame, or loop back to the beginning
778
- next_frame_idx = (frame_idx + 1) % gif.n_frames
779
- parent_frame.after(gif.info['duration'], update_frame, next_frame_idx)
780
-
781
- # Start the GIF animation from frame 0
782
- update_frame(0)
783
-
784
673
  def display_gif_in_plot_frame(gif_path, parent_frame):
785
674
  """Display and zoom a GIF to fill the entire parent_frame, maintaining aspect ratio, with lazy resizing and caching."""
786
675
  # Clear parent_frame if it contains any previous widgets