Skip to content

Commit

Permalink
create biolucida name mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ddjnw1yu committed Apr 22, 2024
1 parent 7887c65 commit c322875
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/biolucida_process_results.py
@@ -1,6 +1,7 @@
import re

from xml.etree import ElementTree
from app.manifest_name_to_discover_name import biolucida_name_map


XMP_NS = {'xmp': 'http://ns.adobe.com/xap/1.0/', 'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'x': 'adobe:ns:meta/'}
Expand Down Expand Up @@ -87,3 +88,12 @@ def process_results(data):
raise NotImplementedError(f"Not able to handle XMP core meta data for version: '{version}'")

raise AttributeError(f"Not able to match version from: '{xmp_version_string}'")


def process_result(data):
if 'name' in data:
image_name = data['name']
if image_name in biolucida_name_map:
data['name'] = biolucida_name_map[image_name]

return data
4 changes: 2 additions & 2 deletions app/main.py
Expand Up @@ -47,7 +47,7 @@
from app.utilities import img_to_base64_str, get_path_from_mangled_list
from app.osparc.osparc import start_simulation as do_start_simulation
from app.osparc.osparc import check_simulation as do_check_simulation
from app.biolucida_process_results import process_results as process_biolucida_results
from app.biolucida_process_results import process_results as process_biolucida_results, process_result as process_biolucida_result

logging.basicConfig()

Expand Down Expand Up @@ -951,7 +951,7 @@ def thumbnail_by_image_id(image_id, recursive_call=False):
def image_info_by_image_id(image_id):
url = Config.BIOLUCIDA_ENDPOINT + "/image/{0}".format(image_id)
response = requests.request("GET", url)
return response.json()
return process_biolucida_result(response.json())


@app.route("/image_search/<dataset_id>", methods=["GET"])
Expand Down
3 changes: 3 additions & 0 deletions app/manifest_name_to_discover_name.py
Expand Up @@ -5113,3 +5113,6 @@
'files/derivative/sub-15\sam-3\sub-15_sam-3_ChAT_P15-3p3_20x.jp2': 'files/derivative/sub-15/sam-3/sub-15_sam-3_ChAT_P15-3p3_20x.jp2',
'files/derivative/sub-15\sam-3\sub-15_sam-3_TH_P15-3p1_20x.jp2': 'files/derivative/sub-15/sam-3/sub-15_sam-3_TH_P15-3p1_20x.jp2'
}

biolucida_name_map = {
}

0 comments on commit c322875

Please sign in to comment.