imod.utils module

This module contains utils functions for IMOD protocols

imod.utils.calculateRotationAngleFromTM(ts)[source]

This method calculates que average tilt image rotation angle from its associated transformation matrix.

imod.utils.format3DCoordinatesList(coordFilePath)[source]

This method takes an IMOD-based fiducial coordinates file path and returns a list containing each coordinate for each fiducial belonging to the tilt-series.

imod.utils.formatAngleFile(inputTs, angleFilePath)[source]

This method takes a list containing the angles for each tilt-image belonging to the tilt-series and writes the IMOD-based angle file at the given location.

imod.utils.formatAngleList(tltFilePath)[source]

This method takes an IMOD-based angle file path and returns a list containing the angles for each tilt-image belonging to the tilt-series.

imod.utils.formatFiducialList(fiducialFilePath)[source]

This method takes an IMOD-based fiducial model file path and returns a list containing the coordinates of each fiducial for each tilt-image belonging to the tilt-series.

imod.utils.formatFiducialResidList(fiducialFilePath)[source]

This method takes an IMOD-based fiducial residual model file path and returns a list containing the coordinates and residual values of each fiducial for each tilt-image belonging to the tilt-series. Since IMOD establishes a float value for each coordinate the are parsed to int.

imod.utils.formatGoldBead3DCoordinatesList(coordFilePath)[source]

This method takes the IMOD-based gold bead 3D coordinates obtained with find3dbeads program file path and returns a list containing each coordinate for each bead belonging to the tilt-series

imod.utils.formatTransformFile(ts, transformFilePath)[source]

This method takes a tilt series and the output transformation file path and creates an IMOD-based transform file in the location indicated.

imod.utils.formatTransformFileFromTransformList(transformMatrixList, transformFilePath)[source]

This method takes a list of Transform matrices and the output transformation file path and creates an IMOD-based transform file in the location indicated. :param transformMatrixList: list of transformation matrices to be writter in file. :param transformFilePath: output location of the file.

imod.utils.formatTransformationMatrix(matrixFile)[source]

This method takes an IMOD-based transformation matrix file path and returns a 3D matrix containing the transformation matrices for each tilt-image belonging to the tilt-series.

imod.utils.generateCutOnFreqDictionary(ctfTomoSeries)[source]

This method generates a dictionary containing the cut-on frequency estimation information from a ctfTomoSeries object.

imod.utils.generateDefocusAngleDictionary(ctfTomoSeries)[source]

This method generates a dictionary containing the defocus angle estimation information from a ctfTomoSeries object.

imod.utils.generateDefocusIMODFileFromObject(ctfTomoSeries, defocusFilePath, isRelion=False)[source]

This methods takes a ctfTomoSeries object a generate a defocus information file in IMOD formatting containing the same information in the specified location.

imod.utils.generateDefocusUDictionary(ctfTomoSeries)[source]

This method generates a dictionary containing the defocus U estimation information from a ctfTomoSeries object.

imod.utils.generateDefocusVDictionary(ctfTomoSeries)[source]

This method generates a dictionary containing the defocus V estimation information from a ctfTomoSeries object.

imod.utils.generateDoseFileFromAccDoseTS(ts, doseFileOutputPath)[source]

This method generates a file containing the dose information of a tilt series in the specified location from the accumulated dose per tilt information. The format file consist in a single column with one dose value per line that must coincide with each image from the tilt-series

imod.utils.generateDoseFileFromDoseTS(ts, doseFileOutputPath)[source]

This method generates a file containing the dose information of a tilt series in the specified location from the dose per tilt information. The format file consist in a single column with one dose value per line that must coincide with each image from the tilt-series

imod.utils.generateIMODFiducialTextFile(landmarkModel, outputFilePath)[source]

This method takes a Scipion LandmarkModel object and generates a text file in the sepecified location in IMOD convention that contains the information of the position of each fiducial through the tilt-series. :param landmarkModel: landmarkModel Scipion object. :param outputFilePath: location where the output file must be saved.

imod.utils.generatePhaseShiftDictionary(ctfTomoSeries)[source]

This method generates a dictionary containing the phase shift estimation information from a ctfTomoSeries object.

imod.utils.getDefocusFileFlag(defocusFilePath)[source]

This method returns the flag that indicate the information contained in an IMOD defocus file. The flag value “is the sum of:

1 if the file has astigmatism values 2 if the astigmatism axis angle is in radians, not degrees 4 if the file has phase shifts 8 if the phase shifts are in radians, not degrees

16 if tilt angles need to be inverted to match what the

program expects (what Ctfplotter would produce) with the -invert option

32 if the file has cut-on frequencies attenuating the phase

at low frequencies”

from https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html

imod.utils.readCTFEstimationInfoFile(defocusFilePath, flag)[source]

This method takes an IMOD-based file path containing the information associated to a CTF estimation and produces a set of dictionaries containing the information of each parameter for each tilt-image belonging to the tilt-series. These dictionaries are readable information for Scipion, useful to generate the corresponding output CTFTomoSeries object.

imod.utils.readDefocusFileAsTable(defocusFilePath)[source]

This method takes an IMOD-based ctf estimation file path and returns a table containing the CTF estimation information of each tilt-image (per line) belonging to the tilt-series.

imod.utils.readExcludeViewsFile(excludeViewsFilePath)[source]

Thie method retrieves from a input exclude views file path a matrix with two columns containing the tsId of tilt-series from which exlude the views in the first column and in the second a string with the pattern of the excluded views

imod.utils.refactorCTFDefocusAstigmatismPhaseShiftCutOnFreqEstimationInfo(ctfInfoIMODTable)[source]

This method takes a table containing the information of an IMOD-based CTF estimation containing defocus, astigmatism, phase shift information and cut-on frequency (8 columns) and produces a new set of dictionaries containing the same information in a format readable for Scipion. Flag 37.

imod.utils.refactorCTFDefocusAstigmatismPhaseShiftEstimationInfo(ctfInfoIMODTable)[source]

This method takes a table containing the information of an IMOD-based CTF estimation containing defocus, astigmatism and phase shift information (8 columns) and produces a new set of dictionaries containing the same information in a format readable for Scipion. Flag 5.

imod.utils.refactorCTFDefocusEstimationInfo(ctfInfoIMODTable)[source]

This method takes a table containing the information of an IMOD-based CTF estimation containing only defocus information (5 columns) and produces a new dictionary containing the same information in a format readable for Scipion. Flag 0.

imod.utils.refactorCTFDefocusPhaseShiftEstimationInfo(ctfInfoIMODTable)[source]

This method takes a table containing the information of an IMOD-based CTF estimation containing defocus, and phase shift information (6 columns) and produces a new set of dictionaries containing the same information in a format readable for Scipion. Flag 4.

imod.utils.refactorCTFDesfocusAstigmatismEstimationInfo(ctfInfoIMODTable)[source]

This method takes a table containing the information of an IMOD-based CTF estimation containing defocus and astigmatism information (7 columns) and produces a set of dictionaries table containing the same information in a format readable for Scipion. Flag 1.