Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple annotation groups #80

Merged
merged 3 commits into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions src/scaffoldmaker/meshtypes/meshtype_3d_cecum1.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,19 +368,17 @@ def generateBaseMesh(cls, region, options):

# Create annotation
cecumGroup = AnnotationGroup(region, get_colon_term("caecum"))
annotationGroups = [cecumGroup]

annotationArrayAlong = []
annotationGroupsAlong = []
for i in range(elementsCountAlong):
annotationArrayAlong.append(['caecum'])
annotationGroupsAlong.append([cecumGroup])

annotationArrayThroughWall = []
annotationGroupsThroughWall = []
for i in range(elementsCountThroughWall):
annotationArrayThroughWall.append([''])
annotationGroupsThroughWall.append([ ])

for nSegment in range(segmentCount):
# Make regular segments
xInner, d1Inner, d2Inner, transitElementList, segmentAxis, annotationGroupsAround, annotationArrayAround \
xInner, d1Inner, d2Inner, transitElementList, segmentAxis, annotationGroupsAround \
= colonSegmentTubeMeshInnerPoints.getColonSegmentTubeMeshInnerPoints(nSegment)

# Replace first half of first segment with apex and sample along apex and second half of segment
Expand Down Expand Up @@ -428,7 +426,6 @@ def generateBaseMesh(cls, region, options):
zRefList, innerRadiusAlongCecum, closedProximalEnd)

# Create coordinates and derivatives
annotationGroups += annotationGroupsAround
wallThicknessList = [wallThickness] * (elementsCountAlong + 1)

