diff --git a/src/scaffoldmaker/annotation/vagus_terms.py b/src/scaffoldmaker/annotation/vagus_terms.py index 27ab6fa8..ab9e81f4 100644 --- a/src/scaffoldmaker/annotation/vagus_terms.py +++ b/src/scaffoldmaker/annotation/vagus_terms.py @@ -89,6 +89,10 @@ ("inferior cervical cardiac branch of vagus nerve", "ILX:0788259", "FMA:6245"), ("thoracic cardiac branch of vagus nerve", "ILX:0794849"), ("esophageal vagus trunk", "ILX:0794853", "esophageal trunk"), + ("cardiac branch of the esophageal plexus of vagus nerve", "ILX:0794917", "cardiac branch of esophageal plexus of vagus nerve"), + ("esophageal branch of esophageal plexus of vagus nerve", "ILX:0794344"), + ("esophageal branches from esophageal plexus of vagus nerve", "ILX:0796116"), + ("esophageal plexus cardiopulmonary branches", "ILX:0796105"), # right vagus branches ("right vagus nerve", "ILX:0789705", "FMA:6219"), @@ -125,8 +129,8 @@ ("right cardiovascular branch of cervical vagus nerve", "ILX:0794846"), ("right cardiovascular branch of thoracic vagus nerve", "ILX:0794851"), ("right cervical cardiopulmonary branch of vagus nerve", "ILX:0794153"), - ("right thoracic cardiopulmonary branch of vagus nerve", "ILX:0794180"), - ("right pulmonary branch of vagus nerve", "ILX:0796017"), + ("right thoracic cardiopulmonary branch of vagus nerve", "ILX:0794180", "right thoracic cardiopulmonary branch"), + ("right pulmonary branch of vagus nerve", "ILX:0796017", "right pulmonary branch"), ("right lateral pulmonary branch of vagus nerve", "ILX:0794277"), ("right medial pulmonary branch of vagus nerve", "ILX:0794254"), ("bronchial branch of right vagus nerve", "ILX:0791364", "FMA:53613",), @@ -149,10 +153,31 @@ ("inferior cervical cardiac branch of right vagus nerve", "ILX:0789456", "FMA:6713"), ("thoracic cardiac branch of right vagus nerve", "ILX:0790057", "FMA:53604"), ("cardiac branch of right vagus to deep cardiac plexus", "ILX:0791784", "FMA:6711"), - # following listed as "right branch of thoracic vagus nerve to esophagus" - ("right branch of right vagus nerve to esophageal nerve plexus", "ILX:0794299"), + ("right branch of thoracic vagus nerve to esophagus", "ILX:0794299"), + ("right branch between cranial nerve bundle and superior cervical ganglion", "ILX:0796398"), + ("right branch between thoracic vagus nerve and 'branch between thoracic vagus nerve and thoracic vagus nerve'", "ILX:0794837"), ("right branch between of thoracic vagus nerve and esophagus plexus", "ILX:0796071", "right branch of thoracic vagus nerve to esophageal plexus"), - + ("right branch between vagus nerve and C2 spinal nerve", "ILX:0793977"), + ("right branch between vagus nerve and cervical spinal nerves", "ILX:0795644"), + ("right branch between vagus nerve and cervical sympathetic trunk", "ILX:0794775", "right branch to cervical sympathetic trunk"), + ("right branch between cervical vagus nerve and a 'branch between cervical vagus nerve and cervical vagus nerve'", "ILX:0794821"), + ("right branch between cervical vagus and inferior root of ansa cervicalis", "ILX:0795597"), + ("right branch of inferior root of ansa cervicalis", "ILX:0796313"), + ("right branch of vagus nerve to ipsilateral carotid bifurcation", "ILX:0794089", "right branch to carotid bifurcation"), + ("right branch of vagus nerve to ipsilateral carotid sinus", "ILX:0794108"), + ("right branch of vagus nerve to ipsilateral common carotid artery", "ILX:0794068", "right branch to common carotid artery"), + ("right branch of vagus nerve to ipsilateral internal carotid artery", "ILX:0794086"), + ("right branch of vagus nerve to ipsilateral internal jugular vein", "ILX:0794077"), + ("right branch of vagus nerve to trachea", "ILX:0794756"), + ("cardiovascular and cardiopulmonary branch of right cervical vagus nerve", "ILX:0796422", "right cardiovascular and cardiopulmonary branch of cervical vagus nerve"), + ("right cardiovascular branch group of cervical vagus nerve", "ILX:0795379"), + ("right cardiovascular branch group of thoracic vagus nerve", "ILX:0795412"), + ("right cervical cardiac branch of vagus nerve", "ILX:0794165", "right cervical cardiac branch"), + ("right medial pulmonary branch of the esophageal plexus", "ILX:0796554"), + ("right pharyngeal branch of cranial nerve bundle", "ILX:0795526"), + ("right pharyngeal branch of vagus nerve", "ILX:0793987"), + ("right unknown branch of vagus nerve", "ILX:0793923"), + ("branch between right thoracic vagus trunk and tracheo-esophageal plexus", "ILX:0796658"), # posterior vagus, a continuation of right vagus ("posterior esophageal vagus trunk", "ILX:0794858"), @@ -160,6 +185,8 @@ ("greater posterior gastric nerve", "ILX:0788809", "FMA:6689"), # following not on interlex: # ("pyloric branch of greater posterior gastric nerve", "FMA:6677"), + ("left lateral pulmonary branch of the esophageal plexus", "ILX:0797435"), + ("posterior esophageal communicating branch", "ILX:0789876", "FMA:53632"), # left vagus branches ("left vagus nerve", "ILX:0785628", "FMA:6220"), @@ -199,8 +226,6 @@ ("left cardiovascular branch of cervical vagus nerve", "ILX:0794847"), ("left cardiovascular branch of thoracic vagus nerve", "ILX:0794852"), ("left cervical cardiopulmonary branch of vagus nerve", "ILX:0794159"), - ("left thoracic cardiopulmonary branch of vagus nerve", "ILX:0794191"), - ("left pulmonary branch of vagus nerve", "ILX:0794265"), ("left lateral pulmonary branch of vagus nerve", "ILX:0794288"), ("left medial pulmonary branch of vagus nerve", "ILX:0794265"), ("bronchial branch of left vagus nerve", "ILX:0791685", "FMA:53558"), @@ -221,15 +246,33 @@ ("inferior cervical cardiac branch of left vagus nerve", "ILX:0786047", "FMA:6714"), ("thoracic cardiac branch of left vagus nerve", "ILX:0791489", "FMA:53605"), ("cardiac branch of left vagus to deep cardiac plexus", "ILX:0795087"), - ("left branch of left vagus nerve to esophageal nerve plexus", "ILX:0794310"), ("left branch between thoracic vagus nerve and esophagus plexus", "ILX:0796087", "left branch of thoracic vagus nerve to esophageal plexus"), + ("left branch between recurrent laryngeal nerve and vagal trunk", "ILX:0794231"), + ("left branch between vagus nerve and carotid sinus nerve", "ILX:0794124"), + ("left branch between vagus nerve and cervical sympathetic trunk", "ILX:0794776"), + ("left branch between vagus nerve and cervical sympathetic trunk and or superior cervical ganglion", "ILX:0794048"), + ("left branch between vagus nerve and hypoglossal nerve", "ILX:0793914"), + ("left branch between vagus nerve and spinal accessory nerve", "ILX:0793960"), + ("left branch between vagus nerve and superior root of ansa cervicalis", "ILX:0793951"), + ("left branch of thoracic vagus nerve to aorta", "ILX:0796495"), + ("left branch of thoracic vagus nerve to esophagus", "ILX:0794310"), + ("left branch of vagus nerve to ipsilateral carotid bifurcation", "ILX:0794094"), + ("left branch of vagus nerve to ipsilateral common carotid artery", "ILX:0794072", "left branch to common carotid artery"), + ("left branch of vagus nerve to ipsilateral internal carotid artery", "ILX:0794087"), + ("left branch of vagus nerve to ipsilateral internal jugular vein", "ILX:0794081"), + ("left cardiovascular branch group of cervical vagus nerve", "ILX:0795395"), + ("left cardiovascular branch group of thoracic vagus nerve", "ILX:0795428"), + ("left cervical cardiac branch of vagus nerve", "ILX:0794171", "left cervical cardiac branch"), + ("left pulmonary branch of vagus nerve", "ILX:0796033", "left pulmonary branch"), # anterior vagus, a continuation of left vagus ("anterior esophageal vagus trunk", "ILX:0794854"), + ("anterior gastric branch of vagus nerve", "ILX:0787035", "FMA:272326"), ("hepatic branch of anterior vagal trunk", "ILX:0784595", "FMA:6666"), ("greater anterior gastric nerve", "ILX:0793831", "FMA:6684"), # not on interlex: # ("branch of greater anterior gastric nerve to coeliac nerve plexus", "FMA:53675"), + ("anterior esophageal communicating branch", "ILX:0792199", "FMA:53631"), # vagus built-in annotations ("vagus centroid", ""), @@ -278,23 +321,23 @@ def get_left_vagus_marker_locations_list(): # vagus markers location in material coordinates between 0 to 1 left_termNameVagusLengthList = { # cervical region - "left level of superior border of jugular foramen on the vagus nerve": 0.02737296, - "left level of inferior border of jugular foramen on the vagus nerve": 0.04434952, - # "left level of inferior border of cranium on the vagus nerve": 0.0588, - # "left level of C1 transverse process on the vagus nerve": 0.10276128, - "left level of angle of the mandible on the vagus nerve": 0.12533074, - # "left level of greater horn of hyoid on the vagus nerve": 0.14595904, - "left level of carotid bifurcation on the vagus nerve": 0.15738364, - "left level of laryngeal prominence on the vagus nerve": 0.20541934, + "left level of superior border of jugular foramen on the vagus nerve": 0.044, + "left level of inferior border of jugular foramen on the vagus nerve": 0.06, # standardized + # "left level of inferior border of cranium on the vagus nerve": 0.072, + # "left level of C1 transverse process on the vagus nerve": 0.111, + "left level of angle of the mandible on the vagus nerve": 0.131, + # "left level of greater horn of hyoid on the vagus nerve": 0.149, + "left level of carotid bifurcation on the vagus nerve": 0.166, # calibrated to Feinstein REVA data + "left level of laryngeal prominence on the vagus nerve": 0.214, # calibrated to Feinstein REVA data # thoracic region - "left level of superior border of the clavicle on the vagus nerve": 0.33847976, - "left level of jugular notch on the vagus nerve": 0.38062311, - "left level of sternal angle on the vagus nerve": 0.48395264, - # "left level of 1 cm superior to start of esophageal plexus on the vagus nerve": 0.52988032, + "left level of superior border of the clavicle on the vagus nerve": 0.320, # standardized + "left level of jugular notch on the vagus nerve": 0.356, + "left level of sternal angle on the vagus nerve": 0.447, + # "left level of 1 cm superior to start of esophageal plexus on the vagus nerve": 0.487, # abdominal region - # "left level of esophageal hiatus on the vagus nerve": 0.813852428, - # "left level of aortic hiatus on the vagus nerve": 0.9323824, - # "left level of end of trunk": 1.0 # note this term is also not on the list of annotations + # "left level of esophageal hiatus on the vagus nerve": 0.738, + # "left level of aortic hiatus on the vagus nerve": 0.842, + # "left level of end of trunk": 0.902, # note this term is also not on the list of annotations } return left_termNameVagusLengthList @@ -303,22 +346,22 @@ def get_right_vagus_marker_locations_list(): # vagus markers location in material coordinates between 0 to 1 right_termNameVagusLengthList = { # cervical region - "right level of superior border of jugular foramen on the vagus nerve": 0.02762944, - "right level of inferior border of jugular foramen on the vagus nerve": 0.04434952, - # "right level of inferior border of cranium on the vagus nerve": 0.0588, - # "right level of C1 transverse process on the vagus nerve": 0.10276128, - "right level of angle of the mandible on the vagus nerve": 0.12648368, - # "right level of greater horn of hyoid on the vagus nerve": 0.14595904, - "right level of carotid bifurcation on the vagus nerve": 0.17798550, - "right level of laryngeal prominence on the vagus nerve": 0.23144827, + "right level of superior border of jugular foramen on the vagus nerve": 0.044, + "right level of inferior border of jugular foramen on the vagus nerve": 0.06, # standardized + # "right level of inferior border of cranium on the vagus nerve": 0.072, + # "right level of C1 transverse process on the vagus nerve": 0.111, + "right level of angle of the mandible on the vagus nerve": 0.131, + # "right level of greater horn of hyoid on the vagus nerve": 0.149, + "right level of carotid bifurcation on the vagus nerve": 0.166, # calibrated to Feinstein REVA data + "right level of laryngeal prominence on the vagus nerve": 0.214, # calibrated to Feinstein REVA data # thoracic region - "right level of superior border of the clavicle on the vagus nerve": 0.33948916, - "right level of jugular notch on the vagus nerve": 0.38937585, - "right level of sternal angle on the vagus nerve": 0.48764507, - # "right level of 1 cm superior to start of esophageal plexus on the vagus nerve": 0.52988032, + "right level of superior border of the clavicle on the vagus nerve": 0.320, # standardized + "right level of jugular notch on the vagus nerve": 0.356, + "right level of sternal angle on the vagus nerve": 0.447, + # "right level of 1 cm superior to start of esophageal plexus on the vagus nerve": 0.487, # abdominal region - # "right level of esophageal hiatus on the vagus nerve": 0.813852428, - # "right level of aortic hiatus on the vagus nerve": 0.9323824, + # "right level of esophageal hiatus on the vagus nerve": 0.738, + # "right level of aortic hiatus on the vagus nerve": 0.842, } return right_termNameVagusLengthList diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_nerve1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_nerve1.py index fc6a6ba0..be6a0749 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_nerve1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_nerve1.py @@ -1,6 +1,7 @@ from cmlibs.maths.vectorops import ( add, cross, distance, dot, magnitude, matrix_mult, matrix_inv, mult, normalize, rejection, set_magnitude, sub) from cmlibs.utils.zinc.field import find_or_create_field_group, find_or_create_field_coordinates +from cmlibs.utils.zinc.finiteelement import evaluate_field_nodeset_range from cmlibs.utils.zinc.general import ChangeManager from cmlibs.zinc.element import Element, Elementbasis, Elementfieldtemplate from cmlibs.zinc.field import Field, FieldFindMeshLocation, FieldGroup @@ -1361,11 +1362,39 @@ def generate_trunk_1d(vagus_data, trunk_proportion, trunk_elements_count_prefit, rms_error, max_error = fitter.getDataRMSAndMaximumProjectionError(trunk_group.getNodesetGroup(datapoints)) nerve_metadata.set_name_rms_max_error("trunk centroid fit error", rms_error, max_error) + with ChangeManager(fieldmodule): + # make a real field which increases down the trunk proportional to vagus coordinates + trunk_distance = (fieldmodule.findFieldByName("cmiss_number") + + fieldmodule.createFieldComponent(fieldmodule.findFieldByName("xi"), 1)) + host_trunk_distance = fieldmodule.createFieldEmbedded(trunk_distance, fitter.getDataHostLocationField()) + minimums, maximums = evaluate_field_nodeset_range(host_trunk_distance, trunk_group.getNodesetGroup(datapoints)) + min_projection_node_number = math.ceil(minimums) + max_projection_node_number = math.floor(maximums) + del host_trunk_distance + fitter.cleanup() del fitter # fit radius if pr: + # add default radius points at trunk nodes outside range of radius data projections + tx = [] + fieldcache = fieldmodule.createFieldcache() + nodes = fieldmodule.findNodesetByFieldDomainType(Field.DOMAIN_TYPE_NODES) + nodeiterator = nodes.createNodeiterator() + node = nodeiterator.next() + for n in range(trunk_elements_count + 1): + nodeIdentifier = node.getIdentifier() + if (nodeIdentifier < min_projection_node_number) or (nodeIdentifier > max_projection_node_number): + fieldcache.setNode(node) + result, x = coordinates.getNodeParameters(fieldcache, -1, Node.VALUE_LABEL_VALUE, 1, components_count) + tx.append(x) + node = nodeiterator.next() + if tx: + field_names_and_values = [("radius", [default_trunk_diameter * 0.5] * len(tx))] + data_identifier = generate_datapoints( + fit_region, tx, data_identifier, field_names_and_values=field_names_and_values, group_name=trunk_group_name) + # add projection distance to radius trunk_location = fieldmodule.createFieldFindMeshLocation(coordinates, coordinates, mesh1d) trunk_location.setSearchMode(trunk_location.SEARCH_MODE_NEAREST) @@ -1376,7 +1405,7 @@ def generate_trunk_1d(vagus_data, trunk_proportion, trunk_elements_count_prefit, fieldassignment = radius.createFieldassignment(new_radius) fieldassignment.setNodeset(trunk_datapoints) fieldassignment.assign() - gradient1_penalty = 1000.0 * points_count_calibration_factor * length_calibration_factor + gradient1_penalty = 10000.0 * points_count_calibration_factor * length_calibration_factor gradient2_penalty = 1.0E+8 * points_count_calibration_factor * (length_calibration_factor ** 3) rms_error, max_error = define_and_fit_field( fit_region, "coordinates", "coordinates", "radius", diff --git a/src/scaffoldmaker/utils/read_vagus_data.py b/src/scaffoldmaker/utils/read_vagus_data.py index 984a9cbc..72d90ff5 100644 --- a/src/scaffoldmaker/utils/read_vagus_data.py +++ b/src/scaffoldmaker/utils/read_vagus_data.py @@ -31,7 +31,7 @@ def __init__(self, data_region): self._trunk_keywords = ['cervical vagus nerve', 'thoracic vagus nerve', 'cervical trunk', 'thoracic trunk', 'vagus x nerve trunk'] - self._branch_keywords = ['branch', 'nerve', 'ganglion'] + self._branch_keywords = ['branch', 'nerve', 'ganglion', 'fusion'] self._non_branch_keywords = ['perineurium', 'epineurium'] self._term_keywords = ['fma:', 'fma_', 'ilx:', 'ilx_', 'uberon:', 'uberon_'] self._orientation_keywords = ['orientation'] @@ -69,7 +69,7 @@ def __init__(self, data_region): for group in group_list: group_name = group.getName().strip() lower_name = group_name.casefold() - if any([keyword in lower_name for keyword in self._term_keywords]): + if any(keyword in lower_name for keyword in self._term_keywords): term_annotation_names.append(group_name) else: annotation_names.append(group_name) diff --git a/tests/test_vagus.py b/tests/test_vagus.py index 77f00957..40841286 100644 --- a/tests/test_vagus.py +++ b/tests/test_vagus.py @@ -311,19 +311,19 @@ def test_vagus_nerve_1(self): TOL = 1.0E-6 expected_metadata = { 'segments': { - 'segment1.exf': {'maximum vagus coordinate': 0.24612805437844187, - 'minimum vagus coordinate': 0.06141502232856895}, - 'segment2.exf': {'maximum vagus coordinate': 0.4241573651485895, - 'minimum vagus coordinate': 0.24875823454739732}, - 'segment3.exf': {'maximum vagus coordinate': 0.5725426975292824, - 'minimum vagus coordinate': 0.4267079428429691} + 'segment1.exf': {'maximum vagus coordinate': 0.24558366014812194, + 'minimum vagus coordinate': 0.0788138673418423}, + 'segment2.exf': {'maximum vagus coordinate': 0.4006751105392706, + 'minimum vagus coordinate': 0.24780825015941482}, + 'segment3.exf': {'maximum vagus coordinate': 0.532313675266658, + 'minimum vagus coordinate': 0.40293635826993446} }, - 'trunk centroid fit error rms': 3.195304274611684, - 'trunk centroid fit error max': 12.380175719267326, - 'trunk radius fit error rms': 1.4392862015456782, - 'trunk radius fit error max': 5.275441468095039, - 'trunk twist angle fit error degrees rms': 3.9171753300051773, - 'trunk twist angle fit error degrees max': 9.782285739956329} + 'trunk centroid fit error rms': 2.6851948642256804, + 'trunk centroid fit error max': 7.904921997395714, + 'trunk radius fit error rms': 1.8986927090614505, + 'trunk radius fit error max': 17.211587059698957, + 'trunk twist angle fit error degrees rms': 4.242842001426614, + 'trunk twist angle fit error degrees max': 10.680695634612922} self.assertEqual(len(metadata), len(expected_metadata)) for key, value in metadata.items(): expected_value = expected_metadata[key] @@ -341,39 +341,39 @@ def test_vagus_nerve_1(self): expected_group_info = { 'left vagus nerve': ( 'http://uri.interlex.org/base/ilx_0785628', None, 25, - [-1242.1408436110323, -6449.120634594644, -61.12471585811795], - [2266.498485565621, -981.8862708609084, 109.4776933847775], - [43.42178093509881, 272.5812192544454, 1545.779335665412], - 253031226.32177484, - 34120295538.69093), + [-2545.1416627882127, -5922.876303368227, -120.13687087625989], + [2617.531313476152, -1114.5818014848053, 124.21189836073981], + [26.721742076513692, 135.6818734038061, 654.3942353676433], + 297406693.5555987, + 40164599792.92432), 'left superior laryngeal nerve': ( - 'http://uri.interlex.org/base/ilx_0788780', 'left vagus nerve', 4, - [5923.1038437858815, -4450.247296980159, -196.91168267106667], - [-1473.666589331894, 858.0767721707383, 37.61788533802071], - [29.49243092889992, 24.929254450240933, 586.7101701356864], - 14619671.696585286, - 898349351.6575073), + 'http://uri.interlex.org/base/ilx_0788780', 'left vagus nerve', 3, + [5917.435264569445, -4445.778660101648, -197.01444269512928], + [-2234.989761439478, 1225.7350194397827, 53.8705143512821], + [28.441662772435848, 26.164418026665317, 584.6645801593635], + 14880989.664956208, + 956728865.6891162), 'left A branch of superior laryngeal nerve': ( - 'http://uri.interlex.org/base/ilx_0795823', 'left superior laryngeal nerve', 2, - [5105.456405352692, -1456.2684158902327, 0.1879302148130364], - [-1289.5813291965014, 381.4601031501815, 17.4939357310412], - [2.9906257013149116, -3.6461931422077214, 299.9629334325899], - 4696616.032520553, - 236649717.0007874), + 'http://uri.interlex.org/base/ilx_0795823', 'left superior laryngeal nerve', 1, + [5106.509650289892, -1452.6499210530492, -0.984447873629037], + [-2611.8705442933133, 635.3916900464677, 75.88439164201642], + [6.639946103532111, -8.511120608359874, 299.8057236640625], + 4915558.017140371, + 267422500.45544925), 'left A thoracic cardiopulmonary branch of vagus nerve': ( 'http://uri.interlex.org/base/ilx_0794192', 'left vagus nerve', 2, [20637.1231811151, -2947.0943923264213, -608.0143165605032], [99.37959607618936, -1713.8821062071527, -61.058814561237654], - [-8.791810160853856, 11.98817110434402, -350.80993036588853], - 6229138.1929114945, - 331466617.8992749), + [-8.760048579733848, 12.018384653067187, -351.606310180449], + 6338018.489008428, + 342899231.78125954), 'left B thoracic cardiopulmonary branch of vagus nerve': ( 'http://uri.interlex.org/base/ilx_0794193', 'left vagus nerve', 1, [22164.37237177626, -3219.4138243419347, -620.4335665416426], [1775.1658782860482, 1620.6243020068152, -217.2367115667926], - [2.2452165218564915, 43.82745017664547, 345.30748541161313], - 4687937.203481174, - 271049251.5313337) + [2.5266947076888755, 43.44552274274338, 344.75835902725083], + 4836738.653021493, + 287554343.10248685) } groups_count = len(expected_group_info) @@ -384,7 +384,7 @@ def test_vagus_nerve_1(self): self.assertTrue(coordinates.isValid()) self.assertEqual(RESULT_OK, fieldmodule.defineAllFaces()) mesh3d = fieldmodule.findMeshByDimension(3) - expected_elements_count = 34 + expected_elements_count = 32 self.assertEqual(expected_elements_count, mesh3d.getSize()) mesh2d = fieldmodule.findMeshByDimension(2) # groups_count + 1 due to one group having 2 branches @@ -466,14 +466,14 @@ def test_vagus_nerve_1(self): xi_centre = [0.5, 0.5, 0.5] # (element_identifier, expected_d3) expected_d3_info = [ - (2, [-27.841230048890253, 260.7466659639747, 1176.8751799214626]), - (4, [-514.0930254730785, 671.2935039396489, 822.8835226739518]), - (6, [-33.44088684233287, 645.9285494148206, 194.22531263541956]), - (8, [-23.73600988035605, 206.6258555865557, 665.2926097904865]), - (10, [-30.597506104686232, -283.59176921547873, 641.4881272444806]), - (12, [-238.74470808058186, -573.0695314634801, 238.27251895181752]), - (14, [-0.9631502817560147, -476.5043907385434, 117.34817168731932]), - (16, [-3.1500151690115956, -475.1247911810948, 108.02626785082279])] + (2, [9.21562156397215, 220.59376293742793, 1258.8336648769296]), + (4, [-540.5815611781568, 556.8678912203784, 885.9322310618469]), + (6, [-21.067090930087062, 632.3320629313625, 213.52007336623498]), + (8, [-5.963415668723854, 99.15707095914347, 695.7951982006999]), + (10, [-127.97404391494035, -444.64867069342364, 519.3241216846709]), + (12, [-1.1875020666034288, -528.0436319192888, 150.69427060648735]), + (14, [0.7938987052352218, -589.3943193870087, 132.3215672366015]), + (16, [0.5122303831515467, -586.6487697666532, 126.42523040232733])] for element_identifier, expected_d3 in expected_d3_info: element = mesh3d.findElementByIdentifier(element_identifier) self.assertEqual(RESULT_OK, fieldcache.setMeshLocation(element, xi_centre)) @@ -494,9 +494,9 @@ def test_vagus_nerve_1(self): fieldcache.clearLocation() result, volume = volume_field.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - expected_volume = 34120295538.69093 if (coordinate_field is coordinates) else 34133114193.810123 + expected_volume = 40164599792.92432 if (coordinate_field is coordinates) else 40212247349.583954 self.assertAlmostEqual(expected_volume, volume, delta=STOL) - expected_elements_count = 34 + expected_elements_count = 32 group = fieldmodule.findFieldByName("epineurium").castGroup() mesh_group2d = group.getMeshGroup(mesh2d) self.assertEqual(expected_elements_count * 4, mesh_group2d.getSize()) @@ -505,7 +505,7 @@ def test_vagus_nerve_1(self): fieldcache.clearLocation() result, surface_area = surface_area_field.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - expected_surface_area = 74658732.66536702 if (coordinate_field is coordinates) else 74810823.39355227 + expected_surface_area = 87348723.88566855 if (coordinate_field is coordinates) else 87548377.43565299 self.assertAlmostEqual(expected_surface_area, surface_area, delta=STOL) group = fieldmodule.findFieldByName("vagus centroid").castGroup() mesh_group1d = group.getMeshGroup(mesh1d) @@ -514,7 +514,7 @@ def test_vagus_nerve_1(self): length_field.setNumbersOfPoints(4) result, length = length_field.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(77989.74712379556, length, delta=LTOL) + self.assertAlmostEqual(85946.41511414078, length, delta=LTOL) # check all markers are added marker_group = fieldmodule.findFieldByName("marker").castGroup() @@ -550,29 +550,29 @@ def test_vagus_nerve_1(self): 0.07044881379783888, 0.00014399999999999916), 'left superior laryngeal nerve': ( - [0.0004896991248311625, 0.0001718248196490253, 0.13358994717220393], - [0.012591688735249879, 0.011554907571233508, -0.005801519857524198], + [0.0005393396476031736, 0.0002210888652800667, 0.14271866282088], + [0.018596645990489238, 0.017306797287668027, -0.009291801681832402], [-0.004035969328504113, 0.004384632192912359, -9.01711847667297e-05], - 0.0029647324574537596, - 2.9681678935347134e-06), + 0.002835745504530076, + 2.8637284074659435e-06), 'left A branch of superior laryngeal nerve': ( - [0.028322975480738796, 0.02498830599810807, 0.11987166123924467], - [-0.009335630171933725, -0.013097308942832018, -0.01748433385528671], - [-0.004243088648924635, 0.004153044805551016, -0.0009050664963775323], - 0.0015933505248969856, - 1.5184536519716786e-06), + [0.02817783261891398, 0.025047882883197675, 0.12792920804201047], + [-0.024421260627580953, -0.03305830892404914, -0.04052420052564549], + [-0.004895751480146281, 0.00466040733272351, -0.0006686618113299209], + 0.001934391869875682, + 1.8995070469086568e-06), 'left A thoracic cardiopulmonary branch of vagus nerve': ( - [-0.00023095034344209296, -1.0213543563703398e-05, 0.38006390857609595], - [-0.026498073841997774, 0.01090206319896006, 0.006047544274512271], + [-0.00023704383215991881, 4.4093799777844035e-06, 0.3570452977819153], + [-0.02640939524976098, 0.010905788542616928, 0.005383942130485252], [-0.002274865823058741, -0.0055501710871262095, -3.291278514777618e-05], - 0.0020613515506789195, - 2.1083349503909266e-06), + 0.0020475265974777873, + 2.0933315712898087e-06), 'left B thoracic cardiopulmonary branch of vagus nerve': ( - [0.0005187730319848923, -0.000913147031720288, 0.4048333718275829], - [0.023402426848619456, -0.026601176543883488, 0.01999575491995305], + [0.0005244494457092982, -0.0008849227880933955, 0.3790474314054079], + [0.02375754350766598, -0.026323189695658004, 0.018508805523753252], [0.004504705667267902, 0.003963119934858472, 1.7331437428769192e-05], - 0.001429957375006481, - 1.4665142890587577e-06)} + 0.0014040753001296209, + 1.4351214793540466e-06)} XTOL = 1.0E-4 # coordinates and derivatives STOL = 1.0E-5 # surface area VTOL = 1.0E-8 # volume @@ -660,7 +660,7 @@ def test_arc_vagus(self): self.assertEqual(14, len(annotation_groups)) fit_metadata = nerve_metadata.getMetadata()['vagus nerve'] self.assertAlmostEqual(fit_metadata['trunk centroid fit error rms'], 0.0, delta=1.0E-4) - self.assertAlmostEqual(fit_metadata['trunk radius fit error rms'], 1.2555492226192078e-05, delta=1.0E-12) + self.assertAlmostEqual(fit_metadata['trunk radius fit error rms'], 1.24972485639109e-05, delta=1.0E-12) self.assertAlmostEqual(fit_metadata['trunk twist angle fit error degrees rms'], 0.0, delta=0.002) fieldmodule = region.getFieldmodule() fieldcache = fieldmodule.createFieldcache()