diff --git a/src/scaffoldmaker/annotation/uterus_terms.py b/src/scaffoldmaker/annotation/uterus_terms.py index a7dbc6b4..67eaa966 100644 --- a/src/scaffoldmaker/annotation/uterus_terms.py +++ b/src/scaffoldmaker/annotation/uterus_terms.py @@ -4,33 +4,53 @@ # convention: preferred name, preferred id, followed by any other ids and alternative names uterus_terms = [ - ("uterus", "UBERON:0000995"), - ("serosa of uterus", "UBERON:0001297"), - ("body of uterus", "UBERON:0009853"), - ("cervix of uterus", "ILX:0745917 "), - ("uterine cervix", "UBERON:0000002"), - ("uterine wall", "UBERON:0000459"), - ("uterine horn", "UBERON:000224"), - ("uterine lumen", "UBERON:0013769"), + ("body of uterus", "UBERON:0009853", "FMA:17739", "ILX:0730129"), + ("broad ligament of uterus", "UBERON:0012332", "FMA:16516", "ILX:0733266"), + ("dorsal cervix junction with vagina", "None"), + ("dorsal top left horn", "None"), + ("dorsal top right horn", "None"), + ("external cervical os", "UBERON:0013760", "FMA:76836", "ILX:0736534"), + ("fundus", "None"), + ("internal cervical os", "UBERON:0013759", "FMA:17747", "ILX:0729495"), + ("junction of left round ligament with uterus", "None"), + ("junction of right round ligament with uterus", "None"), + ("left broad ligament of uterus", "None"), + ("left transverse cervical ligament", "None"), ("left uterine horn", "UBERON:0009020"), - ("right uterine horn", "UBERON:0009022"), - ("serosa of uerine cervix", "None"), - ("lumen of uerine cervix", "None"), - ("serosa of right horn", "None"), - ("lumen of right horn", "None"), - ("serosa of left horn", "None"), + ("left uterine tube", "UBERON:0001303", "FMA:18484", "ILX:0734218"), + ("lumen of body of uterus", "None"), + ("lumen of fallopian tube", "None"), ("lumen of left horn", "None"), - ("serosa of uterus", "None"), + ("lumen of left uterine tube", "None"), + ("lumen of right horn", "None"), + ("lumen of right uterine tube", "None"), + ("lumen of uterine cervix", "None"), ("lumen of uterus", "None"), - ("fundus", "None"), + ("lumen of vagina", "None"), + ("myometrium", "UBERON:0001296", "FMA:17743", " ILX:0735601"), + ("pubocervical ligament (TA98)", "ILX:0743760"), + ("right broad ligament of uterus", "None"), + ("right transverse cervical ligament", "None"), + ("right uterine horn", "UBERON:0009022"), + ("right uterine tube", "UBERON:0001302", "FMA:18483", "ILX:0724908"), + ("serosa of body of uterus", "None"), + ("serosa of left uterine tube", "None"), + ("serosa of left horn", "None"), + ("serosa of right horn", "None"), + ("serosa of right uterine tube", "None"), + ("serosa of uterine cervix", "None"), + ("serosa of uterus", "UBERON:0001297"), + ("serosa of vagina", "None"), + ("uterine cervix", "UBERON:0000002","FMA:17740", "ILX:0724162"), + ("uterine horn", "UBERON:000224"), + ("uterine lumen", "UBERON:0013769"), + ("uterine wall", "UBERON:0000459", "FMA:17560", "ILX:0735839"), + ("uterus", "UBERON:0000995", "FMA:17558", "ILX:0726002"), + ("vagina", "UBERON:0000996", "FMA:19949", "ILX:0736016"), + ("vagina orifice", "UBERON:0012317", "FMA:19984", "ILX:0729556"), ("ventral cervix junction with vagina", "None"), - ("dorsal cervix junction with vagina", "None"), - ("dorsal top right horn", "None"), - ("ventral top right horn", "None"), - ("dorsal top left horn", "None"), ("ventral top left horn", "None"), - ("vagina", "None") -] + ("ventral top right horn", "None")] def get_uterus_term(name: str): """ diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py index a6ec6a92..ef8eb100 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py @@ -39,9 +39,10 @@ class MeshType_3d_bladder1(Scaffold_base): 'Number of elements': 7 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], - [ + [[ (1, [[1.98482, -0.23213, 0.00000], [-0.27986, 0.04637, 0.00000], [-0.03267, -0.19717, 0.00000], [-0.02887, -0.18604, 0.00000], [0.00000, 0.00000, 0.31783], [0.00000, 0.00000, 0.22083]]), (2, [[1.69774, -0.18588, 0.00000], [-0.29430, 0.04613, 0.00000], [-0.05231, -0.33376, 0.00000], @@ -58,7 +59,7 @@ class MeshType_3d_bladder1(Scaffold_base): [0.00715, 0.05112, 0.00000], [0.00000, 0.00000, 0.09658], [0.00000, 0.00000, -0.04254]]), (8, [[0.00000, 0.00000, 0.00000], [-0.23137, 0.00000, 0.00000], [-0.00000, -0.05191, 0.00000], [0.00294, 0.00527, 0.00000], [0.00000, 0.00000, 0.07300], [0.00000, 0.00000, -0.00462]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -84,9 +85,10 @@ class MeshType_3d_bladder1(Scaffold_base): 'Number of elements': 7 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], - [ + [[ (1, [[2.00000, 0.00000, 0.00000], [-0.29240, 0.00000, 0.00000], [0.00000, -0.27079, 0.00000], [0.00000, -0.26496, 0.00000], [0.00000, 0.00000, 0.53835], [0.00000, 0.00000, 0.14344]]), (2, [[1.70113, 0.00000, 0.00000], [-0.30534, 0.00000, 0.00000], [0.00000, -0.46797, 0.00000], @@ -103,7 +105,7 @@ class MeshType_3d_bladder1(Scaffold_base): [0.00000, 0.07176, -0.00000], [0.00000, 0.00000, 0.21298], [0.00000, -0.00000, -0.13616]]), (8, [[0.00000, 0.00000, 0.00000], [-0.24418, 0.00000, 0.00000], [0.00000, -0.11153, 0.00000], [0.00000, 0.04545, -0.00000], [0.00000, 0.00000, 0.09572], [0.00000, -0.00000, -0.09837]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -129,9 +131,10 @@ class MeshType_3d_bladder1(Scaffold_base): 'Number of elements': 7 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], - [ + [[ (1, [[1.94475, -0.28705, 0.00000], [-0.34493, 0.16731, 0.00000], [-0.08535, -0.17595, 0.00000], [-0.04402, -0.10886, 0.00000], [0.00000, 0.00000, 0.18665], [0.00000, 0.00000, 0.24107]]), (2, [[1.61917, -0.14378, 0.00000], [-0.30588, 0.11906, 0.00000], [-0.10871, -0.27931, 0.00000], @@ -148,7 +151,7 @@ class MeshType_3d_bladder1(Scaffold_base): [-0.00525, 0.07201, 0.00000], [0.00000, 0.00000, 0.12027], [0.00000, 0.00000, -0.08509]]), (8, [[0.00000, 0.00000, 0.00000], [-0.27223, 0.00000, 0.00000], [-0.00000, -0.04285, 0.00000], [-0.00982, 0.01186, 0.00000], [0.00000, 0.00000, 0.05222], [0.00000, 0.00000, -0.05101]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -174,9 +177,10 @@ class MeshType_3d_bladder1(Scaffold_base): 'Number of elements': 7 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], - [ + [[ (1, [[1.88718, 0.56852, 0.00000], [-0.20674, -0.15833, 0.00000], [0.09002, -0.11754, 0.00000], [0.13867, -0.25647, 0.00000], [0.00000, 0.00000, 0.11203], [0.00000, 0.00000, 0.47891]]), (2, [[1.66209, 0.42003, 0.00000], [-0.24279, -0.13815, 0.00000], [0.18168, -0.31927, 0.00000], @@ -193,7 +197,7 @@ class MeshType_3d_bladder1(Scaffold_base): [-0.02501, 0.12449, 0.00000], [0.00000, 0.00000, 0.18610], [0.00000, 0.00000, -0.14240]]), (8, [[0.00000, 0.00000, 0.00000], [-0.27970, -0.00000, 0.00000], [0.00000, -0.04485, 0.00000], [-0.00345, 0.06647, 0.00000], [0.00000, 0.00000, 0.05111], [0.00000, 0.00000, -0.12759]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -219,9 +223,10 @@ class MeshType_3d_bladder1(Scaffold_base): 'Number of elements': 7 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], - [ + [[ (1, [[1.98605, -0.21791, 0.00000], [-0.20755, 0.03159, 0.00000], [-0.00760, -0.04989, 0.00000], [-0.02445, -0.15319, 0.00000], [0.00000, 0.00000, 0.12825], [0.00000, 0.00000, 0.29326]]), (2, [[1.75787, -0.18270, 0.00000], [-0.24882, 0.03881, 0.00000], [-0.02816, -0.18050, 0.00000], @@ -238,7 +243,7 @@ class MeshType_3d_bladder1(Scaffold_base): [0.00931, 0.08494, 0.00000], [0.00000, 0.00000, 0.19799], [0.00000, 0.00000, -0.12929]]), (8, [[0.00000, 0.00000, 0.00000], [-0.29834, 0.00000, 0.00000], [0.00000, -0.04096, 0.00000], [0.00133, 0.04434, 0.00000], [0.00000, 0.00000, 0.08550], [0.00000, 0.00000, -0.09569]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -264,9 +269,10 @@ class MeshType_3d_bladder1(Scaffold_base): 'Number of elements': 10 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], - [ + [[ (1, [[2.00000, 0.00000, 0.00000], [-0.04772, 0.00000, 0.00000], [0.00000, -0.21530, 0.00000], [0.00000, 0.04601, 0.00000], [0.00000, 0.00000, 0.21530], [0.00000, 0.00000, -0.04601]]), (2, [[1.90255, 0.00000, 0.00000], [-0.14718, 0.00000, 0.00000], [0.00000, -0.21530, 0.00000], @@ -289,7 +295,7 @@ class MeshType_3d_bladder1(Scaffold_base): [0.00000, 0.11291, 0.00000], [0.00000, 0.00000, 0.21534], [0.00000, 0.00000, -0.11291]]), (11, [[0.00000, 0.00000, 0.00000], [-0.04779, 0.00000, 0.00000], [0.00000, -0.11534, 0.00000], [0.00000, 0.08709, 0.00000], [0.00000, 0.00000, 0.11534], [0.00000, 0.00000, -0.08709]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py index ef04477a..71f035d5 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py @@ -45,7 +45,8 @@ class MeshType_3d_bladderurethra1(Scaffold_base): 'Number of elements': 8 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [[ (1, [[0.0000, 0.0000, 0.0000], [0.0000, 0.0000, 15.000], [0.0000, 0.5000, 0.00000], [0.0000, 0.0000, -0.5000]]), (2, [[0.0000, 0.0000, 15.000], [0.0000, 0.0000, 15.000], [0.0000, 0.5000, 0.00000], [0.0000, 0.0000, -0.5000]]), (3, [[0.0000, 0.0000, 30.000], [0.0000, 0.0000, 15.000], [0.0000, 0.5000, 0.00000], [0.0000, 0.0000, -0.5000]]), @@ -55,7 +56,7 @@ class MeshType_3d_bladderurethra1(Scaffold_base): (7, [[0.0000, 3.0500, 89.940], [0.0000, 1.8000, 15.400], [0.0000, 0.5000, 0.00000], [0.0000, 0.0000, -0.5000]]), (8, [[0.0000, 5.9800, 107.94], [0.0000, 4.5000, 16.800], [0.0000, 0.5000, 0.00000], [0.0000, 0.0000, -0.5000]]), (9, [[0.0000, 12.470, 127.07], [0.0000, 6.6700, 14.800], [0.0000, 0.5000, 0.00000], [0.0000, 0.0000, -0.5000]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -80,7 +81,8 @@ class MeshType_3d_bladderurethra1(Scaffold_base): 'Number of elements': 8 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [[ (1, [[0.0000, 0.0000, 0.0000], [0.0000, 0.0000, 20.000], [0.0000, 0.5000, 0.0000], [0.0000, 0.0000, -0.5000]]), (2, [[0.0000, 0.0000, 20.000], [0.0000, 0.0000, 20.000], [0.0000, 0.5000, 0.0000], [0.0000, 0.0000, -0.5000]]), (3, [[0.0000, 0.0000, 40.000], [0.0000, 0.0000, 20.000], [0.0000, 0.5000, 0.0000], [0.0000, 0.0000, -0.5000]]), @@ -90,7 +92,7 @@ class MeshType_3d_bladderurethra1(Scaffold_base): (7, [[0.0000, -3.8000, 120.30], [0.0000, -0.6000, 18.800], [0.0000, 0.5000, 0.0000], [0.0000, 0.0000, -0.5000]]), (8, [[0.0000, -3.6000, 140.50], [0.0000, 2.0000, 18.400], [0.0000, 0.5000, 0.0000], [0.0000, 0.0000, -0.5000]]), (9, [[0.0000, 0.0000, 160.00], [0.0000, 4.0000, 15.500], [0.0000, 0.5000, 0.0000], [0.0000, 0.0000, -0.5000]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -115,7 +117,8 @@ class MeshType_3d_bladderurethra1(Scaffold_base): 'Number of elements': 8 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [[ (1, [[0.000, 0.0000, 0.0000], [0.0000, 0.2107, 19.185], [0.0000, 0.5000, 0.0006], [0.0000, -0.0002, -0.0098]]), (2, [[0.000, 0.1095, 17.595], [0.0000, 0.0083, 16.005], [0.0000, 0.4999, -0.0074], [0.0000, -0.0000, -0.0062]]), (3, [[0.000, 0.0347, 32.009], [0.0000, 0.0042, 13.831], [0.0000, 0.4999, -0.0122], [0.0000, 0.0001, 0.0027]]), @@ -125,7 +128,7 @@ class MeshType_3d_bladderurethra1(Scaffold_base): (7, [[0.000, -0.6320, 86.026], [0.0000, -0.5928, 14.006], [0.0000, 0.4997, 0.0193], [0.0000, -0.0027, -0.1007]]), (8, [[0.000, -1.1544, 99.742], [0.0000, 0.7147, 16.377], [0.0000, 0.4961, -0.0620], [0.0000, -0.0226, -0.1114]]), (9, [[0.000, 1.2247, 118.63], [0.0000, 4.0316, 21.331], [0.0000, 0.4719, -0.1653], [0.0000, -0.0498, -0.0958]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -150,7 +153,8 @@ class MeshType_3d_bladderurethra1(Scaffold_base): 'Number of elements': 8 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [[ (1, [[0.0000, 0.0000, 0.0000], [0.0000, 0.3967, 17.118], [0.0000, 0.4999, -0.0116], [0.0000, 0.0002, 0.0084]]), (2, [[0.0000, 0.2526, 16.482], [0.0000, 0.1084, 15.844], [0.0000, 0.5000, -0.0034], [0.0000, 0.0001, 0.0073]]), (3, [[0.0000, 0.2277, 31.687], [0.0000, -0.1005, 16.250], [0.0000, 0.5000, 0.0031], [0.0000, 0.0180, 0.0030]]), @@ -160,7 +164,7 @@ class MeshType_3d_bladderurethra1(Scaffold_base): (7, [[0.0000, -1.3669, 104.42], [0.0000, 0.5462, 17.118], [0.0000, 0.4994, -0.0233], [0.0000, -0.0266, -0.1269]]), (8, [[0.0000, -0.1150, 119.12], [0.0000, 2.7663, 14.068], [0.0000, 0.4902, -0.0980], [0.0000, -0.0116, -0.0490]]), (9, [[0.0000, 4.0321, 132.37], [0.0000, 5.4802, 12.315], [0.0000, 0.4691, -0.1728], [0.0000, 0.0080, 0.0382]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -185,7 +189,8 @@ class MeshType_3d_bladderurethra1(Scaffold_base): 'Number of elements': 8 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2], [[ (1, [[0.000, 0.0000, 0.0000], [0.0000, -0.0219, 18.928], [0.0000, 0.5000, 0.0006], [0.0000, 0.0001, -0.0062]]), (2, [[0.000, 0.1095, 17.595], [0.0000, 0.2409, 16.260], [0.0000, 0.4999, -0.0074], [0.0000, -0.0000, -0.0051]]), (3, [[0.000, 0.4589, 32.519], [0.0000, 0.3415, 14.001], [0.0000, 0.4999, -0.0122], [0.0000, -0.0000, 0.0018]]), @@ -195,7 +200,7 @@ class MeshType_3d_bladderurethra1(Scaffold_base): (7, [[0.000, -1.6517, 86.875], [0.0000, -0.5654, 14.673], [0.0000, 0.5000, 0.0047], [0.0000, -0.0038, -0.1421]]), (8, [[0.000, -1.3262, 102.46], [0.0000, 1.8796, 15.041], [0.0000, 0.4872, -0.1123], [0.0000, -0.0646, -0.1586]]), (9, [[0.000, 1.9903, 116.76], [0.0000, 4.7166, 13.462], [0.0000, 0.4510, -0.2159], [0.0000, -0.1378, -0.1893]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_bone1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_bone1.py index fd93ffcd..764cf379 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_bone1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_bone1.py @@ -39,13 +39,14 @@ class MeshType_3d_bone1 (Scaffold_base): 'Number of elements': 3 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.0, 0.0, 0.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]), (2, [[0.0, 0.0, 1.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]), (3, [[0.0, 0.0, 2.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]), (4, [[0.0, 0.0, 3.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]) - ]) + ]]) }) } diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_brainstem.py b/src/scaffoldmaker/meshtypes/meshtype_3d_brainstem.py index ad2ea676..a7507182 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_brainstem.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_brainstem.py @@ -39,8 +39,9 @@ class MeshType_3d_brainstem1(Scaffold_base): 'Number of elements': 8 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.0,0.0,0.0], [0.0,0.0,1.0], [1.0,0.0,0.0], [0.0,0.0,0.0], [-0.0,1.0,0.0], [0.0,0.0,0.0]]), (2, [[0.0,0.0,1.0], [0.0,0.0,1.0], [1.0,0.0,0.0], [0.0,0.0,0.0], [-0.0,1.0,0.0], [0.0,0.0,0.0]]), (3, [[0.0,0.0,2.0], [0.0,0.0,1.0], [1.0,0.0,0.0], [0.0,0.0,0.0], [-0.0,1.0,0.0], [0.0,0.0,0.0]]), @@ -50,7 +51,7 @@ class MeshType_3d_brainstem1(Scaffold_base): (7, [[0.0,0.0,6.0], [0.0,0.0,1.0], [1.0,0.0,0.0], [0.0,0.0,0.0], [-0.0,1.0,0.0], [0.0,0.0,0.0]]), (8, [[0.0,0.0,7.0], [0.0,0.0,1.0], [1.0,0.0,0.0], [0.0,0.0,0.0], [-0.0,1.0,0.0], [0.0,0.0,0.0]]), (9, [[0.0,0.0,8.0], [0.0,0.0,1.0], [1.0,0.0,0.0], [0.0,0.0,0.0], [-0.0,1.0,0.0], [0.0,0.0,0.0]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -83,8 +84,9 @@ class MeshType_3d_brainstem1(Scaffold_base): 'Number of elements': 6 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.0, 10.7,-12.3], [0.0,-3.8,3.1], [4.8,0.0,0.0], [-0.7,0.0,0.0], [-0.0,2.2,2.6], [0.0, 0.5, 0.1]]), (2, [[0.0, 6.8, -8.8], [0.0,-4.0,3.9], [4.5,0.0,0.0], [ 0.1,0.0,0.0], [-0.0,2.7,2.7], [0.0, 0.5, 0.1]]), (3, [[0.0, 2.8, -4.5], [0.0,-3.5,4.2], [5.0,0.0,0.0], [ 1.2,0.0,0.0], [-0.0,3.2,2.8], [0.0, 0.5, 0.0]]), @@ -92,7 +94,7 @@ class MeshType_3d_brainstem1(Scaffold_base): (5, [[0.0, -2.8, 3.0], [0.0,-1.9,4.1], [6.8,0.0,0.0], [-0.6,0.0,0.0], [-0.0,4.5,2.0], [0.0, 0.3,-0.1]]), (6, [[0.0, -3.8, 7.5], [0.0,-2.7,4.6], [5.5,0.0,0.0], [-0.2,0.0,0.0], [-0.0,4.3,2.5], [0.0,-1.0, 1.0]]), (7, [[0.0, -8.2, 11.5], [0.0,-5.9,3.2], [6.8,0.0,0.0], [ 2.8,0.0,0.0], [-0.0,2.3,4.2], [0.0,-3.1, 2.4]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -125,8 +127,9 @@ class MeshType_3d_brainstem1(Scaffold_base): 'Number of elements': 6 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.0,18.9,-50.7], [0.0,-3.2,15.4], [ 7.8,0.0,0.0], [ 0.5,0.0,0.0], [-0.0, 6.1,1.3], [0.0,0.8, 1.7]]), (2, [[0.0,14.6,-36.3], [0.0,-5.4,13.3], [ 8.5,0.0,0.0], [ 0.9,0.0,0.0], [-0.0, 7.2,2.9], [0.0,1.4, 1.6]]), (3, [[0.0, 8.3,-24.1], [0.0,-6.4,12.5], [ 9.6,0.0,0.0], [ 4.4,0.0,0.0], [-0.0, 8.9,4.6], [0.0,1.3, 0.5]]), @@ -134,7 +137,7 @@ class MeshType_3d_brainstem1(Scaffold_base): (5, [[0.0,-2.3, 2.4], [0.0,-3.9,13.2], [20.2,0.0,0.0], [-0.4,0.0,0.0], [-0.0,14.1,4.2], [0.0,2.2,-0.5]]), (6, [[0.0,-6.0, 15.0], [0.0,-2.6,12.9], [16.8,0.0,0.0], [-2.4,0.0,0.0], [-0.0,14.4,2.9], [0.0,0.2,-1.9]]), (7, [[0.0,-7.5, 28.0], [0.0,-0.4,13.1], [15.3,0.0,0.0], [-0.6,0.0,0.0], [-0.0,14.5,0.4], [0.0,0.0,-3.1]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -167,8 +170,9 @@ class MeshType_3d_brainstem1(Scaffold_base): 'Number of elements': 6 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.0, 1.5,-3.4], [0.0,-0.1,1.1], [1.4,0.0,0.0], [-0.1,0.0,0.0], [0.0,1.0, 0.1], [0.0, 0.1, 0.9]]), (2, [[0.0, 1.0,-2.3], [0.0,-0.8,1.0], [1.3,0.0,0.0], [ 0.0,0.0,0.0], [0.0,0.8, 0.7], [0.0, 0.0, 0.6]]), (3, [[0.0,-0.1,-1.6], [0.0,-1.2,0.8], [1.5,0.0,0.0], [ 0.4,0.0,0.0], [0.0,0.7, 1.0], [0.0, 0.1, 0.1]]), @@ -176,7 +180,7 @@ class MeshType_3d_brainstem1(Scaffold_base): (5, [[0.0,-1.5, 0.5], [0.0, 0.1,1.4], [2.0,0.0,0.0], [-0.1,0.0,0.0], [0.0,1.4,-0.1], [0.0, 0.1,-0.1]]), (6, [[0.0,-1.1, 1.9], [0.0,-0.3,1.4], [1.6,0.0,0.0], [-0.1,0.0,0.0], [0.0,1.5, 0.3], [0.0,-0.3, 0.3]]), (7, [[0.0,-2.1, 3.1], [0.0,-1.3,0.8], [2.0,0.0,0.0], [ 0.8,0.0,0.0], [0.0,0.7, 1.2], [0.0,-0.8, 0.7]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -209,8 +213,9 @@ class MeshType_3d_brainstem1(Scaffold_base): 'Number of elements': 6 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.0, 2.9,-5.4], [0.0, 0.5,1.7], [1.9,0.0,0.0], [-0.2,0.0,0.0], [0.0,1.3,-0.4], [-0.0, 0.2, 1.3]]), (2, [[0.0, 2.7,-3.5], [0.0,-0.9,2.0], [1.8,0.0,0.0], [ 0.0,0.0,0.0], [-0.0,1.4,0.6], [-0.0, 0.0, 0.8]]), (3, [[0.0, 1.1,-1.8], [0.0,-1.4,1.7], [2.0,0.0,0.0], [ 0.5,0.0,0.0], [-0.0,1.3,1.1], [ 0.0, 0.1, 0.2]]), @@ -218,7 +223,7 @@ class MeshType_3d_brainstem1(Scaffold_base): (5, [[0.0,-1.1, 1.2], [0.0,-0.7,1.6], [2.7,0.0,0.0], [-0.2,0.0,0.0], [-0.0,1.8,0.8], [ 0.0, 0.1,-0.1]]), (6, [[0.0,-1.5, 3.0], [0.0,-1.1,1.9], [2.2,0.0,0.0], [-0.1,0.0,0.0], [-0.0,1.7,1.0], [ 0.0,-0.4, 0.4]]), (7, [[0.0,-3.3, 4.6], [0.0,-2.4,1.3], [2.7,0.0,0.0], [ 1.1,0.0,0.0], [-0.0,0.9,1.7], [ 0.0,-1.2, 1.0]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -251,8 +256,9 @@ class MeshType_3d_brainstem1(Scaffold_base): 'Number of elements': 6 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.0, 25.6, -29.3], [0.0, -5.4, 3.5], [4.8, 0.0, 0.0], [-0.7, 0.0, 0.0], [0.0, 1.8, 2.9], [0.0, 1.1, 1.4]]), (2, [[0.0, 19.5, -25.3], [0.0, -6.7, 4.8], [5.7, 0.0, 0.0], [2.5, 0.0, 0.0], [0.0, 2.8, 4.0], [0.0, 0.8, 0.7]]), (3, [[0.0, 12.2, -19.9], [0.0, -6.7, 5.4], [10.1, 0.0, 0.0], [3.0, 0.0, 0.0], [0.0, 3.3, 4.2], [0.0, 1.5, 0.5]]), @@ -260,7 +266,7 @@ class MeshType_3d_brainstem1(Scaffold_base): (5, [[0.0, 1.5, -7.4], [0.0, -2.8, 7.0], [11.4, 0.0, 0.0], [-0.3, 0.2, 0.0], [0.0, 7.4, 3.0], [-0.2, 2.4, -1.2]]), (6, [[0.0, 0.1, -1.0], [0.0, -1.5, 6.9], [11.2, 0.3, 0.1], [-0.5, 0.1, 0.1], [-0.3, 11.3, 2.5], [-0.1, 1.5, -0.2]]), (7, [[0.0, -1.5, 6.6], [0.0, -2.0, 7.4], [10.3, 0.2, 0.0], [-1.3, -0.2, -0.0], [-0.2, 9.4, 2.5], [0.2, -2.3, 0.9]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -293,8 +299,9 @@ class MeshType_3d_brainstem1(Scaffold_base): 'Number of elements': 6 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( # dimensional. + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[ 0.0, 21.3,-33.2], [ 0.0,-7.5, 6.0], [ 4.8, 0.0, 0.0], [ 4.8,-0.0,-0.0], [ 0.0, 2.8, 3.5], [ 0.0, 3.2, 1.3]]), (2, [[ 0.0, 14.5,-26.7], [ 0.0,-6.1, 7.2], [ 8.5,-0.0,-0.0], [ 2.6, 0.0, 0.0], [ 0.0, 4.9, 4.1], [-0.0, 1.1, 0.1]]), (3, [[ 0.0, 9.2,-19.0], [ 0.0,-5.2, 7.2], [ 10.1, 0.0, 0.0], [ 1.1,-0.1,-0.0], [ 0.0, 5.0, 3.6], [ 0.1, 0.4,-0.6]]), @@ -302,7 +309,7 @@ class MeshType_3d_brainstem1(Scaffold_base): (5, [[ 0.0, 2.1, -5.5], [ 0.0,-1.2, 7.6], [ 9.4, 0.3, 0.1], [ 0.1, 0.2, 0.1], [-0.2, 6.6, 1.0], [-0.2, 2.2,-0.3]]), (6, [[ 0.0, 1.9, 2.9], [ 0.0,-2.1, 8.8], [ 11.2, 0.2, 0.1], [ 3.3,-0.1,-0.0], [-0.2, 10.4, 2.5], [ 0.1, 0.3, 2.0]]), (7, [[ 0.0, -2.3, 11.4], [ 0.0,-6.2, 8.1], [ 16.2, 0.1, 0.0], [ 6.7,-0.2,-0.0], [-0.0, 6.7, 5.1], [ 0.3,-7.7, 3.2]]) - ]), + ]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_cecum1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_cecum1.py index 58db44f4..fba54ac9 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_cecum1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_cecum1.py @@ -41,13 +41,14 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3.2, 4-3-5" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[7.50,-20.00,0.00], [0.00,8.28,0.00], [-2.50,0.00,0.00], [0.00,0.00,0.00], [0.00,-0.00,2.50], [0.00,0.00,0.00]]), (2, [[7.50,-10.86,0.00], [0.00,10.00,0.00], [-4.50,0.00,0.00], [0.00,0.00,0.00], [0.00,-0.00,4.50], [0.00,0.00,0.00]]), (3, [[7.50,0.00,0.00], [[8.44,0.00,0.04],[0.00,11.72,0.00]], [[0.00,11.60,0.00],[-4.50,0.00,0.00]], [[1.02,6.79,0.00],[0.00,0.00,0.00]], [[0.00,0.00,11.60],[0.00,-0.00,4.50]], [[0.00,0.00,5.77],[0.00,0.00,0.00]]]), (4, [[-1.88,0.00,-0.08], [10.32,0.00,0.12], [0.00,11.60,0.00], [0.00,0.00,0.00], [0.00,0.00,11.60], [0.00,0.00,0.00]]), (5, [[15.00,0.00,0.00], [6.56,0.00,-0.04], [0.00,11.60,0.00], [0.00,0.00,0.00], [0.00,0.00,11.60], [0.00,0.00,0.00]]) - ]), + ]]), 'userAnnotationGroups': [ { @@ -71,13 +72,14 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3.2, 4-3-5" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[-60.630,-80.530,895.250], [-6.170,-10.100,-5.870], [2.660,0.730,-4.050], [2.380,0.990,-1.140], [3.310,-2.970,1.640], [2.380,0.990,-1.140]]), (2, [[-68.640,-93.290,888.060], [-9.850,-15.420,-8.510], [3.880,1.200,-6.660], [2.380,0.990,-1.140], [2.820,-2.460,1.200], [2.380,0.990,-1.140]]), (3, [[-80.390,-111.370,878.290], [[-7.790,-0.980,12.360],[-13.650,-20.740,-11.030]], [[20.720,-4.040,12.540],[5.590,1.310,-9.380]], [[2.380,0.990,-1.140],[2.380,0.990,-1.140]], [[2.470,23.830,3.610],[1.510,-1.370,0.710]], [[2.380,0.990,-1.140],[2.380,0.990,-1.140]]]), (4, [[-71.690,-109.000,866.040], [-9.550,-3.730,12.060], [17.410,-4.850,11.460], [3.730,0.680,4.200], [0.820,19.940,7.200], [3.740,0.690,4.200]]), (5, [[-87.210,-111.060,890.540], [-4.750,0.410,12.390], [23.270,-3.130,7.880], [2.460,-0.390,-2.950], [3.090,24.460,0.450], [1.830,0.460,-4.310]]) - ]), + ]]), 'userAnnotationGroups': [ { @@ -101,7 +103,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3.2, 4-5-6-3-7" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[164.00,29.75,51.53], [0.00,-9.63,-16.67], [-6.00,0.00,0.00], [0.00,0.00,0.00], [0.00,5.20,-3.00], [0.00,0.00,0.00]]), (2, [[164.00,17.50,30.31], [0.00,-14.87,-25.77], [-10.00,0.00,0.00], [0.00,0.00,0.00], [0.00,8.66,-5.00], [0.00,0.00,0.00]]), (3, [[164.00,0.00,0.00], [[30.00,0.00,0.00],[0.00,-20.13,-34.85]], [[0.00,37.00,0.00],[-10.00,0.00,0.00]], [[0.00,0.00,0.00],[0.00,0.00,0.00]], [[0.00,0.00,37.00],[0.00,8.66,-5.00]], [[0.00,0.00,0.00],[0.00,0.00,0.00]]]), @@ -109,7 +112,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (5, [[60.00,0.00,0.00], [60.00,0.00,0.00], [0.00,37.00,0.00], [0.00,0.00,0.00], [0.00,0.00,37.00], [0.00,0.00,0.00]]), (6, [[120.00,0.00,0.00], [52.00,0.00,0.00], [0.00,37.00,0.00], [0.00,0.00,0.00], [0.00,0.00,37.00], [0.00,0.00,0.00]]), (7, [[180.00,0.00,0.00], [2.00,0.00,0.00], [0.00,37.00,0.00], [0.00,0.00,0.00], [0.00,0.00,37.00], [0.00,0.00,0.00]]) - ]), + ]]), 'userAnnotationGroups': [ { diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_colon1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_colon1.py index 944116cb..a5a9070b 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_colon1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_colon1.py @@ -32,7 +32,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3-4-5-6-7-8-9" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.00,0.00,0.00], [-50.70,178.20,0.00], [-40.03,-10.00,-20.01], [-6.86,-11.39,-2.36], [-19.62,-4.20,41.24], [-14.00,-1.00,-12.00]]), (2, [[-47.40,188.60,0.00], [-19.30,177.10,0.00], [-37.98,-6.91,-13.80], [11.23,17.36,14.31], [-13.43,-4.23,38.50], [-4.00,19.00,22.00]]), (3, [[-4.40,396.50,0.00], [206.00,40.10,0.00], [-14.88,29.77,11.90], [13.54,-1.87,21.51], [-6.48,-13.39,32.07], [-6.00,0.00,51.00]]), @@ -42,7 +43,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (7, [[475.20,168.00,0.00], [-0.80,-112.40,0.00], [22.45,0.00,-22.45], [-2.41,-19.32,-15.36], [22.45,-0.00,22.45], [15.00,-1.00,-10.00]]), (8, [[432.60,-32.30,0.00], [-90.50,-59.00,0.00], [10.89,-16.33,-25.41], [-9.58,-7.07,-2.37], [14.04,-21.18,19.63], [8.00,-11.00,-13.00]]), (9, [[272.40,7.50,0.00], [-79.00,47.40,0.00], [1.53,-16.88,-27.61], [-7.76,6.05,-1.75], [-5.63,-28.82,13.68], [4.00,-12.00,-12.00]]) - ]), + ]]), 'userAnnotationGroups': [ { @@ -80,7 +81,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3-4-5-6-7-8-9" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.00,0.00,0.00], [-56.81,105.14,-38.05], [-40.03,-10.00,-20.01], [-3.67,-11.77,-1.56], [-22.35,6.24,39.56], [-14.00,-1.00,-12.00]]), (2, [[-34.50,114.00,-18.10], [-9.51,117.91,3.65], [-35.93,-6.53,-13.07], [12.13,18.49,14.99], [-13.40,-4.92,36.05], [-4.00,19.00,22.00]]), (3, [[-19.10,218.50,5.50], [79.23,66.40,77.49], [-14.71,29.43,11.78], [14.61,7.18,21.72], [-24.58,-18.69,16.37], [-6.00,0.00,51.00]]), @@ -90,7 +92,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (7, [[354.00,105.30,-24.40], [-20.59,-269.54,30.48], [22.54,0.00,-22.54], [-2.92,-19.10,-14.61], [22.47,6.25,21.72], [15.00,-1.00,-10.00]]), (8, [[296.50,-121.20,-0.60], [-170.98,-102.19,-18.39], [10.95,-16.42,-25.54], [-9.48,-6.06,-2.33], [14.12,-21.29,19.73], [8.00,-11.00,-13.00]]), (9, [[169.80,-73.40,-33.50], [-42.47,101.91,-24.43], [1.54,-16.94,-27.72], [-7.96,5.07,-1.75], [-18.03,-23.55,13.36], [4.00,-12.00,-12.00]]) - ] ), + ]]), 'userAnnotationGroups': [ { @@ -129,7 +131,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[-87.210,-111.060,890.540], [-4.750,0.410,12.390], [23.270,-3.130,7.880], [2.460,-0.390,-2.950], [3.090,24.460,0.450], [1.830,0.460,-4.310]]), (2, [[-89.990,-110.570,902.650], [-2.050,0.530,12.720], [24.710,-3.280,4.130], [0.070,0.140,-2.810], [3.420,25.000,-0.640], [0.430,0.100,-3.970]]), (3, [[-91.250,-110.010,915.920], [-0.550,0.530,13.390], [23.610,-2.820,1.080], [-1.460,0.550,-1.920], [2.850,23.610,-0.910], [-1.420,0.540,-2.130]]), @@ -179,7 +182,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (47, [[18.390,-75.310,835.820], [-8.420,10.080,-2.660], [-7.370,-0.990,19.530], [-0.560,0.610,0.800], [16.030,10.170,6.780], [-0.360,-0.280,1.590]]), (48, [[9.350,-65.880,832.920], [-11.900,13.240,-4.280], [-8.470,-0.620,21.630], [-0.850,0.480,1.280], [17.760,11.500,7.330], [-1.390,-0.780,1.040]]), (49, [[-5.120,-48.680,827.110], [-17.030,21.160,-7.340], [-8.980,0.200,21.430], [-0.080,1.010,-1.640], [17.760,11.500,7.330], [-1.390,-0.780,1.040]]) - ] ), + ]]), 'userAnnotationGroups': [ { @@ -219,7 +222,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "33-34-35-36-37-38-39-40-41-42-43-44-45-46-47-48-49-50-51-52-53" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3 ], [ + ['coordinates'], + [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3 ], [[ (1, [[-245.30,444.60,-49.10], [-267.70,-53.10,-20.20], [0.00,0.00,38.02], [0.00,0.00,-4.41], [-7.40,37.29,0.00], [0.00,0.00,-4.41]]), (2, [[-380.30,484.80,-45.00], [24.50,102.70,15.70], [0.00,0.00,34.49], [0.00,0.00,-2.65], [33.55,-8.00,0.00], [0.00,0.00,-2.65]]), (3, [[-298.10,510.40,-36.80], [73.60,9.90,-16.40], [0.00,0.00,32.36], [-12.52,-3.10,-14.34], [4.31,-32.07,0.00], [-12.52,-3.10,-14.34]]), @@ -273,7 +277,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (51, [[-318.10,641.90,-8.50], [166.70,17.60,5.50], [0.89,-3.82,-11.58], [-2.15,-0.82,-0.11], [-1.09,11.54,-3.89], [-2.15,-0.82,-0.11]]), (52, [[-158.30,634.70,-1.90], [176.50,-14.00,10.80], [-1.43,-3.83,-11.56], [-0.81,0.27,-0.12], [1.15,11.54,-3.97], [-0.81,0.27,-0.12]]), (53, [[32.70,611.70,13.60], [205.50,-32.20,20.00], [-1.01,-3.02,-11.90], [1.46,0.96,-0.42], [2.15,11.71,-3.15], [1.46,0.96,-0.42]]) - ] ), + ]]), 'userAnnotationGroups': [ { @@ -311,7 +315,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3-4-5-6-7-8" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.00,0.00,0.00], [6.00,12.00,-2.00], [1.04,0.51,1.04], [-0.03,0.95,-0.68], [1.33,0.06,-0.79], [6.00,0.00,3.00]]), (2, [[-2.00,11.00,-3.00], [-8.00,4.00,9.00], [1.01,1.01,0.50], [-0.03,-0.34,-0.02], [-0.58,1.04,-0.91], [0.00,1.00,2.00]]), (3, [[-3.00,2.00,3.00], [-4.00,-8.00,0.00], [0.98,-0.48,0.98], [-0.15,-0.65,0.01], [-0.88,0.43,1.09], [1.00,0.00,2.00]]), @@ -320,7 +325,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (6, [[-7.00,-8.00,0.00], [5.00,-1.00,-14.00], [0.00,-1.25,0.00], [0.03,0.04,-0.12], [-1.14,-0.00,-0.50], [0.00,0.00,0.50]]), (7, [[-1.00,-6.00,-1.00], [2.00,-2.00,9.00], [0.38,-1.13,-0.38], [0.12,0.11,-0.23], [1.15,0.45,-0.20], [0.00,0.00,0.50]]), (8, [[-2.00,-14.00,5.00], [-2.00,-4.00,2.00], [0.41,-0.84,-0.84], [-0.08,0.22,-0.28], [0.95,-0.30,0.75], [0.00,0.00,0.50]]) - ] ), + ]]), 'userAnnotationGroups': [ { @@ -358,13 +363,14 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3-4-5" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.00,0.00,0.00], [0.00,0.00,13.00], [0.00,-1.55,0.00], [0.00,0.03,0.00], [1.55,-0.00,0.00], [0.00,0.00,0.50]]), (2, [[0.00,0.00,13.00], [0.00,2.00,28.00], [0.00,-1.51,0.00], [0.00,0.05,0.00], [1.50,-0.00,-0.11], [0.00,0.00,0.50]]), (3, [[-14.00,-2.00,13.00], [0.00,-3.00,-19.00], [0.00,-1.43,0.00], [0.00,0.13,0.00], [-1.41,-0.03,-0.23], [0.00,0.00,0.50]]), (4, [[-14.00,-1.00,-10.00], [1.00,1.00,-17.00], [0.00,-1.25,0.00], [0.00,0.08,0.00], [-1.25,-0.00,-0.00], [0.00,0.00,0.50]]), (5, [[-14.00,0.00,-28.00], [0.00,0.00,-11.00], [0.00,-1.25,0.00], [0.00,-0.08,0.00], [-1.25,-0.00,0.00], [0.00,0.00,0.50]]) - ] ), + ]]), 'userAnnotationGroups': [ { @@ -403,7 +409,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "33-34-35-36-37-38-39-40" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[-7.20,83.30,-20.70], [-65.20,-8.10,7.60], [0.00,0.00,38.25], [0.00,0.00,-0.50], [-9.02,37.17,0.51], [0.00,0.00,-0.50]]), (2, [[-68.50,52.80,-9.60], [-40.10,-36.10,10.70], [0.00,0.00,37.69], [0.00,0.00,-0.63], [-30.08,22.66,1.43], [0.00,0.00,-0.63]]), (3, [[-97.40,-26.30,5.70], [18.00,-93.20,13.70], [0.00,0.00,36.98], [0.00,0.00,-0.67], [-34.95,-12.07,0.76], [0.00,0.00,-0.67]]), @@ -444,7 +451,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (38, [[-20.90,15.30,-77.90], [-51.20,-30.60,21.10], [4.73,-5.14,8.14], [-1.12,2.71,-1.85], [-3.33,7.50,6.91], [-1.44,3.31,-2.27]]), (39, [[-47.60,33.90,-112.20], [32.60,30.70,-27.80], [-10.59,-0.41,-1.32], [-7.25,2.76,-6.03], [-4.75,2.85,9.12], [-8.97,3.42,-7.45]]), (40, [[19.60,96.00,-167.50], [19.90,19.10,-18.40], [-8.87,0.91,-5.71], [9.97,-0.68,-0.89], [-3.77,7.41,6.56], [12.30,-0.82,-1.11]]) - ] ), + ]]), 'userAnnotationGroups': [ { diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_esophagus1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_esophagus1.py index d25b3ec6..ac378894 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_esophagus1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_esophagus1.py @@ -33,14 +33,15 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3-4-5" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.394, -100.872, 1402.818], [-0.035, 12.367, -48.020], [8.730, -0.526, -0.142], [0.613, -0.153, -0.037], [-0.272, -4.224, -1.088], [-0.169, -1.491, -0.564]]), (2, [[0.520, -86.043, 1340.066], [0.501, 16.682, -77.602], [9.142, -0.799, -0.113], [0.212, -0.392, 0.096], [-0.465, -5.159, -1.112], [-0.215, -0.377, 0.515]]), (3, [[1.368, -67.733, 1247.932], [0.235, -3.685, -89.672], [9.061, -1.366, 0.080], [-0.833, -0.231, 0.187], [-0.714, -4.722, 0.192], [-0.167, 0.445, 1.659]]), (4, [[0.361, -91.057, 1165.531], [-2.499, -24.560, -49.102], [7.540, -1.290, 0.261], [-0.809, 1.514, 2.095], [-0.806, -4.269, 2.176], [0.001, 0.896, 0.910]]), (5, [[11.750, -111.874, 1127.887], [7.636, -5.715, -7.930], [5.678, 1.265, 4.556], [-8.397, 13.092, 24.878], [-0.708, -3.530, 1.862], [-0.807, -7.995, 7.596]]) - ]), + ]]), 'userAnnotationGroups': [ { diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_gastrointestinaltract1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_gastrointestinaltract1.py index 7c778235..1fb5ac9a 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_gastrointestinaltract1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_gastrointestinaltract1.py @@ -46,7 +46,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "222" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.394,-100.872,1402.818], [-0.035,12.367,-48.020], [8.730,-0.526,-0.142], [0.613,-0.153,-0.037], [-0.272,-4.224,-1.088], [-0.169,-1.491,-0.564]]), (2, [[0.520,-86.043,1340.066], [0.501,16.682,-77.602], [9.142,-0.799,-0.113], [0.212,-0.392,0.096], [-0.465,-5.159,-1.112], [-0.215,-0.377,0.515]]), (3, [[1.368,-67.733,1247.932], [0.235,-3.685,-89.672], [9.061,-1.366,0.080], [-0.833,-0.231,0.187], [-0.714,-4.722,0.192], [-0.167,0.445,1.659]]), @@ -269,7 +270,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (220, [[18.390,-75.310,835.820], [-8.420,10.080,-2.660], [-7.370,-0.990,19.530], [-0.560,0.610,0.800], [16.030,10.170,6.780], [-0.360,-0.280,1.590]]), (221, [[9.350,-65.880,832.920], [-11.900,13.240,-4.280], [-8.470,-0.620,21.630], [-0.850,0.480,1.280], [17.760,11.500,7.330], [-1.390,-0.780,1.040]]), (222, [[-5.120,-48.680,827.110], [-17.030,21.160,-7.340], [-8.980,0.200,21.430], [-0.080,1.010,-1.640], [17.760,11.500,7.330], [-1.390,-0.780,1.040]]) - ] ), + ]] ), 'userAnnotationGroups': [ { diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_musclefusiform1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_musclefusiform1.py index 6ce838f2..d616167d 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_musclefusiform1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_musclefusiform1.py @@ -33,8 +33,9 @@ class MeshType_3d_musclefusiform1(Scaffold_base): 'Number of elements': 6 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[-0.27, 0.44, 0.87], [6.61, 7.71, 43.82], [4.56, -1.02, -0.51], [-1.56, 0.44, 0.72], [0.29, 1.48, -0.30], [0.18, 0.93, 0.18]]), (2, [[3.25, 5.21, 45.57], [0.37, 1.78, 45.29], [4.61, -0.73, -0.01], [1.66, 0.13, 0.29], [0.40, 2.58, -0.10], [0.04, 1.24, 0.22]]), (3, [[0.46, 3.96, 90.94], [-0.69, -2.01, 59.61], [7.90, -0.75, 0.06], [5.17, -0.55, -0.35], [0.37, 3.97, 0.14], [0.20, 2.18, -0.21]]), @@ -42,7 +43,7 @@ class MeshType_3d_musclefusiform1(Scaffold_base): (5, [[11.03, 18.03, 234.00], [11.41, 10.94, 50.55], [8.22, -1.76, -1.46], [-5.41, 0.42, 0.14], [1.09, 6.46, -1.64], [0.55, -0.34, 0.05]]), (6, [[21.86, 23.91, 265.44], [9.61, 3.36, 33.13], [3.98, -1.33, -1.02], [-3.21, 0.42, 0.52], [1.83, 6.41, -1.18], [0.10, -1.87, 0.76]]), (7, [[30.07, 24.60, 299.90], [6.77, -1.97, 35.60], [1.85, -0.92, -0.40], [-1.04, 0.40, 0.71], [1.27, 2.61, -0.09], [-1.23, -5.71, 1.40]]) - ]) + ]]) }), 'Biceps femoris 1': ScaffoldPackage(MeshType_1d_path1, { 'scaffoldSettings': { @@ -53,8 +54,9 @@ class MeshType_3d_musclefusiform1(Scaffold_base): 'Number of elements': 7 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[1.11, 0.78, 0.89], [-17.32, 0.85, 44.44], [-2.04, 5.00, -0.89], [-0.58, 1.13, -0.73], [-3.62, -1.72, -1.38], [1.97, 0.30, 2.07]]), (2, [[-10.89, 4.78, 45.89], [-6.48, 7.14, 45.04], [-2.06, 8.08, -1.58], [0.54, 5.02, -0.64], [-5.26, -1.44, -0.53], [-5.24, 0.26, -0.37]]), (3, [[-11.89, 14.78, 89.89], [-7.65, 6.42, 47.75], [-0.97, 14.98, -2.17], [1.04, 8.35, 0.22], [-13.97, -1.21, -2.08], [-5.63, 0.61, -1.67]]), @@ -63,7 +65,7 @@ class MeshType_3d_musclefusiform1(Scaffold_base): (6, [[-42.89, 21.78, 237.89], [-6.50, 5.06, 48.56], [-0.91, 23.94, -2.62], [-0.55, -6.63, -0.82], [-19.08, -0.99, -2.45], [3.07, -0.76, 1.14]]), (7, [[-48.89, 28.78, 284.89], [-5.02, 10.53, 46.68], [-1.99, 12.97, -3.14], [-0.54, -9.05, 0.11], [-13.94, -2.37, -0.97], [5.44, -0.79, 1.45]]), (8, [[-52.89, 42.78, 330.89], [-2.97, 17.41, 45.15], [-1.98, 5.86, -2.39], [0.55, -5.16, 1.38], [-8.19, -2.58, 0.46], [6.06, 0.38, 1.39]]) - ]) + ]]) }), } diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_ostium2.py b/src/scaffoldmaker/meshtypes/meshtype_3d_ostium2.py index e4871996..72559d98 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_ostium2.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_ostium2.py @@ -33,11 +33,12 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.00, 0.00, 1.00], [0.00, 0.00, -0.50], [0.00, 0.50, 0.00], [0.00, 0.00, 0.00], [1.00, 0.00, 0.00], [0.00, 0.00, 0.00]]), (2, [[0.00, 0.00, 0.50], [0.00, 0.00, -0.50], [0.00, 1.00, 0.00], [0.00, 0.00, 0.00], [1.00, 0.00, 0.00], [0.00, 0.00, 0.00]]), - (3, [[0.00, 0.00, 0.00], [0.00, 0.00, -0.50], [0.00, 1.00, 0.00], [0.00, 0.00, 0.00], [2.00, 0.00, 0.00], [0.00, 0.00, 0.00]])]) + (3, [[0.00, 0.00, 0.00], [0.00, 0.00, -0.50], [0.00, 1.00, 0.00], [0.00, 0.00, 0.00], [2.00, 0.00, 0.00], [0.00, 0.00, 0.00]])]]) }) class MeshType_3d_ostium2(Scaffold_base): diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_smallintestine1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_smallintestine1.py index d4fabe59..9a395d80 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_smallintestine1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_smallintestine1.py @@ -36,7 +36,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "137-138-139-140-141-142-143-144-145-146-147-148-149-150-151-152" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3 ], [ + ['coordinates'], + [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3 ], [[ (1, [[-32.281,-136.261,1061.249], [-6.125,11.114,-0.493], [-5.735,-3.374,-4.823], [-2.070,-0.220,-4.520], [-4.630,-2.238,7.071], [-4.400,2.440,0.570]]), (2, [[-40.674,-122.300,1060.850], [-5.403,7.321,-2.629], [-4.779,-4.249,-5.161], [2.360,-0.320,0.120], [-5.138,-1.668,6.875], [-0.250,2.080,-4.500]]), (3, [[-48.346,-108.981,1049.574], [-6.840,19.440,-21.940], [-3.459,-4.108,-5.699], [0.900,0.690,1.570], [-7.043,0.777,3.341], [-0.760,2.950,-2.230]]), @@ -189,7 +190,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (150, [[-52.380,-100.900,869.760], [4.760,24.010,12.610], [-3.169,0.219,3.447], [-0.280,-0.300,-1.610], [4.600,-0.510,-0.770], [-2.290,1.100,4.280]]), (151, [[-41.730,-76.290,892.900], [-14.020,14.240,19.650], [-3.750,-3.589,-1.622], [3.240,-2.890,0.750], [1.930,-2.620,3.270], [-5.090,5.860,6.610]]), (152, [[-60.630,-80.530,895.250], [-6.170,-10.100,-5.870], [2.660,0.730,-4.050], [2.380,0.990,-1.140], [3.310,-2.970,1.640], [2.380,0.990,-1.140]]) - ] ), + ]]), 'userAnnotationGroups': [ { @@ -250,7 +251,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "533-534-535-536-537" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[-502.30,732.10,92.00], [-49.80,-90.70,0.00], [0.00,0.00,12.00], [0.00,0.00,0.00], [-10.52,5.77,0.00], [0.00,0.00,0.00]]), (2, [[-543.10,654.80,92.00], [-31.70,-64.00,0.00], [0.00,0.00,12.00], [0.00,0.00,0.00], [-10.75,5.33,0.00], [0.00,0.00,0.00]]), (3, [[-566.20,605.00,92.00], [-43.40,-40.20,0.00], [0.00,0.00,12.00], [0.00,0.00,0.00], [-8.16,8.81,0.00], [0.00,0.00,0.00]]), @@ -788,7 +790,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (535, [[-55.20,436.50,11.50], [-50.10,54.50,-0.10], [8.19,8.83,-0.65], [0.24,8.59,-0.86], [-1.11,0.26,-12.00], [0.34,11.63,-1.17]]), (536, [[-121.40,460.30,17.10], [-86.80,60.90,-1.80], [6.07,10.28,-1.54], [0.90,-2.49,-1.08], [-1.49,-0.82,-11.91], [1.24,-3.38,-1.46]]), (537, [[-164.50,536.10,-17.30], [-9.90,55.20,-8.50], [11.44,1.36,-3.37], [8.03,-12.39,-1.98], [-3.05,-2.47,-11.34], [10.93,-16.81,-2.68]]) - ] ), + ]]), 'userAnnotationGroups': [ { @@ -828,7 +830,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "33-34-35-36-37-38-39-40-41-42-43-44-45-46" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3 ], [ + ['coordinates'], + [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3 ], [[ (1, [[-2.30,18.50,-4.40], [-4.20,-0.80,3.70], [0.00,0.70,0.00], [0.00,0.11,0.00], [-0.39,0.01,-0.58], [0.00,0.00,0.50]]), (2, [[-8.60,16.30,-0.40], [-7.10,-2.70,1.60], [0.00,0.83,0.00], [0.00,0.14,0.00], [0.09,0.10,-0.82], [0.00,0.00,0.50]]), (3, [[-18.30,12.60,-1.50], [-6.40,-1.70,-3.80], [0.00,1.00,0.00], [0.00,0.13,0.00], [0.68,0.04,-0.72], [0.00,0.00,0.50]]), @@ -875,7 +878,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (44, [[-20.50,2.30,-6.10], [3.50,7.20,-2.90], [-1.09,0.10,-0.10], [-0.21,0.77,-0.11], [-0.19,0.13,1.08], [0.00,0.00,0.50]]), (45, [[-11.40,2.60,-10.10], [10.40,1.50,-0.20], [-0.09,0.56,-0.95], [0.49,0.10,-0.38], [-0.11,0.94,0.56], [0.00,0.00,0.50]]), (46, [[-3.80,4.20,-7.30], [3.50,0.90,2.70], [0.08,0.40,-1.02], [-0.19,-0.40,0.24], [-0.80,0.75,0.01], [0.00,0.00,0.50]]) - ] ), + ]]), 'userAnnotationGroups': [ { diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_solidcylinder1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_solidcylinder1.py index 47049f38..f88e1d03 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_solidcylinder1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_solidcylinder1.py @@ -32,13 +32,14 @@ class MeshType_3d_solidcylinder1(Scaffold_base): 'Number of elements': 3 }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.0, 0.0, 0.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]), (2, [[0.0, 0.0, 1.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]), (3, [[0.0, 0.0, 2.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]), (4, [[0.0, 0.0, 3.0], [0.0, 0.0, 1.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 0.0]]) - ]) + ]]) }) } diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py index 8afc63a9..073468ad 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_stomach1.py @@ -47,7 +47,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3.2, 4-5-6-7-8-3-9-10-11-12-13-14-15" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.000,0.560,0.000], [0.000,-0.070,0.000], [0.060,0.000,0.000], [0.170,0.120,-0.000], [0.000,0.000,0.060], [0.000,0.000,0.110]]), (2, [[0.000,0.390,0.000], [0.000,-0.280,0.000], [0.130,0.000,0.000], [0.020,-0.120,-0.000], [0.000,0.000,0.130], [0.000,0.000,0.170]]), (3, [[0.000,0.000,0.000], [[-0.200,0.000,0.000],[0.000,-0.490,0.000]], [[0.000,-0.400,0.000],[0.130,0.000,0.000]], [[-0.060,0.010,0.000],[-0.010,-0.400,0.000]], [[0.000,0.000,0.430],[0.000,0.000,0.130]], [[0.000,0.000,0.010],[0.000,0.000,0.010]]]), @@ -63,7 +64,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (13, [[-0.710,0.690,0.000], [0.050,0.170,0.000], [-0.140,0.030,0.000], [0.060,0.050,-0.000], [0.000,0.000,0.180], [0.000,0.000,-0.060]]), (14, [[-0.640,0.830,0.000], [0.100,0.140,0.000], [-0.080,0.060,0.000], [0.030,0.030,-0.000], [0.000,0.000,0.110], [0.000,0.000,-0.030]]), (15, [[-0.510,0.970,0.000], [0.160,0.140,0.000], [-0.080,0.090,0.000], [-0.030,0.030,0.000], [0.000,0.000,0.130], [0.000,0.000,0.070]]) - ]), + ]]), 'userAnnotationGroups': [ { @@ -122,7 +123,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3.2, 4-5-6-7-3-8-9-10-11-12-13-14-15" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[11.750,-111.874,1127.887], [7.636,-5.715,-7.930], [5.678,1.265,4.556], [-8.397,13.092,24.878], [-0.708,-3.530,1.862], [-0.807,-7.995,7.596]]), (2, [[23.789,-117.922,1120.040], [26.354,-6.724,-6.404], [4.223,6.205,10.864], [10.037,1.800,8.968], [-1.192,-11.215,6.869], [-2.926,-13.889,10.204]]), (3, [[63.704,-120.094,1123.374], [[0.500,-9.138,-13.405],[50.106,1.267,11.056]], [[37.742,-3.477,3.778],[-2.509,7.605,10.499]], [[3.190,-0.590,-0.290],[3.190,-0.590,-0.290]], [[-5.452,-34.121,23.056],[-1.379,-10.790,7.486]], [[-0.100,-1.220,0.550],[-0.100,-1.220,0.550]]]), @@ -138,7 +140,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (13, [[-8.740,-158.280,1057.630], [-17.269,8.027,2.588], [-6.253,-10.164,-10.200], [-2.630,4.430,6.290], [-3.442,-11.913,13.981], [-1.380,7.080,-2.660]]), (14, [[-23.260,-147.620,1060.640], [-11.787,11.369,1.720], [-5.807,-5.321,-4.621], [-0.700,3.020,1.710], [-3.207,-4.764,9.515], [-2.080,5.830,-2.460]]), (15, [[-32.281,-136.261,1061.249], [-6.125,11.114,-0.493], [-5.735,-3.374,-4.823], [-2.070,-0.220,-4.520], [-4.630,-2.238,7.071], [-4.400,2.440,0.570]]) - ]), + ]]), 'userAnnotationGroups': [ { @@ -197,7 +199,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3.2, 4-5-6-7-8-9-3-10-11-12-13-14" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[-0.047,0.617,-0.000], [0.043,-0.123,0.000], [0.065,0.011,0.000], [0.098,-0.016,0.000], [0.000,0.000,0.066], [0.000,0.000,0.124]]), (2, [[-0.010,0.400,-0.000], [0.030,-0.309,0.000], [0.109,0.019,0.000], [0.082,-0.024,0.000], [0.000,-0.000,0.110], [0.000,0.000,0.116]]), (3, [[0.000,0.000,0.000], [[-0.288,-0.009,0.000],[-0.010,-0.490,0.000]], [[0.010,-0.400,0.000],[0.109,0.019,0.000]], [[-0.194,0.007,0.000],[-0.194,0.007,0.000]], [[0.000,0.000,0.380],[0.000,-0.000,0.110]], [[0.000,0.000,-0.015],[0.000,0.000,-0.015]]]), @@ -212,7 +215,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (12, [[-0.486,0.419,0.000], [-0.008,0.167,0.000], [-0.170,-0.080,0.000], [0.069,0.087,0.000], [0.000,0.000,0.210], [0.000,0.000,-0.109]]), (13, [[-0.480,0.560,0.000], [-0.012,0.142,0.000], [-0.094,-0.025,0.000], [0.030,0.020,0.000], [0.000,0.000,0.102], [0.000,0.000,-0.046]]), (14, [[-0.510,0.700,0.000], [-0.048,0.137,0.000], [-0.110,-0.040,0.000], [-0.062,-0.050,0.000], [0.000,0.000,0.120], [0.000,0.000,0.082]]) - ]), + ]]), 'userAnnotationGroups': [ { @@ -271,7 +274,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3.2, 4-5-6-7-3-8-9-10-11-12-13" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.040,0.550,0.000], [0.000,-0.040,-0.000], [0.055,-0.007,0.000], [-0.010,-0.090,0.000], [0.000,0.000,0.0554], [0.000,0.000,0.060]]), (2, [[0.030,0.430,0.000], [-0.020,-0.270,-0.000], [0.118,-0.005,-0.000], [-0.000,-0.100,0.000], [-0.000,0.000,0.118], [0.000,0.000,0.080]]), (3, [[0.000,0.000,0.000], [[-0.210,0.000,0.000],[-0.040,-0.590,-0.000]], [[0.000,-0.431,0.000],[0.118,-0.005,-0.000]], [[-0.020,-0.020,0.000],[-0.020,-0.020,0.000]], [[0.000,0.000,0.400],[-0.000,0.000,0.118]], [[0.000,0.000,0.010],[0.000,0.000,0.010]]]), @@ -285,7 +289,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (11, [[-0.700,0.520,0.000], [0.120,0.260,0.000], [-0.270,0.050,0.000], [0.100,0.090,0.000], [0.000,0.000,0.180], [0.000,0.000,-0.110]]), (12, [[-0.500,0.700,0.000], [0.140,0.190,0.000], [-0.090,0.030,0.000], [0.080,-0.020,0.000], [0.000,0.000,0.090], [0.000,0.000,-0.040]]), (13, [[-0.410,0.880,0.000], [0.030,0.160,0.000], [-0.090,0.010,0.000], [-0.080,-0.030,0.000], [0.000,0.000,0.090], [0.000,0.000,0.040]]) - ]), + ]]), 'userAnnotationGroups': [ { @@ -344,7 +348,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3.2, 4-5-6-7-8-9-3-10-11-12-13-14-15" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[-0.011,0.636,0.000], [0.012,-0.116,0.000], [0.057,0.000,0.000], [0.122,-0.056,0.000], [-0.000,0.000,0.057], [0.000,0.000,0.076]]), (2, [[-0.001,0.419,-0.000], [0.008,-0.318,0.000], [0.108,0.000,0.000], [0.101,-0.066,0.000], [0.000,0.000,0.108], [0.000,0.000,0.084]]), (3, [[0.000,0.000,0.000], [[-0.200,0.002,0.000],[-0.006,-0.520,0.000]], [[0.005,-0.420,0.000],[0.108,0.000,0.000]], [[-0.156,0.003,0.000],[-0.156,0.003,0.000]], [[0.000,0.000,0.360],[0.000,0.000,0.108]], [[0.000,0.000,-0.009],[0.000,0.000,-0.009]]]), @@ -360,7 +365,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (13, [[-0.490,0.587,0.000], [-0.018,0.189,-0.000], [-0.152,-0.045,0.000], [0.069,0.049,0.000], [0.000,0.000,0.120], [0.000,0.000,-0.073]]), (14, [[-0.523,0.730,0.000], [-0.032,0.116,0.000], [-0.111,-0.036,0.000], [0.003,-0.002,0.000], [0.000,0.000,0.120], [0.000,0.000,0.018]]), (15, [[-0.552,0.820,0.000], [-0.026,0.063,0.000], [-0.132,-0.045,0.000], [-0.045,-0.016,0.000], [0.000,0.000,0.150], [0.000,0.000,0.042]]) - ]), + ]]), 'userAnnotationGroups': [ { @@ -419,7 +424,8 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): "Structure": "1-2-3.2, 4-5-6-7-8-9-3-10-11-12-13-14-15-16-17-18" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.000,0.800,0.000], [0.000,-0.200,0.000], [0.080,-0.000,0.000], [0.000,-0.100,0.000], [0.000,0.000,0.080], [0.000,0.000,0.100]]), (2, [[0.000,0.500,0.000], [0.000,-0.400,0.000], [0.150,0.000,0.000], [0.000,-0.110,0.000], [0.000,0.000,0.150], [0.000,0.000,0.110]]), (3, [[0.000,0.000,0.000], [[-0.190,0.000,0.000],[0.000,-0.600,0.000]], [[0.000,-0.500,0.000], [0.210,0.000,0.000]], [[0.000,0.000,0.000],[0.000,0.000,0.000]], [[0.000,0.000,0.500],[0.000,0.000,0.200]], [[0.000,0.000,0.000],[0.000,0.000,0.000]]]), @@ -438,7 +444,7 @@ def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): (16, [[-1.100,0.000,0.000], [-0.100,0.000,0.000], [0.000,-0.200,0.000], [0.000,0.000,0.000], [0.000,0.000,0.200], [0.000,0.000,0.000]]), (17, [[-1.200,0.000,0.000], [-0.100,0.000,0.000], [0.000,-0.200,0.000], [0.000,0.000,0.000], [0.000,0.000,0.200], [0.000,0.000,0.000]]), (18, [[-1.300,0.000,0.000], [-0.100,0.000,0.000], [0.000,-0.200,0.000], [0.000,0.000,0.000], [0.000,0.000,0.200], [0.000,0.000,0.000]]) - ]), + ]]), 'userAnnotationGroups': [ { diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_uterus1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_uterus1.py index ce3e1ef0..ceb33d82 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_uterus1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_uterus1.py @@ -42,8 +42,9 @@ class MeshType_3d_uterus1(Scaffold_base): "Structure": "1-2-3-4-5, 6-7-8-9-5.2, 5.3-10-11, 11-12-13, 13-14" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[24.20, 0.00, 36.56], [-2.53, 0.00, -14.75], [2.42, 0.00, -0.41], [0.13, 0.00, -0.34], [0.00, -2.50, 0.00], [0.00, 0.00, 0.00]]), (2, [[20.88, 0.00, 23.34], [-4.10, 0.00, -11.62], [2.47, 0.00, -0.87], [-0.03, 0.00, -0.57], [0.00, -2.50, 0.00], [0.00, 0.00, 0.00]]), (3, [[16.28, 0.00, 13.37], [-5.76, 0.00, -8.94], [2.38, 0.00, -1.54], [-0.41, 0.00, -0.56], [0.00, -2.50, 0.00], [0.00, 0.00, 0.00]]), @@ -59,7 +60,7 @@ class MeshType_3d_uterus1(Scaffold_base): (11, [[0.00, 0.00, -7.37], [0.00, 0.00, -3.46], [2.50, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.50, 0.00], [0.00, 0.00, 0.00]]), (12, [[0.00, 0.00, -10.98], [0.00, 0.00, -3.31], [2.50, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.50, 0.00], [0.00, 0.00, 0.00]]), (13, [[0.00, 0.00, -14.00], [0.00, 0.00, -3.51], [2.50, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.50, 0.00], [0.00, 0.00, 0.00]]), - (14, [[0.00, 0.00, -18.00], [0.00, 0.00, -4.49], [2.50, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.50, 0.00], [0.00, 0.00, 0.00]])]), + (14, [[0.00, 0.00, -18.00], [0.00, 0.00, -4.49], [2.50, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.50, 0.00], [0.00, 0.00, 0.00]])]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -102,8 +103,9 @@ class MeshType_3d_uterus1(Scaffold_base): "Structure": "1-2-3-4-5, 6-7-8-9-5.2, 5.3-10, 10-11, 11-12-13-14-15-16" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[25.00, 0.00, 43.53], [0.06, 0.00, -11.85], [2.27, 0.09, 0.01], [0.15, -0.06, -0.57], [0.09, -2.33, 0.00], [-0.08, 0.74, -0.01]]), (2, [[23.55, 0.00, 31.29], [-2.96, 0.00, -12.51], [2.27, 0.04, -0.54], [-0.15, -0.04, -0.53], [0.03, -1.91, -0.01], [-0.04, 0.10, 0.00]]), (3, [[19.03, 0.00, 18.76], [-6.24, 0.00, -11.75], [1.96, 0.01, -1.04], [-0.29, 0.01, -0.58], [0.01, -2.16, 0.00], [0.00, -0.20, -0.01]]), @@ -121,7 +123,7 @@ class MeshType_3d_uterus1(Scaffold_base): (13, [[0.00, 0.00, -16.00], [0.00, 0.00, -4.00], [4.65, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.60, 0.00], [0.00, 0.00, 0.00]]), (14, [[0.00, 0.00, -20.00], [0.00, 0.00, -4.00], [4.65, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.60, 0.00], [0.00, 0.00, 0.00]]), (15, [[0.00, 0.00, -24.00], [0.00, 0.00, -4.00], [4.65, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.60, 0.00], [0.00, 0.00, 0.00]]), - (16, [[0.00, 0.00, -28.00], [0.00, 0.00, -4.00], [4.65, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.60, 0.00], [0.00, 0.00, 0.00]])]), + (16, [[0.00, 0.00, -28.00], [0.00, 0.00, -4.00], [4.65, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -2.60, 0.00], [0.00, 0.00, 0.00]])]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -164,7 +166,8 @@ class MeshType_3d_uterus1(Scaffold_base): "Structure": "1-2-3, 4-5-3.2, 3.3-6, 6-7, 7-8-9" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + ['coordinates'], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[2.00, 0.00, 0.00], [-1.00, 0.00, 0.00], [0.00, 0.00, -0.30], [0.00, 0.00, 0.00], [0.00, -0.30, 0.00], [0.00, 0.00, 0.00]]), (2, [[1.00, 0.00, 0.00], [-1.00, 0.00, 0.00], [0.00, 0.00, -0.30], [0.00, 0.00, 0.00], [0.00, -0.30, 0.00], [0.00, 0.00, 0.00]]), (3, [[0.00, 0.00, 0.00], [[-1.00, 0.00, 0.00], [1.00, 0.00, 0.00], [0.00, 0.00, -1.00]], @@ -175,7 +178,7 @@ class MeshType_3d_uterus1(Scaffold_base): (6, [[0.00, 0.00, -1.00], [0.00, 0.00, -1.00], [0.30, 0.00, 0.00], [0.12, 0.00, -0.12], [0.00, -0.30, 0.00], [0.00, 0.00, 0.00]]), (7, [[0.00, 0.00, -2.00], [0.00, 0.00, -1.00], [0.30, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -0.30, 0.00], [0.00, 0.00, 0.00]]), (8, [[0.00, 0.00, -3.00], [0.00, 0.00, -1.00], [0.30, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -0.30, 0.00], [0.00, 0.00, 0.00]]), - (9, [[0.00, 0.00, -4.00], [0.00, 0.00, -1.00], [0.30, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -0.30, 0.00], [0.00, 0.00, 0.00]])]), + (9, [[0.00, 0.00, -4.00], [0.00, 0.00, -1.00], [0.30, 0.00, 0.00], [0.00, 0.00, 0.00], [0.00, -0.30, 0.00], [0.00, 0.00, 0.00]])]]), 'userAnnotationGroups': [ { '_AnnotationGroup': True, @@ -460,11 +463,11 @@ def defineFaceAnnotations(cls, region, options, annotationGroups): is_uterus_inner = fm.createFieldAnd(is_uterus, is_exterior_face_xi3_0) serosaOfCervix = findOrCreateAnnotationGroupForTerm(annotationGroups, region, - get_uterus_term("serosa of uerine cervix")) + get_uterus_term("serosa of uterine cervix")) serosaOfCervix.getMeshGroup(mesh2d).addElementsConditional(is_cervix_outer) lumenOfCervix = findOrCreateAnnotationGroupForTerm(annotationGroups, region, - get_uterus_term("lumen of uerine cervix")) + get_uterus_term("lumen of uterine cervix")) lumenOfCervix.getMeshGroup(mesh2d).addElementsConditional(is_cervix_inner) serosaOfRightHorn = findOrCreateAnnotationGroupForTerm(annotationGroups, region, @@ -1118,7 +1121,7 @@ def getTubeNodes(cx_group, elementsCountAround, elementsCountAlongTube, elements tubemesh.extrudeSurfaceCoordinates(xInner, d1Inner, d2Inner, d3Inner, [wallThickness] * (elementsCountAlongTube + 1), relativeThicknessList, elementsCountAround, elementsCountAlongTube, elementsCountThroughWall, - transitElementList, outward=False) + transitElementList, outward=False)[0:5] coordinatesList = [xList, d1List, d2List, d3List] diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_uterus2.py b/src/scaffoldmaker/meshtypes/meshtype_3d_uterus2.py new file mode 100644 index 00000000..6ad25f28 --- /dev/null +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_uterus2.py @@ -0,0 +1,1057 @@ +""" +Generates a 3-D uterus mesh from a 1-D network layout, with variable +numbers of elements around, along and through wall. +""" + +import math + +from cmlibs.utils.zinc.field import findOrCreateFieldCoordinates +from cmlibs.utils.zinc.finiteelement import get_element_node_identifiers +from cmlibs.utils.zinc.general import ChangeManager +from cmlibs.zinc.element import Element +from cmlibs.zinc.field import Field +from cmlibs.zinc.node import Node +from scaffoldmaker.annotation.annotationgroup import AnnotationGroup, getAnnotationGroupForTerm, \ + findOrCreateAnnotationGroupForTerm +from scaffoldmaker.annotation.uterus_terms import get_uterus_term +from scaffoldmaker.meshtypes.meshtype_1d_network_layout1 import MeshType_1d_network_layout1 +from scaffoldmaker.meshtypes.scaffold_base import Scaffold_base +from scaffoldmaker.scaffoldpackage import ScaffoldPackage +from scaffoldmaker.utils.bifurcation import SegmentTubeData, \ + TubeBifurcationData, generateTube, generateTubeBifurcation, generateCurveMesh, blendNetworkNodeCoordinates +from scaffoldmaker.utils.networkmesh import getPathRawTubeCoordinates, resampleTubeCoordinates +from scaffoldmaker.utils.zinc_utils import exnode_string_from_nodeset_field_parameters +from scaffoldmaker.utils.zinc_utils import get_nodeset_path_ordered_field_parameters + +def getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName): + assert parameterSetName in cls.getParameterSetNames() # make sure parameter set is in list of parameters of parent scaffold + if parameterSetName in ("Default", "Human 1"): + return ScaffoldPackage(MeshType_1d_network_layout1, { + 'scaffoldSettings': { + "Structure": "1-2-3, 4-5-6, 3-7-8-11.1, 6-9-10-11.2, 11.3-12-13-14,14-15-16,16-17-18", + "Define inner coordinates": True, + }, + 'meshEdits': exnode_string_from_nodeset_field_parameters( + ["coordinates", "inner coordinates"], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ + (1, [[-9.16, 10.27,-3.09], [ 0.89, 0.73,-1.15], [ 0.04,-0.23,-0.11], [ 0.08, 0.02, 0.01], [-0.20, 0.03,-0.14], [ 0.08,-0.06,-0.09]]), + (2, [[-8.06, 10.64,-4.32], [ 1.27,-0.02,-1.26], [-0.00,-0.25, 0.00], [-0.10, 0.01, 0.14], [-0.17,-0.00,-0.17], [-0.02,-0.00, 0.02]]), + (3, [[-6.71, 10.19,-5.51], [ 1.73,-0.52,-0.85], [-0.06,-0.25, 0.03], [-0.11,-0.25,-0.05], [-0.12,-0.00,-0.24], [ 0.12, 0.01,-0.37]]), + (4, [[ 9.16, 10.27,-3.09], [-0.89, 0.73,-1.15], [-0.04,-0.23,-0.11], [-0.08, 0.02, 0.01], [-0.20,-0.03, 0.14], [ 0.08, 0.06, 0.09]]), + (5, [[ 8.06, 10.64,-4.32], [-1.27,-0.02,-1.26], [ 0.00,-0.25, 0.00], [ 0.10, 0.01, 0.14], [-0.17, 0.00, 0.17], [-0.02, 0.00,-0.02]]), + (6, [[ 6.71, 10.19,-5.51], [-1.73,-0.52,-0.85], [ 0.06,-0.25, 0.03], [ 0.11,-0.25,-0.05], [-0.12, 0.00, 0.24], [ 0.12,-0.01, 0.37]]), + (7, [[-4.71, 9.65,-5.89], [ 2.18,-0.21,-0.35], [-0.09,-0.77,-0.10], [ 0.27,-1.14,-0.57], [-0.11, 0.11,-0.78], [-0.31, 0.46,-0.76]]), + (8, [[-2.42, 9.80,-6.20], [ 2.36, 0.21,-0.17], [ 0.13,-2.36,-1.07], [ 0.04,-0.93,-0.64], [-0.20, 0.80,-1.80], [ 0.22, 0.68,-0.92]]), + (9, [[ 4.71, 9.65,-5.89], [-2.18,-0.21,-0.35], [ 0.09,-0.77,-0.10], [-0.27,-1.14,-0.57], [-0.11,-0.11, 0.78], [-0.31,-0.46, 0.76]]), + (10, [[ 2.42, 9.80,-6.20], [-2.36, 0.21,-0.17], [-0.13,-2.36,-1.07], [-0.04,-0.93,-0.64], [-0.20,-0.80, 1.80], [ 0.22,-0.68, 0.92]]), + (11, [[-0.00, 10.08,-6.23], [[ 2.47, 0.34, 0.11],[-2.47, 0.34, 0.11],[ 0.02,-0.35, 2.81]], [[ 0.42,-2.59,-1.43],[-0.42,-2.59,-1.43],[ 0.03, 2.93, 0.36]], [[ 0.19, 0.45,-0.09],[-0.19, 0.45,-0.09],[ 0.01,-0.22,-0.05]], [[-0.08, 1.42,-2.59],[-0.08,-1.42, 2.59],[-3.52, 0.03, 0.03]], [[-0.16, 0.54,-0.68],[-0.16,-0.54, 0.68],[ 0.47, 0.03,-0.12]]]), + (12, [[-0.00, 9.50,-3.62], [ 0.00,-0.81, 2.39], [ 0.02, 2.37, 0.80], [-0.02,-0.82, 0.29], [-3.08, 0.02, 0.01], [ 0.41,-0.03, 0.02]]), + (13, [[-0.00, 8.50,-1.48], [ 0.00,-1.16, 1.77], [-0.01, 1.33, 0.87], [-0.01,-0.82, 0.10], [-2.70,-0.01,-0.01], [ 0.29,-0.01,-0.01]]), + (14, [[-0.00, 7.27,-0.08], [ 0.00,-1.09, 0.82], [ 0.00, 0.75, 0.99], [ 0.01,-0.49, 0.09], [-2.51, 0.00, 0.00], [ 0.18, 0.01, 0.01]]), + (15, [[-0.00, 6.50, 0.28], [ 0.00,-0.83, 0.18], [ 0.00, 0.22, 1.00], [ 0.00,-0.30,-0.20], [-2.34, 0.00, 0.00], [ 0.22, 0.00, 0.00]]), + (16, [[-0.00, 5.67, 0.28], [ 0.00,-1.58,-0.05], [ 0.00,-0.03, 0.81], [ 0.00, 0.11,-0.26], [-2.07,-0.00, 0.00], [ 0.63, 0.00, 0.00]]), + (17, [[-0.00, 3.35, 0.14], [ 0.00,-2.85,-0.14], [ 0.00,-0.02, 0.46], [ 0.00, 0.02,-0.13], [-1.08,-0.00, 0.00], [ 0.76, 0.00, 0.00]]), + (18, [[ 0.00,-0.03, 0.00], [ 0.00,-3.91,-0.13], [ 0.00,-0.02, 0.55], [-0.00,-0.01, 0.31], [-0.55,-0.00, 0.00], [ 0.30,-0.00, 0.00]])], [ + (1, [[-9.16,10.27,-3.09], [0.89,0.73,-1.15], [0.02,-0.11,-0.06], [0.04,0.01,0.00], [-0.10,0.02,-0.07], [0.04,-0.03,-0.05]]), + (2, [[-8.06,10.64,-4.32], [1.27,-0.02,-1.26], [0.00,-0.12,0.00], [-0.05,0.00,0.07], [-0.08,0.00,-0.09], [-0.01,0.00,0.01]]), + (3, [[-6.71,10.19,-5.51], [1.73,-0.52,-0.85], [-0.03,-0.13,0.01], [-0.05,-0.13,-0.03], [-0.06,0.00,-0.12], [0.06,0.00,-0.19]]), + (4, [[9.16,10.27,-3.09], [-0.89,0.73,-1.15], [-0.02,-0.11,-0.06], [-0.04,0.01,0.00], [-0.10,-0.02,0.07], [0.04,0.03,0.05]]), + (5, [[8.06,10.64,-4.32], [-1.27,-0.02,-1.26], [0.00,-0.12,0.00], [0.05,0.00,0.07], [-0.08,0.00,0.09], [-0.01,0.00,-0.01]]), + (6, [[6.71,10.19,-5.51], [-1.73,-0.52,-0.85], [0.03,-0.13,0.01], [0.05,-0.13,-0.03], [-0.06,0.00,0.12], [0.06,0.00,0.19]]), + (7, [[-4.71,9.65,-5.89], [2.18,-0.21,-0.35], [-0.05,-0.38,-0.05], [0.13,-0.57,-0.28], [-0.06,0.06,-0.39], [-0.15,0.23,-0.38]]), + (8, [[-2.42,9.80,-6.20], [2.36,0.21,-0.17], [0.07,-1.18,-0.54], [0.02,-0.53,-0.26], [-0.10,0.40,-0.90], [0.11,0.27,-0.49]]), + (9, [[4.71,9.65,-5.89], [-2.18,-0.21,-0.35], [0.05,-0.38,-0.05], [-0.13,-0.57,-0.28], [-0.06,-0.06,0.39], [-0.15,-0.23,0.38]]), + (10, [[2.42,9.80,-6.20], [-2.36,0.21,-0.17], [-0.07,-1.18,-0.54], [-0.02,-0.53,-0.26], [-0.10,-0.40,0.90], [0.11,-0.27,0.49]]), + (11, [[-0.00,10.08,-6.23], [[2.47,0.34,0.11],[-2.47,0.34,0.11],[0.02,-0.35,2.81]], [[0.21,-1.29,-0.72],[-0.21,-1.29,-0.72],[0.01,1.46,0.18]], [[0.09,0.23,-0.05],[-0.09,0.23,-0.05],[0.00,-0.11,-0.02]], [[-0.04,0.71,-1.30],[-0.04,-0.71,1.30],[-1.76,0.01,0.01]], [[-0.08,0.27,-0.34],[-0.08,-0.27,0.34],[0.23,0.02,-0.06]]]), (12, [[-0.00,9.50,-3.62], [0.00,-0.81,2.39], [0.01,1.18,0.40], [-0.01,-0.38,0.15], [-1.54,0.01,0.00], [0.20,-0.01,0.01]]), + (13, [[-0.00,8.50,-1.48], [0.00,-1.16,1.77], [-0.00,0.67,0.44], [0.00,-0.39,0.06], [-1.35,0.00,0.00], [0.59,0.00,0.00]]), + (14, [[-0.00,7.27,-0.08], [0.00,-1.09,0.82], [0.02,0.40,0.53], [0.00,-0.26,0.06], [-0.36,0.01,0.01], [0.47,0.00,0.00]]), + (15, [[-0.00,6.50,0.28], [0.00,-0.83,0.18], [-0.00,0.11,0.50], [-0.01,-0.15,-0.12], [-0.41,0.00,0.00], [0.00,0.00,0.00]]), + (16, [[-0.00,5.67,0.28], [0.00,-1.58,-0.05], [0.00,-0.01,0.41], [-0.00,0.06,-0.13], [-0.36,0.00,0.00], [-0.07,0.00,0.00]]), + (17, [[-0.00,3.35,0.14], [0.00,-2.85,-0.14], [0.00,-0.01,0.23], [-0.00,0.01,-0.06], [-0.54,0.00,0.00], [0.04,0.00,0.00]]), + (18, [[0.00,-0.03,0.00], [0.00,-3.91,-0.13], [0.00,-0.01,0.28], [0.00,-0.01,0.16], [-0.28,0.00,0.00], [0.48,0.00,0.00]])]]), + + 'userAnnotationGroups': [ + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '1-17', + 'name': get_uterus_term('uterus')[0], + 'ontId': get_uterus_term('uterus')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '1-2', + 'name': get_uterus_term('left uterine tube')[0], + 'ontId': get_uterus_term('left uterine tube')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '3-4', + 'name': get_uterus_term('right uterine tube')[0], + 'ontId': get_uterus_term('right uterine tube')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '5-13', + 'name': get_uterus_term('body of uterus')[0], + 'ontId': get_uterus_term('body of uterus')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '14-15', + 'name': get_uterus_term('uterine cervix')[0], + 'ontId': get_uterus_term('uterine cervix')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '16-17', + 'name': get_uterus_term('vagina')[0], + 'ontId': get_uterus_term('vagina')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '1-10', + 'name': 'pre-bifurcation segments', + 'ontId': 'None' + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '11-17', + 'name': 'post-bifurcation segments', + 'ontId': 'None' + } + ] + }) + elif "Mouse 1" in parameterSetName: + return ScaffoldPackage(MeshType_1d_network_layout1, { + 'scaffoldSettings': { + "Structure": "1-2-3-4-5, 6-7-8-9-10, 5-11.1, 10-11.2, 11.3-12-13-14, 14-15, 15-16", + "Define inner coordinates": True, + }, + 'meshEdits': exnode_string_from_nodeset_field_parameters( + ["coordinates", "inner coordinates"], + [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ + (1, [[-24.20,54.56,0.00], [2.53,-14.75,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [2.42,0.41,0.00], [0.14,-0.02,0.00]]), + (2, [[-20.88,41.34,0.00], [4.10,-11.62,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [2.47,0.87,0.00], [0.05,0.43,0.00]]), + (3, [[-16.28,31.37,0.00], [5.76,-8.94,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [2.38,1.54,0.00], [-0.55,0.82,0.00]]), + (4, [[-9.59,23.63,0.00], [6.74,-6.07,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [1.74,1.94,0.00], [-0.66,0.45,0.00]]), + (5, [[-3.14,19.13,0.00], [4.91,-2.86,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [1.31,2.26,0.00], [-0.29,0.21,0.00]]), + (6, [[24.20,54.56,0.00], [-2.53,-14.75,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [2.42,-0.41,0.00], [0.14,0.02,0.00]]), + (7, [[20.88,41.34,0.00], [-4.10,-11.62,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [2.47,-0.87,0.00], [0.05,-0.43,0.00]]), + (8, [[16.28,31.37,0.00], [-5.76,-8.94,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [2.38,-1.54,0.00], [-0.55,-0.82,0.00]]), + (9, [[9.59,23.63,0.00], [-6.74,-6.07,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [1.74,-1.94,0.00], [-0.66,-0.45,0.00]]), + (10, [[3.14,19.13,0.00], [-4.91,-2.86,-0.00], [0.00,0.00,-2.50], [0.00,0.00,0.00], [1.31,-2.26,0.00], [-0.29,-0.21,0.00]]), + (11, [[0.00,17.63,-0.00], [[1.29,-0.13,-0.00],[-1.29,-0.13,-0.00],[0.00,-3.86,-0.00]], [[0.00,0.00,-2.50],[0.00,0.00,-2.50],[0.00,0.00,2.50]], [[-0.00,-0.00,-0.00],[-0.00,0.00,-0.00],[0.00,0.00,0.00]], [[0.28,2.81,0.00],[0.28,-2.81,0.00],[-2.67,-0.00,0.00]], [[-3.19,1.05,-0.00],[-3.19,-1.05,-0.00],[0.25,0.00,0.00]]]), + (12, [[0.00,13.95,-0.00], [0.00,-3.50,-0.00], [0.00,0.00,2.50], [0.00,0.00,-0.00], [-2.50,-0.00,0.00], [0.09,0.00,0.00]]), + (13, [[0.00,10.63,-0.00], [0.00,-3.47,-0.00], [0.00,0.00,2.50], [0.00,0.00,-0.00], [-2.50,-0.00,0.00], [0.00,0.00,0.00]]), + (14, [[0.00,7.02,-0.00], [0.00,-3.31,-0.00], [0.00,0.00,2.50], [0.00,0.00,-0.00], [-2.50,-0.00,0.00], [0.00,0.00,0.00]]), + (15, [[0.00,4.00,-0.00], [0.00,-3.51,-0.00], [0.00,0.00,2.50], [0.00,0.00,-0.00], [-2.50,-0.00,0.00], [0.00,0.00,0.00]]), + (16, [[0.00,0.00,-0.00], [0.00,-4.49,-0.00], [0.00,0.00,2.50], [-0.00,-0.00,0.00], [-2.50,-0.00,0.00], [-0.00,-0.00,-0.00]])],[ + (1, [[-24.20,54.56,0.00], [2.53,-14.75,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [1.45,0.25,0.00], [0.08,-0.01,0.00]]), + (2, [[-20.88,41.34,0.00], [4.10,-11.62,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [1.48,0.52,0.00], [0.03,0.26,0.00]]), + (3, [[-16.28,31.37,0.00], [5.76,-8.94,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [1.43,0.92,0.00], [-0.33,0.50,0.00]]), + (4, [[-9.59,23.63,0.00], [6.74,-6.07,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [1.05,1.16,0.00], [-0.40,0.27,0.00]]), + (5, [[-3.14,19.13,0.00], [4.91,-2.86,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [0.79,1.35,0.00], [-0.18,0.12,0.00]]), + (6, [[24.20,54.56,0.00], [-2.53,-14.75,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [1.45,-0.25,0.00], [0.08,0.01,0.00]]), + (7, [[20.88,41.34,0.00], [-4.10,-11.62,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [1.48,-0.52,0.00], [0.03,-0.26,0.00]]), + (8, [[16.28,31.37,0.00], [-5.76,-8.94,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [1.43,-0.92,0.00], [-0.33,-0.50,0.00]]), + (9, [[9.59,23.63,0.00], [-6.74,-6.07,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [1.05,-1.16,0.00], [-0.40,-0.27,0.00]]), + (10, [[3.14,19.13,0.00], [-4.91,-2.86,-0.00], [0.00,0.00,-1.50], [0.00,0.00,0.00], [0.79,-1.35,0.00], [-0.18,-0.12,0.00]]), + (11, [[0.00,17.63,-0.00], [[1.29,-0.13,-0.00],[-1.29,-0.13,-0.00],[0.00,-3.86,-0.00]], [[0.00,0.00,-1.50],[0.00,0.00,-1.50],[0.00,0.00,1.50]], [[-0.00,-0.00,-0.00],[-0.00,0.00,-0.00],[0.00,0.00,0.00]], [[0.17,1.68,0.00],[0.17,-1.68,0.00],[-1.60,-0.00,0.00]], [[-1.91,0.62,-0.00],[-1.91,-0.62,-0.00],[0.15,0.00,0.00]]]), + (12, [[0.00,13.95,-0.00], [0.00,-3.50,-0.00], [0.00,0.00,1.50], [0.00,0.00,0.00], [-1.50,-0.00,0.00], [0.05,0.00,0.00]]), + (13, [[0.00,10.63,-0.00], [0.00,-3.47,-0.00], [0.00,0.00,1.50], [0.00,0.00,0.00], [-1.50,-0.00,0.00], [-0.00,0.00,0.00]]), + (14, [[0.00,7.02,-0.00], [0.00,-3.31,-0.00], [0.00,0.00,1.50], [0.00,0.00,0.00], [-1.50,-0.00,0.00], [-0.00,0.00,0.00]]), + (15, [[0.00,4.00,-0.00], [0.00,-3.51,-0.00], [0.00,0.00,1.50], [0.00,0.00,0.00], [-1.50,-0.00,0.00], [0.00,0.00,0.00]]), + (16, [[0.00,0.00,-0.00], [0.00,-4.49,-0.00], [0.00,0.00,1.50], [-0.00,-0.00,-0.00], [-1.50,-0.00,0.00], [-0.00,-0.00,-0.00]])]]), + + 'userAnnotationGroups': [ + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '1-15', + 'name': get_uterus_term('uterus')[0], + 'ontId': get_uterus_term('uterus')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '1-4', + 'name': get_uterus_term('left uterine horn')[0], + 'ontId': get_uterus_term('left uterine horn')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '5-8', + 'name': get_uterus_term('right uterine horn')[0], + 'ontId': get_uterus_term('right uterine horn')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '9-13', + 'name': get_uterus_term('body of uterus')[0], + 'ontId': get_uterus_term('body of uterus')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '14', + 'name': get_uterus_term('uterine cervix')[0], + 'ontId': get_uterus_term('uterine cervix')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '15', + 'name': get_uterus_term('vagina')[0], + 'ontId': get_uterus_term('vagina')[1] + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '1-10', + 'name': 'pre-bifurcation segments', + 'ontId': 'None' + }, + { + '_AnnotationGroup': True, + 'dimension': 1, + 'identifierRanges': '11-15', + 'name': 'post-bifurcation segments', + 'ontId': 'None' + }, + ] + }) + + +class MeshType_3d_uterus2(Scaffold_base): + """ + Generates a 3-D uterus mesh from a 1-D network layout with variable numbers of elements around, along and through + wall. + Magnitude of D2 and D3 are the radii of the uterus in the respective directions. + """ + + @staticmethod + def getName(): + return '3D Uterus 2' + + @staticmethod + def getParameterSetNames(): + return [ + 'Default', + 'Human 1', + 'Mouse 1'] + + @classmethod + def getDefaultOptions(cls, parameterSetName='Default'): + + options = { + 'Base parameter set': parameterSetName, + 'Network layout': getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName), + 'Number of elements around': 10, + 'Number of elements around horns': 8, + 'Number of elements through wall': 1, + "Annotation elements counts around": [0], + 'Target element density along longest segment': 5.0, + "Serendipity": True, + 'Use linear through wall': True, + 'Use cross derivatives': False, + 'Refine': False, + 'Refine number of elements along': 4, + 'Refine number of elements around': 4, + 'Refine number of elements through wall': 1 + } + if 'Mouse' in parameterSetName: + options['Number of elements around'] = 8 + options['Target element density along longest segment'] = 10.0 + + return options + + @staticmethod + def getOrderedOptionNames(): + optionNames = [ + 'Network layout', + 'Number of elements around', + 'Number of elements around horns', + 'Number of elements through wall', + 'Target element density along longest segment', + "Serendipity", + 'Refine', + 'Refine number of elements along', + 'Refine number of elements around', + 'Refine number of elements through wall'] + return optionNames + + @classmethod + def getOptionValidScaffoldTypes(cls, optionName): + if optionName == 'Network layout': + return [MeshType_1d_network_layout1] + return [] + + @classmethod + def getOptionScaffoldTypeParameterSetNames(cls, optionName, scaffoldType): + if optionName == 'Network layout': + return cls.getParameterSetNames() + assert scaffoldType in cls.getOptionValidScaffoldTypes(optionName), \ + cls.__name__ + '.getOptionScaffoldTypeParameterSetNames. ' + \ + 'Invalid option \'' + optionName + '\' scaffold type ' + scaffoldType.getName() + return scaffoldType.getParameterSetNames() + + @classmethod + def getOptionScaffoldPackage(cls, optionName, scaffoldType, parameterSetName=None): + """ + :param parameterSetName: Name of valid parameter set for option Scaffold, or None for default. + :return: ScaffoldPackage. + """ + if parameterSetName: + assert parameterSetName in cls.getOptionScaffoldTypeParameterSetNames(optionName, scaffoldType), \ + 'Invalid parameter set ' + str(parameterSetName) + ' for scaffold ' + str(scaffoldType.getName()) + \ + ' in option ' + str(optionName) + ' of scaffold ' + cls.getName() + if optionName == 'Network layout': + if not parameterSetName: + parameterSetName = "Default" + return getDefaultNetworkLayoutScaffoldPackage(cls, parameterSetName) + assert False, cls.__name__ + '.getOptionScaffoldPackage: Option ' + optionName + ' is not a scaffold' + + @classmethod + def checkOptions(cls, options): + if not options['Network layout'].getScaffoldType() in cls.getOptionValidScaffoldTypes('Network layout'): + options['Network layout'] = cls.getOptionScaffoldPackage('Network layout', MeshType_1d_network_layout1) + for key in [ + 'Number of elements through wall', + 'Refine number of elements along', + 'Refine number of elements around', + 'Refine number of elements through wall' + ]: + if options[key] < 1: + options[key] = 1 + + for key in [ + 'Number of elements around', + 'Number of elements around horns']: + if options[key] < 4: + options[key] = 4 + if options[key] % 2 > 0: + options[key] = options[key] // 2 * 2 + if options["Number of elements through wall"] < 1: + options["Number of elements through wall"] = 1 + + if options["Target element density along longest segment"] < 1.0: + options["Target element density along longest segment"] = 1.0 + dependentChanges = False + return dependentChanges + + @classmethod + def generateBaseMesh(cls, region, options): + """ + Generate the base tricubic Hermite mesh. See also generateMesh(). + :param region: Zinc region to define model in. Must be empty. + :param options: Dict containing options. See getDefaultOptions(). + :return: None + """ + parameterSetName = options['Base parameter set'] + isHuman = parameterSetName in ("Default", "Human 1") + networkLayout = options['Network layout'] + elementsCountAroundPostBifurcation = options['Number of elements around'] + elementsCountAroundPreBifurcation = options['Number of elements around horns'] + elementsCountThroughWall = options['Number of elements through wall'] + defaultElementsCountAround = elementsCountAroundPostBifurcation + annotationElementsCountsAround = [0, 0, elementsCountAroundPostBifurcation, elementsCountAroundPreBifurcation] + targetElementDensityAlongLongestSegment = options['Target element density along longest segment'] + useCrossDerivatives = options['Use cross derivatives'] + serendipity = options["Serendipity"] + showIntersectionCurves = False + showTrimSurfaces = False # options["Show trim surfaces"] + + # Geometric coordinates + layoutRegion = region.createRegion() + networkLayout.generate(layoutRegion) # ask scaffold to generate to get user-edited parameters + layoutAnnotationGroups = networkLayout.getAnnotationGroups() + + fieldmodule = region.getFieldmodule() + nodes = fieldmodule.findNodesetByFieldDomainType(Field.DOMAIN_TYPE_NODES) + coordinates = findOrCreateFieldCoordinates(fieldmodule) + nodeIdentifier = 1 + elementIdentifier = 1 + + networkMesh = networkLayout.getConstructionObject() + + layoutRegion = networkMesh.getRegion() + layoutFieldmodule = layoutRegion.getFieldmodule() + layoutNodes = layoutFieldmodule.findNodesetByFieldDomainType(Field.DOMAIN_TYPE_NODES) + layoutCoordinates = layoutFieldmodule.findFieldByName("coordinates").castFiniteElement() + layoutInnerCoordinates = layoutFieldmodule.findFieldByName("inner coordinates").castFiniteElement() + if not layoutInnerCoordinates.isValid(): + layoutInnerCoordinates = None + dimension = 3 if layoutInnerCoordinates else 2 + layoutMesh = layoutFieldmodule.findMeshByDimension(1) + assert (elementsCountThroughWall == 1) or (layoutInnerCoordinates and (elementsCountThroughWall >= 1)) + + fieldmodule = region.getFieldmodule() + mesh = fieldmodule.findMeshByDimension(dimension) + fieldcache = fieldmodule.createFieldcache() + + # make 2D annotation groups from 1D network layout annotation groups + annotationGroups = [] + layoutAnnotationMeshGroupMap = [] # List of tuples of layout annotation mesh group to final mesh group + for layoutAnnotationGroup in layoutAnnotationGroups: + if layoutAnnotationGroup.getDimension() == 1: + annotationGroup = AnnotationGroup(region, layoutAnnotationGroup.getTerm()) + annotationGroups.append(annotationGroup) + layoutAnnotationMeshGroupMap.append( + (layoutAnnotationGroup.getMeshGroup(layoutMesh), annotationGroup.getMeshGroup(mesh))) + + valueLabels = [ + Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, + Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3] + + networkSegments = networkMesh.getNetworkSegments() + + bodyGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, get_uterus_term("body of uterus")) + bodyMeshGroup = bodyGroup.getMeshGroup(mesh) + cervixGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, get_uterus_term("uterine cervix")) + cervixMeshGroup = cervixGroup.getMeshGroup(mesh) + uterusGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, get_uterus_term("uterus")) + + # map from NetworkSegment to SegmentTubeData + outerSegmentTubeData = {} + innerSegmentTubeData = {} if layoutInnerCoordinates else None + longestSegmentLength = 0.0 + for networkSegment in networkSegments: + pathParameters = get_nodeset_path_ordered_field_parameters( + layoutNodes, layoutCoordinates, valueLabels, + networkSegment.getNodeIdentifiers(), networkSegment.getNodeVersions()) + elementsCountAround = defaultElementsCountAround + i = 0 + for layoutAnnotationGroup in layoutAnnotationGroups: + if i >= len(annotationElementsCountsAround): + break + annotationElementsCountAround = annotationElementsCountsAround[i] + if annotationElementsCountAround > 0: + if networkSegment.hasLayoutElementsInMeshGroup(layoutAnnotationGroup.getMeshGroup(layoutMesh)): + elementsCountAround = annotationElementsCountAround + break + i += 1 + outerSegmentTubeData[networkSegment] = tubeData = SegmentTubeData(pathParameters, elementsCountAround) + px, pd1, pd2, pd12 = getPathRawTubeCoordinates(pathParameters, elementsCountAround) + tubeData.setRawTubeCoordinates((px, pd1, pd2, pd12)) + + segmentLength = tubeData.getSegmentLength() + if segmentLength > longestSegmentLength: + longestSegmentLength = segmentLength + + if layoutInnerCoordinates: + innerPathParameters = get_nodeset_path_ordered_field_parameters( + layoutNodes, layoutInnerCoordinates, valueLabels, + networkSegment.getNodeIdentifiers(), networkSegment.getNodeVersions()) + px, pd1, pd2, pd12 = getPathRawTubeCoordinates(innerPathParameters, elementsCountAround) + innerSegmentTubeData[networkSegment] = innerTubeData = SegmentTubeData(innerPathParameters, + elementsCountAround) + innerTubeData.setRawTubeCoordinates((px, pd1, pd2, pd12)) + + for layoutAnnotationMeshGroup, annotationMeshGroup in layoutAnnotationMeshGroupMap: + if networkSegment.hasLayoutElementsInMeshGroup(layoutAnnotationMeshGroup): + tubeData.addAnnotationMeshGroup(annotationMeshGroup) + if layoutInnerCoordinates: + innerTubeData.addAnnotationMeshGroup(annotationMeshGroup) + + if longestSegmentLength > 0.0: + targetElementLength = longestSegmentLength / targetElementDensityAlongLongestSegment + else: + targetElementLength = 1.0 + + # map from NetworkNodes to bifurcation data, resample tube coordinates to fit bifurcation + outerNodeTubeBifurcationData = {} + innerNodeTubeBifurcationData = {} if layoutInnerCoordinates else None + + allSegmentTubeData = [outerSegmentTubeData] + if layoutInnerCoordinates: + allSegmentTubeData.append(innerSegmentTubeData) + + for segmentTubeData in allSegmentTubeData: + nodeTubeBifurcationData = innerNodeTubeBifurcationData if (segmentTubeData is innerSegmentTubeData) else \ + outerNodeTubeBifurcationData + # count = 0 + for networkSegment in networkSegments: + tubeData = segmentTubeData[networkSegment] + rawTubeCoordinates = tubeData.getRawTubeCoordinates() + segmentNodes = networkSegment.getNetworkNodes() + startSegmentNode = segmentNodes[0] + startTubeBifurcationData = nodeTubeBifurcationData.get(startSegmentNode) + startSurface = None + newBifurcationData = [] + if not startTubeBifurcationData: + startInSegments = startSegmentNode.getInSegments() + startOutSegments = startSegmentNode.getOutSegments() + if ((len(startInSegments) + len(startOutSegments)) == 3): + startTubeBifurcationData = TubeBifurcationData(startInSegments, startOutSegments, segmentTubeData) + nodeTubeBifurcationData[startSegmentNode] = startTubeBifurcationData + newBifurcationData.append(startTubeBifurcationData) + + if startTubeBifurcationData: + startSurface = startTubeBifurcationData.getSegmentTrimSurface(networkSegment) + endSegmentNode = segmentNodes[-1] + endTubeBifurcationData = nodeTubeBifurcationData.get(endSegmentNode) + endSurface = None + createEndBifurcationData = not endTubeBifurcationData + if createEndBifurcationData: + endInSegments = endSegmentNode.getInSegments() + endOutSegments = endSegmentNode.getOutSegments() + if ((len(endInSegments) + len(endOutSegments)) == 3): + # print("create end", networkSegment, endSegmentNode.getNodeIdentifier(), + # len(endInSegments), len(endOutSegments)) + endTubeBifurcationData = TubeBifurcationData(endInSegments, endOutSegments, segmentTubeData) + nodeTubeBifurcationData[endSegmentNode] = endTubeBifurcationData + newBifurcationData.append(endTubeBifurcationData) + if endTubeBifurcationData: + endSurface = endTubeBifurcationData.getSegmentTrimSurface(networkSegment) + if segmentTubeData is outerSegmentTubeData: + segmentLength = tubeData.getSegmentLength() + elementsCountAlong = max(1, math.ceil(segmentLength / targetElementLength)) + loop = (len(startSegmentNode.getInSegments()) == 1) and \ + (startSegmentNode.getInSegments()[0] is networkSegment) and \ + (networkSegment.getNodeVersions()[0] == networkSegment.getNodeVersions()[-1]) + if (elementsCountAlong == 1) and (startTubeBifurcationData and endTubeBifurcationData): + # at least 2 segments if bifurcating at either end, or loop + elementsCountAlong = 1 + elif (elementsCountAlong < 3) and loop: + # at least 3 segments around loop; 2 should work, but zinc currently makes incorrect faces + elementsCountAlong = 3 + else: + # must match count from outer surface! + outerTubeData = outerSegmentTubeData[networkSegment] + elementsCountAlong = outerTubeData.getSampledElementsCountAlong() + sx, sd1, sd2, sd12 = resampleTubeCoordinates( + rawTubeCoordinates, elementsCountAlong, startSurface=startSurface, endSurface=endSurface) + tubeData.setSampledTubeCoordinates((sx, sd1, sd2, sd12)) + del segmentTubeData + + # blend coordinates where versions are shared between segments + blendedNetworkNodes = set() + for networkSegment in networkSegments: + segmentNodes = networkSegment.getNetworkNodes() + for segmentNode in [segmentNodes[0], segmentNodes[-1]]: + if segmentNode not in blendedNetworkNodes: + blendNetworkNodeCoordinates(segmentNode, allSegmentTubeData) + blendedNetworkNodes.add(segmentNode) + del blendedNetworkNodes + + completedBifurcations = set() # record so only done once + + with ChangeManager(fieldmodule): + for networkSegment in networkSegments: + segmentNodes = networkSegment.getNetworkNodes() + startSegmentNode = segmentNodes[0] + startInSegments = startSegmentNode.getInSegments() + startOutSegments = startSegmentNode.getOutSegments() + startSkipCount = 1 if ((len(startInSegments) + len(startOutSegments)) > 2) else 0 + endSegmentNode = segmentNodes[-1] + endInSegments = endSegmentNode.getInSegments() + endOutSegments = endSegmentNode.getOutSegments() + endSkipCount = 1 if ((len(endInSegments) + len(endOutSegments)) > 2) else 0 + + for stage in range(3): + if stage == 1: + # tube + outerTubeData = outerSegmentTubeData[networkSegment] + outerTubeCoordinates = outerTubeData.getSampledTubeCoordinates() + if bodyMeshGroup in outerTubeData.getAnnotationMeshGroups(): + elementsAlongBodyDistalSegment = len(outerTubeCoordinates) + elementsAroundBodyDistalSegment = len(outerTubeCoordinates[0][0]) + if cervixMeshGroup in outerTubeData.getAnnotationMeshGroups(): + elementsAlongCervixSegment = len(outerTubeCoordinates) + elementsAroundCervixSegment = len(outerTubeCoordinates[0][0]) + if cervixMeshGroup in outerTubeData.getAnnotationMeshGroups(): + elementStartIdxCervix = elementIdentifier + loop = (len(startInSegments) == 1) and (startInSegments[0] is networkSegment) and \ + (networkSegment.getNodeVersions()[0] == networkSegment.getNodeVersions()[-1]) + innerTubeData = innerSegmentTubeData[networkSegment] if layoutInnerCoordinates else None + innerTubeCoordinates = innerTubeData.getSampledTubeCoordinates() if layoutInnerCoordinates else None + startNodeIds = outerTubeData.getStartNodeIds(startSkipCount) + if (not startNodeIds) and (startSkipCount == 0) and (startInSegments or startOutSegments): + # discover start nodes from single adjacent segment + if startInSegments: + startNodeIds = outerSegmentTubeData[startInSegments[0]].getEndNodeIds(0) + else: + startNodeIds = outerSegmentTubeData[startOutSegments[0]].getStartNodeIds(0) + if startNodeIds: + outerTubeData.setStartNodeIds(startNodeIds, startSkipCount) + endNodeIds = outerTubeData.getEndNodeIds(endSkipCount) + if (not endNodeIds) and (endSkipCount == 0) and (endOutSegments or endInSegments): + # discover end nodes from single adjacent segment + if endOutSegments: + endNodeIds = outerSegmentTubeData[endOutSegments[0]].getStartNodeIds(0) + elif endInSegments: + endNodeIds = outerSegmentTubeData[endInSegments[0]].getEndNodeIds(0) + if endNodeIds: + outerTubeData.setEndNodeIds(endNodeIds, endSkipCount) + nodeIdentifier, elementIdentifier, startNodeIds, endNodeIds = generateTube( + outerTubeCoordinates, innerTubeCoordinates, elementsCountThroughWall, + region, fieldcache, coordinates, nodeIdentifier, elementIdentifier, + startSkipCount=startSkipCount, endSkipCount=endSkipCount, + startNodeIds=startNodeIds, endNodeIds=endNodeIds, + annotationMeshGroups=outerTubeData.getAnnotationMeshGroups(), + loop=loop, serendipity=serendipity) + outerTubeData.setStartNodeIds(startNodeIds, startSkipCount) + outerTubeData.setEndNodeIds(endNodeIds, endSkipCount) + + if (len(startInSegments) == 1) and (startSkipCount == 0): + # copy startNodeIds to end of last segment + inTubeData = outerSegmentTubeData[startInSegments[0]] + inTubeData.setEndNodeIds(startNodeIds, 0) + if (len(endOutSegments) == 1) and (endSkipCount == 0): + # copy endNodesIds to start of next segment + outTubeData = outerSegmentTubeData[endOutSegments[0]] + outTubeData.setStartNodeIds(endNodeIds, 0) + else: + # start, end bifurcation + outerTubeBifurcationData = outerNodeTubeBifurcationData.get( + startSegmentNode if (stage == 0) else endSegmentNode) + if outerTubeBifurcationData and not outerTubeBifurcationData in completedBifurcations: + if showIntersectionCurves: + lineIdentifier = None + for s in range(3): + curve = outerTubeBifurcationData.getIntersectionCurve(s) + cx, cd1, cProportions, loop = curve + if cx: + nodeIdentifier, lineIdentifier = \ + generateCurveMesh(region, cx, cd1, loop, nodeIdentifier, lineIdentifier) + if showTrimSurfaces: + faceIdentifier = elementIdentifier if (dimension == 2) else None + for s in range(3): + trimSurface = outerTubeBifurcationData.getTrimSurface(s) + if trimSurface: + nodeIdentifier, faceIdentifier = \ + trimSurface.generateMesh(region, nodeIdentifier, faceIdentifier) + if dimension == 2: + elementIdentifier = faceIdentifier + innerTubeBifurcationData = None + if innerNodeTubeBifurcationData: + innerTubeBifurcationData = innerNodeTubeBifurcationData.get( + startSegmentNode if (stage == 0) else endSegmentNode) + + crossIndexes = outerTubeBifurcationData.getCrossIndexes() # only get these from outer + if not crossIndexes: + outerTubeBifurcationData.determineCrossIndexes() + outerTubeBifurcationData.determineMidCoordinates() + if innerTubeBifurcationData: + innerTubeBifurcationData.determineCrossIndexes() + innerTubeBifurcationData.determineMidCoordinates() + crossIndexes = outerTubeBifurcationData.getCrossIndexes() + + outerTubeCoordinates = outerTubeBifurcationData.getConnectingTubeCoordinates() + outerMidCoordinates = outerTubeBifurcationData.getMidCoordinates() + inward = outerTubeBifurcationData.getSegmentsIn() + outerTubeData = outerTubeBifurcationData.getTubeData() + tubeNodeIds = [outerTubeData[s].getEndNodeIds(1) if inward[s] else \ + outerTubeData[s].getStartNodeIds(1) for s in range(3)] + innerTubeCoordinates = None + innerMidCoordinates = None + if innerTubeBifurcationData: + innerTubeCoordinates = innerTubeBifurcationData.getConnectingTubeCoordinates() + innerMidCoordinates = innerTubeBifurcationData.getMidCoordinates() + annotationMeshGroups = [outerTubeData[s].getAnnotationMeshGroups() for s in range(3)] + nodeIdentifier, elementIdentifier = generateTubeBifurcation( + outerTubeCoordinates, innerTubeCoordinates, inward, elementsCountThroughWall, + outerMidCoordinates, innerMidCoordinates, crossIndexes, + region, fieldcache, coordinates, nodeIdentifier, elementIdentifier, tubeNodeIds, + annotationMeshGroups, serendipity=serendipity) + + for s in range(3): + if inward[s]: + if not outerTubeData[s].getEndNodeIds(1): + outerTubeData[s].setEndNodeIds(tubeNodeIds[s], 1) + else: + if not outerTubeData[s].getStartNodeIds(1): + outerTubeData[s].setStartNodeIds(tubeNodeIds[s], 1) + + completedBifurcations.add(outerTubeBifurcationData) + + is_uterus = uterusGroup.getGroup() + myometriumGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, get_uterus_term("myometrium")) + myometriumGroup.getMeshGroup(mesh).addElementsConditional(is_uterus) + + # Add human specific annotations + if isHuman: + # find elements on left and right edges + elementsOnRightMarginVentral = [] + elementsOnRightMarginDorsal = [] + elementsOnLeftMarginVentral = [] + elementsOnLeftMarginDorsal = [] + + for i in range(elementsAlongBodyDistalSegment): + elementsOnRightMarginVentral.append(elementStartIdxCervix - 1 - i * elementsAroundBodyDistalSegment - (math.ceil(elementsAroundBodyDistalSegment * 0.25) - 1)) + elementsOnRightMarginDorsal.append(elementStartIdxCervix - 1 - i * elementsAroundBodyDistalSegment - (math.ceil(elementsAroundBodyDistalSegment * 0.25) - 1) - 1) + elementsOnLeftMarginVentral.append(elementStartIdxCervix - (i + 1) * elementsAroundBodyDistalSegment + (math.ceil(elementsAroundBodyDistalSegment * 0.25) - 1)) + elementsOnLeftMarginDorsal.append(elementStartIdxCervix - (i + 1) * elementsAroundBodyDistalSegment + (math.ceil(elementsAroundBodyDistalSegment * 0.25) - 1) + 1) + + nearRightMarginDorsalGroup = AnnotationGroup(region, ("elements adjacent to right margin dorsal", "None")) + nearRightMarginVentralGroup = AnnotationGroup(region, ("elements adjacent to right margin ventral", "None")) + nearLeftMarginDorsalGroup = AnnotationGroup(region, ("elements adjacent to left margin dorsal", "None")) + nearLeftMarginVentralGroup = AnnotationGroup(region, ("elements adjacent to left margin ventral", "None")) + + # track backwards to find elements near the margins + lastElements = [elementsOnLeftMarginVentral[-1], elementsOnLeftMarginDorsal[-1], + elementsOnRightMarginVentral[-1], elementsOnRightMarginDorsal[-1]] + marginGroups = [nearLeftMarginVentralGroup, nearLeftMarginDorsalGroup, + nearRightMarginVentralGroup, nearRightMarginDorsalGroup] + + for i in range(4): + adjacentElement = mesh.findElementByIdentifier(lastElements[i]) + eft = adjacentElement.getElementfieldtemplate(coordinates, -1) + lastNode = get_element_node_identifiers(adjacentElement, eft)[4] + addElementsToMargin(mesh, coordinates, marginGroups[i], lastNode) + + elementIter = mesh.createElementiterator() + element = elementIter.next() + while element.isValid(): + elementIdentifier = element.getIdentifier() + if elementIdentifier in elementsOnRightMarginVentral: + nearRightMarginVentralGroup.getMeshGroup(mesh).addElement(element) + elif elementIdentifier in elementsOnRightMarginDorsal: + nearRightMarginDorsalGroup.getMeshGroup(mesh).addElement(element) + elif elementIdentifier in elementsOnLeftMarginVentral: + nearLeftMarginVentralGroup.getMeshGroup(mesh).addElement(element) + elif elementIdentifier in elementsOnLeftMarginDorsal: + nearLeftMarginDorsalGroup.getMeshGroup(mesh).addElement(element) + element = elementIter.next() + + annotationGroups.append(nearRightMarginDorsalGroup) + annotationGroups.append(nearRightMarginVentralGroup) + annotationGroups.append(nearLeftMarginDorsalGroup) + annotationGroups.append(nearLeftMarginVentralGroup) + + elementsOnRightMarginVentral = [] + elementsOnRightMarginDorsal = [] + elementsOnLeftMarginVentral = [] + elementsOnLeftMarginDorsal = [] + + for i in range(elementsAlongCervixSegment): + elementsOnRightMarginDorsal.append(elementStartIdxCervix - 1 + i * elementsAroundCervixSegment - (math.ceil(elementsAroundBodyDistalSegment * 0.25) - 1) - 1) + elementsOnRightMarginVentral.append(elementStartIdxCervix - 1 + i * elementsAroundCervixSegment - (math.ceil(elementsAroundBodyDistalSegment * 0.25) - 1)) + elementsOnLeftMarginVentral.append(elementStartIdxCervix + (math.ceil(elementsAroundBodyDistalSegment * 0.25) - 1) + i * elementsAroundCervixSegment) + elementsOnLeftMarginDorsal.append(elementStartIdxCervix + (math.ceil(elementsAroundBodyDistalSegment * 0.25) - 1) + 1 + i * elementsAroundCervixSegment) + + nearRightMarginDorsalCervixGroup = AnnotationGroup(region, ("elements adjacent to right margin dorsal of cervix", "None")) + nearRightMarginVentralCervixGroup = AnnotationGroup(region, ("elements adjacent to right margin ventral of cervix", "None")) + nearLeftMarginDorsalCervixGroup = AnnotationGroup(region, ("elements adjacent to left margin dorsal of cervix", "None")) + nearLeftMarginVentralCervixGroup = AnnotationGroup(region, ("elements adjacent to left margin ventral of cervix", "None")) + + elementIter = mesh.createElementiterator() + element = elementIter.next() + while element.isValid(): + elementIdentifier = element.getIdentifier() + if elementIdentifier in elementsOnRightMarginVentral: + nearRightMarginVentralCervixGroup.getMeshGroup(mesh).addElement(element) + elif elementIdentifier in elementsOnRightMarginDorsal: + nearRightMarginDorsalCervixGroup.getMeshGroup(mesh).addElement(element) + elif elementIdentifier in elementsOnLeftMarginVentral: + nearLeftMarginVentralCervixGroup.getMeshGroup(mesh).addElement(element) + elif elementIdentifier in elementsOnLeftMarginDorsal: + nearLeftMarginDorsalCervixGroup.getMeshGroup(mesh).addElement(element) + element = elementIter.next() + + annotationGroups.append(nearRightMarginDorsalCervixGroup) + annotationGroups.append(nearRightMarginVentralCervixGroup) + annotationGroups.append(nearLeftMarginDorsalCervixGroup) + annotationGroups.append(nearLeftMarginVentralCervixGroup) + + allMarkers = {"junction of left round ligament with uterus": {"x": [-4.1312, 9.96436, -7.11994]}, + "junction of right round ligament with uterus": {"x": [4.13116, 9.96438, -7.11997]}} + + for key in allMarkers: + x = allMarkers[key]["x"] + group = findOrCreateAnnotationGroupForTerm( annotationGroups, region, + get_uterus_term(key), isMarker=True) + markerNode = group.createMarkerNode(nodeIdentifier, coordinates, x) + nodeIdentifier = markerNode.getIdentifier() + 1 + for group in annotationGroups: + group.getNodesetGroup(nodes).addNode(markerNode) + + preBifurcationGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + ("pre-bifurcation segments", "None")) + postBifurcationGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + ("post-bifurcation segments", "None")) + annotationGroups.remove(preBifurcationGroup) + annotationGroups.remove(postBifurcationGroup) + + return annotationGroups, None + + + @classmethod + def refineMesh(cls, meshrefinement, options): + """ + Refine source mesh into separate region, with change of basis. + :param meshrefinement: MeshRefinement, which knows source and target region. + :param options: Dict containing options. See getDefaultOptions(). + """ + refineElementsCountAround = options['Refine number of elements around'] + refineElementsCountAlong = options['Refine number of elements along'] + refineElementsCountThroughWall = options['Refine number of elements through wall'] + + meshrefinement.refineAllElementsCubeStandard3d(refineElementsCountAround, refineElementsCountAlong, + refineElementsCountThroughWall) + return + + @classmethod + def defineFaceAnnotations(cls, region, options, annotationGroups): + """ + Add face annotation groups from the highest dimension mesh. + Must have defined faces and added subelements for highest dimension groups. + :param region: Zinc region containing model. + :param options: Dict containing options. See getDefaultOptions(). + :param annotationGroups: List of annotation groups for top-level elements. + New face annotation groups are appended to this list. + """ + parameterSetName = options['Base parameter set'] + isHuman = parameterSetName in ("Default", "Human 1") + isMouse = parameterSetName in "Mouse 1" + + # Create 2d surface mesh groups + fm = region.getFieldmodule() + uterusGroup = getAnnotationGroupForTerm(annotationGroups, get_uterus_term("uterus")) + cervixGroup = getAnnotationGroupForTerm(annotationGroups, get_uterus_term("uterine cervix")) + bodyGroup = getAnnotationGroupForTerm(annotationGroups, get_uterus_term("body of uterus")) + vaginaGroup = getAnnotationGroupForTerm(annotationGroups, get_uterus_term("vagina")) + + mesh1d = fm.findMeshByDimension(1) + mesh2d = fm.findMeshByDimension(2) + + is_exterior = fm.createFieldIsExterior() + is_exterior_face_xi3_1 = fm.createFieldAnd(is_exterior, fm.createFieldIsOnFace(Element.FACE_TYPE_XI3_1)) + is_exterior_face_xi3_0 = fm.createFieldAnd(is_exterior, fm.createFieldIsOnFace(Element.FACE_TYPE_XI3_0)) + is_exterior_face_xi2_0 = fm.createFieldAnd(is_exterior, fm.createFieldIsOnFace(Element.FACE_TYPE_XI2_0)) + is_exterior_face_xi2_1 = fm.createFieldAnd(is_exterior, fm.createFieldIsOnFace(Element.FACE_TYPE_XI2_1)) + + is_uterus = uterusGroup.getGroup() + is_uterus_outer = fm.createFieldAnd(is_uterus, is_exterior_face_xi3_1) + is_uterus_inner = fm.createFieldAnd(is_uterus, is_exterior_face_xi3_0) + + is_body = bodyGroup.getGroup() + is_body_outer = fm.createFieldAnd(is_body, is_exterior_face_xi3_1) + is_body_inner = fm.createFieldAnd(is_body, is_exterior_face_xi3_0) + + is_cervix = cervixGroup.getGroup() + is_cervix_outer = fm.createFieldAnd(is_cervix, is_exterior_face_xi3_1) + is_cervix_inner = fm.createFieldAnd(is_cervix, is_exterior_face_xi3_0) + + is_vagina = vaginaGroup.getGroup() + is_vagina_outer = fm.createFieldAnd(is_vagina, is_exterior_face_xi3_1) + is_vagina_inner = fm.createFieldAnd(is_vagina, is_exterior_face_xi3_0) + is_vagina_xi2_0 = fm.createFieldAnd(is_vagina, is_exterior_face_xi2_0) + is_vagina_xi2_1 = fm.createFieldAnd(is_vagina, is_exterior_face_xi2_1) + is_vagina_xi2_01 = fm.createFieldXor(is_vagina_xi2_0, is_vagina_xi2_1) + + serosaOfUterus = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("serosa of uterus")) + serosaOfUterus.getMeshGroup(mesh2d).addElementsConditional(is_uterus_outer) + + lumenOfUterus = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("lumen of uterus")) + lumenOfUterus.getMeshGroup(mesh2d).addElementsConditional(is_uterus_inner) + + serosaOfBody = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("serosa of body of uterus")) + serosaOfBody.getMeshGroup(mesh2d).addElementsConditional(is_body_outer) + + lumenOfBody = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("lumen of body of uterus")) + lumenOfBody.getMeshGroup(mesh2d).addElementsConditional(is_body_inner) + + serosaOfCervix = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("serosa of uterine cervix")) + serosaOfCervix.getMeshGroup(mesh2d).addElementsConditional(is_cervix_outer) + + lumenOfCervix = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("lumen of uterine cervix")) + lumenOfCervix.getMeshGroup(mesh2d).addElementsConditional(is_cervix_inner) + + serosaOfVagina = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("serosa of vagina")) + serosaOfVagina.getMeshGroup(mesh2d).addElementsConditional(is_vagina_outer) + + lumenOfVagina = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("lumen of vagina")) + lumenOfVagina.getMeshGroup(mesh2d).addElementsConditional(is_vagina_inner) + + if isHuman: + leftUterineTubeGroup = getAnnotationGroupForTerm(annotationGroups, get_uterus_term("left uterine tube")) + is_leftUterineTube = leftUterineTubeGroup.getGroup() + is_leftUterineTube_outer = fm.createFieldAnd(is_leftUterineTube, is_exterior_face_xi3_1) + is_leftUterineTube_inner = fm.createFieldAnd(is_leftUterineTube, is_exterior_face_xi3_0) + + serosaOfLeftUterineTube = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("serosa of left uterine tube")) + serosaOfLeftUterineTube.getMeshGroup(mesh2d).addElementsConditional(is_leftUterineTube_outer) + + rightUterineTubeGroup = getAnnotationGroupForTerm(annotationGroups, get_uterus_term("right uterine tube")) + is_rightUterineTube = rightUterineTubeGroup.getGroup() + is_rightUterineTube_outer = fm.createFieldAnd(is_rightUterineTube, is_exterior_face_xi3_1) + is_rightUterineTube_inner = fm.createFieldAnd(is_rightUterineTube, is_exterior_face_xi3_0) + + serosaOfRightUterineTube = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("serosa of right uterine tube")) + serosaOfRightUterineTube.getMeshGroup(mesh2d).addElementsConditional(is_rightUterineTube_outer) + + lumenOfLeftUterineTube = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("lumen of left uterine tube")) + lumenOfLeftUterineTube.getMeshGroup(mesh2d).addElementsConditional(is_leftUterineTube_inner) + + lumenOfRightUterineTube = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("lumen of right uterine tube")) + lumenOfRightUterineTube.getMeshGroup(mesh2d).addElementsConditional(is_rightUterineTube_inner) + + nearRightMarginDorsalGroup = getAnnotationGroupForTerm(annotationGroups, + ("elements adjacent to right margin dorsal", + "None")) + nearRightMarginVentralGroup = getAnnotationGroupForTerm(annotationGroups, + ("elements adjacent to right margin ventral", + "None")) + nearLeftMarginDorsalGroup = getAnnotationGroupForTerm(annotationGroups, + ("elements adjacent to left margin dorsal", + "None")) + nearLeftMarginVentralGroup = getAnnotationGroupForTerm(annotationGroups, + ("elements adjacent to left margin ventral", + "None")) + + is_pubocervical = fm.createFieldAnd(is_body_outer, is_cervix_outer) + pubocervical = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("pubocervical ligament (TA98)")) + pubocervical.getMeshGroup(mesh1d).addElementsConditional(is_pubocervical) + + is_internal_os = fm.createFieldAnd(is_body_inner, is_cervix_inner) + internalOs = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("internal cervical os")) + internalOs.getMeshGroup(mesh1d).addElementsConditional(is_internal_os) + + is_external_os = fm.createFieldAnd(is_vagina_inner, is_cervix_inner) + externalOs = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("external cervical os")) + externalOs.getMeshGroup(mesh1d).addElementsConditional(is_external_os) + + is_vagina_orifice = fm.createFieldAnd(is_vagina_xi2_01, is_exterior_face_xi3_0) + vaginaOrifice = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("vagina orifice")) + vaginaOrifice.getMeshGroup(mesh1d).addElementsConditional(is_vagina_orifice) + + # Broad ligament of uterus + is_nearLeftMarginDorsal = fm.createFieldAnd(nearLeftMarginDorsalGroup.getGroup(), is_exterior_face_xi3_1) + is_nearLeftMarginVentral = fm.createFieldAnd(nearLeftMarginVentralGroup.getGroup(), is_exterior_face_xi3_1) + is_leftBroadLigament = fm.createFieldAnd(is_nearLeftMarginDorsal, is_nearLeftMarginVentral) + leftBroadLigament = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("left broad ligament of uterus")) + leftBroadLigament.getMeshGroup(mesh1d).addElementsConditional(is_leftBroadLigament) + + is_nearRightMarginDorsal = fm.createFieldAnd(nearRightMarginDorsalGroup.getGroup(), is_exterior_face_xi3_1) + is_nearRightMarginVentral = fm.createFieldAnd(nearRightMarginVentralGroup.getGroup(), is_exterior_face_xi3_1) + is_rightBroadLigament = fm.createFieldAnd(is_nearRightMarginDorsal, is_nearRightMarginVentral) + rightBroadLigament = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("right broad ligament of uterus")) + rightBroadLigament.getMeshGroup(mesh1d).addElementsConditional(is_rightBroadLigament) + + # Transverse cervical ligament + nearRightMarginDorsalCervixGroup = \ + getAnnotationGroupForTerm(annotationGroups, + ("elements adjacent to right margin dorsal of cervix", "None")) + nearRightMarginVentralCervixGroup = \ + getAnnotationGroupForTerm(annotationGroups, + ("elements adjacent to right margin ventral of cervix", "None")) + nearLeftMarginDorsalCervixGroup = \ + getAnnotationGroupForTerm(annotationGroups, + ("elements adjacent to left margin dorsal of cervix", "None")) + nearLeftMarginVentralCervixGroup = \ + getAnnotationGroupForTerm(annotationGroups, + ("elements adjacent to left margin ventral of cervix", "None")) + + is_nearLeftMarginDorsalCervix = fm.createFieldAnd(nearLeftMarginDorsalCervixGroup.getGroup(), + is_cervix_outer) + is_nearLeftMarginVentralCervix = fm.createFieldAnd(nearLeftMarginVentralCervixGroup.getGroup(), + is_cervix_outer) + is_leftTransverseCervicalLigament = fm.createFieldAnd(is_nearLeftMarginDorsalCervix, + is_nearLeftMarginVentralCervix) + leftTransverseCervicalLigament = \ + findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("left transverse cervical ligament")) + leftTransverseCervicalLigament.getMeshGroup(mesh1d).addElementsConditional(is_leftTransverseCervicalLigament) + + is_nearRightMarginDorsalCervix = fm.createFieldAnd(nearRightMarginDorsalCervixGroup.getGroup(), + is_cervix_outer) + is_nearRightMarginVentralCervix = fm.createFieldAnd(nearRightMarginVentralCervixGroup.getGroup(), + is_cervix_outer) + is_rightTransverseCervicalLigament = fm.createFieldAnd(is_nearRightMarginDorsalCervix, + is_nearRightMarginVentralCervix) + rightTransverseCervicalLigament = \ + findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("right transverse cervical ligament")) + rightTransverseCervicalLigament.getMeshGroup(mesh1d).addElementsConditional( + is_rightTransverseCervicalLigament) + + annotationGroups.remove(nearRightMarginDorsalGroup) + annotationGroups.remove(nearRightMarginVentralGroup) + annotationGroups.remove(nearLeftMarginDorsalGroup) + annotationGroups.remove(nearLeftMarginVentralGroup) + + annotationGroups.remove(nearRightMarginDorsalCervixGroup) + annotationGroups.remove(nearRightMarginVentralCervixGroup) + annotationGroups.remove(nearLeftMarginDorsalCervixGroup) + annotationGroups.remove(nearLeftMarginVentralCervixGroup) + + if isMouse: + rightHornGroup = getAnnotationGroupForTerm(annotationGroups, get_uterus_term("right uterine horn")) + leftHornGroup = getAnnotationGroupForTerm(annotationGroups, get_uterus_term("left uterine horn")) + + is_rightHorn = rightHornGroup.getGroup() + is_rightHorn_outer = fm.createFieldAnd(is_rightHorn, is_exterior_face_xi3_1) + is_rightHorn_inner = fm.createFieldAnd(is_rightHorn, is_exterior_face_xi3_0) + + is_leftHorn = leftHornGroup.getGroup() + is_leftHorn_outer = fm.createFieldAnd(is_leftHorn, is_exterior_face_xi3_1) + is_leftHorn_inner = fm.createFieldAnd(is_leftHorn, is_exterior_face_xi3_0) + + serosaOfRightHorn = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("serosa of right horn")) + serosaOfRightHorn.getMeshGroup(mesh2d).addElementsConditional(is_rightHorn_outer) + + lumenOfRightHorn = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("lumen of right horn")) + lumenOfRightHorn.getMeshGroup(mesh2d).addElementsConditional(is_rightHorn_inner) + + serosaOfLeftHorn = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("serosa of left horn")) + serosaOfLeftHorn.getMeshGroup(mesh2d).addElementsConditional(is_leftHorn_outer) + + lumenOfLeftHorn = findOrCreateAnnotationGroupForTerm(annotationGroups, region, + get_uterus_term("lumen of left horn")) + lumenOfLeftHorn.getMeshGroup(mesh2d).addElementsConditional(is_leftHorn_inner) + + +def addElementsToMargin(mesh, coordinates, group, nodeId): + """ + Track from the node to find elements Add elements lying on the margin and add them to a group. + :param coordinates: Coordinates field. + :param group: Group for adding elements lying on the margin. + :param nodeId: Node to start tracking from. + """ + elementIter = mesh.createElementiterator() + element = elementIter.next() + while element.isValid(): + eft = element.getElementfieldtemplate(coordinates, -1) + nodeIdentifiers = get_element_node_identifiers(element, eft) + if nodeIdentifiers[6] == nodeId: + group.getMeshGroup(mesh).addElement(element) + adjacentElement = element + eft = adjacentElement.getElementfieldtemplate(coordinates, -1) + nodeId = get_element_node_identifiers(adjacentElement, eft)[4] + elementIter = mesh.createElementiterator() + element = elementIter.next() + + return diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_wholebody1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_wholebody1.py index 71165cf3..7f057495 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_wholebody1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_wholebody1.py @@ -47,15 +47,16 @@ class MeshType_3d_wholebody1(Scaffold_base): 'Default': ScaffoldPackage(MeshType_1d_path1, { 'scaffoldSettings': cylinder1Settings, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], - [ + [[ (1, [[0.0, 0.0, 0.0], setMagnitude(axis1, cylinder1Settings['Length']), setMagnitude(axis2, 0.5), [0.0, 0.0, 0.0], setMagnitude(axis3, 0.5), [0.0, 0.0, 0.0]]), (2, [setMagnitude(axis1, cylinder1Settings['Length']), setMagnitude(axis1, cylinder1Settings['Length']), setMagnitude(axis2, 0.5), [0.0, 0.0, 0.0], setMagnitude(axis3, 0.5), [0.0, 0.0, 0.0]]) - ]) + ]]) }) } diff --git a/src/scaffoldmaker/scaffoldpackage.py b/src/scaffoldmaker/scaffoldpackage.py index 0715f4ee..89626ce6 100644 --- a/src/scaffoldmaker/scaffoldpackage.py +++ b/src/scaffoldmaker/scaffoldpackage.py @@ -210,24 +210,23 @@ def getTransformationMatrix(self): [ 0.0, 0.0, 0.0, 1.0 ] ] return None - def applyTransformation(self): + def applyTransformation(self, editCoordinatesField): ''' If rotation, scale or transformation are set, transform node coordinates. Only call after generate(). - :return: True if a non-identity transformation has been applied, False if not. + :param editCoordinatesField: Coordinates field in which transformation is applied to. + :return: True if a non-identity transformation has been applied, False if not. Return None if field is invalid. ''' assert self._region fieldmodule = self._region.getFieldmodule() - coordinates = fieldmodule.findFieldByName('coordinates').castFiniteElement() - if not coordinates.isValid(): + if not editCoordinatesField.isValid(): print('Warning: ScaffoldPackage.applyTransformation: Missing coordinates field') return with ChangeManager(fieldmodule): - componentsCount = coordinates.getNumberOfComponents() - if componentsCount < 3: - # pad with zeros - coordinates = fieldmodule.createFieldConcatenate([ coordinates ] + [ fieldmodule.createFieldConstant([ 0.0 ]*(3 - componentsCount)) ]) - newCoordinates = coordinates + componentsCount = editCoordinatesField.getNumberOfComponents() + # pad with zeros if componentsCount < 3 + newCoordinates = targetCoordinates = editCoordinatesField if (componentsCount >= 3) else fieldmodule.createFieldConcatenate([ editCoordinates ] + [ fieldmodule.createFieldConstant([ 0.0 ]*(3 - componentsCount)) ]) + # apply scale first so variable scaling in x, y, z doesn't interplay with rotation if not all((v == 1.0) for v in self._scale): #print("applyTransformation: apply scale", self._scale) @@ -240,13 +239,13 @@ def applyTransformation(self): #print("applyTransformation: apply translation", self._translation) newCoordinates = newCoordinates + fieldmodule.createFieldConstant(self._translation) # be sure to delete temporary fields and fieldassignment to reduce messages - doApply = newCoordinates is not coordinates + doApply = newCoordinates is not targetCoordinates if doApply: - fieldassignment = coordinates.createFieldassignment(newCoordinates) + fieldassignment = targetCoordinates.createFieldassignment(newCoordinates) fieldassignment.assign() del fieldassignment del newCoordinates - del coordinates + del targetCoordinates return doApply def generate(self, region, applyTransformation=True): @@ -272,7 +271,11 @@ def generate(self, region, applyTransformation=True): self._userAnnotationGroups = [ AnnotationGroup.fromDict(dct, self._region) for dct in self._userAnnotationGroupsDict ] self._isGenerated = True if applyTransformation: - self.applyTransformation() + fieldmodule = self._region.getFieldmodule() + for editFieldName in ['coordinates', 'inner coordinates']: + editCoordinates = fieldmodule.findFieldByName(editFieldName) + if editCoordinates.isValid(): + self.applyTransformation(editCoordinates) def deleteElementsInRanges(self, region, deleteElementRanges): """ diff --git a/src/scaffoldmaker/scaffolds.py b/src/scaffoldmaker/scaffolds.py index 40b0c3d9..c2fbf46b 100644 --- a/src/scaffoldmaker/scaffolds.py +++ b/src/scaffoldmaker/scaffolds.py @@ -55,6 +55,7 @@ from scaffoldmaker.meshtypes.meshtype_3d_tubenetwork1 import MeshType_3d_tubenetwork1 from scaffoldmaker.meshtypes.meshtype_3d_tubeseptum1 import MeshType_3d_tubeseptum1 from scaffoldmaker.meshtypes.meshtype_3d_uterus1 import MeshType_3d_uterus1 +from scaffoldmaker.meshtypes.meshtype_3d_uterus2 import MeshType_3d_uterus2 from scaffoldmaker.meshtypes.meshtype_3d_wholebody1 import MeshType_3d_wholebody1 from scaffoldmaker.scaffoldpackage import ScaffoldPackage @@ -115,6 +116,7 @@ def __init__(self): MeshType_3d_tubenetwork1, MeshType_3d_tubeseptum1, MeshType_3d_uterus1, + MeshType_3d_uterus2, MeshType_3d_wholebody1 ] diff --git a/src/scaffoldmaker/utils/bifurcation.py b/src/scaffoldmaker/utils/bifurcation.py index 84752e64..b1b40cd5 100644 --- a/src/scaffoldmaker/utils/bifurcation.py +++ b/src/scaffoldmaker/utils/bifurcation.py @@ -1644,6 +1644,65 @@ def determineMidCoordinates(self): self._midCoordinates[s][1][1:-1] = loopd1[1:-1] +def blendNetworkNodeCoordinates(networkNode, segmentTubeDataList): + """ + Blend coordinate d2 between segments connecting at networkNode if sharing the same version. + Must only call after all tube data has been resampled. + :param networkNode: The node to blend coordinates at. + :param segmentTubeDataList: List of dict mapping NetworkSegment to TubeData. Assumes all same structure. + :return: None + """ + inSegments = networkNode.getInSegments() + outSegments = networkNode.getOutSegments() + nodeVersionSegments = {} # map from version number to list of segments using it + for segment in (inSegments + outSegments): + nodeVersions = segment.getNodeVersions() + nodeIndex = -1 if (segment in inSegments) else 0 + nodeVersion = nodeVersions[nodeIndex] + nodeVersionSegment = nodeVersionSegments.get(nodeVersion) + if not nodeVersionSegment: + nodeVersionSegments[nodeVersion] = nodeVersionSegment = [] + nodeVersionSegment.append(segment) + for nodeVersion, segments in nodeVersionSegments.items(): + if len(segments) < 2: + continue # no blending required + for segmentTubeData in segmentTubeDataList: + d2Rings = [] + nodesCountAround = None + for segment in segments: + tubeData = segmentTubeData[segment] + nodeIndex = -1 if segment in inSegments else 0 + d2Ring = tubeData.getSampledTubeCoordinates()[2][nodeIndex] + if (not d2Rings) or (len(d2Ring) == nodesCountAround): + d2Rings.append(d2Ring) + nodesCountAround = len(d2Ring) + else: + print("Cannot blend d1 version " + str(nodeVersion) + " at layout node " + + str(networkNode.getNodeIdentifier()) + " due to mismatch in number around") + break + ringCount = len(d2Rings) + if ringCount < 2: + break + for n in range(nodesCountAround): + # harmonic mean magnitude; directions are the same as same version + sum = 0.0 + ringMags = [] + for d2Ring in d2Rings: + ringMag = magnitude(d2Ring[n]) + ringMags.append(ringMag) + if ringMag == 0.0: + sum = 0.0 + break + sum += 1.0 / ringMag + mag = (ringCount / sum) if (sum != 0.0) else 0.0 + for r in range(ringCount): + d2Ring = d2Rings[r] + if ringMags[r] > 0.0: + d2 = mult(d2Ring[n], mag / ringMags[r]) + for c in range(3): + d2Ring[n][c] = d2[c] + + def generateTubeBifurcationTree(networkMesh: NetworkMesh, region, coordinates, nodeIdentifier, elementIdentifier, defaultElementsCountAround: int, targetElementDensityAlongLongestSegment: float, elementsCountThroughWall: int, layoutAnnotationGroups: list=[], @@ -1765,7 +1824,6 @@ def generateTubeBifurcationTree(networkMesh: NetworkMesh, region, coordinates, n startInSegments = startSegmentNode.getInSegments() startOutSegments = startSegmentNode.getOutSegments() if (len(startInSegments) + len(startOutSegments)) == 3: - # print("create start", networkSegment, startSegmentNode) startTubeBifurcationData = TubeBifurcationData(startInSegments, startOutSegments, segmentTubeData) nodeTubeBifurcationData[startSegmentNode] = startTubeBifurcationData newBifurcationData.append(startTubeBifurcationData) @@ -1786,14 +1844,6 @@ def generateTubeBifurcationTree(networkMesh: NetworkMesh, region, coordinates, n endSurface = endTubeBifurcationData.getSegmentTrimSurface(networkSegment) if segmentTubeData is outerSegmentTubeData: segmentLength = tubeData.getSegmentLength() - # Previous code setting number of elements along to satisfy targetElementAspectRatio - # ringCount = len(rawTubeCoordinates[0]) - # sumRingLength = 0.0 - # for n in range(ringCount): - # ringLength = getCubicHermiteCurvesLength(rawTubeCoordinates[0][n], rawTubeCoordinates[1][n], loop=True) - # sumRingLength += ringLength - # meanElementLengthAround = sumRingLength / (ringCount * tubeData.getElementsCountAround()) - # targetElementLength = targetElementAspectRatio * meanElementLengthAround elementsCountAlong = max(1, math.ceil(segmentLength / targetElementLength)) loop = (len(startSegmentNode.getInSegments()) == 1) and \ (startSegmentNode.getInSegments()[0] is networkSegment) and \ @@ -1808,25 +1858,33 @@ def generateTubeBifurcationTree(networkMesh: NetworkMesh, region, coordinates, n # must match count from outer surface! outerTubeData = outerSegmentTubeData[networkSegment] elementsCountAlong = outerTubeData.getSampledElementsCountAlong() - # print("Resample startSurface", startSurface is not None, "endSurface", endSurface is not None) sx, sd1, sd2, sd12 = resampleTubeCoordinates( rawTubeCoordinates, elementsCountAlong, startSurface=startSurface, endSurface=endSurface) tubeData.setSampledTubeCoordinates((sx, sd1, sd2, sd12)) del segmentTubeData - completedBifurcations = set() # record so only done once + # blend coordinates where versions are shared between segments + blendedNetworkNodes = set() + for networkSegment in networkSegments: + segmentNodes = networkSegment.getNetworkNodes() + for segmentNode in [segmentNodes[0], segmentNodes[-1]]: + if segmentNode not in blendedNetworkNodes: + blendNetworkNodeCoordinates(segmentNode, allSegmentTubeData) + blendedNetworkNodes.add(segmentNode) + del blendedNetworkNodes + completedBifurcations = set() # record so only done once with ChangeManager(fieldmodule): for networkSegment in networkSegments: segmentNodes = networkSegment.getNetworkNodes() startSegmentNode = segmentNodes[0] startInSegments = startSegmentNode.getInSegments() startOutSegments = startSegmentNode.getOutSegments() - startSkipCount = 1 if ((len(startInSegments) > 1) or (len(startOutSegments) > 1)) else 0 + startSkipCount = 1 if ((len(startInSegments) + len(startOutSegments)) > 2) else 0 endSegmentNode = segmentNodes[-1] endInSegments = endSegmentNode.getInSegments() endOutSegments = endSegmentNode.getOutSegments() - endSkipCount = 1 if ((len(endInSegments) > 1) or (len(endOutSegments) > 1)) else 0 + endSkipCount = 1 if ((len(endInSegments) + len(endOutSegments)) > 2) else 0 for stage in range(3): if stage == 1: @@ -1836,7 +1894,23 @@ def generateTubeBifurcationTree(networkMesh: NetworkMesh, region, coordinates, n innerTubeData = innerSegmentTubeData[networkSegment] if layoutInnerCoordinates else None innerTubeCoordinates = innerTubeData.getSampledTubeCoordinates() if layoutInnerCoordinates else None startNodeIds = outerTubeData.getStartNodeIds(startSkipCount) + if (not startNodeIds) and (startSkipCount == 0) and (startInSegments or startOutSegments): + # discover start nodes from single adjacent segment + if startInSegments: + startNodeIds = outerSegmentTubeData[startInSegments[0]].getEndNodeIds(0) + else: + startNodeIds = outerSegmentTubeData[startOutSegments[0]].getStartNodeIds(0) + if startNodeIds: + outerTubeData.setStartNodeIds(startNodeIds, startSkipCount) endNodeIds = outerTubeData.getEndNodeIds(endSkipCount) + if (not endNodeIds) and (endSkipCount == 0) and (endOutSegments or endInSegments): + # discover end nodes from single adjacent segment + if endOutSegments: + endNodeIds = outerSegmentTubeData[endOutSegments[0]].getStartNodeIds(0) + elif endInSegments: + endNodeIds = outerSegmentTubeData[endInSegments[0]].getEndNodeIds(0) + if endNodeIds: + outerTubeData.setEndNodeIds(endNodeIds, endSkipCount) loop = (len(startInSegments) == 1) and (startInSegments[0] is networkSegment) and \ (networkSegment.getNodeVersions()[0] == networkSegment.getNodeVersions()[-1]) nodeIdentifier, elementIdentifier, startNodeIds, endNodeIds = generateTube( @@ -1898,14 +1972,13 @@ def generateTubeBifurcationTree(networkMesh: NetworkMesh, region, coordinates, n inward = outerTubeBifurcationData.getSegmentsIn() outerTubeData = outerTubeBifurcationData.getTubeData() tubeNodeIds = [outerTubeData[s].getEndNodeIds(1) if inward[s] else \ - outerTubeData[s].getStartNodeIds(1) for s in range(3)] + outerTubeData[s].getStartNodeIds(1) for s in range(3)] innerTubeCoordinates = None innerMidCoordinates = None if innerTubeBifurcationData: innerTubeCoordinates = innerTubeBifurcationData.getConnectingTubeCoordinates() innerMidCoordinates = innerTubeBifurcationData.getMidCoordinates() annotationMeshGroups = [outerTubeData[s].getAnnotationMeshGroups() for s in range(3)] - nodeIdentifier, elementIdentifier = generateTubeBifurcation( outerTubeCoordinates, innerTubeCoordinates, inward, elementsCountThroughWall, outerMidCoordinates, innerMidCoordinates, crossIndexes, diff --git a/src/scaffoldmaker/utils/zinc_utils.py b/src/scaffoldmaker/utils/zinc_utils.py index c76b24d4..62f1979d 100644 --- a/src/scaffoldmaker/utils/zinc_utils.py +++ b/src/scaffoldmaker/utils/zinc_utils.py @@ -431,16 +431,17 @@ def print_node_field_parameters(value_labels, node_field_parameters, format_stri def exnode_string_from_nodeset_field_parameters( + field_names=["coordinates"], value_labels = [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1], - node_field_parameters = [ + node_field_parameters = [[ (1, [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0]]), - (2, [[1.0, 0.0, 0.0], [1.0, 0.0, 0.0]]) - ], + (2, [[1.0, 0.0, 0.0], [1.0, 0.0, 0.0]])]], group_name = 'meshEdits'): """ Return a string in Zinc EX format defining nodes with the supplied identifiers and coordinate field parameters. Works in a private zinc context. + :param field_names: List of fields defining fields for node_field_parameters. :param value_labels: List of Node.ValueLabels supplied for each node. :param node_field_parameters: List of tuples of node identifier and parameters for each of the node values supplied. Versions may be supplied for any node/value @@ -455,55 +456,66 @@ def exnode_string_from_nodeset_field_parameters( # following requires at least one value label and node, assumes consistent values and components counts value_labels_count = len(value_labels) assert len(node_field_parameters) > 0 - node_parameters = node_field_parameters[0][1] + node_parameters = node_field_parameters[0][0][1] components_count = \ len(node_parameters[0][0]) if isinstance(node_parameters[0][0], list) else len(node_parameters[0]) context = Context('exnode_string_from_nodeset_field_parameters') region = context.getDefaultRegion() fieldmodule = region.getFieldmodule() + allCoordinates = [] with ChangeManager(fieldmodule): fieldcache = fieldmodule.createFieldcache() - coordinates = find_or_create_field_coordinates(fieldmodule, components_count=components_count) + for i in range(len(field_names)): + allCoordinates.append(find_or_create_field_coordinates(fieldmodule, field_names[i], + components_count=components_count)) + nodes = fieldmodule.findNodesetByFieldDomainType(Field.DOMAIN_TYPE_NODES) group = fieldmodule.createFieldGroup() group.setName(group_name) nodeset_group = group.createNodesetGroup(nodes) - # dict mapping from tuple of derivative versions to nodetemplate - nodetemplates = {} + # create nodes - for node_identifier, node_parameters in node_field_parameters: - value_labels_versions = [] - for d in range(value_labels_count): - if isinstance(node_parameters[d][0], list): - value_labels_versions.append(len(node_parameters[d])) - else: - value_labels_versions.append(1) - value_labels_versions = tuple(value_labels_versions) # must be tuple to use as dict key - nodetemplate = nodetemplates.get(value_labels_versions) - if not nodetemplate: - nodetemplate = nodes.createNodetemplate() - nodetemplate.defineField(coordinates) - if not Node.VALUE_LABEL_VALUE in value_labels: - nodetemplate.setValueNumberOfVersions(coordinates, -1, Node.VALUE_LABEL_VALUE, 0) + for i in range(len(node_field_parameters)): + nodetemplates = {} # dict mapping from tuple of derivative versions to nodetemplate + for node_identifier, node_parameters in node_field_parameters[i]: + value_labels_versions = [] for d in range(value_labels_count): - nodetemplate.setValueNumberOfVersions(coordinates, -1, value_labels[d], value_labels_versions[d]) - nodetemplates[value_labels_versions] = nodetemplate - node = nodeset_group.createNode(node_identifier, nodetemplate) - fieldcache.setNode(node) - for d in range(value_labels_count): - if isinstance(node_parameters[d][0], list): - for v in range(value_labels_versions[d]): - coordinates.setNodeParameters(fieldcache, -1, value_labels[d], v + 1, node_parameters[d][v]) + if isinstance(node_parameters[d][0], list): + value_labels_versions.append(len(node_parameters[d])) + else: + value_labels_versions.append(1) + value_labels_versions = tuple(value_labels_versions) # must be tuple to use as dict key + nodetemplate = nodetemplates.get(value_labels_versions) + + if not nodetemplate: + nodetemplate = nodes.createNodetemplate() + nodetemplate.defineField(allCoordinates[i]) + if not Node.VALUE_LABEL_VALUE in value_labels: + nodetemplate.setValueNumberOfVersions(allCoordinates[i], -1, Node.VALUE_LABEL_VALUE, 0) + for d in range(value_labels_count): + nodetemplate.setValueNumberOfVersions(allCoordinates[i], -1, value_labels[d], value_labels_versions[d]) + nodetemplates[value_labels_versions] = nodetemplate + if i == 0: + node = nodeset_group.createNode(node_identifier, nodetemplate) else: - coordinates.setNodeParameters(fieldcache, -1, value_labels[d], 1, node_parameters[d]) + node = nodes.findNodeByIdentifier(node_identifier) + node.merge(nodetemplate) + fieldcache.setNode(node) + for d in range(value_labels_count): + if isinstance(node_parameters[d][0], list): + for v in range(value_labels_versions[d]): + allCoordinates[i].setNodeParameters(fieldcache, -1, value_labels[d], v + 1, node_parameters[d][v]) + else: + allCoordinates[i].setNodeParameters(fieldcache, -1, value_labels[d], 1, node_parameters[d]) + # serialise to string sir = region.createStreaminformationRegion() srm = sir.createStreamresourceMemory() sir.setResourceGroupName(srm, group_name) region.write(sir) result, exString = srm.getBuffer() - return exString + return exString def disconnectFieldMeshGroupBoundaryNodes(coordinateFields, meshGroup1, meshGroup2, nextNodeIdentifier): """ diff --git a/tests/test_colon.py b/tests/test_colon.py index 00ddd0b6..575cd378 100644 --- a/tests/test_colon.py +++ b/tests/test_colon.py @@ -34,12 +34,13 @@ def test_colon1(self): "Structure": "1-2-3-4" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( + ['coordinates'], [Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, - Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [ + Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3], [[ (1, [[0.00, 0.00, 0.00], [-50.70, 178.20, 0.00], [-37.97, -9.49, -18.98], [-6.86, -11.39, -2.36], [-18.61, -3.98, 39.12], [-14.00, -1.00, -12.00]]), (2, [[-47.40, 188.60, 0.00], [-19.30, 177.10, 0.00], [-35.79, -6.51, -13.01], [11.23, 17.36, 14.31], [-12.66, -3.99, 36.28], [-4.00, 19.00, 22.00]]), (3, [[-4.40, 396.50, 0.00], [206.00, 40.10, 0.00], [-13.89, 27.78, 11.11], [13.54, -1.87, 21.51], [-6.05, -12.50, 29.93], [-6.00, 0.00, 51.00]]), - (4, [[130.00, 384.10, 0.00], [130.80, -40.50, 0.00], [-5.35, 4.28, 31.06], [5.83, -8.41, 8.86], [-15.28, -27.78, 2.51], [0.00, 1.00, 24.00]])]), + (4, [[130.00, 384.10, 0.00], [130.80, -40.50, 0.00], [-5.35, 4.28, 31.06], [5.83, -8.41, 8.86], [-15.28, -27.78, 2.51], [0.00, 1.00, 24.00]])]]), 'userAnnotationGroups': [ { diff --git a/tests/test_network.py b/tests/test_network.py index 9ebb8683..976e78de 100644 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -470,19 +470,19 @@ def test_3d_tube_network_loop_two_segments(self): volumeField.setNumbersOfPoints(4) result, volume = volumeField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(volume, 0.0737712467160836, delta=1.0E-6) + self.assertAlmostEqual(volume, 0.07367803305504764, delta=1.0E-6) outerSurfaceAreaField = fieldmodule.createFieldMeshIntegral(isExteriorXi3_1, coordinates, mesh2d) outerSurfaceAreaField.setNumbersOfPoints(4) result, outerSurfaceArea = outerSurfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(outerSurfaceArea, 1.9703453648288696, delta=1.0E-6) + self.assertAlmostEqual(outerSurfaceArea, 1.9684589894847588, delta=1.0E-6) innerSurfaceAreaField = fieldmodule.createFieldMeshIntegral(isExteriorXi3_0, coordinates, mesh2d) innerSurfaceAreaField.setNumbersOfPoints(4) result, innerSurfaceArea = innerSurfaceAreaField.evaluateReal(fieldcache, 1) self.assertEqual(result, RESULT_OK) - self.assertAlmostEqual(innerSurfaceArea, 0.9851721220077057, delta=1.0E-6) + self.assertAlmostEqual(innerSurfaceArea, 0.9842289454638566, delta=1.0E-6) if __name__ == "__main__": diff --git a/tests/test_smallintestine.py b/tests/test_smallintestine.py index cfdc069b..0afb0ed6 100644 --- a/tests/test_smallintestine.py +++ b/tests/test_smallintestine.py @@ -30,11 +30,12 @@ def test_smallintestine1(self): "Structure": "1-2-3-4" }, 'meshEdits': exnode_string_from_nodeset_field_parameters( - [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3 ], [ + ['coordinates'], + [ Node.VALUE_LABEL_VALUE, Node.VALUE_LABEL_D_DS1, Node.VALUE_LABEL_D_DS2, Node.VALUE_LABEL_D2_DS1DS2, Node.VALUE_LABEL_D_DS3, Node.VALUE_LABEL_D2_DS1DS3 ], [[ (1, [ [ -2.30, 18.50, -4.40 ], [ -4.20, -0.80, 3.70 ], [ 0.00, 0.60, 0.00 ], [ 0.00, 0.11, 0.00 ], [ -0.33, 0.01, -0.50 ], [ 0.00, 0.00, 0.50 ] ] ), (2, [ [ -8.60, 16.30, -0.40 ], [ -7.10, -2.70, 1.60 ], [ 0.00, 0.73, 0.00 ], [ 0.00, 0.14, 0.00 ], [ 0.08, 0.09, -0.72 ], [ 0.00, 0.00, 0.50 ] ] ), (3, [ [ -18.30, 12.60, -1.50 ], [ -6.40, -1.70, -3.80 ], [ 0.00, 0.90, 0.00 ], [ 0.00, 0.13, 0.00 ], [ 0.61, 0.04, -0.65 ], [ 0.00, 0.00, 0.50 ] ] ), - (4, [ [ -15.60, 13.70, -6.10 ], [ 7.00, 2.10, -1.80 ], [ 0.00, 1.00, 0.00 ], [ 0.00, 0.05, 0.00 ], [ 0.50, 0.08, 0.86 ], [ 0.00, 0.00, 0.50 ] ] ) ] ), + (4, [ [ -15.60, 13.70, -6.10 ], [ 7.00, 2.10, -1.80 ], [ 0.00, 1.00, 0.00 ], [ 0.00, 0.05, 0.00 ], [ 0.50, 0.08, 0.86 ], [ 0.00, 0.00, 0.50 ] ] )]]), 'userAnnotationGroups': [ { diff --git a/tests/test_uterus.py b/tests/test_uterus.py new file mode 100644 index 00000000..c619e957 --- /dev/null +++ b/tests/test_uterus.py @@ -0,0 +1,165 @@ +import copy +import unittest + +from cmlibs.utils.zinc.finiteelement import evaluateFieldNodesetRange, findNodeWithName +from cmlibs.utils.zinc.general import ChangeManager +from cmlibs.zinc.context import Context +from cmlibs.zinc.element import Element +from cmlibs.zinc.field import Field +from cmlibs.zinc.result import RESULT_OK +from scaffoldmaker.annotation.annotationgroup import getAnnotationGroupForTerm +from scaffoldmaker.annotation.uterus_terms import get_uterus_term +from scaffoldmaker.meshtypes.meshtype_3d_uterus2 import MeshType_3d_uterus2 +from scaffoldmaker.utils.meshrefinement import MeshRefinement +from scaffoldmaker.utils.zinc_utils import createFaceMeshGroupExteriorOnFace + +from testutils import assertAlmostEqualList + + +class StomachScaffoldTestCase(unittest.TestCase): + + def test_uterus1(self): + """ + Test creation of uterus scaffold. + """ + scaffold = MeshType_3d_uterus2 + parameterSetNames = scaffold.getParameterSetNames() + self.assertEqual(parameterSetNames, ["Default", "Human 1", "Mouse 1"]) + options = scaffold.getDefaultOptions("Human 1") + + networkLayout = options.get("Network layout") + networkLayoutSettings = networkLayout.getScaffoldSettings() + self.assertEqual("1-2-3, 4-5-6, 3-7-8-11.1, 6-9-10-11.2, 11.3-12-13-14,14-15-16,16-17-18", + networkLayoutSettings["Structure"]) + + self.assertEqual(14, len(options)) + self.assertEqual(10, options.get("Number of elements around")) + self.assertEqual(8, options.get("Number of elements around horns")) + self.assertEqual(1, options.get("Number of elements through wall")) + self.assertEqual(5.0, options.get("Target element density along longest segment")) + self.assertEqual(True, options.get("Serendipity")) + + context = Context("Test") + region = context.getDefaultRegion() + self.assertTrue(region.isValid()) + annotationGroups = scaffold.generateBaseMesh(region, options)[0] + self.assertEqual(17, len(annotationGroups)) + + fieldmodule = region.getFieldmodule() + self.assertEqual(RESULT_OK, fieldmodule.defineAllFaces()) + mesh3d = fieldmodule.findMeshByDimension(3) + self.assertEqual(248, mesh3d.getSize()) + mesh2d = fieldmodule.findMeshByDimension(2) + self.assertEqual(1005, mesh2d.getSize()) + mesh1d = fieldmodule.findMeshByDimension(1) + self.assertEqual(1278, mesh1d.getSize()) + nodes = fieldmodule.findNodesetByFieldDomainType(Field.DOMAIN_TYPE_NODES) + self.assertEqual(522, nodes.getSize()) + datapoints = fieldmodule.findNodesetByFieldDomainType(Field.DOMAIN_TYPE_DATAPOINTS) + self.assertEqual(0, datapoints.getSize()) + + coordinates = fieldmodule.findFieldByName("coordinates").castFiniteElement() + self.assertTrue(coordinates.isValid()) + minimums, maximums = evaluateFieldNodesetRange(coordinates, nodes) + assertAlmostEqualList(self, minimums, [-9.360152113397383, -0.05, -8.943209696521798], 1.0E-6) + assertAlmostEqualList(self, maximums, [9.360152113397215, 12.920227960030479, 1.278732071803069], 1.0E-6) + + with ChangeManager(fieldmodule): + one = fieldmodule.createFieldConstant(1.0) + faceMeshGroup = createFaceMeshGroupExteriorOnFace(fieldmodule, Element.FACE_TYPE_XI3_1) + surfaceAreaField = fieldmodule.createFieldMeshIntegral(one, coordinates, faceMeshGroup) + surfaceAreaField.setNumbersOfPoints(4) + volumeField = fieldmodule.createFieldMeshIntegral(one, coordinates, mesh3d) + volumeField.setNumbersOfPoints(3) + fieldcache = fieldmodule.createFieldcache() + result, surfaceArea = surfaceAreaField.evaluateReal(fieldcache, 1) + self.assertEqual(result, RESULT_OK) + self.assertAlmostEqual(surfaceArea, 264.7433300356289, delta=1.0E-6) + result, volume = volumeField.evaluateReal(fieldcache, 1) + self.assertEqual(result, RESULT_OK) + self.assertAlmostEqual(volume, 188.23971703799126, delta=1.0E-6) + + # check some annotationGroups: + expectedSizes3d = { + "body of uterus": 130, + "left uterine tube": 24, + "uterine cervix": 20, + "vagina": 50, + "uterus": 248 + } + + for name in expectedSizes3d: + term = get_uterus_term(name) + group = getAnnotationGroupForTerm(annotationGroups, term) + size = group.getMeshGroup(mesh3d).getSize() + self.assertEqual(expectedSizes3d[name], size, name) + + # refine 4x4x4 and check result + # first remove any surface annotation groups as they are re-added by defineFaceAnnotations + removeAnnotationGroups = [] + for annotationGroup in annotationGroups: + if (not annotationGroup.hasMeshGroup(mesh3d)) and \ + (annotationGroup.hasMeshGroup(mesh2d) or annotationGroup.hasMeshGroup(mesh1d)): + removeAnnotationGroups.append(annotationGroup) + + for annotationGroup in removeAnnotationGroups: + annotationGroups.remove(annotationGroup) + self.assertEqual(17, len(annotationGroups)) + + refineRegion = region.createRegion() + refineFieldmodule = refineRegion.getFieldmodule() + options['Refine number of elements along'] = 4 + options['Refine number of elements around'] = 4 + options['Refine number of elements through wall'] = 4 + meshrefinement = MeshRefinement(region, refineRegion, annotationGroups) + scaffold.refineMesh(meshrefinement, options) + annotationGroups = meshrefinement.getAnnotationGroups() + + refineFieldmodule.defineAllFaces() + oldAnnotationGroups = copy.copy(annotationGroups) + for annotationGroup in annotationGroups: + annotationGroup.addSubelements() + scaffold.defineFaceAnnotations(refineRegion, options, annotationGroups) + for annotation in annotationGroups: + if annotation not in oldAnnotationGroups: + annotationGroup.addSubelements() + self.assertEqual(29, len(annotationGroups)) +# + mesh3d = refineFieldmodule.findMeshByDimension(3) + self.assertEqual(15872, mesh3d.getSize()) + mesh2d = refineFieldmodule.findMeshByDimension(2) + self.assertEqual(51792, mesh2d.getSize()) + mesh1d = refineFieldmodule.findMeshByDimension(1) + self.assertEqual(56016, mesh1d.getSize()) + nodes = refineFieldmodule.findNodesetByFieldDomainType(Field.DOMAIN_TYPE_NODES) + self.assertEqual(20097, nodes.getSize()) + datapoints = refineFieldmodule.findNodesetByFieldDomainType(Field.DOMAIN_TYPE_DATAPOINTS) + self.assertEqual(0, datapoints.getSize()) + + # check some refined annotationGroups: + for name in expectedSizes3d: + term = get_uterus_term(name) + group = getAnnotationGroupForTerm(annotationGroups, term) + size = group.getMeshGroup(mesh3d).getSize() + self.assertEqual(expectedSizes3d[name]*64, size, name) + + # test finding a marker in refined scaffold + markerGroup = refineFieldmodule.findFieldByName("marker").castGroup() + refinedNodes = refineFieldmodule.findNodesetByFieldDomainType(Field.DOMAIN_TYPE_NODES) + markerNodes = markerGroup.getNodesetGroup(refinedNodes) + self.assertEqual(2, markerNodes.getSize()) + markerName = refineFieldmodule.findFieldByName("marker_name") + self.assertTrue(markerName.isValid()) + markerLocation = refineFieldmodule.findFieldByName("marker_location") + self.assertTrue(markerLocation.isValid()) + cache = refineFieldmodule.createFieldcache() + node = findNodeWithName(markerNodes, markerName, "junction of left round ligament with uterus") + self.assertTrue(node.isValid()) + cache.setNode(node) + element, xi = markerLocation.evaluateMeshLocation(cache, 3) + self.assertEqual(3712, element.getIdentifier()) + assertAlmostEqualList(self, xi, [1.0, 1.0, 1.0], 1.0E-04) + + +if __name__ == "__main__": + unittest.main()