Ejemplo n.º 1
0
def cylinderEnergyObjective(inputcoordinates, grad):
    global numOfLayer, alpha, beta, pressure, cell, functionCallCounter, bendingThreshold
    functionCallCounter += 1
    #making of hexagonal lattic
    #Reshape the tempcoordinates, to x-y-z arrays
    tempcoordinates = inputcoordinates.reshape((3, numberofvertices))
    ####iterating the vertices to feed the new coordinates in
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    counter = 0  #counter to change vertex positions
    while vertex != None:
        vertex.setRcoordinate(tempcoordinates[0,
                                              counter])  #setting x coordinate
        vertex.setThetacoordinate(
            tempcoordinates[1, counter])  #setting y coordinate
        vertex.setZcoordinate(tempcoordinates[2,
                                              counter])  #setting z coordinate
        counter += 1
        vertex = vertices.next()
    ######################################################
    #cell = settingParameters(cell)
    cell.setCartesian()  #SETTING THE CARTESIAN COORDINATES FROM CYLINDRICAL
    cell.setParameters()
    ######################################################
    #returning the total energy
    energyvalue = cell.getEnergyCartesianVolume()
    ###Checking if the Fourth Term (Bending Energy ) has crossed the threshold
    if cell.getFourthTerm() > bendingThreshold:
        print "Fourth term greater than threshold : ", cell.getFourthTerm()
        energyvalue = float('inf')  #returning Infinite value
    #else return normal
    return energyvalue
def cartesianEnergyObjective(inputcoordinates,grad):
    global numOfLayer, alpha, beta, pressure, cell, functionCallCounter,bendingThreshold
    functionCallCounter += 1
    #making of hexagonal lattic
    #Reshape the tempcoordinates, to x-y-z arrays
    tempcoordinates = inputcoordinates.reshape((3,numberofvertices))
    ####iterating the vertices to feed the new coordinates in
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    counter = 0#counter to change vertex positions
    while vertex != None:
        vertex.setXcoordinate(tempcoordinates[0,counter])#setting x coordinate
        vertex.setYcoordinate(tempcoordinates[1,counter])#setting y coordinate
        vertex.setZcoordinate(tempcoordinates[2,counter])#setting z coordinate
        counter += 1
        vertex = vertices.next()
    ######################################################
    #cell = settingParameters(cell)
    cell.setParameters()
    ######################################################
    #Checking the Bans : fourtherm < bending energy & Cell is Convex ! 
    """
    fourthterm = cell.getFourthTerm()
    bendingThreshold = cell.getBendingThreshold()
    if (fourthterm > bendingThreshold):
      return float('inf')
    if not (cell.isConvex()): #if cell is not convex
      return float('inf')
    """
    #returning the total energy
    energyvalue = cell.getEnergyCartesianVolume()
    return energyvalue
Ejemplo n.º 3
0
def energyobjective(inputcoordinates, grad):
    global numOfLayer, alpha, beta, pressure, cell, functionCallCounter
    functionCallCounter += 1
    #making of hexagonal lattic
    #Reshape the tempcoordinates, to x-y-z arrays
    tempcoordinates = inputcoordinates.reshape((3, numberofvertices))
    ####iterating the vertices to feed the new coordinates in
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    counter = 0  #counter to change vertex positions
    while vertex != None:
        vertex.setXcoordinate(tempcoordinates[0,
                                              counter])  #setting x coordinate
        vertex.setYcoordinate(tempcoordinates[1,
                                              counter])  #setting y coordinate
        vertex.setZcoordinate(tempcoordinates[2,
                                              counter])  #setting z coordinate
        counter += 1
        vertex = vertices.next()
    #####################################################
    cell = settingParameters(cell)
    ######################################################
    #returning the total energy
    energyvalue = cell.getEnergyCartesianVolume()
    #release the current cell
    #printing the counter and if the passed value is different than the previous values passed
    #print maincounter, energyvalue
    #print np.subtract(tempcoordinates, tempcoordstore)
    return energyvalue
