def run(): asm = PASM([0, 1], 1000) allLines = [] pts = [] for f in files: with open(os.path.join(OUTPUT, f), "r") as infile: allLines = infile.readlines() if len(allLines) > 0: cleanLines = [x.strip().split('\t') for x in allLines] ptList = [Point(x[0], x[1]) for x in cleanLines] print len(ptList) asm.addShape(Shape(ptList)) asm.iterateAlignment()
def run(): asm = PASM([0,1], 1000 ) allLines = [] pts = [] for f in files: with open( os.path.join( OUTPUT, f), "r" ) as infile: allLines = infile.readlines() if len(allLines) > 0: cleanLines = [ x.strip().split('\t') for x in allLines] ptList = [ Point( x[0], x[1]) for x in cleanLines ] print len( ptList ) asm.addShape( Shape( ptList ) ) asm.iterateAlignment()
elif line is '}': pointLine = False pass elif pointLine: ptList.append( map( float, line.split(' ') ) ) else: pass asm.addShape( Shape( ptList ) ) m += 1 print m if __name__ == "__main__": DIR = "C:\\Users\\Valerie\\Desktop\\MicroExpress\\facePoints" SUBDIR = "session_1" folder = os.path.join( DIR, SUBDIR ) files = next(os.walk(folder))[2] asm = PASM( [36,31], 100) readIn( asm, files) asm.iterateAlignment() with open( 'outfile-ASM-100iters-500tr.txt', "w") as output: output.write( str(asm.meanShape) ) output.write( "!!!\n" ) for shape in asm.allShapes: output.write( str(shape) ) output.write( "@@@\n" ) output.write( "!!!\n" )
elif line is '}': pointLine = False pass elif pointLine: ptList.append(map(float, line.split(' '))) else: pass asm.addShape(Shape(ptList)) m += 1 print m if __name__ == "__main__": DIR = "C:\\Users\\Valerie\\Desktop\\MicroExpress\\facePoints" SUBDIR = "session_1" folder = os.path.join(DIR, SUBDIR) files = next(os.walk(folder))[2] asm = PASM([36, 31], 100) readIn(asm, files) asm.iterateAlignment() with open('outfile-ASM-100iters-500tr.txt', "w") as output: output.write(str(asm.meanShape)) output.write("!!!\n") for shape in asm.allShapes: output.write(str(shape)) output.write("@@@\n") output.write("!!!\n")