kaveh commited on
Commit
c0ccb4f
·
1 Parent(s): 3bd9573

Update terminology to reflect "traction stress map" instead of "force map". Adjust README.md for clarity on app version and refine comments in download_ckp.py for better understanding of checkpoint downloads.

Browse files
S2FApp/README.md CHANGED
@@ -52,8 +52,8 @@ Checkpoints are downloaded automatically from the [Shape2Force model repo](https
52
  - **Downloads**: map PNG (scale bar + colourbar), CSV with metrics and parameters, and a PDF report that records the
53
  input file, model, checkpoint SHA-256, substrate setting, pixel size, display and force-region settings and app
54
  version. Batch mode gives a PDF (summary table + one page per image), a CSV, and a ZIP with, per image, the PNG and a
55
- TIFF whose pixel values are traction stress in Pa (for measurements in Fiji/ImageJ). Set `S2F_APP_COMMIT` to add
56
- the git commit.
57
 
58
  ## Full Project
59
 
 
52
  - **Downloads**: map PNG (scale bar + colourbar), CSV with metrics and parameters, and a PDF report that records the
53
  input file, model, checkpoint SHA-256, substrate setting, pixel size, display and force-region settings and app
54
  version. Batch mode gives a PDF (summary table + one page per image), a CSV, and a ZIP with, per image, the PNG and a
55
+ TIFF whose pixel values are traction stress in Pa (for measurements in Fiji/ImageJ). Reports record the app version
56
+ (`APP_VERSION` in `config/constants.py`; bump it and tag the GitHub release on each deploy).
57
 
58
  ## Full Project
59
 
S2FApp/app.py CHANGED
@@ -229,7 +229,7 @@ with st.sidebar:
229
  ["single_cell", "spheroid"],
230
  format_func=lambda x: MODEL_TYPE_LABELS[x],
231
  horizontal=False,
232
- help="Single cell: substrate-aware force prediction. Spheroid: spheroid force maps.",
233
  )
234
 
235
  ckp_folder = get_ckp_folder(ckp_base, model_type)
@@ -362,7 +362,7 @@ with st.sidebar:
362
  list(COLORMAPS.keys()),
363
  key="s2f_colormap",
364
  label_visibility="collapsed",
365
- help="Color scheme for the force map. Viridis is often preferred for accessibility.",
366
  )
367
 
368
 
 
229
  ["single_cell", "spheroid"],
230
  format_func=lambda x: MODEL_TYPE_LABELS[x],
231
  horizontal=False,
232
+ help="Single cell: substrate-aware force prediction. Spheroid: spheroid traction stress maps.",
233
  )
234
 
235
  ckp_folder = get_ckp_folder(ckp_base, model_type)
 
362
  list(COLORMAPS.keys()),
363
  key="s2f_colormap",
364
  label_visibility="collapsed",
365
+ help="Color scheme for the traction stress map. Viridis is often preferred for accessibility.",
366
  )
367
 
368
 
S2FApp/download_ckp.py CHANGED
@@ -14,8 +14,8 @@ if not has_any:
14
  repo = os.environ.get("HF_MODEL_REPO", "Angione-Lab/Shape2Force")
15
  files = list_repo_files(repo)
16
  pth_files = [f for f in files if f.startswith("ckp/") and f.endswith(".pth")]
17
- # All checkpoints: single cell (S2F), spheroid S2F (ckp_spheroid_GN.pth, the model reported in the paper
18
- # and the app default) and the smaller supervised spheroid model (ckp_spheroid_FN.pth).
19
  for f in pth_files:
20
  hf_hub_download(repo_id=repo, filename=f, local_dir="/app")
21
  print("Downloaded checkpoints from", repo)
 
14
  repo = os.environ.get("HF_MODEL_REPO", "Angione-Lab/Shape2Force")
15
  files = list_repo_files(repo)
16
  pth_files = [f for f in files if f.startswith("ckp/") and f.endswith(".pth")]
17
+ # All checkpoints: single cell (S2F), spheroid S2F (ckp_spheroid_GN.pth, the model reported in the paper)
18
+ # and the smaller supervised spheroid model (ckp_spheroid_FN.pth, the app default).
19
  for f in pth_files:
20
  hf_hub_download(repo_id=repo, filename=f, local_dir="/app")
21
  print("Downloaded checkpoints from", repo)
S2FApp/ui/measure_tool.py CHANGED
@@ -214,7 +214,7 @@ def render_region_canvas(display_heatmap, raw_heatmap=None, bf_img=None, origina
214
  left_col, right_col = st.columns(2, gap=None)
215
  with left_col:
216
  draw_mode = st.selectbox("Tool", DRAW_TOOLS, format_func=lambda x: TOOL_LABELS[x], key=f"draw_mode_region_{key_suffix}")
217
- st.caption("Left-click add, right-click close. \nForce map (draw region)")
218
  canvas_result = st_canvas(
219
  fill_color="rgba(0, 188, 212, 0.25)", stroke_width=2, stroke_color="#00bcd4",
220
  background_image=pil_bg, drawing_mode=draw_mode, update_streamlit=True,
 
214
  left_col, right_col = st.columns(2, gap=None)
215
  with left_col:
216
  draw_mode = st.selectbox("Tool", DRAW_TOOLS, format_func=lambda x: TOOL_LABELS[x], key=f"draw_mode_region_{key_suffix}")
217
+ st.caption("Left-click add, right-click close. \nTraction stress map (draw region)")
218
  canvas_result = st_canvas(
219
  fill_color="rgba(0, 188, 212, 0.25)", stroke_width=2, stroke_color="#00bcd4",
220
  background_image=pil_bg, drawing_mode=draw_mode, update_streamlit=True,
S2FApp/utils/report.py CHANGED
@@ -365,8 +365,8 @@ def create_measure_pdf_report(bf_img, heatmap_labeled_rgb, table_rows, base_name
365
  Image.fromarray(heatmap_labeled_rgb).save(hm_labeled_buf, format="PNG")
366
  hm_labeled_buf.seek(0)
367
  c.drawImage(ImageReader(hm_labeled_buf), hm_x, img_bottom, width=img_w, height=img_h, preserveAspectRatio=True)
368
- hm_label_w = c.stringWidth("Force map", "Helvetica", 9)
369
- c.drawString(hm_x + (img_w - hm_label_w) / 2, img_bottom - 14, "Force map")
370
 
371
  # Spacing: one line between images/labels and measurements section
372
  row_height = 14
 
365
  Image.fromarray(heatmap_labeled_rgb).save(hm_labeled_buf, format="PNG")
366
  hm_labeled_buf.seek(0)
367
  c.drawImage(ImageReader(hm_labeled_buf), hm_x, img_bottom, width=img_w, height=img_h, preserveAspectRatio=True)
368
+ hm_label_w = c.stringWidth("Traction stress map", "Helvetica", 9)
369
+ c.drawString(hm_x + (img_w - hm_label_w) / 2, img_bottom - 14, "Traction stress map")
370
 
371
  # Spacing: one line between images/labels and measurements section
372
  row_height = 14