lambda scientist commited on
Commit
07cafd6
1 Parent(s): a2e6ff7
.gitignore ADDED
@@ -0,0 +1,167 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
105
+ __pypackages__/
106
+
107
+ # Celery stuff
108
+ celerybeat-schedule
109
+ celerybeat.pid
110
+
111
+ # SageMath parsed files
112
+ *.sage.py
113
+
114
+ # Environments
115
+ .env
116
+ .venv
117
+ env/
118
+ venv/
119
+ ENV/
120
+ env.bak/
121
+ venv.bak/
122
+
123
+ # Spyder project settings
124
+ .spyderproject
125
+ .spyproject
126
+
127
+ # Rope project settings
128
+ .ropeproject
129
+
130
+ # mkdocs documentation
131
+ /site
132
+
133
+ # mypy
134
+ .mypy_cache/
135
+ .dmypy.json
136
+ dmypy.json
137
+
138
+ # Pyre type checker
139
+ .pyre/
140
+
141
+ # pytype static type analyzer
142
+ .pytype/
143
+
144
+ # Cython debug symbols
145
+ cython_debug/
146
+
147
+ # PyCharm
148
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
149
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
151
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
152
+ #.idea/
153
+
154
+ # Custom Corentin
155
+ *.html
156
+ MyoQuant
157
+ EHRoes
158
+ *.h5
159
+ log
160
+ pid
161
+ *.npy
162
+ *.tiff
163
+ *.npz
164
+ *.jpg
165
+ *.csv
166
+ *.png
167
+ *.tif
pages/1_HE_Staining_Analysis.py CHANGED
@@ -32,37 +32,37 @@ st.set_page_config(
32
  use_GPU = is_gpu_availiable()
33
 
34
 
35
- @st.experimental_singleton
36
  def st_load_cellpose():
37
  return load_cellpose()
38
 
39
 
40
- @st.experimental_singleton
41
  def st_load_stardist():
42
  return load_stardist()
43
 
44
 
45
- @st.experimental_memo
46
  def st_run_cellpose(image_ndarray, _model):
47
  return run_cellpose(image_ndarray, _model)
48
 
49
 
50
- @st.experimental_memo
51
  def st_run_stardist(image_ndarray, _model, nms_thresh, prob_thresh):
52
  return run_stardist(image_ndarray, _model, nms_thresh, prob_thresh)
53
 
54
 
55
- @st.experimental_memo
56
  def st_df_from_cellpose_mask(mask):
57
  return df_from_cellpose_mask(mask)
58
 
59
 
60
- @st.experimental_memo
61
  def st_df_from_stardist_mask(mask):
62
  return df_from_stardist_mask(mask)
63
 
64
 
65
- @st.experimental_memo
66
  def st_predict_all_cells(
67
  image_ndarray, df_cellpose, mask_stardist, internalised_threshold
68
  ):
@@ -71,12 +71,12 @@ def st_predict_all_cells(
71
  )
72
 
73
 
74
- @st.experimental_memo
75
  def st_extract_ROIs(image_ndarray, selected_fiber, df_cellpose, mask_stardist):
76
  return extract_ROIs(image_ndarray, selected_fiber, df_cellpose, mask_stardist)
77
 
78
 
79
- @st.experimental_memo
80
  def st_single_cell_analysis(
81
  single_cell_img,
82
  single_cell_mask,
@@ -99,7 +99,7 @@ def st_single_cell_analysis(
99
  )
100
 
101
 
102
- @st.experimental_memo
103
  def st_paint_histo_img(image_ndarray, df_cellpose, cellpose_df_stat):
104
  return paint_histo_img(image_ndarray, df_cellpose, cellpose_df_stat)
105
 
 
32
  use_GPU = is_gpu_availiable()
33
 
34
 
35
+ @st.cache_resource
36
  def st_load_cellpose():
37
  return load_cellpose()
38
 
39
 
40
+ @st.cache_resource
41
  def st_load_stardist():
42
  return load_stardist()
43
 
44
 
45
+ @st.cache_data
46
  def st_run_cellpose(image_ndarray, _model):
47
  return run_cellpose(image_ndarray, _model)
48
 
49
 
50
+ @st.cache_data
51
  def st_run_stardist(image_ndarray, _model, nms_thresh, prob_thresh):
52
  return run_stardist(image_ndarray, _model, nms_thresh, prob_thresh)
53
 
54
 
55
+ @st.cache_data
56
  def st_df_from_cellpose_mask(mask):
57
  return df_from_cellpose_mask(mask)
58
 
59
 
60
+ @st.cache_data
61
  def st_df_from_stardist_mask(mask):
62
  return df_from_stardist_mask(mask)
63
 
64
 
65
+ @st.cache_data
66
  def st_predict_all_cells(
67
  image_ndarray, df_cellpose, mask_stardist, internalised_threshold
68
  ):
 
71
  )
72
 
73
 
74
+ @st.cache_data
75
  def st_extract_ROIs(image_ndarray, selected_fiber, df_cellpose, mask_stardist):
76
  return extract_ROIs(image_ndarray, selected_fiber, df_cellpose, mask_stardist)
77
 
78
 
79
+ @st.cache_data
80
  def st_single_cell_analysis(
81
  single_cell_img,
82
  single_cell_mask,
 
99
  )
100
 
101
 
102
+ @st.cache_data
103
  def st_paint_histo_img(image_ndarray, df_cellpose, cellpose_df_stat):
104
  return paint_histo_img(image_ndarray, df_cellpose, cellpose_df_stat)
105
 
pages/2_SDH_Staining_Analysis.py CHANGED
@@ -34,42 +34,42 @@ st.set_page_config(
34
  use_GPU = is_gpu_availiable()
35
 
36
 
37
- @st.experimental_singleton
38
  def st_load_sdh_model(model_path):
39
  return load_sdh_model(model_path)
40
 
41
 
42
- @st.experimental_singleton
43
  def st_load_cellpose():
44
  return load_cellpose()
45
 
46
 
47
- @st.experimental_memo
48
  def st_run_cellpose(image_ndarray, _model):
49
  return run_cellpose(image_ndarray, _model)
50
 
51
 
52
- @st.experimental_memo
53
  def st_df_from_cellpose_mask(mask):
54
  return df_from_cellpose_mask(mask)
55
 
56
 
57
- @st.experimental_memo
58
  def st_predict_all_cells(image_ndarray, cellpose_df, _model_SDH):
59
  return predict_all_cells(image_ndarray, cellpose_df, _model_SDH)
60
 
61
 
62
- @st.experimental_memo
63
  def st_extract_single_image(image_ndarray, cellpose_df, index):
64
  return extract_single_image(image_ndarray, cellpose_df, index)
65
 
66
 
67
- @st.experimental_memo
68
  def st_predict_single_cell(image_ndarray, _model_SDH):
69
  return predict_single_cell(image_ndarray, _model_SDH)
70
 
71
 
72
- @st.experimental_memo
73
  def st_paint_full_image(image_sdh, df_cellpose, class_predicted_all):
74
  return paint_full_image(image_sdh, df_cellpose, class_predicted_all)
75
 
 
34
  use_GPU = is_gpu_availiable()
35
 
36
 
37
+ @st.cache_resource
38
  def st_load_sdh_model(model_path):
39
  return load_sdh_model(model_path)
40
 
41
 
42
+ @st.cache_resource
43
  def st_load_cellpose():
44
  return load_cellpose()
45
 
46
 
47
+ @st.cache_data
48
  def st_run_cellpose(image_ndarray, _model):
49
  return run_cellpose(image_ndarray, _model)
50
 
51
 
52
+ @st.cache_data
53
  def st_df_from_cellpose_mask(mask):
54
  return df_from_cellpose_mask(mask)
55
 
56
 
57
+ @st.cache_data
58
  def st_predict_all_cells(image_ndarray, cellpose_df, _model_SDH):
59
  return predict_all_cells(image_ndarray, cellpose_df, _model_SDH)
60
 
61
 
62
+ @st.cache_data
63
  def st_extract_single_image(image_ndarray, cellpose_df, index):
64
  return extract_single_image(image_ndarray, cellpose_df, index)
65
 
66
 
67
+ @st.cache_data
68
  def st_predict_single_cell(image_ndarray, _model_SDH):
69
  return predict_single_cell(image_ndarray, _model_SDH)
70
 
71
 
72
+ @st.cache_data
73
  def st_paint_full_image(image_sdh, df_cellpose, class_predicted_all):
74
  return paint_full_image(image_sdh, df_cellpose, class_predicted_all)
75
 
pages/3_Breast_Muscle_Analysis.py CHANGED
@@ -35,37 +35,37 @@ st.set_page_config(
35
  use_GPU = is_gpu_availiable()
36
 
37
 
38
- @st.experimental_singleton
39
  def st_load_cellpose():
40
  return load_cellpose()
41
 
42
 
43
- @st.experimental_singleton
44
  def st_load_stardist(fluo=False):
45
  return load_stardist(fluo)
46
 
47
 
48
- @st.experimental_memo
49
  def st_run_cellpose(image_ndarray, _model):
50
  return run_cellpose(image_ndarray, _model)
51
 
52
 
53
- @st.experimental_memo
54
  def st_run_stardist(image_ndarray, _model, nms_thresh, prob_thresh):
55
  return run_stardist(image_ndarray, _model, nms_thresh, prob_thresh)
56
 
57
 
58
- @st.experimental_memo
59
  def st_df_from_cellpose_mask(mask):
60
  return df_from_cellpose_mask(mask)
61
 
62
 
63
- @st.experimental_memo
64
  def st_df_from_stardist_mask(mask):
65
  return df_from_stardist_mask(mask)
66
 
67
 
68
- @st.experimental_memo
69
  def st_predict_all_cells(
70
  image_ndarray, df_cellpose, mask_stardist, internalised_threshold
71
  ):
@@ -74,12 +74,12 @@ def st_predict_all_cells(
74
  )
75
 
76
 
77
- @st.experimental_memo
78
  def st_extract_ROIs(image_ndarray, selected_fiber, df_cellpose, mask_stardist):
79
  return extract_ROIs(image_ndarray, selected_fiber, df_cellpose, mask_stardist)
80
 
81
 
82
- @st.experimental_memo
83
  def st_single_cell_analysis(
84
  single_cell_img,
85
  single_cell_mask,
@@ -102,7 +102,7 @@ def st_single_cell_analysis(
102
  )
103
 
104
 
105
- @st.experimental_memo
106
  def st_paint_histo_img(image_ndarray, df_cellpose, cellpose_df_stat):
107
  return paint_histo_img(image_ndarray, df_cellpose, cellpose_df_stat)
108
 
 
35
  use_GPU = is_gpu_availiable()
36
 
37
 
38
+ @st.cache_resource
39
  def st_load_cellpose():
40
  return load_cellpose()
41
 
42
 
43
+ @st.cache_resource
44
  def st_load_stardist(fluo=False):
45
  return load_stardist(fluo)
46
 
47
 
48
+ @st.cache_data
49
  def st_run_cellpose(image_ndarray, _model):
50
  return run_cellpose(image_ndarray, _model)
51
 
52
 
53
+ @st.cache_data
54
  def st_run_stardist(image_ndarray, _model, nms_thresh, prob_thresh):
55
  return run_stardist(image_ndarray, _model, nms_thresh, prob_thresh)
56
 
57
 
58
+ @st.cache_data
59
  def st_df_from_cellpose_mask(mask):
60
  return df_from_cellpose_mask(mask)
61
 
62
 
63
+ @st.cache_data
64
  def st_df_from_stardist_mask(mask):
65
  return df_from_stardist_mask(mask)
66
 
67
 
68
+ @st.cache_data
69
  def st_predict_all_cells(
70
  image_ndarray, df_cellpose, mask_stardist, internalised_threshold
71
  ):
 
74
  )
75
 
76
 
77
+ @st.cache_data
78
  def st_extract_ROIs(image_ndarray, selected_fiber, df_cellpose, mask_stardist):
79
  return extract_ROIs(image_ndarray, selected_fiber, df_cellpose, mask_stardist)
80
 
81
 
82
+ @st.cache_data
83
  def st_single_cell_analysis(
84
  single_cell_img,
85
  single_cell_mask,
 
102
  )
103
 
104
 
105
+ @st.cache_data
106
  def st_paint_histo_img(image_ndarray, df_cellpose, cellpose_df_stat):
107
  return paint_histo_img(image_ndarray, df_cellpose, cellpose_df_stat)
108
 
pages/4_ATP_Staining_Analysis.py CHANGED
@@ -34,42 +34,42 @@ st.set_page_config(
34
  )
35
 
36
 
37
- @st.experimental_singleton
38
  def st_load_cellpose():
39
  return load_cellpose()
40
 
41
 
42
- @st.experimental_memo
43
  def st_run_cellpose(image_atp, _model):
44
  return run_cellpose(image_atp, _model)
45
 
46
 
47
- @st.experimental_memo
48
  def st_df_from_cellpose_mask(mask):
49
  return df_from_cellpose_mask(mask)
50
 
51
 
52
- @st.experimental_memo
53
  def st_get_all_intensity(image_atp, df_cellpose):
54
  return get_all_intensity(image_atp, df_cellpose)
55
 
56
 
57
- @st.experimental_memo
58
  def st_estimate_threshold(intensity_list):
59
  return estimate_threshold(intensity_list)
60
 
61
 
62
- @st.experimental_memo
63
  def st_plot_density(all_cell_median_intensity, intensity_threshold):
64
  return plot_density(all_cell_median_intensity, intensity_threshold)
65
 
66
 
67
- @st.experimental_memo
68
  def st_predict_all_cells(image_atp, cellpose_df, intensity_threshold):
69
  return predict_all_cells(image_atp, cellpose_df, intensity_threshold)
70
 
71
 
72
- @st.experimental_memo
73
  def st_paint_full_image(image_atp, df_cellpose, class_predicted_all):
74
  return paint_full_image(image_atp, df_cellpose, class_predicted_all)
75
 
 
34
  )
35
 
36
 
37
+ @st.cache_resource
38
  def st_load_cellpose():
39
  return load_cellpose()
40
 
41
 
42
+ @st.cache_data
43
  def st_run_cellpose(image_atp, _model):
44
  return run_cellpose(image_atp, _model)
45
 
46
 
47
+ @st.cache_data
48
  def st_df_from_cellpose_mask(mask):
49
  return df_from_cellpose_mask(mask)
50
 
51
 
52
+ @st.cache_data
53
  def st_get_all_intensity(image_atp, df_cellpose):
54
  return get_all_intensity(image_atp, df_cellpose)
55
 
56
 
57
+ @st.cache_data
58
  def st_estimate_threshold(intensity_list):
59
  return estimate_threshold(intensity_list)
60
 
61
 
62
+ @st.cache_data
63
  def st_plot_density(all_cell_median_intensity, intensity_threshold):
64
  return plot_density(all_cell_median_intensity, intensity_threshold)
65
 
66
 
67
+ @st.cache_data
68
  def st_predict_all_cells(image_atp, cellpose_df, intensity_threshold):
69
  return predict_all_cells(image_atp, cellpose_df, intensity_threshold)
70
 
71
 
72
+ @st.cache_data
73
  def st_paint_full_image(image_atp, df_cellpose, class_predicted_all):
74
  return paint_full_image(image_atp, df_cellpose, class_predicted_all)
75