Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions src/cmlibs/exporter/flatmapsvg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,16 +1007,25 @@ def _define_background_regions(boundaries, view_box):
cervical_min_y = min_y + brain_height
thoracic_min_y = cervical_min_y + cervical_height
lumbar_min_y = thoracic_min_y + thoracic_height
brain_rect = f'<rect x="{min_x}" y="{min_y}" width="{width}" height="{brain_height}" fill="red"><title>.id(brain_region)</title></rect>'
cervical_rect = f'<rect x="{min_x}" y="{cervical_min_y}" width="{width}" height="{cervical_height}" fill="green"><title>.id(cervical_region)</title></rect>'
thoracic_rect = f'<rect x="{min_x}" y="{thoracic_min_y}" width="{width}" height="{thoracic_height}" fill="grey"><title>.id(thoracic_region)</title></rect>'
lumbar_rect = f'<rect x="{min_x}" y="{lumbar_min_y}" width="{width}" height="{lumbar_height}" fill="blue"><title>.id(lumbar_region)</title></rect>'
features = {
"brain_region": {"name": "Brain"},
"cervical_region": {"name": "Cervical C1-C7"},
"thoracic_region": {"name": "Thoracic T1-T12"},
"lumbar_region": {"name": "Lumbar L1-"}
}

brain_rect = ''
cervical_rect = ''
thoracic_rect = ''
lumbar_rect = ''
features = {}
if width > 0:
if brain_height > 0:
features["brain_region"] = {"name": "Brain"}
brain_rect = f'<rect x="{min_x}" y="{min_y}" width="{width}" height="{brain_height}" fill="red"><title>.id(brain_region)</title></rect>'
if cervical_height > 0:
features["cervical_region"] = {"name": "Cervical C1-C7"}
cervical_rect = f'<rect x="{min_x}" y="{cervical_min_y}" width="{width}" height="{cervical_height}" fill="green"><title>.id(cervical_region)</title></rect>'
if thoracic_height > 0:
features["thoracic_region"] = {"name": "Thoracic T1-T12"}
thoracic_rect = f'<rect x="{min_x}" y="{thoracic_min_y}" width="{width}" height="{thoracic_height}" fill="grey"><title>.id(thoracic_region)</title></rect>'
if lumbar_height > 0:
features["lumbar_region"] = {"name": "Lumbar L1-"}
lumbar_rect = f'<rect x="{min_x}" y="{lumbar_min_y}" width="{width}" height="{lumbar_height}" fill="blue"><title>.id(lumbar_region)</title></rect>'

return f'{brain_rect}{cervical_rect}{thoracic_rect}{lumbar_rect}', features