def getMeanRadius(cell):
	vertices = qd.CellVertexIterator(cell)
	vertex = vertices.next()
	countVertex = cell.countVertices()
	radiusArray = np.zeros(countVertex)
	counter = 0
	while vertex != None:
		radiusArray[counter] = np.sqrt(vertex.getXcoordinate()**2+vertex.getYcoordinate()**2)
		counter += 1
		vertex = vertices.next()
	return radiusArray
def getTissueHeight(cell):
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    vertnum = cell.countVertices()
    zArray = np.zeros(vertnum)
    counter = 0
    while vertex != None:
        zArray[counter] = vertex.getZcoordinate()
        counter += 1
        vertex = vertices.next()
    ######################################
    return np.max(zArray)
Ejemplo n.º 6
0
def termsofenergy(inputcoordinates):
    global maincounter, numOfLayer, alpha, beta, pressure, cell
    #making of hexagonal lattice
    maincounter += 1
    #Reshape the tempcoordinates, to x-y-z arrays
    tempcoordinates = inputcoordinates.reshape((3, numberofvertices))
    #to store the deformation on the cells
    faceids = []
    deformations = []
    ####iterating the vertices to feed the new coordinates in
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    counter = 0  #counter to change vertex positions
    while vertex != None:
        vertex.setXcoordinate(tempcoordinates[0,
                                              counter])  #setting x coordinate
        vertex.setYcoordinate(tempcoordinates[1,
                                              counter])  #setting y coordinate
        vertex.setZcoordinate(tempcoordinates[2,
                                              counter])  #setting z coordinate
        counter += 1
        vertex = vertices.next()
    #####################################################
    #cell = settingParameters(cell)
    cell.setParameters()
    #####################################################
    #calculating the deformation of Area
    faces = qd.CellFaceIterator(cell)
    face1 = faces.next()
    while face1 != None:
        if face1.getID() == 1:
            face1 = faces.next()
            continue
        #print face1.getID()
        targetarea = face1.getTargetArea()
        currentarea = face1.getAreaOfFace()
        #print "targetarea :", targetarea, "current area: ",currentarea, "difference :",targetarea-currentarea
        #change of area (strain on area %)
        faceids.append(face1.getID())
        deformations.append(100 * (currentarea - targetarea) / targetarea)
        face1 = faces.next()
    ######################################################
    #returning the total energy
    first = cell.getFirstTerm()
    second = cell.getSecondTerm()
    third = cell.getThirdTerm()
    fourth = cell.getFourthTerm()
    volume = cell.getVolume()
    #release the current cell
    #printing the counter and if the passed value is different than the previous values passed
    #print maincounter, energyvalue
    #print np.subtract(tempcoordinates, tempcoordstore)
    return [first, second, third, volume, [faceids, deformations], fourth]
def getEdge(cell, vert1id, vert2id):
	vertices = qd.CellVertexIterator(cell)
	vertex = vertices.next()
	while vertex != None:
		if vertex.getID() == vert1id:
			break
		vertex= vertices.next()
	###################################
	edges = qd.VertexEdgeIterator(vertex)
	edge = edges.next()
	while edge != None:
		if edge.Dest().getID() == vert2id:
			break
		edge = edges.next()
	return edge
Ejemplo n.º 8
0
def getCoordinates(cell):
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    vertexid = np.array([])
    xcoord = np.array([])
    ycoord = np.array([])
    zcoord = np.array([])
    while vertex != None:
        #saving the ids
        vertexid = np.append(vertexid, vertex.getID())
        xcoord = np.append(xcoord, vertex.getXcoordinate())
        ycoord = np.append(ycoord, vertex.getYcoordinate())
        zcoord = np.append(zcoord, vertex.getZcoordinate())
        vertex = vertices.next()
    coordinates = np.concatenate((xcoord, ycoord, zcoord))
    return coordinates
