print "end partial_3 computation" # ------------------------------------------------------------ # input from volume image (test: 250 x 250 x 250) # ------------------------------------------------------------ out = [] Nx,Ny,Nz = imageHeight/imageDx, imageWidth/imageDx, imageDepth/imageDz segFaces = set(["Fz0V","Fz1V","Fy0V","Fy1V","Fx0V","Fx1V"]) for inputIteration in range(imageDepth/imageDz): startImage = endImage endImage = startImage + imageDz xEnd, yEnd = 0,0 theImage,colors,theColors = pngstack2array3d('SLICES2/', startImage, endImage, colors) print "\ntheColors =",theColors theColors = theColors.reshape(1,2) background = max(theColors[0]) foreground = min(theColors[0]) print "\n(background,foreground) =",(background,foreground) if __name__=="__main__" and DEBUG == True: print "\nstartImage, endImage =", (startImage, endImage) for i in range(imageHeight/imageDx): for j in range(imageWidth/imageDy): xStart, yStart = i * imageDx, j * imageDy xEnd, yEnd = xStart+imageDx, yStart+imageDy
[2, 2, 2, 1, 1, 1], [3, 3, 3, 4, 1, 1], [3, 3, 3, 4, 1, 1], [0, 0, 0, 4, 2, 2], [0, 0, 0, 2, 2, 2], [0, 0, 0, 2, 2, 2], ] nx, ny, nz = image.shape # ------------------------------------------------------------ # input da immagine di volume # ------------------------------------------------------------ colors = 2 image, colors = pngstack2array3d("SLICES2/", 430, 480, colors) image = image[:, :50, :50] nx, ny, nz = image.shape # ------------------------------------------------------------ # complesso a celle cubiche # ------------------------------------------------------------ def ind(x, y, z): return x + (nx + 1) * (y + (ny + 1) * (z)) def invertIndex(nx, ny, nz): nx, ny, nz = nx + 1, ny + 1, nz + 1 def invertIndex0(offset):