Skip to content

Commit

Permalink
minerva-author-ui@1.5.0 minerva-browser@3.15.5
Browse files Browse the repository at this point in the history
  • Loading branch information
thejohnhoffer committed Jun 7, 2023
1 parent 77c7230 commit cadad87
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion minerva-story/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<body>
<div id="minerva-browser" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;"> </div>
<script defer src="https://use.fontawesome.com/releases/v5.2.0/js/all.js" integrity="sha384-4oV5EgaV02iISL2ban6c/RmotsABqE4yZxZLcYMAdG7FAPsyHYAPpywE9PJo+Khy" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/minerva-browser@3.15.0/build/bundle.js"></script>
<script src="https://cdn.jsdelivr.net/npm/minerva-browser@3.15.5/build/bundle.js"></script>
<script>
window.viewer = MinervaStory.default.build_page({
hideWelcome: true,
Expand Down
30 changes: 20 additions & 10 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,18 @@ def extract_story_json_stem(input_file):

def yield_labels(opener, csv_file, chan_label, num_channels):
label_num = 0
can_open_csv = False
# First, try to load labels from CSV
if str(csv_file) != ".":
try:
with open(csv_file, encoding="utf-8-sig") as cf:
for row in csv.DictReader(cf):
if label_num < num_channels:
default = row.get("marker_name", str(label_num))
default = row.get("Marker Name", default)
yield chan_label.get(str(label_num), default)
label_num += 1
# Second, try to load labels from OME-XML
else:
except FileNotFoundError:
# Second, try to load labels from OME-XML
for label in opener.load_xml_markers():
yield label
label_num += 1
Expand Down Expand Up @@ -1667,6 +1668,8 @@ def api_import():
saved = copy_saved_states(autosaved, saved)

input_image_file = pathlib.Path(saved["in_file"])
if (data["missingpath"]):
input_image_file = pathlib.Path(data["missingpath"])

if data["csvpath"]:
csv_file = pathlib.Path(data["csvpath"])
Expand All @@ -1683,14 +1686,17 @@ def api_import():
# This step could take up to a minute
response["masks"] = reload_all_mask_state_subsets(saved["masks"])

if "defaults" in saved:
response["defaults"] = saved["defaults"]

response["waypoints"] = saved["waypoints"]
response["groups"] = saved["groups"]
for group in saved["groups"]:
for chan in group["channels"]:

if "defaults" in saved:
response["defaults"] = saved["defaults"]
for chan in saved["defaults"]:
chan_label[str(chan["id"])] = chan["label"]
else:
for group in saved["groups"]:
for chan in group["channels"]:
chan_label[str(chan["id"])] = chan["label"]
else:
csv_file = pathlib.Path(data["csvpath"])

Expand Down Expand Up @@ -1721,7 +1727,8 @@ def api_import():

(invalid, opener) = return_image_opener(str(input_image_file))
if invalid or not opener:
return api_error(404, "Image file not found: " + str(input_image_file))
img_file = re.search("[^\\\/]*$", str(input_image_file))[0]
return api_error(404, "IMAGE ASK ERR: " + img_file)

(num_channels, num_levels, width, height) = opener.get_shape()

Expand All @@ -1734,6 +1741,9 @@ def api_import():
print(e)
return api_error(500, "Invalid tiff file")

# Copy defaults to channel label dictionary
chan_defaults = response.get("defaults", []);

try:
labels = list(yield_labels(opener, csv_file, chan_label, num_channels))
except Exception:
Expand All @@ -1760,7 +1770,7 @@ def api_import():
"marker_csv_file": str(csv_file),
"input_image_file": str(input_image_file),
"waypoints": response.get("waypoints", []),
"defaults": response.get("defaults"),
"defaults": response.get("defaults", []),
"sample_info": response.get(
"sample_info", {"rotation": 0, "name": "", "text": ""}
),
Expand Down
2 changes: 1 addition & 1 deletion src/save_exhibit_pyramid.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def json_to_html(exhibit):
' <body>\n'
' <div id="minerva-browser" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%;"></div>\n'
' <script defer src="https://use.fontawesome.com/releases/v5.2.0/js/all.js" integrity="sha384-4oV5EgaV02iISL2ban6c/RmotsABqE4yZxZLcYMAdG7FAPsyHYAPpywE9PJo+Khy" crossorigin="anonymous"></script>\n'
' <script src="https://cdn.jsdelivr.net/npm/minerva-browser@3.15.0/build/bundle.js"></script>\n'
' <script src="https://cdn.jsdelivr.net/npm/minerva-browser@3.15.5/build/bundle.js"></script>\n'
' <script>\n'
' window.viewer = MinervaStory.default.build_page({\n'
f'exhibit: {exhibit},\n'
Expand Down
2 changes: 1 addition & 1 deletion static/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><title>Minerva Author</title><link rel="icon" href="images/favicon.png"><meta charset="UTF-8"><meta http-equiv="Cache-control" content="no-cache"/><meta name="description" content="Minerva Author is an authoring tool used to create Minerva narrated stories via selection of specific channel groupings and image views."><meta name="keywords" content="Minerva, microscopy, multiplexed, immunofluorescence, imaging, OME, LSP"><meta property="og:title" content="Minerva Author"/><meta property="og:type" content="website"/><meta property="og:url" content="https://author.minerva.im"/><meta property="og:image" content="https://author.minerva.im/images/Minerva-Author_HorizLogo_RGB.svg"/><script defer="defer" src="https://use.fontawesome.com/releases/v5.2.0/js/all.js" integrity="sha384-4oV5EgaV02iISL2ban6c/RmotsABqE4yZxZLcYMAdG7FAPsyHYAPpywE9PJo+Khy" crossorigin="anonymous"></script></head><body><div id="minerva"></div><script src="https://cdn.jsdelivr.net/npm/minerva-author-ui@1.4.0/build/bundle.cd18d7bf8c0adf1d053d.js"></script></body></html>
<!doctype html><html><head><title>Minerva Author</title><link rel="icon" href="images/favicon.png"><meta charset="UTF-8"><meta http-equiv="Cache-control" content="no-cache"/><meta name="description" content="Minerva Author is an authoring tool used to create Minerva narrated stories via selection of specific channel groupings and image views."><meta name="keywords" content="Minerva, microscopy, multiplexed, immunofluorescence, imaging, OME, LSP"><meta property="og:title" content="Minerva Author"/><meta property="og:type" content="website"/><meta property="og:url" content="https://author.minerva.im"/><meta property="og:image" content="https://author.minerva.im/images/Minerva-Author_HorizLogo_RGB.svg"/><script defer="defer" src="https://use.fontawesome.com/releases/v5.2.0/js/all.js" integrity="sha384-4oV5EgaV02iISL2ban6c/RmotsABqE4yZxZLcYMAdG7FAPsyHYAPpywE9PJo+Khy" crossorigin="anonymous"></script></head><body><div id="minerva"></div><script src="https://cdn.jsdelivr.net/npm/minerva-author-ui@1.5.0/build/bundle.aa36dd10fcd586e82f39.js"></script></body></html>

0 comments on commit cadad87

Please sign in to comment.