def cartesianEnergyObjective(inputcoordinates, grad):
    global numOfLayer, alpha, beta, pressure, cell, functionCallCounter, bendingThreshold, meanFormMatrix
    #making of hexagonal lattic
    #Reshape the tempcoordinates, to x-y-z arrays
    ####iterating the vertices to feed the new coordinates in
    tempcoordinates = inputcoordinates.reshape((3, numberofvertices))
    ####iterating the vertices to feed the new coordinates in
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    counter = 0  #counter to change vertex positions
    while vertex != None:
        vertex.setXcoordinate(tempcoordinates[0,
                                              counter])  #setting x coordinate
        vertex.setYcoordinate(tempcoordinates[1,
                                              counter])  #setting y coordinate
        vertex.setZcoordinate(tempcoordinates[2,
                                              counter])  #setting z coordinate
        counter += 1
        vertex = vertices.next()
    ######################################################
    #cell = settingParameters(cell)
    cell.setParameters()
    ######################################################
    faces = qd.CellFaceIterator(cell)
    face = faces.next()
    faceFormMatrix = np.zeros((2, 2))
    energyvalue = 0.
    while face != None:
        faceFormMatrix[0, 0] = qd.getCurrentFormMatrix(face, 0, 0)
        faceFormMatrix[0, 1] = qd.getCurrentFormMatrix(face, 0, 1)
        faceFormMatrix[1, 0] = qd.getCurrentFormMatrix(face, 1, 0)
        faceFormMatrix[1, 1] = qd.getCurrentFormMatrix(face, 1, 1)
        #####################
        differenceMatrix = faceFormMatrix - meanFormMatrix
        #####################
        differenceMatrix = np.power(differenceMatrix, 2)
        energyvalue += np.sum(differenceMatrix)
        face = faces.next()
    ######################################################
    #returning the total energy
    return energyvalue
