Exemplo n.º 1
0
import numpy as np
from scenarios import EMD_2984, _4NRE, EMD_3061, EMD_6479, EMD_21452
import denoise_methods.BM4D as BM4D

if __name__ == '__main__':
    name = EMD_21452
    threshold_list = [5.25]
    for tr in threshold_list:
        file_path = str(get_project_root().parent) + name

        ed = read(file_path)

        ed.re_normalize()
        denoiser = BM4D.BM4D(ed.values)
        denoise_data = denoiser.execute_3d(tr)

        ed.update_from_values(denoise_data)
        ed.header.mean = np.mean(ed.buffer)
        ed.header.stddev = np.std(ed.buffer)
        ed.header.min = np.min(ed.buffer)
        ed.header.max = np.max(ed.buffer)

        ed.header.fields["amean"] = ed.header.mean
        ed.header.fields["amax"] = ed.header.max
        ed.header.fields["amin"] = ed.header.min
        ed.header.fields["sd"] = ed.header.stddev

        print(ed.header.min, ed.header.max, ed.header.mean, ed.header.stddev)
        to_ccp4_file(ed, 'bm4d_14p_' + str(tr))

Exemplo n.º 2
0
from scripts.ccp4_parser import to_ccp4_file
from scripts import edplot
import denoise_methods.BM3D as BMND
import numpy as np
from scenarios import EMD_2984, _4NRE, EMD_3061, EMD_6479

if __name__ == '__main__':
    file_names = [EMD_6479] #, file_name2]
    for name in file_names:
        file_path = str(get_project_root().parent) + name

        ed = read(file_path)

        ed.re_normalize()
        denoiser = BMND.BM3D(ed.values)
        denoise_data = denoiser.execute_2d()

        ed.update_from_values(denoise_data)
        ed.header.mean = np.mean(ed.buffer)
        ed.header.stddev = np.std(ed.buffer)
        ed.header.min = np.min(ed.buffer)
        ed.header.max = np.max(ed.buffer)

        ed.header.fields["amean"] = ed.header.mean
        ed.header.fields["amax"] = ed.header.max
        ed.header.fields["amin"] = ed.header.min
        ed.header.fields["sd"] = ed.header.stddev

        print(ed.header.min, ed.header.max, ed.header.mean, ed.header.stddev)
        to_ccp4_file(ed, 'bm3d_new')
Exemplo n.º 3
0
from scripts.ccp4_parser import to_ccp4_file
from scripts import edplot
import numpy as np
from scenarios import EMD_2984, _4NRE, EMD_3061, EMD_6479

file_names = [EMD_2984]
for name in file_names:
    file_path = str(get_project_root().parent) + name

    ed = read(file_path)

    import denoise_methods.median_filter as mf
    denoiser = mf.MedianFilter(ed.values)
    denoise_data = denoiser.execute_2d()

    #ed.values = denoise_data
    ed.update_from_values(denoise_data)
    ed.header.mean = np.mean(ed.buffer)
    ed.header.stddev = np.std(ed.buffer)
    ed.header.min = np.min(ed.buffer)
    ed.header.max = np.max(ed.buffer)

    ed.header.fields["amean"] = ed.header.mean
    ed.header.fields["amax"] = ed.header.max
    ed.header.fields["amin"] = ed.header.min
    ed.header.fields["sd"] = ed.header.stddev

    print(ed.header.min, ed.header.max, ed.header.mean, ed.header.stddev)

    to_ccp4_file(ed, 'mf_2d_v2')
Exemplo n.º 4
0
if __name__ == '__main__':
    file_names = [EMD_6479]
    for name in file_names:
        file_path = str(get_project_root().parent) + name
        ed = read(file_path)

        import denoise_methods.nl_means3d as nlm

        #edplot.edplot2d(ed, optName='true')
        ed.re_normalize()
        ed.update_from_buffer(ed.buffer)
        denoiser = nlm.NLMeans(ed.values, 40)
        denoise_data = denoiser.execute_3d()

        ed.update_from_values(denoise_data)
        ed.header.mean = np.mean(ed.buffer)
        ed.header.stddev = np.std(ed.buffer)
        ed.header.min = np.min(ed.buffer)
        ed.header.max = np.max(ed.buffer)

        ed.header.fields["amean"] = ed.header.mean
        ed.header.fields["amax"] = ed.header.max
        ed.header.fields["amin"] = ed.header.min
        ed.header.fields["sd"] = ed.header.stddev

        #print('++++++', ed.header.min, ed.header.max, ed.header.mean, ed.header.stddev)
        #ed.re_normalize()
        #edplot.edplot2d(ed, optName='nlm_2d')

        to_ccp4_file(ed, 'nlm_3d_v2_1.4s')
