Ejemplo n.º 1
0
op = {
    'model': {
        'missing_wedge_angle': 30,
        'SNR': 0.05
    },
    'ctf': {
        'pix_size': 1.0,
        'Dz': -5.0,
        'voltage': 300,
        'Cs': 2.0,
        'sigma': 0.4
    }
}

# generate a density map v that contains a toy structure
v = MU.generate_toy_model(dim_siz=64)  # generate a pseudo density map
print(v.shape)

# randomly rotate and translate v
loc_proportion = 0.1
loc_max = N.array(v.shape, dtype=float) * loc_proportion
angle = GAL.random_rotation_angle_zyz()
loc_r = (N.random.random(3) - 0.5) * loc_max
vr = GR.rotate(v, angle=angle, loc_r=loc_r, default_val=0.0)

# generate simulated subtomogram vb from v
vb = TSRSC.do_reconstruction(vr, op, verbose=True)
print('vb', 'mean', vb.mean(), 'std', vb.std(), 'var', vb.var())

# save v and vb as 3D grey scale images
TIF.put_mrc(vb, '/tmp/vb.mrc', overwrite=True)
Ejemplo n.º 2
0
'''
Alignment of two 3D grey scale images
'''

#----------------------------
# generate simulated images

import aitom.model.util as TMU
v = TMU.generate_toy_model(dim_siz=32)

import aitom.geometry.ang_loc as TGAL
import aitom.geometry.rotate as TGR
import random
import numpy as N

# randomly rotate and translate v
loc_proportion = 0.1
loc_max = N.array(v.shape, dtype=float) * loc_proportion
angle = TGAL.random_rotation_angle_zyz()
loc_r = (N.random.random(3) - 0.5) * loc_max
vr = TGR.rotate(v, angle=angle, loc_r=loc_r, default_val=0.0)

#--------------------------------
# align vr against v

import aitom.align.util as TAU
al = TAU.align_vols_no_mask(v, vr)
print('rigid transform of alignment', al)

vr_i = TGR.rotate(
    vr, angle=al['angle'], loc_r=al['loc'], default_val=0.0