def getXBandBoundsForOptimization(cell,radius, perimeterVertexNum=0, Length = 1):
    #getting the coordinates of the cell
    ##intial parameters for optimization, the coordiantes of vertices
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    #vertexid = np.array([])
    xcoord = np.array([])
    ycoord = np.array([])
    zcoord = np.array([])
    while vertex != None: 
        #saving the ids
        #vertexid = np.append(vertexid, vertex.getID())
        xcoord = np.append(xcoord, vertex.getXcoordinate())
        ycoord = np.append(ycoord, vertex.getYcoordinate())
        zcoord = np.append(zcoord, vertex.getZcoordinate())
        vertex = vertices.next()
    coordinates = np.concatenate((xcoord,ycoord,zcoord))
    numberofvertices = cell.countVertices()
    #print "lenght of xcoord : ", len(xcoord), "totalvertex", totalvertex
    basefreedom = 2*(radius+1)#in this case: we just let the vertices in the boundary move freely in their own X-Y plane
    epsbasefreedom = (1./20)*(2.*np.pi*radius)/perimeterVertexNum#vertex is allowed to move 5% of average perimeter side length
    print "Bounding X-Band cells to not move"
    #print "basefreedom", basefreedom
    #print "epsbasefreedom", epsbasefreedom
    fac = 6
    #boundary set so that outer (periphery) vertices do not move
    uboundsx = np.zeros((numberofvertices))
    uboundsy = np.zeros((numberofvertices))
    uboundsz = np.zeros((numberofvertices))
    lboundsx = np.zeros((numberofvertices))
    lboundsy = np.zeros((numberofvertices))
    lboundsz = np.zeros((numberofvertices))
    ###############################
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    vertcounter = 0
    while vertex != None: 
        currentvertid = vertex.getID()
        #print vertcounter, " -> ",currentvertid
        ##       DOME VERTEX    X##########
        if vertex.getDomePosition():#If domePosition == True -> then Vertex is in Dome
            uboundsx[vertcounter] = fac*radius
            uboundsy[vertcounter] = fac*radius
            uboundsz[vertcounter] = fac*radius
            lboundsx[vertcounter] = -fac*radius
            lboundsy[vertcounter] = -fac*radius
            lboundsz[vertcounter] = 0.
        else:## #If domePosition == False -> then Vertex is in Cylindrical Flanks
            ##     Cylinder VERTEX    X##########
            uboundsx[vertcounter] = xcoord[vertcounter]
            uboundsy[vertcounter] = ycoord[vertcounter]
            uboundsz[vertcounter] = zcoord[vertcounter] + Length#z-coordinates are allowed to move by 1 side lenght up or down
            lboundsx[vertcounter] = xcoord[vertcounter]
            lboundsy[vertcounter] = ycoord[vertcounter]
            lboundsz[vertcounter] = ((zcoord[vertcounter] - Length)>0)*(zcoord[vertcounter] - Length)#z-coordinates are allowed to move by 1 side length up or down or until z >= 0
        vertcounter += 1
        vertex = vertices.next()
    ###base cells###
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    vertcounter = 0
    while vertex != None: 
        currentvertid = vertex.getID()
        if checkExternalVertex(vertex):#if the vertex is external vertex then new bounds applied
            uboundsx[vertcounter] = xcoord[vertcounter]
            uboundsy[vertcounter] = ycoord[vertcounter]
            uboundsz[vertcounter] = zcoord[vertcounter]
            lboundsx[vertcounter] = xcoord[vertcounter]
            lboundsy[vertcounter] = ycoord[vertcounter]
            lboundsz[vertcounter] = zcoord[vertcounter]
        elif checkXBand(vertex):#True : if this vertex belongs to face on X-band
            uboundsx[vertcounter] = xcoord[vertcounter]
            uboundsy[vertcounter] = ycoord[vertcounter]
            uboundsz[vertcounter] = zcoord[vertcounter]
            lboundsx[vertcounter] = xcoord[vertcounter]
            lboundsy[vertcounter] = ycoord[vertcounter]
            lboundsz[vertcounter] = zcoord[vertcounter]
        vertex = vertices.next()
        vertcounter += 1
    ### Upper bounds ###
    upperbounds = np.concatenate((uboundsx,uboundsy,uboundsz))
    ##Lower bounds
    lowerbounds = np.concatenate((lboundsx,lboundsy,lboundsz))
    return (upperbounds, lowerbounds)
 #appending to the terms array
 firsttermarray = np.append(firsttermarray, tempterms[0])
 secondtermarray = np.append(secondtermarray, tempterms[1])
 thirdtermarray = np.append(thirdtermarray, tempterms[2])
 volumearray = np.append(volumearray, tempterms[3])
 deformations = tempterms[4]#taking the deformation datas
 meanDeformation = np.append(meanDeformation, np.mean(np.array(deformations[1])))
 stdDeformation = np.append(stdDeformation, np.std(np.array(deformations[1])))
 fourthtermarray = np.append(fourthtermarray,tempterms[5])
 #rearraging the optimizer 1D output to 3xN array
 ###########################################################################################
 #   Putting New Vertex Coordinates In The Vertices On The CELL 
 ###########################################################################################
 newvertexpositions = xopt.reshape((3,numberofvertices))
 #setting the vertices of cell with new coordinates
 vertices = qd.CellVertexIterator(cell)
 vertex = vertices.next()
 counter = 0#counter to change vertex positions
 while vertex != None:
     vertex.setXcoordinate(newvertexpositions[0,counter])#setting x coordinate
     vertex.setYcoordinate(newvertexpositions[1,counter])#setting y coordinate
     vertex.setZcoordinate(newvertexpositions[2,counter])#setting z coordinate
     counter += 1
     vertex = vertices.next()
 cell.setParameters()
 ###################################################################################################
 ###                            PERFORMING GROWTH                                               ####
 ###################################################################################################
 print "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
 print "     Performing growth       STEP : : ", growthcounter
 print "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
