Documented functions with links to source

Program to align segments from helical specimens with a restrained in-plane rotation of 0 or 180 +/- delta degrees

class segmentalign2d_prep.SegmentAlign2dPar[source]

Class to initiate default dictionary with input parameters including help and range values and status dictionary

Methods

add_mask_dimension_to_features

define_parameters_and_their_properties

define_program_states

set_frc_based_filter_option

set_iteration_count

set_reference_option

set_refinement_option

add_mask_dimension_to_features()[source]
define_parameters_and_their_properties()[source]
set_reference_option(feature_set)[source]
set_iteration_count(feature_set)[source]
set_refinement_option(feature_set)[source]
set_frc_based_filter_option(feature_set)[source]
define_program_states()[source]
class segmentalign2d_prep.SegmentAlign2dPreparation(parset=None)[source]
  • Class to prepare iterative alignment of segments

Methods

compute_binfactor_for_desired_resolution(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

define_flow_of_alignment(pixelsize, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_bfactor_coefficients(bfactor, …[, …])

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_cosine_falloff(image_dimension, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_filter_function(…[, …])

  • Function to generate a filter function based on hyperbolic tangent (low-pass, high-pass or band-pass filters are possible)

read_custom_filter_file([…])

  • Function to read Fourier coefficients from text file

average_stack

center_and_rotate_image

center_reference_images_by_alignment_to_avg

define_helix_or_particle_dimensions

get_align_info_nt

get_image_alignments_from_stack

get_image_list_named_tuple

log_mask_dimensions

prepare_alignment

prepare_empty_rings

prepare_mask

prepare_reference_stack

set_given_parameters

define_helix_or_particle_dimensions()[source]
set_given_parameters()[source]
prepare_cosine_falloff(image_dimension, start_falloff, falloff_length)[source]
>>> from spring.segment2d.segmentalign2d import SegmentAlign2d
>>> SegmentAlign2d().prepare_cosine_falloff(30, 7, 5)
array([1.       , 1.       , 1.       , 1.       , 1.       , 1.       ,
       1.       , 0.9330127, 0.75     , 0.5      , 0.25     , 0.0669873,
       0.       , 0.       , 0.       ])
>>> SegmentAlign2d().prepare_cosine_falloff(50, 21, 10)
array([1.        , 1.        , 1.        , 1.        , 1.        ,
       1.        , 1.        , 1.        , 1.        , 1.        ,
       1.        , 1.        , 1.        , 1.        , 1.        ,
       1.        , 1.        , 1.        , 1.        , 1.        ,
       1.        , 0.97974649, 0.92062677, 0.82743037, 0.70770751])
prepare_bfactor_coefficients(bfactor, pixelsize, image_dimension, cutoff_A=None)[source]
>>> from spring.segment2d.segmentalign2d import SegmentAlign2d
>>> SegmentAlign2d().prepare_bfactor_coefficients(0, 1.0, 50)
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
       1., 1., 1., 1., 1., 1., 1., 1.])
>>> SegmentAlign2d().prepare_bfactor_coefficients(100, 1.0, 50)
array([1.        , 0.98920796, 0.95752564, 0.90696062, 0.84062374,
       0.76241263, 0.67663385, 0.58761458, 0.49935179, 0.41523683,
       0.33787832, 0.26902956, 0.20961139, 0.15981037, 0.1192258 ,
       0.08703837, 0.06217652, 0.04346276, 0.02972922, 0.0198987 ,
       0.01303291, 0.00835282, 0.00523842, 0.00321471, 0.00193045])
>>> SegmentAlign2d().prepare_bfactor_coefficients(-100, 1.0, 50)
array([  1.        ,   1.01090978,   1.04435845,   1.10258371,
         1.18959286,   1.3116257 ,   1.4779042 ,   1.70179577,
         2.00259621,   2.40826423,   2.95964534,   3.7170637 ,
         4.77073318,   6.25741626,   8.38744639,  11.48918606,
        16.08324067,  23.00820047,  33.63694445,  50.25453012,
        76.72884995, 119.72006788, 190.89740003, 311.06981145,
       518.01282467])
>>> SegmentAlign2d().prepare_bfactor_coefficients(0, 1.0, 50, 4.0)
array([1.       , 1.       , 1.       , 1.       , 1.       , 1.       ,
       1.       , 1.       , 1.       , 1.       , 1.       , 1.       ,
       0.9330127, 0.75     , 0.5      , 0.25     , 0.0669873, 0.       ,
       0.       , 0.       , 0.       , 0.       , 0.       , 0.       ,
       0.       ])
>>> SegmentAlign2d().prepare_bfactor_coefficients(100, 1.0, 50, 4.0)
array([1.        , 0.98920796, 0.95752564, 0.90696062, 0.84062374,
       0.76241263, 0.67663385, 0.58761458, 0.49935179, 0.41523683,
       0.33787832, 0.26902956, 0.19557009, 0.11985778, 0.0596129 ,
       0.02175959, 0.00416504, 0.        , 0.        , 0.        ,
       0.        , 0.        , 0.        , 0.        , 0.        ])
>>> SegmentAlign2d().prepare_bfactor_coefficients(0.0, 5.0, 50, 12)
array([1.       , 1.       , 1.       , 1.       , 1.       , 1.       ,
       1.       , 1.       , 1.       , 1.       , 1.       , 1.       ,
       1.       , 1.       , 1.       , 1.       , 1.       , 1.       ,
       1.       , 1.       , 1.       , 0.9330127, 0.75     , 0.5      ,
       0.25     ])
prepare_filter_function(high_pass_filter_option, high_pass_filter_cutoff, low_pass_filter_option, low_pass_filter_cutoff, pixelsize, image_dimension, filter_falloff=0.08, custom_filter_option=False, custom_filter_file=None, bfactor=0.0)[source]
  • Function to generate a filter function based on hyperbolic tangent (low-pass, high-pass or band-pass filters are possible)

#. Input: high_pass_filter_option, low_pass_filter_option, custom_filter_option: True or False, high_pass_filter_cutoff, low_pass_filter_cutoff: in 1/Angstrom, pixelsize: Angstrom/pixel, image_dimension: pixel, pixelsize, image_dimension: number of pixels filter_falloff: percent of pixels that make up smooth filter falloff custom_filter_file: recognizes last column as filter coefficient from provided text file

  1. Output: list of filter coefficients as in Fourier pixels

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d
>>> sa = SegmentAlign2d()
>>> sa.prepare_filter_function(True, 0.02, True, 0.08, 5, 10, 0.08) 
[8.228716029901051e-06, 0.9999985361545757, 1.0, 0.9999985361545757, 4.1143580149505254e-06]
>>> sa.prepare_filter_function(True, 0.04, True, 0.06, 5, 50, 0.05) 
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.4444668511591772e-11, 0.0009282164067423437, 0.9999716817428013, 
0.9999999999992549, 1.0, 1.0, 1.0, 0.9999999999992549, 0.9999716817428013, 0.0009282164067422882, 
2.4444668511591772e-11, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
>>> sa.prepare_filter_function(True, 0.04, False, 0.06, 1.5, 50, 0.05, False, None, -100) 
[5.172734356748137e-05, 0.002565400437652817, 0.051660149853613654, 
0.06479161976119088, 0.06716260031683237, 0.07014331907922618, 
0.07396474866331282, 0.07875025482159989, 0.08465798862251377, 
0.09189094570840427, 0.10070853850346509, 0.11144193977503326, 
0.124514471444123, 0.14046877432184984, 0.16000315768767867, 
0.18402045973674444, 0.21369406779466352, 0.2505576217346058, 
0.2966276062917161, 0.3545718989002555, 0.42794293056222643, 
0.521502262206533, 0.6416753173042158, 0.7971926179830757, 1.0]
>>> sa.prepare_filter_function(True, 0.04, False, 0.06, 1.5, 50, 0.05, False, None, 100) 
[0.00083194331592229, 0.04086391086268285, 0.7994182049573009, 
0.9554175714851911, 0.9257214133064412, 0.8864208155253327, 
0.8406237416314447, 0.7895406073354527, 0.7344436719295907, 
0.6766338461617276, 0.6173907887659099, 0.5579275104833195, 
0.4993517885992762, 0.4426359119476192, 0.38859560599099563, 
0.33787832130766693, 0.29096045886431027, 0.24815259496665634, 
0.2096113871510978, 0.1753566038791111, 0.14529162554555938, 
0.11922579924973033, 0.09689717267500671, 0.07799435496458187, 
0.06217652402211632]
>>> sa.prepare_filter_function(False, 0.04, False, 0.06, 1.0, 50, 0.05, False, None, 100) 
[1.0, 0.9892079619944574, 0.9575256423365532, 0.9069606178873836, 
0.8406237433345053, 0.7624126296654683, 0.676633846161729, 
0.5876145767179657, 0.4993517885992762, 0.4152368286818413, 
0.33787832130766693, 0.26902955708479037, 0.2096113871510978, 
0.15981036888569505, 0.11922579924973033, 0.08703836765622351, 
0.06217652402211632, 0.04346276456589661, 0.02972921638615875, 
0.01989870361309264, 0.013032907448509368, 0.008352818518081014, 
0.0052384160278331, 0.0032147124638421238, 0.0019304541362277093]
read_custom_filter_file(custom_filter_file=None, image_dimension=None)[source]
  • Function to read Fourier coefficients from text file

log_mask_dimensions()[source]
prepare_mask(helixwidthpix, helixheightpix, image_dimension)[source]
prepare_empty_rings(first_ring, last_ring, ring_step, full_circle_mode='F')[source]
center_and_rotate_image(ref_center, file_name, file_info, search_range_pix, delta_psi, y_align=False)[source]
prepare_reference_stack(reference_stack_name)[source]
average_stack(stack, img_info, align=False)[source]
center_reference_images_by_alignment_to_avg(file_info, ref_center)[source]
get_image_list_named_tuple()[source]
get_image_alignments_from_stack(alignment_stack_name)[source]
compute_binfactor_for_desired_resolution(desired_resolution, pixelsize)[source]
>>> from spring.segment2d.segmentalign2d import SegmentAlign2d
>>> s = SegmentAlign2d()
>>> resolutions = np.array([24.0, 12.0, 7.0, 3.0])
>>> s.compute_binfactor_for_desired_resolution(resolutions, 2.4)
array([3, 2, 1])
>>> s.compute_binfactor_for_desired_resolution(resolutions, 1.2)
array([7, 3, 2, 1])
>>> s.compute_binfactor_for_desired_resolution(resolutions, 1.372)
array([6, 3, 2, 1])
get_align_info_nt()[source]
define_flow_of_alignment(pixelsize, binfactor, iteration_count, x_range_A, y_range_A)[source]
>>> from spring.segment2d.segmentalign2d import SegmentAlign2d
>>> SegmentAlign2d().define_flow_of_alignment(1.2, 2, 2, 50, 50) 
[align_info(iteration_id=0, pixelsize=8.4, binfactor=7, x_range=5.9523809523809526, y_range=5.9523809523809526), 
align_info(iteration_id=1, pixelsize=8.4, binfactor=7, x_range=5.9523809523809526, y_range=5.9523809523809526), 
align_info(iteration_id=0, pixelsize=3.5999999999999996, binfactor=3, x_range=5.9523809523809526, y_range=5.9523809523809526), 
align_info(iteration_id=1, pixelsize=3.5999999999999996, binfactor=3, x_range=5.9523809523809526, y_range=5.9523809523809526), 
align_info(iteration_id=0, pixelsize=2.4, binfactor=2, x_range=5.9523809523809526, y_range=5.9523809523809526), 
align_info(iteration_id=1, pixelsize=2.4, binfactor=2, x_range=5.9523809523809526, y_range=5.9523809523809526)]
>>> SegmentAlign2d().define_flow_of_alignment(5.0, 2, 5, 50, 50) 
[align_info(iteration_id=0, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0), 
align_info(iteration_id=1, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0), 
align_info(iteration_id=2, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0), 
align_info(iteration_id=3, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0), 
align_info(iteration_id=4, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0)]
>>> SegmentAlign2d().define_flow_of_alignment(5.0, 1, 5, 50, 50) 
[align_info(iteration_id=0, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0), 
align_info(iteration_id=1, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0), 
align_info(iteration_id=2, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0), 
align_info(iteration_id=3, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0), 
align_info(iteration_id=4, pixelsize=10.0, binfactor=2, x_range=5.0, y_range=5.0), 
align_info(iteration_id=0, pixelsize=5.0, binfactor=1, x_range=5.0, y_range=5.0), 
align_info(iteration_id=1, pixelsize=5.0, binfactor=1, x_range=5.0, y_range=5.0), 
align_info(iteration_id=2, pixelsize=5.0, binfactor=1, x_range=5.0, y_range=5.0), 
align_info(iteration_id=3, pixelsize=5.0, binfactor=1, x_range=5.0, y_range=5.0), 
align_info(iteration_id=4, pixelsize=5.0, binfactor=1, x_range=5.0, y_range=5.0)]
prepare_alignment()[source]
class segmentalign2d.SegmentAlign2dImagesToReferences(parset=None)[source]

Methods

compute_binfactor_for_desired_resolution(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

define_flow_of_alignment(pixelsize, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_bfactor_coefficients(bfactor, …[, …])

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_cosine_falloff(image_dimension, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_filter_function(…[, …])

  • Function to generate a filter function based on hyperbolic tangent (low-pass, high-pass or band-pass filters are possible)

read_custom_filter_file([…])

  • Function to read Fourier coefficients from text file

average_stack

calculate_averages

center_and_rotate_image

center_reference_images_by_alignment_to_avg

compute_average_and_normalize

compute_variance_and_normalize

define_helix_or_particle_dimensions

get_align_info_nt

get_image_alignments_from_stack

get_image_list_named_tuple

log_mask_dimensions

prepare_alignment

prepare_empty_rings

prepare_mask

prepare_reference_stack

put_random_image_in_reference_image_container

set_given_parameters

put_random_image_in_reference_image_container(reference_stack, assigned_images, each_ref_id, alignment_stack_name)[source]
compute_average_and_normalize(reference_stack, each_ref_id)[source]
compute_variance_and_normalize(reference_stack, each_ref_id)[source]
calculate_averages(reference_stack, iteration_id, each_ref_id)[source]
class segmentalign2d.SegmentAlign2dAlign(parset=None)[source]

Methods

compute_binfactor_for_desired_resolution(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

define_flow_of_alignment(pixelsize, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

limit_search_range_based_on_previous_alignment(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

log_alignment_params(previous_params, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

low_pass_filter_reference_according_to_frc(…)

  • Function to filter low-resolution reference image with a hyperbolic tangent that was fitted against fourier ring correlation

prepare_bfactor_coefficients(bfactor, …[, …])

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_cosine_falloff(image_dimension, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_filter_function(…[, …])

  • Function to generate a filter function based on hyperbolic tangent (low-pass, high-pass or band-pass filters are possible)

read_custom_filter_file([…])

  • Function to read Fourier coefficients from text file

align_images_to_references

average_stack

calculate_averages

center_and_rotate_image

center_reference_images_by_alignment_to_avg

compute_average_and_normalize

compute_variance_and_normalize

define_helix_or_particle_dimensions

define_parameters_for_alignment

determine_odd_and_even_average_including_variance

generate_reference_rings_from_image

get_align_info_nt

get_image_alignments_from_stack

get_image_list_named_tuple

log_mask_dimensions

make_rings_and_prepare_cimage_header

perform_coarse_restrained_alignment

perform_fine_alignment

prepare_alignment

prepare_empty_rings

prepare_mask

prepare_reference_images_for_alignment

prepare_reference_stack

put_random_image_in_reference_image_container

set_given_parameters

low_pass_filter_reference_according_to_frc(total_average, frc_line)[source]
  • Function to filter low-resolution reference image with a hyperbolic tangent that was fitted against fourier ring correlation

Prepare the reference in 2D alignment, i.e., low-pass filter and center. Input: list ref_data 2 - raw average 3 - fsc result Output: filtered, centered, and masked reference image apply filtration (FRC) to reference image:

generate_reference_rings_from_image(reference_image, polar_interpolation_parameters, ring_weights, image_dimension, full_circle_mode='F')[source]
make_rings_and_prepare_cimage_header(image_dimension, polar_interpolation_parameters, ring_weights, reference_image)[source]
prepare_reference_images_for_alignment(mask, reference_stack)[source]
define_parameters_for_alignment(alignment_stack_name, alignment_info, ringref)[source]
limit_search_range_based_on_previous_alignment(local_prev_shift_x, x_limit, fine_x_range)[source]
>>> from spring.segment2d.segmentalign2d import SegmentAlign2d
>>> s = SegmentAlign2d()
>>> s.limit_search_range_based_on_previous_alignment(2.75, 3, 0.5)
2.5
>>> s.limit_search_range_based_on_previous_alignment(2.25, 3, 0.5)
2.25
>>> s.limit_search_range_based_on_previous_alignment(-2.75, 3, 0.5)
-2.5
>>> s.limit_search_range_based_on_previous_alignment(2.05, 3, 3)
0
>>> s.limit_search_range_based_on_previous_alignment(2.05, 5, 3)
2
perform_coarse_restrained_alignment(alignment_stack_name, ringref, polar_interpolation_parameters, alignment_info, refine_locally, full_circle_mode, align_img, search_ranges, search_limits, translation_step, center_x, center_y, each_image)[source]
perform_fine_alignment(ringref, polar_interpolation_parameters, alignment_info, full_circle_mode, align_img, search_ranges, search_limits, translation_step, center_x, center_y, dummy_transform, image_nt, determined_params, each_image, local_prev_shift_x, local_prev_shift_y)[source]
determine_odd_and_even_average_including_variance(align_img, reference_stack, assigned_images, each_image, angt, refined_shift_x, refined_shift_y, mirror, matched_reference)[source]
log_alignment_params(previous_params, determined_params)[source]
>>> from spring.segment2d.segmentalign2d import SegmentAlign2d
>>> s = SegmentAlign2d()
>>> param_nt = s.get_image_list_named_tuple()
>>> a = b = [param_nt(1, 1, 3, 0, 0, 0, 0, 1)]
>>> SegmentAlign2d().log_alignment_params(a, b)
'  stack_id    local_id    ref_id    shift_x    shift_y    inplane_angle    peak    mirror  cycle\n----------  ----------  --------  ---------  ---------  ---------------  ------  --------  ----------\n         1           1         3          0          0                0       0         1  previous\n         1           1         3          0          0                0       0         1  determined'
align_images_to_references(alignment_stack_name, reference_stack, previous_params, ringref, polar_interpolation_parameters, ring_weights, alignment_info, refine_locally=True, full_circle_mode='F')[source]
class segmentalign2d.SegmentAlign2dPostAlign(parset=None)[source]

Methods

compute_binfactor_for_desired_resolution(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

define_flow_of_alignment(pixelsize, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

limit_search_range_based_on_previous_alignment(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

log_alignment_params(previous_params, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

low_pass_filter_reference_according_to_frc(…)

  • Function to filter low-resolution reference image with a hyperbolic tangent that was fitted against fourier ring correlation

prepare_bfactor_coefficients(bfactor, …[, …])

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_cosine_falloff(image_dimension, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_filter_function(…[, …])

  • Function to generate a filter function based on hyperbolic tangent (low-pass, high-pass or band-pass filters are possible)

read_custom_filter_file([…])

  • Function to read Fourier coefficients from text file

align_images_to_references

average_stack

calculate_averages

center_and_rotate_image

center_reference_images_by_alignment_to_avg

compute_average_and_normalize

compute_variance_and_normalize

define_helix_or_particle_dimensions

define_parameters_for_alignment

determine_odd_and_even_average_including_variance

filter_references_if_requested

generate_reference_rings_from_image

generate_temp_bin_name

get_align_info_nt

get_image_alignments_from_stack

get_image_list_named_tuple

log_mask_dimensions

make_rings_and_prepare_cimage_header

pass_alignment_parameters_from_reference_groups_to_images

perform_coarse_restrained_alignment

perform_fine_alignment

prepare_alignment

prepare_empty_rings

prepare_mask

prepare_reference_images_for_alignment

prepare_reference_stack

put_random_image_in_reference_image_container

set_given_parameters

write_out_aligned_averages_and_adapt_scales_from_previous_cycle

filter_references_if_requested(reference_stack, frc_line, each_ref_id)[source]
pass_alignment_parameters_from_reference_groups_to_images(reference_stack, alignment_info, assigned_images, mask, alignment_stack_name, reference_aligned)[source]
generate_temp_bin_name(tempdir, stack_name, spec='ali')[source]
write_out_aligned_averages_and_adapt_scales_from_previous_cycle(reference_stack_name, reference_stack, segsizepix, previous_binfactor, current_binfactor)[source]
class segmentalign2d.SegmentAlign2d(parset=None)[source]

Methods

compute_binfactor_for_desired_resolution(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

define_flow_of_alignment(pixelsize, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

limit_search_range_based_on_previous_alignment(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

log_alignment_params(previous_params, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

low_pass_filter_reference_according_to_frc(…)

  • Function to filter low-resolution reference image with a hyperbolic tangent that was fitted against fourier ring correlation

prepare_bfactor_coefficients(bfactor, …[, …])

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_cosine_falloff(image_dimension, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_filter_function(…[, …])

  • Function to generate a filter function based on hyperbolic tangent (low-pass, high-pass or band-pass filters are possible)

read_custom_filter_file([…])

  • Function to read Fourier coefficients from text file

align_images_to_references

average_stack

bin_references_and_images

calculate_averages

center_and_rotate_image

center_reference_images_by_alignment_to_avg

cleanup_segmentalign2d

compute_average_and_normalize

compute_variance_and_normalize

define_helix_or_particle_dimensions

define_parameters_for_alignment

define_previous_params_and_refine_locally

determine_odd_and_even_average_including_variance

filter_references_if_requested

generate_aligned_output_file_and_update_header_of_input

generate_reference_rings_from_image

generate_temp_bin_name

get_align_info_nt

get_image_alignments_from_stack

get_image_list_named_tuple

log_mask_dimensions

make_rings_and_prepare_cimage_header

pass_alignment_parameters_from_reference_groups_to_images

perform_coarse_restrained_alignment

perform_fine_alignment

perform_iterative_alignment

perform_segmentalign2d

prepare_alignment

prepare_empty_rings

prepare_mask

prepare_reference_images_for_alignment

prepare_reference_stack

put_random_image_in_reference_image_container

set_given_parameters

write_aligned_unfiltered_averages_and_variances

write_out_aligned_averages_and_adapt_scales_from_previous_cycle

define_previous_params_and_refine_locally(images_info, determined_params, previous_binfactor, align_id, each_info)[source]
bin_references_and_images(alignment_stack_name, reference_stack_name, reference_stack, alignment_info, image_ids, align_id, previous_binfactor)[source]
write_aligned_unfiltered_averages_and_variances(reference_stack, reference_aligned, each_ref_id)[source]
generate_aligned_output_file_and_update_header_of_input(determined_params)[source]
cleanup_segmentalign2d()[source]
perform_iterative_alignment(alignment_info, images_info)[source]
perform_segmentalign2d()[source]
segmentalign2d.main()[source]

Created on Apr 14, 2011

@author: sachse

class segmentalign2d_mpi.SegmentAlign2dMpiPreparation(parset=None)[source]
  • class that holds functions for MPI functions of segmentalign

Methods

compute_binfactor_for_desired_resolution(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

define_flow_of_alignment(pixelsize, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

limit_search_range_based_on_previous_alignment(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

log_alignment_params(previous_params, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

low_pass_filter_reference_according_to_frc(…)

  • Function to filter low-resolution reference image with a hyperbolic tangent that was fitted against fourier ring correlation

prepare_bfactor_coefficients(bfactor, …[, …])

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_cosine_falloff(image_dimension, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_filter_function(…[, …])

  • Function to generate a filter function based on hyperbolic tangent (low-pass, high-pass or band-pass filters are possible)

read_custom_filter_file([…])

  • Function to read Fourier coefficients from text file

update_local_ids_in_list_of_named_tuple(…)

>>> from collections import namedtuple

align_images_to_references

average_stack

bin_references_and_images

calculate_averages

center_and_rotate_image

center_reference_images_by_alignment_to_avg

cleanup_segmentalign2d

compute_average_and_normalize

compute_variance_and_normalize

define_helix_or_particle_dimensions

define_parameters_for_alignment

define_previous_params_and_refine_locally

determine_odd_and_even_average_including_variance

filter_references_if_requested

generate_aligned_output_file_and_update_header_of_input

generate_reference_rings_from_image

generate_temp_bin_name

get_align_info_nt

get_image_alignments_from_stack

get_image_list_named_tuple

log_mask_dimensions

make_rings_and_prepare_cimage_header

pass_alignment_parameters_from_reference_groups_to_images

perform_coarse_restrained_alignment

perform_fine_alignment

perform_iterative_alignment

perform_segmentalign2d

prepare_alignment

prepare_alignment_mpi

prepare_empty_rings

prepare_mask

prepare_reference_images_for_alignment

prepare_reference_stack

put_random_image_in_reference_image_container

set_given_parameters

write_aligned_unfiltered_averages_and_variances

write_out_aligned_averages_and_adapt_scales_from_previous_cycle

update_local_ids_in_list_of_named_tuple(named_tuples)[source]
>>> from collections import namedtuple
>>> info = namedtuple('info', 'stack_id local_id')
>>> l = [info(10, 10), info(11, 11)]
>>> from spring.segment2d.segmentalign2d_mpi import SegmentAlign2dMpi
>>> SegmentAlign2dMpi().update_local_ids_in_list_of_named_tuple(l)
[info(stack_id=10, local_id=0), info(stack_id=11, local_id=1)]
prepare_alignment_mpi()[source]
class segmentalign2d_mpi.SegmentAlign2dMpi(parset=None)[source]

Methods

compute_binfactor_for_desired_resolution(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

define_flow_of_alignment(pixelsize, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

limit_search_range_based_on_previous_alignment(…)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

log_alignment_params(previous_params, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

low_pass_filter_reference_according_to_frc(…)

  • Function to filter low-resolution reference image with a hyperbolic tangent that was fitted against fourier ring correlation

mpi_gather_assigned_images(…)

>>> from spring.segment2d.segmentalign2d_mpi import SegmentAlign2dMpi

mpi_reduce_reference_stack(…)

  • Function to sum up even and odd images from reference stack

prepare_bfactor_coefficients(bfactor, …[, …])

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_cosine_falloff(image_dimension, …)

>>> from spring.segment2d.segmentalign2d import SegmentAlign2d

prepare_filter_function(…[, …])

  • Function to generate a filter function based on hyperbolic tangent (low-pass, high-pass or band-pass filters are possible)

read_custom_filter_file([…])

  • Function to read Fourier coefficients from text file

update_local_ids_in_list_of_named_tuple(…)

>>> from collections import namedtuple

align_images_to_references

average_stack

bin_references_and_images

calculate_averages

center_and_rotate_image

center_reference_images_by_alignment_to_avg

cleanup_segmentalign2d

compute_average_and_normalize

compute_variance_and_normalize

define_helix_or_particle_dimensions

define_parameters_for_alignment

define_previous_params_and_refine_locally

determine_odd_and_even_average_including_variance

filter_references_if_requested

gather_assigned_images_from_cpus_to_common_assigment_on_root

gather_averages_from_cpus_to_common_reference_stack_on_root

generate_aligned_output_file_and_update_header_of_input

generate_reference_rings_from_image

generate_temp_bin_name

get_align_info_nt

get_image_alignments_from_stack

get_image_list_named_tuple

log_mask_dimensions

make_rings_and_prepare_cimage_header

pass_alignment_parameters_from_reference_groups_to_images

perform_coarse_restrained_alignment

perform_fine_alignment

perform_iterative_alignment

perform_iterative_alignment_mpi

perform_segmentalign2d

perform_segmentalign2d_mpi

prepare_alignment

prepare_alignment_mpi

prepare_empty_rings

prepare_mask

prepare_reference_images_for_alignment

prepare_reference_stack

put_random_image_in_reference_image_container

set_given_parameters

write_aligned_unfiltered_averages_and_variances

write_out_aligned_averages_and_adapt_scales_from_previous_cycle

mpi_reduce_reference_stack(distributed_odd_averages, distributed_even_averages, distributed_variances, distributed_image_counts, reference_stack)[source]
  • Function to sum up even and odd images from reference stack

mpi_gather_assigned_images(distributed_assignments, reference_image_count)[source]
>>> from spring.segment2d.segmentalign2d_mpi import SegmentAlign2dMpi
>>> distributed_assignments = [[[0, 2], [1]], [[4], [3]], [[5, 6, 7], []], [[8, 9], []]]
>>> SegmentAlign2dMpi().mpi_gather_assigned_images(distributed_assignments, 2)
[[0, 2, 4, 5, 6, 7, 8, 9], [1, 3]]
gather_assigned_images_from_cpus_to_common_assigment_on_root(assigned_images, reference_stack)[source]
gather_averages_from_cpus_to_common_reference_stack_on_root(reference_stack)[source]
perform_iterative_alignment_mpi(alignment_info, images_info)[source]
perform_segmentalign2d_mpi()[source]
segmentalign2d_mpi.main()[source]