Exemplo n.º 1
0
def diff_pkl2chomp ( files , savedir ) :
	#grab files, skip directories
	if os.path.isdir (files):
		fdir = files + '/'
		dlist = os.listdir(fdir)
		frames = []
		for f in dlist:
			if f.endswith('npy') and not os.path.isdir(fdir+f):
				frames.append(f)
	else:
		frames = [ files ]
		fdir = files.rpartition('/')[0].rpartition('/')[0]+'/'
	#savedir = '/home/kellys/RBC_Deriv_120125_r01/'

	#print 'attempting chomp runs..'
	frames.sort(key=natural_key)
	for frame in frames:
		savename = frame.rstrip('npy') + 'cub'
		#CB.png2chomp(fdir + frame)
		arr = numpy.load(fdir+frame)
		w = numpy.where(arr==True)
		newarr = numpy.vstack( (w[0],w[1])).T
		CB.array2chomp(newarr,fdir+savename)
		CB.run_chomp(fdir + savename, savedir+savename)
Exemplo n.º 2
0
    "/sciclone/home04/jberwald/data10/wyss/data/Cells_Jesse/Old/frames/old_50125/" "fft_frames/bandpass/smooth_r0708/"
)

# grab files, skip directories
if os.path.isdir(files):
    fdir = files + "/"
    dlist = os.listdir(fdir)
    frames = []
    for f in dlist:
        if f.endswith("npy") and not os.path.isdir(fdir + f):
            frames.append(f)
else:
    frames = [files]
    fdir = files.rpartition("/")[0].rpartition("/")[0] + "/"
# savedir = '/home/kellys/RBC_Deriv_120125_r01/'
# savedir = '/home/kellys/RBC_Deriv_110125_r01/'
savedir = files + "betti/"  #'/home/kellys/RBC_Deriv_120125_r005/'

print "attempting chomp runs.."
for frame in frames:
    filename = frame.rstrip("npy") + "cub"
    savename = frame.rstrip("npy") + "cbetti"
    # CB.png2chomp(fdir + frame)
    arr = numpy.load(fdir + frame)
    w = numpy.where(arr == True)
    # w2 = numpy.where(w[2] == 0)[0]
    newarr = numpy.vstack((w[0], w[1])).T
    CB.array2chomp(newarr, fdir + filename)
    CB.run_chomp(fdir + filename, fdir + savename)
print "finished.."
Exemplo n.º 3
0
    # vol = find_volume( test_voxel )
    # pts = subdivide( test_voxel )
    
    # print "voxel\n", test_voxel
    # print "voxel vol", vol
    # print ""
    # print "sub voxel\n", pts
    # print "vol", find_volume( pts )
    # print ""

    # dx = np.absolute( pts[1][0]-pts[0][0] )
    # print "dx", dx

    # scaled  = pts * 1./dx
    # print "scaled\n", scaled

    pts, scalars, dx, dy, dz = run()
    pts[:,:-1] *= 1./dx
    # pts[:,0] *= 1./dx
    # pts[:,1] *= 1./dy
    # pts[:,2] *= 1./dz

    uniq_scalars = np.unique( scalars )
    colors_idx = [ np.where( pts[:,-1] == s )[0]
                  for s in uniq_scalars ]
    cubset = [ np.array( pts[ colors_idx[i], :-1 ], dtype=np.uint )
                 for i,s in enumerate( uniq_scalars ) ]
    fname = 'cylinder'
    for i,s in enumerate( uniq_scalars ):
        cb.array2chomp( cubset[i], fname+str(s)+'.cub' )