def rawFeatureVector(id2, id1, biniter): if not id1 in iddict: iddict[id1]=getDendriticProfiles(id1, biniter) if not id2 in iddict: iddict[id2]=getDendriticProfiles(id2, biniter) histo1=iddict[id1] histo2=iddict[id2] xhisto1=histo1[0] yhisto1=histo1[1] zhisto1=histo1[2] xhisto2=histo2[0] yhisto2=histo2[1] zhisto2=histo2[2] #Calculation of sum of distances in bin is now included in #getDendriticProfiles function to reduce runtime xsumDist1 = histo1[3] ysumDist1 = histo1[4] zsumDist1 = histo1[5] xsumDist2 = histo2[3] ysumDist2 = histo2[4] zsumDist2 = histo2[5] rawVector = xhisto1 + xhisto2 + yhisto1 + yhisto2 + zhisto1 + zhisto2 + xsumDist1 +xsumDist2 + ysumDist1 + ysumDist2 + zsumDist1 + zsumDist2 return rawVector
def featureVector(id1, id2, biniter): if not id1 in iddict: iddict[id1]=getDendriticProfiles(id1, biniter) if not id2 in iddict: iddict[id2]=getDendriticProfiles(id2, biniter) histo1=iddict[id1] histo2=iddict[id2] trainingvector =feature1(histo1,histo2, biniter) + feature2(histo1, histo2, biniter) + feature3(histo1, histo2, biniter) + feature4(histo1, histo2, biniter) return trainingvector
def profileDistances(ID, biniter): histo=getDendriticProfiles(ID, biniter) xhisto=histo[0] yhisto=histo[1] zhisto=histo[2] xdistance=[] ydistance=[] zdistance=[] tree = Display.getFront().getLayerSet().findById(ID) coords = Matrix(getNodeCoordinates(tree)) m=coords.getRowDimension() for i in range(0, m): xdist = coords.get(i, 1 ) if xdist > 0 : xdistance.append(xdist) else: xdistance.append((-1)*xdist) for i in range(0, m): ydist = coords.get(i, 0 ) if ydist > 0 : ydistance.append(ydist) else: ydistance.append((-1)*ydist) for i in range(0, m): zdist = sqrt(coords.get(i, 0)**2 + coords.get(i,1)**2) zdistance.append(zdist) return xdistance, ydistance, zdistance
def rawHistogramVector(id1, id2, biniter): if not id1 in iddict: iddict[id1]=getDendriticProfiles(id1, biniter) if not id2 in iddict: iddict[id2]=getDendriticProfiles(id2, biniter) histo1=iddict[id1] histo2=iddict[id2] xhisto1=histo1[0] yhisto1=histo1[1] zhisto1=histo1[2] xhisto2=histo2[0] xhisto2=reversing(xhisto2) yhisto2=histo2[1] zhisto2=histo2[2] trainingvector = [] trainingvector = xhisto1 + yhisto1 + zhisto1 + xhisto2 + yhisto2 + zhisto2 return trainingvector