xList, d1List, d2List, d3List, curvatureList = tubemesh.getCoordinatesFromInner(xWarpedList, d1WarpedList,
Expand Down Expand Up @@ -470,24 +467,23 @@ def generateBaseMesh(cls, region, options):
# Create nodes and elements
if tcThickness > 0:
tubeTCWidthList = colonSegmentTubeMeshInnerPoints.getTubeTCWidthList()
xCecum, d1Cecum, d2Cecum, d3Cecum, annotationGroups, annotationArrayAround = getTeniaColi(
xCecum, d1Cecum, d2Cecum, d3Cecum, annotationGroupsAround = getTeniaColi(
region, xCecum, d1Cecum, d2Cecum, d3Cecum, curvatureList, tcCount, elementsCountAroundTC,
elementsCountAroundHaustrum, elementsCountAlong, elementsCountThroughWall,
tubeTCWidthList, tcThickness, sxRefList, annotationGroups, annotationArrayAround,
closedProximalEnd)
tubeTCWidthList, tcThickness, sxRefList, annotationGroupsAround, closedProximalEnd)

nextNodeIdentifier, nextElementIdentifier, annotationGroups = createNodesAndElementsTeniaColi(
region, xCecum, d1Cecum, d2Cecum, d3Cecum, xFlat, d1Flat, d2Flat, xTexture, d1Texture, d2Texture,
elementsCountAroundTC, elementsCountAroundHaustrum, elementsCountAlong, elementsCountThroughWall,
tcCount, annotationGroups, annotationArrayAround, annotationArrayAlong, annotationArrayThroughWall,
tcCount, annotationGroupsAround, annotationGroupsAlong, annotationGroupsThroughWall,
firstNodeIdentifier, firstElementIdentifier, useCubicHermiteThroughWall, useCrossDerivatives,
closedProximalEnd)

else:
nextNodeIdentifier, nextElementIdentifier, annotationGroups = tubemesh.createNodesAndElements(
region, xCecum, d1Cecum, d2Cecum, d3Cecum, xFlat, d1Flat, d2Flat, xTexture, d1Texture, d2Texture,
elementsCountAround, elementsCountAlong, elementsCountThroughWall,
annotationGroups, annotationArrayAround, annotationArrayAlong, annotationArrayThroughWall,
annotationGroupsAround, annotationGroupsAlong, annotationGroupsThroughWall,
firstNodeIdentifier, firstElementIdentifier, useCubicHermiteThroughWall, useCrossDerivatives,
closedProximalEnd)

Expand Down
44 changes: 18 additions & 26 deletions src/scaffoldmaker/meshtypes/meshtype_3d_colon1.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,47 +441,41 @@ def generateBaseMesh(cls, region, options):
elementsAlongInDistal = elementsCountAlong - elementsAlongInProximal - elementsAlongInTransverse
elementsCountAlongGroups = [elementsAlongInProximal, elementsAlongInTransverse, elementsAlongInDistal]

annotationGroups = []
colonGroup = AnnotationGroup(region, get_colon_term("colon"))
annotationGroupsAlong = [colonGroup]

if tcCount == 1:
proximalGroup = AnnotationGroup(region, get_colon_term("proximal colon"))
transverseGroup = AnnotationGroup(region, get_colon_term("transverse colon"))
distalGroup = AnnotationGroup(region, get_colon_term("distal colon"))
annotationGroupsAlong += [proximalGroup, transverseGroup, distalGroup]
annotationGroupNamesAlong = [['colon', 'proximal colon'],
['colon', 'transverse colon'],
['colon', 'distal colon']]
rchristie marked this conversation as resolved.
Show resolved Hide resolved
annotationGroupAlong = [[colonGroup, proximalGroup],
[colonGroup, transverseGroup],
[colonGroup, distalGroup]]

elif tcCount == 2:
spiralGroup = AnnotationGroup(region, get_colon_term("spiral colon"))
transverseGroup = AnnotationGroup(region, get_colon_term("transverse colon"))
distalGroup = AnnotationGroup(region, get_colon_term("distal colon"))
annotationGroupsAlong += [spiralGroup, transverseGroup, distalGroup]
annotationGroupNamesAlong = [['colon', 'spiral colon'],
['colon', 'transverse colon'],
['colon', 'distal colon']]
annotationGroupAlong = [[colonGroup, spiralGroup],
[colonGroup, transverseGroup],
[colonGroup, distalGroup]]

elif tcCount == 3:
ascendingGroup = AnnotationGroup(region, get_colon_term("ascending colon"))
transverseGroup = AnnotationGroup(region, get_colon_term("transverse colon"))
descendingGroup = AnnotationGroup(region, get_colon_term("descending colon"))
annotationGroupsAlong += [ascendingGroup, transverseGroup, descendingGroup]
annotationGroupNamesAlong = [['colon', 'ascending colon'],
['colon', 'transverse colon'],
['colon', 'descending colon']]
annotationGroupAlong = [[colonGroup, ascendingGroup],
[colonGroup, transverseGroup],
[colonGroup, descendingGroup]]

annotationGroups += annotationGroupsAlong
annotationArrayAlong = []
annotationGroupsAlong = []
for i in range(len(elementsCountAlongGroups)):
elementsCount = elementsCountAlongGroups[i]
for n in range(elementsCount):
annotationArrayAlong.append(annotationGroupNamesAlong[i])
annotationGroupsAlong.append(annotationGroupAlong[i])

annotationArrayThroughWall = []
annotationGroupsThroughWall = []
for i in range(elementsCountThroughWall):
annotationArrayThroughWall.append([''])
annotationGroupsThroughWall.append([ ])

xExtrude = []
d1Extrude = []
Expand All @@ -499,7 +493,7 @@ def generateBaseMesh(cls, region, options):

for nSegment in range(segmentCount):
# Create inner points
xInner, d1Inner, d2Inner, transitElementList, segmentAxis, annotationGroupsAround, annotationArrayAround\
xInner, d1Inner, d2Inner, transitElementList, segmentAxis, annotationGroupsAround \
= colonSegmentTubeMeshInnerPoints.getColonSegmentTubeMeshInnerPoints(nSegment)

# Project reference point for warping onto central path
Expand All @@ -525,8 +519,6 @@ def generateBaseMesh(cls, region, options):

contractedWallThicknessList = colonSegmentTubeMeshInnerPoints.getContractedWallThicknessList()

annotationGroups += annotationGroupsAround

# Create coordinates and derivatives
xList, d1List, d2List, d3List, curvatureList = tubemesh.getCoordinatesFromInner(xExtrude, d1Extrude,
d2Extrude, d3UnitExtrude, contractedWallThicknessList,
Expand All @@ -538,10 +530,10 @@ def generateBaseMesh(cls, region, options):

if tcThickness > 0:
tubeTCWidthList = colonSegmentTubeMeshInnerPoints.getTubeTCWidthList()
xList, d1List, d2List, d3List, annotationGroups, annotationArrayAround = getTeniaColi(
xList, d1List, d2List, d3List, annotationArrayAround = getTeniaColi(
region, xList, d1List, d2List, d3List, curvatureList, tcCount, elementsCountAroundTC,
elementsCountAroundHaustrum, elementsCountAlong, elementsCountThroughWall,
tubeTCWidthList, tcThickness, sxRefExtrudeList, annotationGroups, annotationArrayAround,
tubeTCWidthList, tcThickness, sxRefExtrudeList, annotationGroupsAround,
closedProximalEnd)

# Create flat and texture coordinates
Expand All @@ -554,7 +546,7 @@ def generateBaseMesh(cls, region, options):
nextNodeIdentifier, nextElementIdentifier, annotationGroups = createNodesAndElementsTeniaColi(
region, xList, d1List, d2List, d3List, xFlat, d1Flat, d2Flat, xTexture, d1Texture, d2Texture,
elementsCountAroundTC, elementsCountAroundHaustrum, elementsCountAlong, elementsCountThroughWall,
tcCount, annotationGroups, annotationArrayAround, annotationArrayAlong, annotationArrayThroughWall,
tcCount, annotationGroupsAround, annotationGroupsAlong, annotationGroupsThroughWall,
firstNodeIdentifier, firstElementIdentifier, useCubicHermiteThroughWall, useCrossDerivatives,
closedProximalEnd)

Expand All @@ -568,7 +560,7 @@ def generateBaseMesh(cls, region, options):
nextNodeIdentifier, nextElementIdentifier, annotationGroups = tubemesh.createNodesAndElements(
region, xList, d1List, d2List, d3List, xFlat, d1Flat, d2Flat, xTexture, d1Texture, d2Texture,
elementsCountAround, elementsCountAlong, elementsCountThroughWall,
annotationGroups, annotationArrayAround, annotationArrayAlong, annotationArrayThroughWall,
annotationGroupsAround, annotationGroupsAlong, annotationGroupsThroughWall,
firstNodeIdentifier, firstElementIdentifier, useCubicHermiteThroughWall, useCrossDerivatives,
closedProximalEnd)

Expand Down
Loading