示例#1
0

print('python')
G = np.zeros((512, 512, 240), dtype=np.uint8)
G[128:384, 128:384, 60:180] = 1
volume_data = np.load('1.npz')
F = volume_data['volume'].astype(np.uint8)
start_time = time.time()
F = post_processing(F, F, 1.0, False)
print(time.time() - start_time)
start_time = time.time()
for l in range(10):
    DSC = DSC_computation(F, G)
print(DSC)
print(time.time() - start_time)

print('SWIG')
volume_data = np.load('1.npz')
G = np.zeros((512, 512, 240), dtype=np.uint8)
G[128:384, 128:384, 60:180] = 1
F = volume_data['volume'].astype(np.uint8)
start_time = time.time()
ff.post_processing(F, F, 1.0, False)
print(time.time() - start_time)
start_time = time.time()
for l in range(10):
    P = np.zeros(3, dtype=np.uint32)
    ff.DSC_computation(F, G, P)
print(P, float(P[2]) * 2 / (P[0] + P[1]))
print(time.time() - start_time)
示例#2
0
def post_processing(F, S, threshold, organ_ID):
    ff.post_processing(F, S, threshold, False)
    return F
示例#3
0
def largest_component(voxel):
	''' Call ff '''
	voxel = voxel.astype(np.uint8)
	ff.post_processing(voxel, voxel, 1, False)
	return voxel.astype(np.int32)