Expand Down
297 changes: 297 additions & 0 deletions tests/resources/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
{
"features": {
"brain_region": {
"name": "Brain"
},
"marker_10001": {
"colour": "orange",
"label": "Label 'right level of superior border of jugular foramen on the vagus nerve' for term 'UBERON:9947841' was not found during lookup.",
"models": "UBERON:9947841"
},
"marker_10002": {
"colour": "orange",
"label": "Label 'right level of inferior border of jugular foramen on the vagus nerve' for term 'UBERON:9936083' was not found during lookup.",
"models": "UBERON:9936083"
},
"marker_10003": {
"colour": "orange",
"label": "Label 'right level of angle of the mandible on the vagus nerve' for term 'UBERON:9986030' was not found during lookup.",
"models": "UBERON:9986030"
},
"marker_10004": {
"colour": "orange",
"label": "Label 'right level of carotid bifurcation on the vagus nerve' for term 'UBERON:9936336' was not found during lookup.",
"models": "UBERON:9936336"
},
"marker_10005": {
"colour": "orange",
"label": "Label 'right level of laryngeal prominence on the vagus nerve' for term 'UBERON:9931228' was not found during lookup.",
"models": "UBERON:9931228"
},
"marker_10006": {
"colour": "orange",
"label": "Label 'right level of superior border of the clavicle on the vagus nerve' for term 'UBERON:9968398' was not found during lookup.",
"models": "UBERON:9968398"
},
"marker_10007": {
"colour": "orange",
"label": "Label 'right level of jugular notch on the vagus nerve' for term 'UBERON:9967307' was not found during lookup.",
"models": "UBERON:9967307"
},
"marker_10008": {
"colour": "orange",
"label": "Label 'right level of sternal angle on the vagus nerve' for term 'UBERON:9987408' was not found during lookup.",
"models": "UBERON:9987408"
},
"nerve_feature_01": {
"label": "Label 'Right hypoglossal nerve' for term 'ILX:987654' was not found during lookup."
},
"nerve_feature_02": {
"label": "Label 'Right spinal accessory nerve' for term 'ILX:345678' was not found during lookup."
},
"nerve_feature_03": {
"label": "Label 'cardiovascular/cardiopulmonary branch of right cervical vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_04": {
"label": "Label 'cardiovascular/cardiopulmonary branch of right thoracic vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_08": {
"label": "Label 'right A branch of cervical vagus nerve to sympathetic chain, cardiovascular, and pulmonary structures' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_09": {
"label": "Label 'right A branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_10": {
"label": "Label 'right A cardiovascular branch of cervical vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_11": {
"label": "Label 'right A cardiovascular branch of cranial nerve bundle' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_12": {
"label": "Label 'right A lateral pulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_13": {
"label": "Label 'right A medial pulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_14": {
"label": "Label 'right A thoracic cardiopulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_15": {
"label": "Label 'right B branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_16": {
"label": "Label 'right B cardiovascular branch of cranial nerve bundle' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_17": {
"label": "Label 'right B lateral pulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_18": {
"label": "Label 'right B medial pulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_19": {
"label": "Label 'right B thoracic cardiopulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_20": {
"label": "Label 'right C branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_21": {
"label": "Label 'right C lateral pulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_22": {
"label": "Label 'right C medial pulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_23": {
"label": "Label 'right C thoracic cardiopulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_24": {
"label": "Label 'right D branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_25": {
"label": "Label 'right D lateral pulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_26": {
"label": "Label 'right D medial pulmonary branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_27": {
"label": "Label 'right E branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_28": {
"label": "Label 'right F branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_29": {
"label": "Label 'right G branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_30": {
"label": "Label 'right H branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_31": {
"label": "Label 'right I branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_32": {
"label": "Label 'right J branch of thoracic vagus nerve to esophageal plexus' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_33": {
"label": "Label 'right branch between cranial nerve bundle and superior cervical ganglion' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_35": {
"label": "Label 'right branch of cervical vagus nerve to sympathetic chain, cardiovascular, and pulmonary structures' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_36": {
"label": "Label 'right cardiovascular branch of cervical vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_38": {
"label": "Label 'right cervical vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_39": {
"label": "Label 'right cranial nerve bundle to cervical spinal nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_42": {
"label": "Label 'right pharyngeal branch of cranial nerve bundle' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_43": {
"label": "Label 'right recurrent laryngeal nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_44": {
"label": "Label 'right superior laryngeal nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_46": {
"label": "Label 'right thoracic vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_47": {
"label": "Label 'right unknown branch of vagus nerve' for term '<missing-annotation>' was not found during lookup."
},
"nerve_feature_48": {
"label": "Label 'right vagus nerve' for term '<missing-annotation>' was not found during lookup."
}
},
"networks": [
{
"centrelines": [
{
"id": "nerve_feature_38"
},
{
"id": "nerve_feature_48"
},
{
"id": "nerve_feature_46"
},
{
"id": "nerve_feature_01",
"models": "ILX:987654"
},
{
"id": "nerve_feature_02",
"models": "ILX:345678"
},
{
"id": "nerve_feature_03"
},
{
"id": "nerve_feature_04"
},
{
"id": "nerve_feature_08"
},
{
"id": "nerve_feature_35"
},
{
"id": "nerve_feature_09"
},
{
"id": "nerve_feature_10"
},
{
"id": "nerve_feature_36"
},
{
"id": "nerve_feature_11"
},
{
"id": "nerve_feature_12"
},
{
"id": "nerve_feature_13"
},
{
"id": "nerve_feature_14"
},
{
"id": "nerve_feature_15"
},
{
"id": "nerve_feature_16"
},
{
"id": "nerve_feature_17"
},
{
"id": "nerve_feature_18"
},
{
"id": "nerve_feature_19"
},
{
"id": "nerve_feature_20"
},
{
"id": "nerve_feature_21"
},
{
"id": "nerve_feature_22"
},
{
"id": "nerve_feature_23"
},
{
"id": "nerve_feature_24"
},
{
"id": "nerve_feature_25"
},
{
"id": "nerve_feature_26"
},
{
"id": "nerve_feature_27"
},
{
"id": "nerve_feature_28"
},
{
"id": "nerve_feature_29"
},
{
"id": "nerve_feature_30"
},
{
"id": "nerve_feature_31"
},
{
"id": "nerve_feature_32"
},
{
"id": "nerve_feature_33"
},
{
"id": "nerve_feature_39"
},
{
"id": "nerve_feature_42"
},
{
"id": "nerve_feature_43"
},
{
"id": "nerve_feature_44"
},
{
"id": "nerve_feature_47"
}
],
"id": "vagus",
"type": "nerve"
}
]
}
270 changes: 270 additions & 0 deletions tests/resources/vagus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/test_flatmapsvg.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_flatmap_svg_user_mesh(self):
tree = ET.parse(flatmap_svg_file)
root = tree.getroot()

self.assertEqual(92, len(root))
self.assertEqual(89, len(root))

with open(properties_file) as f:
content = json.load(f)
Expand Down
Loading