From 334b3f548b476af4d7fe236649b4c6ee4a14c720 Mon Sep 17 00:00:00 2001 From: Zohreh Ekhlasi Date: Mon, 22 Mar 2021 11:28:05 +1300 Subject: [PATCH 1/6] Added four fiducial points. --- .../meshtypes/meshtype_3d_bladderurethra1.py | 139 ++++++++++++------ 1 file changed, 97 insertions(+), 42 deletions(-) diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py index 041f97e9..da899529 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py @@ -677,52 +677,53 @@ def generateBaseMesh(cls, region, options): outerNodes_d1.append(d1List[(2 * n2 + 1) * elementsCountAround + n1]) outerNodes_d2.append(d2List[(2 * n2 + 1) * elementsCountAround + n1]) + elementsCount1 = elementsCountAround // 2 + elementsCount2 = elementsCountAlongBladder + # Create trackSurface at the outer layer of the bladder for ureter 1 + nodesOnTrackSurface_x = [] + nodesOnTrackSurface_d1 = [] + nodesOnTrackSurface_d2 = [] + for n2 in range(elementsCountAlongBladder + 1): + for n1 in range(elementsCountAround // 2 + 1): + nodesOnTrackSurface_x.append(outerNodes_x[n2 * elementsCountAround + n1]) + nodesOnTrackSurface_d1.append(outerNodes_d1[n2 * elementsCountAround + n1]) + nodesOnTrackSurface_d2.append(outerNodes_d2[n2 * elementsCountAround + n1]) + trackSurfaceUreter1 = TrackSurface(elementsCount1, elementsCount2, nodesOnTrackSurface_x, + nodesOnTrackSurface_d1, nodesOnTrackSurface_d2) + + ureter1Position = trackSurfaceUreter1.createPositionProportion(ureterPositionAround, ureterPositionDown) + ureterElementPositionAround = ureter1Position.e1 + ureterElementPositionDown = ureter1Position.e2 + elementToDeleteStartIdx1 = elementsCountThroughWall * elementsCountAround * (ureterElementPositionDown - (0 if ureter1Position.xi2 > 0.5 else 1)) \ + + ureterElementPositionAround + (1 if ureter1Position.xi1 > 0.5 else 0) + + elementIndex = elementToDeleteStartIdx1 - elementsCountAround * ureterElementPositionDown + + # Create trackSurface at the outer layer of the bladder for ureter 2 + nodesOnTrackSurface2_x = [] + nodesOnTrackSurface2_d1 = [] + nodesOnTrackSurface2_d2 = [] + for n2 in range(elementsCountAlongBladder + 1): + for n1 in range(elementsCountAround // 2, elementsCountAround): + nodesOnTrackSurface2_x.append(outerNodes_x[n2 * elementsCountAround + n1]) + nodesOnTrackSurface2_d1.append(outerNodes_d1[n2 * elementsCountAround + n1]) + nodesOnTrackSurface2_d2.append(outerNodes_d2[n2 * elementsCountAround + n1]) + nodesOnTrackSurface2_x.append(outerNodes_x[n2 * elementsCountAround]) + nodesOnTrackSurface2_d1.append(outerNodes_d1[n2 * elementsCountAround]) + nodesOnTrackSurface2_d2.append(outerNodes_d2[n2 * elementsCountAround]) + + trackSurfaceUreter2 = TrackSurface(elementsCount1, elementsCount2, nodesOnTrackSurface2_x, + nodesOnTrackSurface2_d1, nodesOnTrackSurface2_d2) + ureter2Position = TrackSurfacePosition(elementsCountAround // 2 - ureterElementPositionAround + (-1 if ureter1Position.xi1 > 0 else 0), + ureterElementPositionDown, + (1 - ureter1Position.xi1) if ureter1Position.xi1 > 0 else ureter1Position.xi1, + ureter1Position.xi2) + if includeUreter: - elementsCount1 = elementsCountAround // 2 - elementsCount2 = elementsCountAlongBladder - # Create trackSurface at the outer layer of the bladder for ureter 1 - nodesOnTrackSurface_x = [] - nodesOnTrackSurface_d1 = [] - nodesOnTrackSurface_d2 = [] - for n2 in range(elementsCountAlongBladder + 1): - for n1 in range(elementsCountAround // 2 + 1): - nodesOnTrackSurface_x.append(outerNodes_x[n2 * elementsCountAround + n1]) - nodesOnTrackSurface_d1.append(outerNodes_d1[n2 * elementsCountAround + n1]) - nodesOnTrackSurface_d2.append(outerNodes_d2[n2 * elementsCountAround + n1]) - trackSurfaceUreter1 = TrackSurface(elementsCount1, elementsCount2, nodesOnTrackSurface_x, - nodesOnTrackSurface_d1, nodesOnTrackSurface_d2) - - ureter1Position = trackSurfaceUreter1.createPositionProportion(ureterPositionAround, ureterPositionDown) - ureterElementPositionAround = ureter1Position.e1 - ureterElementPositionDown = ureter1Position.e2 - elementToDeleteStartIdx1 = elementsCountThroughWall * elementsCountAround * (ureterElementPositionDown - (0 if ureter1Position.xi2 > 0.5 else 1)) \ - + ureterElementPositionAround + (1 if ureter1Position.xi1 > 0.5 else 0) - - elementIndex = elementToDeleteStartIdx1 - elementsCountAround * ureterElementPositionDown if ureterElementPositionAround > (elementsCountAround / 4): elementsCountVentral1 = (elementsCountAround // 4) else: elementsCountVentral1 = elementIndex - 1 - - # Create trackSurface at the outer layer of the bladder for ureter 2 - nodesOnTrackSurface2_x = [] - nodesOnTrackSurface2_d1 = [] - nodesOnTrackSurface2_d2 = [] - for n2 in range(elementsCountAlongBladder + 1): - for n1 in range(elementsCountAround // 2, elementsCountAround): - nodesOnTrackSurface2_x.append(outerNodes_x[n2 * elementsCountAround + n1]) - nodesOnTrackSurface2_d1.append(outerNodes_d1[n2 * elementsCountAround + n1]) - nodesOnTrackSurface2_d2.append(outerNodes_d2[n2 * elementsCountAround + n1]) - nodesOnTrackSurface2_x.append(outerNodes_x[n2 * elementsCountAround]) - nodesOnTrackSurface2_d1.append(outerNodes_d1[n2 * elementsCountAround]) - nodesOnTrackSurface2_d2.append(outerNodes_d2[n2 * elementsCountAround]) - - trackSurfaceUreter2 = TrackSurface(elementsCount1, elementsCount2, nodesOnTrackSurface2_x, - nodesOnTrackSurface2_d1, nodesOnTrackSurface2_d2) - ureter2Position = TrackSurfacePosition(elementsCountAround // 2 - ureterElementPositionAround + (-1 if ureter1Position.xi1 > 0 else 0), - ureterElementPositionDown, - (1 - ureter1Position.xi1) if ureter1Position.xi1 > 0 else ureter1Position.xi1, - ureter1Position.xi2) else: elementsCountVentral1 = elementsCountAround // 4 @@ -813,7 +814,7 @@ def generateBaseMesh(cls, region, options): ureterMeshGroup, bladderMeshGroup) # Apex annotation point - nodeIdentifier = nextNodeIdentifier + nodeIdentifier = nextNodeIdentifier + elementsCountAroundUreter * 4 * 2 + elementsCountAroundUreter * 2 * 2 * elementsCountUreterRadial idx = 1 element1 = mesh.findElementByIdentifier(idx) markerPoint = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) @@ -821,6 +822,60 @@ def generateBaseMesh(cls, region, options): markerName.assignString(cache, 'Apex of urinary bladder') markerLocation.assignMeshLocation(cache, element1, [0.0, 0.0, 1.0]) + # Markers for ureters + if includeUreter: + # Left ureter + nodeIdentifier += 1 + idx1 = elementsCountAlong * elementsCountAround + elementsCountAroundUreter + element1 = mesh.findElementByIdentifier(idx1) + markerUreter1Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) + cache.setNode(markerUreter1Point) + markerName.assignString(cache, 'ureter junction of bladder trigone') + markerLocation.assignMeshLocation(cache, element1, [0.0, 1.0, 1.0]) + # Right ureter + nodeIdentifier += 1 + idx2 = elementsCountAlong * elementsCountAround + 2 * elementsCountAroundUreter + element2 = mesh.findElementByIdentifier(idx2) + markerUreter2Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) + cache.setNode(markerUreter2Point) + markerName.assignString(cache, 'ureter junction of bladder trigone') + markerLocation.assignMeshLocation(cache, element2, [0.0, 1.0, 1.0]) + else: + # Left ureter + nodeIdentifier += 1 + idx1 = ureterElementPositionDown * elementsCountAround + ureterElementPositionAround + 1 + element1 = mesh.findElementByIdentifier(idx1) + markerUreter1Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) + cache.setNode(markerUreter1Point) + markerName.assignString(cache, 'ureter junction of bladder trigone') + markerLocation.assignMeshLocation(cache, element1, [ureter1Position.xi1, ureter1Position.xi2, 1.0]) + # Right ureter + nodeIdentifier += 1 + idx2 = ureterElementPositionDown * elementsCountAround + elementsCountAround - ureterElementPositionAround + element2 = mesh.findElementByIdentifier(idx2) + markerUreter2Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) + cache.setNode(markerUreter2Point) + markerName.assignString(cache, 'ureter junction of bladder trigone') + markerLocation.assignMeshLocation(cache, element2, [1-ureter1Position.xi1, ureter1Position.xi2, 1.0]) + + # Markers for urethra + # Dorsal + nodeIdentifier += 1 + idx1 = (elementsCountAlongBladder - 1) * elementsCountAround + elementsCountAround // 2 + element1 = mesh.findElementByIdentifier(idx1) + markerUreter1Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) + cache.setNode(markerUreter1Point) + markerName.assignString(cache, 'urethra junction with bladder dorsal') + markerLocation.assignMeshLocation(cache, element1, [1.0, 1.0, 1.0]) + # Ventral + nodeIdentifier += 1 + idx1 = (elementsCountAlongBladder - 1) * elementsCountAround + 1 + element1 = mesh.findElementByIdentifier(idx1) + markerUreter1Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) + cache.setNode(markerUreter1Point) + markerName.assignString(cache, 'urethra junction with bladder ventral') + markerLocation.assignMeshLocation(cache, element1, [0.0, 1.0, 1.0]) + fm.endChange() return annotationGroups From 5007f71b907233064974312346d0f9acdfb90aef Mon Sep 17 00:00:00 2001 From: Zohreh Ekhlasi Date: Mon, 22 Mar 2021 17:19:33 +1300 Subject: [PATCH 2/6] Minor changes in annotation. --- src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py index fde481e5..8729c5b3 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py @@ -265,7 +265,7 @@ def generateBaseMesh(cls, region, options): elementtemplate.defineField(coordinates, -1, eft) neckGroup = AnnotationGroup(region, get_bladder_term("neck of urinary bladder")) - bodyGroup = AnnotationGroup(region, get_bladder_term("Dome of the Bladder")) + bodyGroup = AnnotationGroup(region, get_bladder_term("dome of the Bladder")) urinaryBladderGroup = AnnotationGroup(region, get_bladder_term("urinary bladder")) annotationGroups = [neckGroup, bodyGroup, urinaryBladderGroup] @@ -863,7 +863,7 @@ def defineFaceAnnotations(cls, region, options, annotationGroups): # create 2d surface mesh groups fm = region.getFieldmodule() neckGroup = getAnnotationGroupForTerm(annotationGroups, get_bladder_term("neck of urinary bladder")) - bodyGroup = getAnnotationGroupForTerm(annotationGroups, get_bladder_term("Dome of the Bladder")) + bodyGroup = getAnnotationGroupForTerm(annotationGroups, get_bladder_term("dome of the Bladder")) urinaryBladderGroup = getAnnotationGroupForTerm(annotationGroups, get_bladder_term("urinary bladder")) mesh2d = fm.findMeshByDimension(2) is_exterior = fm.createFieldIsExterior() From 0caee728ca797ca706665c51917eb498ea212f7b Mon Sep 17 00:00:00 2001 From: Zohreh Ekhlasi Date: Mon, 22 Mar 2021 17:21:03 +1300 Subject: [PATCH 3/6] Minor changes in annotation. --- src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py index 8729c5b3..384a37e7 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_bladder1.py @@ -265,7 +265,7 @@ def generateBaseMesh(cls, region, options): elementtemplate.defineField(coordinates, -1, eft) neckGroup = AnnotationGroup(region, get_bladder_term("neck of urinary bladder")) - bodyGroup = AnnotationGroup(region, get_bladder_term("dome of the Bladder")) + bodyGroup = AnnotationGroup(region, get_bladder_term("dome of the bladder")) urinaryBladderGroup = AnnotationGroup(region, get_bladder_term("urinary bladder")) annotationGroups = [neckGroup, bodyGroup, urinaryBladderGroup] @@ -863,7 +863,7 @@ def defineFaceAnnotations(cls, region, options, annotationGroups): # create 2d surface mesh groups fm = region.getFieldmodule() neckGroup = getAnnotationGroupForTerm(annotationGroups, get_bladder_term("neck of urinary bladder")) - bodyGroup = getAnnotationGroupForTerm(annotationGroups, get_bladder_term("dome of the Bladder")) + bodyGroup = getAnnotationGroupForTerm(annotationGroups, get_bladder_term("dome of the bladder")) urinaryBladderGroup = getAnnotationGroupForTerm(annotationGroups, get_bladder_term("urinary bladder")) mesh2d = fm.findMeshByDimension(2) is_exterior = fm.createFieldIsExterior() From 1fb92aa128e7be58630767d0568c49d078b64af0 Mon Sep 17 00:00:00 2001 From: Zohreh Ekhlasi Date: Tue, 27 Apr 2021 05:37:12 +1200 Subject: [PATCH 4/6] Applied dic for markers and changed names. --- .../meshtypes/meshtype_3d_bladderurethra1.py | 87 ++++++------------- 1 file changed, 28 insertions(+), 59 deletions(-) diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py index da899529..fe3a97fb 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py @@ -813,68 +813,37 @@ def generateBaseMesh(cls, region, options): d2Final, nextNodeIdentifier, nextElementIdentifier, elementsCountUreterRadial, ureterMeshGroup, bladderMeshGroup) - # Apex annotation point - nodeIdentifier = nextNodeIdentifier + elementsCountAroundUreter * 4 * 2 + elementsCountAroundUreter * 2 * 2 * elementsCountUreterRadial - idx = 1 - element1 = mesh.findElementByIdentifier(idx) - markerPoint = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) - cache.setNode(markerPoint) - markerName.assignString(cache, 'Apex of urinary bladder') - markerLocation.assignMeshLocation(cache, element1, [0.0, 0.0, 1.0]) - - # Markers for ureters + # Define markers for apex, ureter and urethra junctions with bladder + idx1 = 1 + xi1 = [0.0, 0.0, 0.0] if includeUreter: - # Left ureter - nodeIdentifier += 1 - idx1 = elementsCountAlong * elementsCountAround + elementsCountAroundUreter - element1 = mesh.findElementByIdentifier(idx1) - markerUreter1Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) - cache.setNode(markerUreter1Point) - markerName.assignString(cache, 'ureter junction of bladder trigone') - markerLocation.assignMeshLocation(cache, element1, [0.0, 1.0, 1.0]) - # Right ureter - nodeIdentifier += 1 - idx2 = elementsCountAlong * elementsCountAround + 2 * elementsCountAroundUreter - element2 = mesh.findElementByIdentifier(idx2) - markerUreter2Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) - cache.setNode(markerUreter2Point) - markerName.assignString(cache, 'ureter junction of bladder trigone') - markerLocation.assignMeshLocation(cache, element2, [0.0, 1.0, 1.0]) + idx2 = elementsCountAlong * elementsCountAround + elementsCountAroundUreter + idx3 = elementsCountAlong * elementsCountAround + 2 * elementsCountAroundUreter + xi2 = [0.0, 1.0, 0.0] + xi3 = [0.0, 1.0, 0.0] else: - # Left ureter - nodeIdentifier += 1 - idx1 = ureterElementPositionDown * elementsCountAround + ureterElementPositionAround + 1 - element1 = mesh.findElementByIdentifier(idx1) - markerUreter1Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) - cache.setNode(markerUreter1Point) - markerName.assignString(cache, 'ureter junction of bladder trigone') - markerLocation.assignMeshLocation(cache, element1, [ureter1Position.xi1, ureter1Position.xi2, 1.0]) - # Right ureter + idx2 = ureterElementPositionDown * elementsCountAround * elementsCountThroughWall + ureterElementPositionAround + 1 + idx3 = ureterElementPositionDown * elementsCountAround * elementsCountThroughWall + elementsCountAround - ureterElementPositionAround + xi2 = [ureter1Position.xi1, ureter1Position.xi2, 0.0] + xi3 = [1 - ureter1Position.xi1, ureter1Position.xi2, 0.0] + idx4 = (elementsCountAlongBladder - 1) * elementsCountAround * elementsCountThroughWall + elementsCountAround // 2 + xi4 = [1.0, 1.0, 0.0] + idx5 = (elementsCountAlongBladder - 1) * elementsCountAround * elementsCountThroughWall + 1 + xi5 = [0.0, 1.0, 0.0] + + element_id = [idx1, idx2, idx3, idx4, idx5] + xi = [xi1, xi2, xi3, xi4, xi5] + marker_dic = {"name": ["Apex of urinary bladder", " left ureter junction with bladder", "right ureter junction with bladder", + "urethra junction with bladder dorsal", "urethra junction with bladder ventral"], "element_id": element_id, "xi": xi} + + nodeIdentifier = nextNodeIdentifier + elementsCountAroundUreter * 4 * 2 + elementsCountAroundUreter * 2 * 2 * elementsCountUreterRadial + for n in range(len(marker_dic["name"])): + element1 = mesh.findElementByIdentifier(marker_dic["element_id"][n]) + markerPoint = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) + cache.setNode(markerPoint) + markerName.assignString(cache, (marker_dic["name"][n])) + markerLocation.assignMeshLocation(cache, element1, marker_dic["xi"][n]) nodeIdentifier += 1 - idx2 = ureterElementPositionDown * elementsCountAround + elementsCountAround - ureterElementPositionAround - element2 = mesh.findElementByIdentifier(idx2) - markerUreter2Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) - cache.setNode(markerUreter2Point) - markerName.assignString(cache, 'ureter junction of bladder trigone') - markerLocation.assignMeshLocation(cache, element2, [1-ureter1Position.xi1, ureter1Position.xi2, 1.0]) - - # Markers for urethra - # Dorsal - nodeIdentifier += 1 - idx1 = (elementsCountAlongBladder - 1) * elementsCountAround + elementsCountAround // 2 - element1 = mesh.findElementByIdentifier(idx1) - markerUreter1Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) - cache.setNode(markerUreter1Point) - markerName.assignString(cache, 'urethra junction with bladder dorsal') - markerLocation.assignMeshLocation(cache, element1, [1.0, 1.0, 1.0]) - # Ventral - nodeIdentifier += 1 - idx1 = (elementsCountAlongBladder - 1) * elementsCountAround + 1 - element1 = mesh.findElementByIdentifier(idx1) - markerUreter1Point = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) - cache.setNode(markerUreter1Point) - markerName.assignString(cache, 'urethra junction with bladder ventral') - markerLocation.assignMeshLocation(cache, element1, [0.0, 1.0, 1.0]) fm.endChange() return annotationGroups From ed7ced7cf8a0f987a38a8710231e150e5a7f85c6 Mon Sep 17 00:00:00 2001 From: Zohreh Ekhlasi Date: Tue, 11 May 2021 14:41:35 +1200 Subject: [PATCH 5/6] Added marker annotations to bladder terms. --- src/scaffoldmaker/annotation/bladder_terms.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scaffoldmaker/annotation/bladder_terms.py b/src/scaffoldmaker/annotation/bladder_terms.py index 9b08c5f1..920f5d94 100644 --- a/src/scaffoldmaker/annotation/bladder_terms.py +++ b/src/scaffoldmaker/annotation/bladder_terms.py @@ -36,7 +36,12 @@ ("ventral part of serosa of urethra", "ILX:0739306"), ("ventral part of serosa of urinary bladder", "ILX:0739249"), ("ventral part of bladder", "None"), - ("ventral part of urethra", "ILX:0739259") + ("ventral part of urethra", "ILX:0739259"), + ("apex of urinary bladder", "ILX:0774405"), + ("left ureter junction with bladder", "None"), + ("right ureter junction with bladder", "None"), + ("urethra junction with bladder dorsal", "None"), + ("urethra junction with bladder ventral", "None") ] def get_bladder_term(name : str): From 46b2149b72f3e09ee6920bdba2bb37ffd54e1436 Mon Sep 17 00:00:00 2001 From: Zohreh Ekhlasi Date: Tue, 11 May 2021 14:43:48 +1200 Subject: [PATCH 6/6] Added markers to their own group, the marker group and the whole bladder annotation group. --- .../meshtypes/meshtype_3d_bladderurethra1.py | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py b/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py index fe3a97fb..ea8eea9d 100644 --- a/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py +++ b/src/scaffoldmaker/meshtypes/meshtype_3d_bladderurethra1.py @@ -814,35 +814,47 @@ def generateBaseMesh(cls, region, options): ureterMeshGroup, bladderMeshGroup) # Define markers for apex, ureter and urethra junctions with bladder + apexGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, get_bladder_term("apex of urinary bladder")) + leftUreterGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, get_bladder_term("left ureter junction with bladder")) + rightUreterGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, get_bladder_term("right ureter junction with bladder")) + dorsalUrethraGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, get_bladder_term("urethra junction with bladder dorsal")) + ventralUrethraGroup = findOrCreateAnnotationGroupForTerm(annotationGroups, region, get_bladder_term("urethra junction with bladder ventral")) + idx1 = 1 xi1 = [0.0, 0.0, 0.0] + markerList = [] + markerList.append({"group": apexGroup, "elementId": idx1, "xi": xi1}) if includeUreter: idx2 = elementsCountAlong * elementsCountAround + elementsCountAroundUreter - idx3 = elementsCountAlong * elementsCountAround + 2 * elementsCountAroundUreter xi2 = [0.0, 1.0, 0.0] + markerList.append({"group": leftUreterGroup, "elementId": idx2, "xi": xi2}) + idx3 = elementsCountAlong * elementsCountAround + 2 * elementsCountAroundUreter xi3 = [0.0, 1.0, 0.0] + markerList.append({"group": rightUreterGroup, "elementId": idx3, "xi": xi3}) else: idx2 = ureterElementPositionDown * elementsCountAround * elementsCountThroughWall + ureterElementPositionAround + 1 - idx3 = ureterElementPositionDown * elementsCountAround * elementsCountThroughWall + elementsCountAround - ureterElementPositionAround xi2 = [ureter1Position.xi1, ureter1Position.xi2, 0.0] + markerList.append({"group": leftUreterGroup, "elementId": idx2, "xi": xi2}) + idx3 = ureterElementPositionDown * elementsCountAround * elementsCountThroughWall + elementsCountAround - ureterElementPositionAround xi3 = [1 - ureter1Position.xi1, ureter1Position.xi2, 0.0] + markerList.append({"group": rightUreterGroup, "elementId": idx3, "xi": xi3}) idx4 = (elementsCountAlongBladder - 1) * elementsCountAround * elementsCountThroughWall + elementsCountAround // 2 xi4 = [1.0, 1.0, 0.0] + markerList.append({"group": dorsalUrethraGroup, "elementId": idx4, "xi": xi4}) idx5 = (elementsCountAlongBladder - 1) * elementsCountAround * elementsCountThroughWall + 1 xi5 = [0.0, 1.0, 0.0] - - element_id = [idx1, idx2, idx3, idx4, idx5] - xi = [xi1, xi2, xi3, xi4, xi5] - marker_dic = {"name": ["Apex of urinary bladder", " left ureter junction with bladder", "right ureter junction with bladder", - "urethra junction with bladder dorsal", "urethra junction with bladder ventral"], "element_id": element_id, "xi": xi} + markerList.append({"group": ventralUrethraGroup, "elementId": idx5, "xi": xi5}) nodeIdentifier = nextNodeIdentifier + elementsCountAroundUreter * 4 * 2 + elementsCountAroundUreter * 2 * 2 * elementsCountUreterRadial - for n in range(len(marker_dic["name"])): - element1 = mesh.findElementByIdentifier(marker_dic["element_id"][n]) + bladderNodesetGroup = bladderGroup.getNodesetGroup(nodes) + for marker in markerList: + annotationGroup = marker["group"] markerPoint = markerPoints.createNode(nodeIdentifier, markerTemplateInternal) cache.setNode(markerPoint) - markerName.assignString(cache, (marker_dic["name"][n])) - markerLocation.assignMeshLocation(cache, element1, marker_dic["xi"][n]) + markerLocation.assignMeshLocation(cache, mesh.findElementByIdentifier(marker["elementId"]), marker["xi"]) + markerName.assignString(cache, annotationGroup.getName()) + annotationGroup.getNodesetGroup(nodes).addNode(markerPoint) + bladderNodesetGroup.addNode(markerPoint) nodeIdentifier += 1 fm.endChange()