Documented functions with links to source¶
Program to split large scan into individual micrographs. The location of individual micrographs is determined by a dummy micrograph reference.
-
class
scansplit.
Micrograph
[source]¶ Methods
readmic
(inputimg)Function to load micrograph and define sizes
adjust_gray_values_for_print_and_optimal_display
get_statistics_from_image
-
class
scansplit.
ScanSplitPar
[source]¶ Class to initiate default dictionary with input parameters including help and range values and status dictionary
Methods
define_parameters_and_their_properties
define_program_states
set_cc_threshold
set_contact_print_option
set_final_print_option
set_label_width_and_height
set_mic_crop_count
set_mic_out_pattern
set_mic_width_and_height
set_normscan_option
set_rows_and_cols_count
-
class
scansplit.
ScanSplitRough
(parset=None)[source]¶ Class that holds all functions required for splitting micrographs
__init__ Function to read in the entered parameter dictionary, load micrograph and initialize unique temporary directory
Usage: ScanSplit(pardict)
Input: pardict = OrderedDict of program parameters
Methods
roughsplit
(scanimg, row_count, column_count, …)Function to roughly split scan into micrographs based on given number of rows and columns
-
roughsplit
(scanimg, row_count, column_count, no_mics)[source]¶ Function to roughly split scan into micrographs based on given number of rows and columns
Usage: roughsplit(row_count, column_count, mic_count)
Input: number of rows, number of columns, number of micrographs,
Output: dictionary of roughly windowed micrographs (EMData objects)
>>> from spring.micprgs.scansplit import ScanSplit >>> import numpy as np >>> from EMAN2 import EMNumPy >>> scanimg = EMNumPy.numpy2em(np.reshape(np.arange(0., 100.), (20, 5))) >>> mic_one, decfactor = ScanSplit().roughsplit(scanimg, 2, 1, 2) >>> np.rint(EMNumPy.em2numpy(mic_one[0])) array([[ 0., 1., 2., 3., 4.], [ 5., 6., 7., 8., 9.], [10., 11., 12., 13., 14.], [15., 16., 17., 18., 19.], [20., 21., 22., 23., 24.], [25., 26., 27., 28., 29.], [30., 31., 32., 33., 34.], [35., 36., 37., 38., 39.], [40., 41., 42., 43., 44.], [45., 46., 47., 48., 49.]], dtype=float32)
>>> scanimg = EMNumPy.numpy2em(np.reshape(np.arange(0., 100.), (10, 10))) >>> mic_one, decfactor = ScanSplit().roughsplit(scanimg, 1, 2, 2) >>> np.rint(EMNumPy.em2numpy(mic_one[0])) array([[ 0., 1., 2., 3., 4.], [10., 11., 12., 13., 14.], [20., 21., 22., 23., 24.], [30., 31., 32., 33., 34.], [40., 41., 42., 43., 44.], [50., 51., 52., 53., 54.], [60., 61., 62., 63., 64.], [70., 71., 72., 73., 74.], [80., 81., 82., 83., 84.], [90., 91., 92., 93., 94.]], dtype=float32)
-
class
scansplit.
ScanSplitFind
(parset=None)[source]¶ Methods
adjust_refmic
(refmic, miclist)Function to adjust size of reference microgrph to the size of rough split
findlabel
(miclist, decimation_factor_find, …)Function to locate micrograph position using cross-correlation map with reference micrograph
make_refmic
([mwidth, mheight, lwidth, …])Function to generate a reference micrograph including black label at bottom with the given dimensions
roughsplit
(scanimg, row_count, column_count, …)Function to roughly split scan into micrographs based on given number of rows and columns
determine_micrograph_offset_against_reference_micrograph
-
make_refmic
(mwidth=None, mheight=None, lwidth=None, lheight=None, scanstep=None)[source]¶ Function to generate a reference micrograph including black label at bottom with the given dimensions
Usage: make_refmic(mwidth, mheight, lwidth, lheight, scanstep)
Input: micrograph widht, micrograph height, label width, label height, scanner stepsize
Output: reference micrograph
>>> from spring.micprgs.scansplit import ScanSplit >>> refmic = ScanSplit().make_refmic(9, 10, 3, 2, 10000) >>> import numpy as np >>> from EMAN2 import EMNumPy >>> np.rint(EMNumPy.em2numpy(refmic)) 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., 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., 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., 0., 0., 0., 1., 1., 1.], [1., 1., 1., 0., 0., 0., 1., 1., 1.]], dtype=float32)
-
adjust_refmic
(refmic, miclist)[source]¶ Function to adjust size of reference microgrph to the size of rough split
-
determine_micrograph_offset_against_reference_micrograph
(refmic_with_label_top, refmic_with_label_bottom, micrograph)[source]¶
-
findlabel
(miclist, decimation_factor_find, scanstep)[source]¶ Function to locate micrograph position using cross-correlation map with reference micrograph
Usage: findlabel(refmic, miclist)
Input: stack of roughly split micrographs, reference micrograph, number of micrographs, dictionary that holds micrograph objects, number of micrographs
Output: Position of X-offset and Y-offset and cross-correlation peak value of match
-
class
scansplit.
ScanSplitOptions
(parset=None)[source]¶ Methods
adjust_refmic
(refmic, miclist)Function to adjust size of reference microgrph to the size of rough split
>>> ScanSplit().assign_edge_value_to_edge_columns(2, 100)
bin_micrographs
(miclist, binfactor)Function to bin series of micrographs by binfactor
contactprint
(scanimg, infile)Function to generate a contact print of the negative scan
finalprint
(miclist)Function to generate final prints of the cropped micrographs
findlabel
(miclist, decimation_factor_find, …)Function to locate micrograph position using cross-correlation map with reference micrograph
make_refmic
([mwidth, mheight, lwidth, …])Function to generate a reference micrograph including black label at bottom with the given dimensions
normalize_columns
(micrograph)determine number of columns pull out each column normalize
normscan
(miclist)Function to normalize micrograph columns from Zeiss scans
prepare_print
(img, infile, outfile[, fig_number])Function to write print
roughsplit
(scanimg, row_count, column_count, …)Function to roughly split scan into micrographs based on given number of rows and columns
determine_micrograph_offset_against_reference_micrograph
-
assign_edge_value_to_edge_columns
(column_number, column_count)[source]¶ >>> ScanSplit().assign_edge_value_to_edge_columns(2, 100) 6 >>> ScanSplit().assign_edge_value_to_edge_columns(66, 100) 66 >>> ScanSplit().assign_edge_value_to_edge_columns(95, 100) 94
-
normscan
(miclist)[source]¶ Function to normalize micrograph columns from Zeiss scans
Usage: normscan(normscanpath, miclist)
Input: list of micrographs
Output: Series of normalized micrographs, list of normalized micrograph filenames
-
contactprint
(scanimg, infile)[source]¶ Function to generate a contact print of the negative scan
Usage: contactprint(scanimg, infile)
Input: micrograph EMData object, input filename
Output: compressed contact print ( file)
-
prepare_print
(img, infile, outfile, fig_number=None)[source]¶ Function to write print
Usage: fig = prepare_print(img, infile, outfile, fig_number)
Input: image to be printed, input filename, outputfilename, figure number
Output: figure to be saved
-
class
scansplit.
ScanSplit
(parset=None)[source]¶ Methods
adjust_refmic
(refmic, miclist)Function to adjust size of reference microgrph to the size of rough split
assign_edge_value_to_edge_columns
(…)>>> ScanSplit().assign_edge_value_to_edge_columns(2, 100)
bin_micrographs
(miclist, binfactor)Function to bin series of micrographs by binfactor
Function to adjust windowing parameter in case of incompletely scanned micrographs
contactprint
(scanimg, infile)Function to generate a contact print of the negative scan
finalprint
(miclist)Function to generate final prints of the cropped micrographs
findlabel
(miclist, decimation_factor_find, …)Function to locate micrograph position using cross-correlation map with reference micrograph
finesplit
(row_count, column_count, mwidth, …)Function to finely split scan into micrographs according to found micrograph location
make_refmic
([mwidth, mheight, lwidth, …])Function to generate a reference micrograph including black label at bottom with the given dimensions
normalize_columns
(micrograph)determine number of columns pull out each column normalize
normscan
(miclist)Function to normalize micrograph columns from Zeiss scans
prepare_print
(img, infile, outfile[, fig_number])Function to write print
roughsplit
(scanimg, row_count, column_count, …)Function to roughly split scan into micrographs based on given number of rows and columns
split_output_string
(outfile)>>> ScanSplit().split_output_string('test_???.mrc')
compute_micrograph_center_in_scan
determine_micrograph_offset_against_reference_micrograph
perform_splitscan
perform_splitscan_by_finding_location_with_respect_to_reference_micrograph
-
split_output_string
(outfile)[source]¶ >>> ScanSplit().split_output_string('test_???.mrc') ['test_', '.mrc'] >>> ScanSplit().split_output_string('test_??.mrc') ['test_', '.mrc'] >>> ScanSplit().split_output_string('test_?.mrc') ['test_', '.mrc'] >>> ScanSplit().split_output_string('test_*.mrc') ['test_', '.mrc'] >>> ScanSplit().split_output_string('test_%02d.mrc') ['test_', '.mrc']
-
check_and_adjust_windowing_paramters
(scan_dimension, mic_dimension, center)[source]¶ Function to adjust windowing parameter in case of incompletely scanned micrographs
>>> ScanSplit().check_and_adjust_windowing_paramters((1500, 1000), (500, 500), (300, 300)) (500, 450, 300, 275) >>> ScanSplit().check_and_adjust_windowing_paramters((1000, 1000), (500, 500), (300, 300)) (450, 450, 275, 275) >>> ScanSplit().check_and_adjust_windowing_paramters((1500, 1500), (500, 500), (300, 300)) (500, 500, 300, 300)
-
finesplit
(row_count, column_count, mwidth, mheight, scanstep, xoffset, yoffset, ccpeaks, cc_threshold, outfile)[source]¶ Function to finely split scan into micrographs according to found micrograph location
Usage: finesplit(row_count, column_count, mwidth, mheight, scanstep, xoffset, yoffset, ccpeaks, cc_threshold, outfile)
Input: number of rows, number of colums, number of micrographs, micrograph width, micrograph height, scanner stepsize, X-offset center, Y-offset center, list of cross-correlation peaks, cross-correlation threshold
Output: series of cropped micrographs
-
class
scansplit_mpi.
ScanSplitMpi
(parset=None)[source]¶ Methods
adjust_refmic
(refmic, miclist)Function to adjust size of reference microgrph to the size of rough split
assign_edge_value_to_edge_columns
(…)>>> ScanSplit().assign_edge_value_to_edge_columns(2, 100)
bin_micrographs
(miclist, binfactor)Function to bin series of micrographs by binfactor
check_and_adjust_windowing_paramters
(…)Function to adjust windowing parameter in case of incompletely scanned micrographs
contactprint
(scanimg, infile)Function to generate a contact print of the negative scan
finalprint
(miclist)Function to generate final prints of the cropped micrographs
findlabel
(miclist, decimation_factor_find, …)Function to locate micrograph position using cross-correlation map with reference micrograph
finesplit
(row_count, column_count, mwidth, …)Function to finely split scan into micrographs according to found micrograph location
make_refmic
([mwidth, mheight, lwidth, …])Function to generate a reference micrograph including black label at bottom with the given dimensions
normalize_columns
(micrograph)determine number of columns pull out each column normalize
normscan
(miclist)Function to normalize micrograph columns from Zeiss scans
prepare_print
(img, infile, outfile[, fig_number])Function to write print
roughsplit
(scanimg, row_count, column_count, …)Function to roughly split scan into micrographs based on given number of rows and columns
split_output_string
(outfile)>>> ScanSplit().split_output_string('test_???.mrc')
compute_micrograph_center_in_scan
determine_micrograph_offset_against_reference_micrograph
end_scan_mpi_programs
perform_splitscan
perform_splitscan_by_finding_location_with_respect_to_reference_micrograph
startup_scan_mpi_programs