Exemplo n.º 5
0
    file_name1 = '/mol_data/ccp4/EMD-3061.ccp4'  # dsn6/4nre_2fofc.dsn6 ccp4/4nre.ccp4 EMD-3061 EMD-6479
    file_name2 = '/mol_data/ccp4/EMD-6479.ccp4'
    file_names = [file_name2]  #, file_name2]
    for name in file_names:
        file_path = str(get_project_root().parent) + name

        ed = read(file_path)

        import denoise_methods.BM3D as BMND

        ed.re_normalize()
        denoiser = BMND.BMnD(ed.values, 40)
        denoise_data = denoiser.execute_2d()

        ed.update_from_values(denoise_data)
        ed.header.mean = np.mean(ed.buffer)
        ed.header.stddev = np.std(ed.buffer)
        ed.header.min = np.min(ed.buffer)
        ed.header.max = np.max(ed.buffer)

        ed.header.fields["amean"] = ed.header.mean
        ed.header.fields["amax"] = ed.header.max
        ed.header.fields["amin"] = ed.header.min
        ed.header.fields["sd"] = ed.header.stddev

        print(ed.header.min, ed.header.max, ed.header.mean, ed.header.stddev)
        #ed.re_normalize()
        #edplot.edplot2d(ed,optName='bm3d_')
        #edplot.edplot2d(ed, optName='true1')
        to_ccp4_file(ed, 'bm3d_2')
Exemplo n.º 6
0
    file_names = [_4NRE]
    for name in file_names:
        file_path = str(get_project_root().parent) + name
        ed = read(file_path)

        import denoise_methods.nl_means as nlm

        ed.re_normalize()
        ed.update_from_buffer(ed.buffer)
        denoiser = nlm.NLMeans(ed.values, 40)
        denoise_data = denoiser.execute_2d()


        ed.update_from_values(denoise_data)
        ed.header.mean = np.mean(ed.buffer)
        ed.header.stddev = np.std(ed.buffer)
        ed.header.min = np.min(ed.buffer)
        ed.header.max = np.max(ed.buffer)


        ed.header.fields["amean"] = ed.header.mean
        ed.header.fields["amax"] = ed.header.max
        ed.header.fields["amin"] = ed.header.min
        ed.header.fields["sd"] = ed.header.stddev

        #print('++++++', ed.header.min, ed.header.max, ed.header.mean, ed.header.stddev)
        #ed.re_normalize()
        #edplot.edplot2d(ed, optName='nlm_2d')

        to_ccp4_file(ed, 'nlm_2d_v2')
Exemplo n.º 7
0
import numpy as np
from scenarios import EMD_2984, _4NRE, EMD_3061, EMD_6479

file_names = [EMD_2984]
for name in file_names:
    file_path = str(get_project_root().parent) + name

    ed = read(file_path)

    import denoise_methods.median_filter as mf
    denoiser = mf.MedianFilter(ed.values)
    denoise_data = denoiser.execute_3d()

    #ed.values = denoise_data
    ed.update_from_values(denoise_data)
    ed.header.mean = np.mean(ed.buffer)
    ed.header.stddev = np.std(ed.buffer)
    ed.header.min = np.min(ed.buffer)
    ed.header.max = np.max(ed.buffer)

    ed.header.fields["amean"] = ed.header.mean
    ed.header.fields["amax"] = ed.header.max
    ed.header.fields["amin"] = ed.header.min
    ed.header.fields["sd"] = ed.header.stddev

    print(ed.header.min, ed.header.max, ed.header.mean, ed.header.stddev)
    #ed.re_normalize()
    edplot.edplot2d(ed)

    to_ccp4_file(ed, 'mf_3d')