Ejemplo n.º 12
0
def energyobjective(inputcoordinates, grad):
    global maincounter, numOfLayer, alpha, beta, pressure, cell
    #making of hexagonal lattice
    maincounter += 1
    #Reshape the tempcoordinates, to x-y-z arrays
    tempcoordinates = inputcoordinates.reshape((3, numberofvertices))
    ####iterating the vertices to feed the new coordinates in
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    counter = 0  #counter to change vertex positions
    while vertex != None:
        vertex.setXcoordinate(tempcoordinates[0,
                                              counter])  #setting x coordinate
        vertex.setYcoordinate(tempcoordinates[1,
                                              counter])  #setting y coordinate
        vertex.setZcoordinate(tempcoordinates[2,
                                              counter])  #setting z coordinate
        counter += 1
        vertex = vertices.next()
    #####################################################
    for _ in range(1):
        faces = qd.CellFaceIterator(cell)
        face1 = faces.next()
        while face1 != None:
            #print face1.getID()
            face1.setProjectedCoordinate()
            face1 = faces.next()
        #####################################################
        #setting parameters for all vertices
        vertices = qd.CellVertexIterator(cell)
        vertex = vertices.next()
        while vertex != None:
            vertex.setparameters()
            vertex = vertices.next()
        #####################################################
        #setting Mu for all Faces
        faces = qd.CellFaceIterator(cell)
        face1 = faces.next()
        while face1 != None:
            #print face1.getID()
            face1.setMu()
            face1 = faces.next()
        #####################################################
        #setting parameters for all vertices
        vertices = qd.CellVertexIterator(cell)
        vertex = vertices.next()
        while vertex != None:
            vertex.setDerivatives()
            vertex = vertices.next()
        #####################################################
        faces = qd.CellFaceIterator(cell)
        face1 = faces.next()
        while face1 != None:
            #print face1.getID()
            face1.setEnergyTerms()
            face1 = faces.next()
    ######################################################
    #returning the total energy
    energyvalue = cell.getEnergyCartesianVolume()
    #release the current cell
    #printing the counter and if the passed value is different than the previous values passed
    #print maincounter, energyvalue
    #print np.subtract(tempcoordinates, tempcoordstore)
    return energyvalue
Ejemplo n.º 13
0
def getBoundsForOptimization(cell, radius, perimeterVertexNum):
    #getting the coordinates of the cell
    ##intial parameters for optimization, the coordiantes of vertices
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    #vertexid = np.array([])
    xcoord = np.array([])
    ycoord = np.array([])
    zcoord = np.array([])
    while vertex != None:
        #saving the ids
        #vertexid = np.append(vertexid, vertex.getID())
        xcoord = np.append(xcoord, vertex.getXcoordinate())
        ycoord = np.append(ycoord, vertex.getYcoordinate())
        zcoord = np.append(zcoord, vertex.getZcoordinate())
        vertex = vertices.next()
    coordinates = np.concatenate((xcoord, ycoord, zcoord))
    numberofvertices = cell.countVertices()
    #print "lenght of xcoord : ", len(xcoord), "totalvertex", totalvertex
    basefreedom = 2 * (
        radius + 1
    )  #in this case: we just let the vertices in the boundary move freely in their own X-Y plane
    epsbasefreedom = (1. / 20.) * (
        2. * np.pi * radius
    ) / perimeterVertexNum  #vertex is allowed to move 5% of average perimeter side length
    print "small freedome for base vertices : 5%"
    print "basefreedom", basefreedom
    print "epsbasefreedom", epsbasefreedom
    fac = 6
    #boundary set so that outer (periphery) vertices do not move
    uboundsx = np.zeros((numberofvertices))
    uboundsy = np.zeros((numberofvertices))
    uboundsz = np.zeros((numberofvertices))
    lboundsx = np.zeros((numberofvertices))
    lboundsy = np.zeros((numberofvertices))
    lboundsz = np.zeros((numberofvertices))
    ###############################
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    vertcounter = 0
    while vertex != None:
        currentvertid = vertex.getID()
        #print vertcounter, " -> ",currentvertid
        ## DOME VERTEX
        if not checkExternalVertex(
                vertex):  #so if vertex is external vertex, "else" is applied
            #if vertex is not external vertex
            uboundsx[vertcounter] = fac * radius
            uboundsy[vertcounter] = fac * radius
            uboundsz[vertcounter] = fac * radius
            lboundsx[vertcounter] = -fac * radius
            lboundsy[vertcounter] = -fac * radius
            lboundsz[vertcounter] = 0.
        else:  #if vertex is external vertex
            uboundsx[vertcounter] = xcoord[vertcounter] + epsbasefreedom
            uboundsy[vertcounter] = ycoord[vertcounter] + epsbasefreedom
            uboundsz[vertcounter] = zcoord[
                vertcounter] + epsbasefreedom  #z-coordinates are allowed to move by 1 side lenght up or down
            lboundsx[vertcounter] = xcoord[vertcounter] - epsbasefreedom
            lboundsy[vertcounter] = ycoord[vertcounter] - epsbasefreedom
            lboundsz[vertcounter] = zcoord[vertcounter] - epsbasefreedom
        vertcounter += 1
        vertex = vertices.next()
    ###base cells###
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    vertcounter = 0
    while vertex != None:
        currentvertid = vertex.getID()
        if checkExternalVertex(
                vertex
        ):  #if the vertex is external vertex then new bounds applied
            uboundsx[vertcounter] = xcoord[vertcounter] + epsbasefreedom
            uboundsy[vertcounter] = ycoord[vertcounter] + epsbasefreedom
            uboundsz[vertcounter] = zcoord[vertcounter] + epsbasefreedom
            lboundsx[vertcounter] = xcoord[vertcounter] - epsbasefreedom
            lboundsy[vertcounter] = ycoord[vertcounter] - epsbasefreedom
            lboundsz[vertcounter] = 0.
        vertex = vertices.next()
        vertcounter += 1
    ### Upper bounds ###
    upperbounds = np.concatenate((uboundsx, uboundsy, uboundsz))
    ##Lower bounds
    lowerbounds = np.concatenate((lboundsx, lboundsy, lboundsz))
    return (upperbounds, lowerbounds)
