Пример #1
0
def read_mrc_data(path, show_progress=False):
    #return read_mrc(path=path, show_progress=show_progress)['value']
    return TIM.read_data(path)
Пример #2
0
def read_mrc_data(path, show_progress=False):
    return TIM.read_data(path)
Пример #3
0

@jit(nopython=True)
def generate_feature_vector(b, label, cluster_center_number):
    result = np.array([0] * cluster_center_number)
    # sum_f = np.array((cluster_center_number, 2), 0)
    sum_f = np.array([[0 for i in range(2)] for j in range(cluster_center_number)])
    for i in range(0, b.shape[0]):
        for j in range(0, b.shape[1]):
            for k in range(0, b.shape[2]):
                sum_f[label[i][j][k]][1] = sum_f[label[i][j][k]][1] + 1
                sum_f[label[i][j][k]][0] = sum_f[label[i][j][k]][0] + b[i][j][k]
    for i in range(cluster_center_number):
        assert sum_f[i][1] > 0
        result[i] = sum_f[i][0] / sum_f[i][1]
    return result


if __name__ == "__main__":
    # file path
    path = input("Enter data path: ")
    from aitom.io import mrcfile_proxy

    a = mrcfile_proxy.read_data(path)
    print("file has been read, shape is", a.shape)
    start_time = time.time()
    saliency_detection(a=a, gaussian_sigma=2.5, gabor_sigma=14.0, gabor_lambda=13.0, cluster_center_number=10000,
                       multiprocessing_num=0, pick_num=1000, save_flag=True)
    end_time = time.time()
    print('saliency detection takes', end_time - start_time, 's')
Пример #4
0
    dmax = np.amax(dimg)
    dimg = (dimg / dmax) * 255
    # TODO: Change the image saving path
    img_path = '/Users/apple/Desktop/Lab/Zach_Project/Denoising_Result/Difference_' + str(
        type) + '.png'
    plt.imsave(img_path, dimg, cmap='gray')


if __name__ == "__main__":
    # TODO: Change the data path, name and Gussian denoise type
    path = '/Users/apple/Desktop/Lab/Zach_Project/Sample_Data/aitom_demo_single_particle_tomogram.mrc'
    name = 'aitom_demo_single_particle_tomogram'
    G_type = 1

    # read the volume data as numpy array
    original = mrcfile_proxy.read_data(path)
    # save a slice of original tomogram
    oimg = (original[:, :, int(original.shape[2] / 2)]).copy()
    # TODO: Change the orginal image saving directory
    img_path = '/Users/apple/Desktop/Lab/Zach_Project/Denoising_Result/Original.png'
    plt.imsave(img_path, oimg, cmap='gray')

    # perform three diffrent kind of denoising
    # The difference comparison between original tomogram and filtered tomogram is commented out
    g_fimg = g_denoising(G_type,
                         a=original,
                         name=name,
                         gaussian_sigma=2.5,
                         save_flag=True)
    # diff_compare(oimg, g_fimg, "Gaussian")