def getBoundsForOptimization(cell, radius, perimeterVertexNum):
    #getting the coordinates of the cell
    ##intial parameters for optimization, the coordiantes of vertices
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    #vertexid = np.array([])
    xcoord = np.array([])
    ycoord = np.array([])
    zcoord = np.array([])
    while vertex != None:
        #saving the ids
        #vertexid = np.append(vertexid, vertex.getID())
        xcoord = np.append(xcoord, vertex.getXcoordinate())
        ycoord = np.append(ycoord, vertex.getYcoordinate())
        zcoord = np.append(zcoord, vertex.getZcoordinate())
        vertex = vertices.next()
    coordinates = np.concatenate((xcoord, ycoord, zcoord))
    numberofvertices = cell.countVertices()
    #print "lenght of xcoord : ", len(xcoord), "totalvertex", totalvertex
    basefreedom = 2 * (
        radius + 1
    )  #in this case: we just let the vertices in the boundary move freely in their own X-Y plane
    epsbasefreedom = (1. / 5) * (
        2. * np.pi * radius
    ) / perimeterVertexNum  #vertex is allowed to move 5% of average perimeter side length
    print "small freedome for base vertices : 20%"
    print "basefreedom", basefreedom
    print "epsbasefreedom", epsbasefreedom
    fac = 6
    #boundary set so that outer (periphery) vertices do not move
    uboundsx = np.zeros((numberofvertices))
    uboundsy = np.zeros((numberofvertices))
    uboundsz = np.zeros((numberofvertices))
    lboundsx = np.zeros((numberofvertices))
    lboundsy = np.zeros((numberofvertices))
    lboundsz = np.zeros((numberofvertices))
    ###############################
    vertices = qd.CellVertexIterator(cell)
    vertex = vertices.next()
    vertcounter = 0
    while vertex != None:
        currentvertid = vertex.getID()
        #print vertcounter, " -> ",currentvertid
        ## DOME VERTEX
        if currentvertid > perimeterVertexNum:
            uboundsx[vertcounter] = xcoord[vertcounter] + 0.5
            uboundsy[vertcounter] = ycoord[vertcounter] + 0.5
            uboundsz[vertcounter] = zcoord[vertcounter] + 0.5
            lboundsx[vertcounter] = xcoord[vertcounter] - 0.5
            lboundsy[vertcounter] = ycoord[vertcounter] - 0.5
            lboundsz[vertcounter] = zcoord[vertcounter] - 0.5
        else:  ## CYLINDER VERTEX
            uboundsx[vertcounter] = xcoord[vertcounter]
            uboundsy[vertcounter] = ycoord[vertcounter]
            uboundsz[vertcounter] = zcoord[vertcounter]
            lboundsx[vertcounter] = xcoord[vertcounter]
            lboundsy[vertcounter] = ycoord[vertcounter]
            lboundsz[vertcounter] = zcoord[vertcounter]
        vertcounter += 1
        vertex = vertices.next()
    ### Upper bounds ###
    upperbounds = np.concatenate((uboundsx, uboundsy, uboundsz))
    ##Lower bounds
    lowerbounds = np.concatenate((lboundsx, lboundsy, lboundsz))
    return (upperbounds, lowerbounds)