tomo.objects module

class tomo.objects.AverageSubTomogram(**kwargs)[source]

Bases: SubTomogram

Represents a Average SubTomogram. It is a SubTomogram but it is useful to differentiate outputs.

class tomo.objects.CTFTomo(**kwargs)[source]

Bases: CTFModel

Represents a generic CTF model for a tilt-image.

appendCutOnFreqList(value)[source]
appendDefocusAngleList(value)[source]
appendDefocusUList(value)[source]
appendDefocusVList(value)[source]
appendPhaseShiftList(value)[source]
completeInfoFromList()[source]

This method will set the _defocusU, _defocusV and _defocusAngle attributes from the provided CTF estimation information lists.

Based on the IMOD program ctfphaseflip: “The program will assign that defocus value to the midpoint of the range of views. For a view at a given tilt angle, it will find the defocus either by interpolating between two surrounding midpoint angles, if there are such angles, or by taking the nearest defocus value, if the angle is beyond the range of the available midpoint angles. ” - From IMOD documentation https://bio3d.colorado.edu/imod/doc/man/ctfphaseflip.html

This method will assign as the defocus value and angle the median of the estimation list.

copyInfo(other, copyId=False)[source]
static ctfModelToCtfTomo(ctfModel)[source]
getCutOnFreq()[source]
getCutOnFreqList()[source]
getDefocusAngleList()[source]
getDefocusUDeviation(mean)[source]
getDefocusUList()[source]
getDefocusVDeviation(mean)[source]
getDefocusVList()[source]
getIndex()[source]
getIsDefocusUDeviationInRange()[source]
getIsDefocusVDeviationInRange()[source]
getPhaseShiftList()[source]
getdefocusUDeviation()[source]
getdefocusVDeviation()[source]
hasAstigmatismInfoAsList()[source]

This method checks if the CTFTomo object contains astigmatism information in the form of a list.

hasCutOnFrequncyInfoAsList()[source]

This method checks if the CTFTomo object contains cut-on frequency information in the form of a list.

hasEstimationInfoAsList()[source]

This method checks if the CTFTomo object contains estimation information in the form of a list.

hasPhaseShiftInfoAsList()[source]

This method checks if the CTFTomo object contains phase shift information in the form of a list.

isDefocusUDeviationInRange(mean, percentage=20)[source]
isDefocusVDeviationInRange(mean, percentage=20)[source]
setCutOnFreq(value)[source]
setCutOnFreqList(cutOnFreqList)[source]
setDefocusAngleList(defList)[source]
setDefocusUList(defList)[source]
setDefocusVList(defList)[source]
setIndex(value)[source]
setIsDefocusUDeviationInRange(value)[source]
setIsDefocusVDeviationInRange(value)[source]
setPhaseShiftList(defList)[source]
class tomo.objects.CTFTomoSeries(**kwargs)[source]

Bases: EMSet

Represents a set of CTF models belonging to the same tilt-series.

ITEM_TYPE

alias of CTFTomo

calculateDefocusUDeviation(defocusUTolerance=20)[source]
calculateDefocusVDeviation(defocusVTolerance=20)[source]
clone(ignoreAttrs=('_mapperPath', '_size'))[source]

Override the clone defined in Object to avoid copying _mapperPath property

getIMODDefocusFileFlag()[source]

Return the format file from which the CTF estimation information has been acquired. This parameter is useful for posterior information and format conversions between IMOD and Scipion. 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

getIsDefocusUDeviationInRange()[source]
getIsDefocusVDeviationInRange()[source]
getNumberOfEstimationsInRange()[source]

Return the tilt-images range size used for estimation.

getTiltSeries()[source]

Return the tilt-series associated with this CTF model series.

getTsId()[source]

Get unique TiltSeries ID, usually retrieved from the file pattern provided by the user at the import time.

setIMODDefocusFileFlag(flag)[source]

Set the format file from which the CTF estimation information has been acquired. :param flag: Integer of the range size.

This parameter is useful for posterior information and format conversions between IMOD and Scipion. 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

setIsDefocusUDeviationInRange(value)[source]
setIsDefocusVDeviationInRange(value)[source]
setNumberOfEstimationsInRange(estimationRange)[source]

Set the tilt-images range size used for estimation. :param estimationRange: Integer of the range size.

setNumberOfEstimationsInRangeFromDefocusList()[source]

Set the tilt-images estimation range size used for estimation from the defocus info list size.

setTiltSeries(tiltSeries)[source]

Set the tilt-series from which this CTF model series were estimated. :param tiltSeries: Either a TiltSeries object or a pointer to it.

setTsId(value)[source]
class tomo.objects.ClassSubTomogram(**kwargs)[source]

Bases: SetOfSubTomograms

Represent a Class that groups SubTomogram objects. The representative of the class is an AverageSubTomogram.

REP_TYPE

alias of AverageSubTomogram

clone()[source]

Override the clone defined in Object to avoid copying _mapperPath property

close()[source]
copyInfo(other)[source]

Copy basic information (id and other properties) but not _mapperPath or _size from other set of SubTomograms to current one.

class tomo.objects.Coordinate3D(**kwargs)[source]

Bases: EMObject

This class holds the (x,y,z) position and other information associated with a coordinate

copyInfo(coord)[source]

Copy information from other coordinate.

euler2Matrix(r, p, y)[source]
eulerAngles()[source]
getBoxSize()[source]
getGroupId()[source]
getMatrix(convention=None)[source]
getPosition(originFunction)[source]

Get the position a Coordinate3D refered to a given origin defined by originFunction. The input of the method is a funtion (originFunction) which moves the coordinate position refered to the bottom left corner to other origin (retrieved by originFunction) in the grid.

Parameters:

param function originFunction

Function to return a Vector to refer a coordinate to the bottom left corner from a given convention.

Example:

>>> origin = originFunction((Lx, Ly, Lz))
>>> (vx, vy, vz)  # Vector to refer (x,y,z) coordinate to an origin from the bottom left corner

Firstly, the Scipion origin vector stored in the Tomogram associated to the Coordinate3D will be applied to refer the current coordinate to the bottom left coordinate of the Tomogram.

getTomoId()[source]
getVolId()[source]
getVolName()[source]
getVolume()[source]

Return the micrograph object to which this coordinate is associated.

getVolumeOrigin(angstrom=False)[source]

Return the a vector that can be used to move the position of the Coordinate3D (referred to the center of the Tomogram or other origin specified by the user) to the bottom left corner of the Tomogram

getX(originFunction)[source]

See getPosition method for a full description of how “originFunction” works

getY(originFunction)[source]

See getPosition method for a full description of how “originFunction” works

getZ(originFunction)[source]

See getPosition method for a full description of how “originFunction” works

hasGroupId()[source]
hasTransform()[source]
invertY()[source]
scale(factor)[source]

Scale x, y and z coordinates by a given factor.

setBoxSize(boxSize)[source]
setGroupId(groupId)[source]
setMatrix(matrix, convention=None)[source]
setPosition(x, y, z, originFunction)[source]

Set the position of the coordinate to be saved in the Coordinate3D object. The inputs of the method are the (x,y,z) position of the coordinate and a funtion (originFunction) which moves the current position to the bottom left corner of the Tomogram with dimensions Lx, Ly, Lz.

Parameters:

param int x

Position of the coordinate in the X axis

param int y

Position of the coordinate in the Y axis

param int z

Position of the coordinate in the Z axis

param function originFunction

Function to return a Vector to refer a coordinate to the bottom left corner from a given convention.

Example:

>>> origin = originFunction((Lx, Ly, Lz))
>>> (vx, vy, vz)  # Vector to refer (x,y,z) coordinate to the bottom left corner

In this way, it is possible to apply the Scipion origin vector stored in the Tomogram associated to the Coordinate3D which moves the positions referred to the bottom left corner of a grid to the center of gravity of the grid (or any other origin specified by the user).

IMPORTANT NOTE: For this method to work properly, it is needed to associate the Tomogram before doing a call to this method.

Example:

>>> coord = Coordinate3D()
>>> coord.setPosition(x, y, z, originFunction)
>>> Error: Tomogram is still NoneType
>>> coord.setVolume(Tomogram)
>>> coord.setPosition(x, y, z, originFunction)
>>> Exit: Everything runs normally

This requirement is only needed for “setPostion” method. The remaining attributes of the object can be set either before or after calling “setVolume” method.

setTomoId(tomoId)[source]
setVolId(volId)[source]
setVolume(volume)[source]

Set the micrograph to which this coordinate belongs.

setX(x, originFunction)[source]

See setPosition method for a full description of how “originFunction” works

setY(y, originFunction)[source]

See setPosition method for a full description of how “originFunction” works

setZ(z, originFunction)[source]

See setPosition method for a full description of how “originFunction” works

shiftX(shiftX)[source]
shiftY(shiftY)[source]
shiftZ(shiftZ)[source]
class tomo.objects.Ellipsoid(**kwargs)[source]

Bases: EMObject

This class represent an ellipsoid. This is an instance class of description attribute of object MeshPoint

getAlgebraicDesc()[source]
getCenter()[source]
getRadii()[source]
hasAlgebraicDesc()[source]
setAlgebraicDesc(algebraicDesc)[source]
setCenter(center)[source]
setRadii(radii)[source]
class tomo.objects.LandmarkModel(tsId=None, fileName=None, modelName=None, **kwargs)[source]

Bases: EMObject

Represents the set of landmarks belonging to an specific tilt-series.

addLandmark(xCoor, yCoor, tiltIm, chainId, xResid, yResid)[source]
getFileName()[source]
getModelName()[source]
getTiltSeries()[source]

Return the tilt-series associated with this landmark model.

getTsId()[source]
retrieveInfoTable()[source]

This methods return a table containing the information of the lankmark model. One landmark pero line specifying in order: xCoor, YCoor, tiltIm, chainId, xResid, yResid

setFileName(fileName)[source]
setModelName(modelName)[source]
setTiltSeries(tiltSeries)[source]

Set the tilt-series from which this landmark model were calculated. :param tiltSeries: Either a TiltSeries object or a pointer to it.

setTsId(tsId)[source]
class tomo.objects.MeshPoint(**kwargs)[source]

Bases: Coordinate3D

Mesh object: it stores the coordinates of the points (specified by the user) needed to define the triangulation of a volume. A Mesh object can be consider as a point cloud in 3D containing the coordinates needed to divide a given region of space into planar triangles interconnected that will result in a closed surface.

getDescription()[source]
getVolumeName()[source]
hasDescription()[source]
setDescription(description)[source]
setVolumeName(volName)[source]
class tomo.objects.SetOfAverageSubTomograms(**kwargs)[source]

Bases: SetOfSubTomograms

Represents a set of Averages. It is a SetOfSubTomograms but it is useful to differentiate outputs.

ITEM_TYPE

alias of AverageSubTomogram

REP_TYPE

alias of AverageSubTomogram

class tomo.objects.SetOfCTFTomoSeries(**kwargs)[source]

Bases: EMSet

Represents a set of CTF model series belonging to the same set of tilt-series.

ITEM_TYPE

alias of CTFTomoSeries

USE_CREATE_COPY_FOR_SUBSET = True
copyInfo(other)[source]

Define a dummy copyInfo function to be used for some generic operations on sets.

getFirstItem()[source]

Return the first item in the Set.

getSetOfTiltSeries(pointer=False)[source]

Return the tilt-series associated with this CTF model series.

iterClassItems(iterDisabled=False)[source]

Iterate over the images of a class. Params:

iterDisabled: If True, also include the disabled items.

iterItems(orderBy='id', direction='ASC')[source]
setSetOfTiltSeries(setOfTiltSeries)[source]

Set the tilt-series from which this CTF model series were estimated. :param setOfTiltSeries: Either a TiltSeries object or a pointer to it.

class tomo.objects.SetOfClassesSubTomograms(**kwargs)[source]

Bases: SetOfClasses

Store results from a subtomogram averaging method.

ITEM_TYPE

alias of ClassSubTomogram

REP_TYPE

alias of AverageSubTomogram

class tomo.objects.SetOfCoordinates3D(**kwargs)[source]

Bases: EMSet

Encapsulate the logic of a set of volumes coordinates. Each coordinate has a (x,y,z) position and is related to a Volume The SetOfCoordinates3D can also have information about TiltPairs.

ITEM_TYPE

alias of Coordinate3D

copyInfo(other)[source]

Copy basic information (id and other properties) but not _mapperPath or _size from other set of objects to current one.

getBoxSize()[source]

Return the box size of the particles.

getFiles()[source]

Get all filePaths

getFirstItem()[source]

Return the first item in the Set.

getPrecedents()[source]

Returns the SetOfTomograms or Tilt Series associated with this SetOfCoordinates

getSamplingRate()[source]

Return the sampling rate of the particles.

getSummary()[source]
iterCoordinates(volume=None, orderBy='id')[source]

Iterate over the coordinates associated with a tomogram. If volume=None, the iteration is performed over the whole set of coordinates.

IMPORTANT NOTE: During the storing process in the database, Coordinates3D will lose their pointer to ther associated Tomogram. This method overcomes this problem by retrieving and relinking the Tomogram as if nothing would ever happened.

It is recommended to use this method when working with Coordinates3D, being the common “iterItems” deprecated for this set.

Example:

>>> for coord in coordSet.iterItems()
>>>     print(coord.getVolName())
>>>     Error: Tomogram associated to Coordinate3D is NoneType (pointer lost)
>>> for coord in coordSet.iterCoordinates()
>>>     print(coord.getVolName())
>>>     '/path/to/Tomo.file' retrieved correctly
iterVolumeCoordinates(volume)[source]

Iterates over the set of coordinates belonging to that micrograph.

iterVolumes()[source]

Iterate over the objects set associated with this set of coordinates.

setBoxSize(boxSize)[source]

Set the box size of the particles.

setPrecedents(precedents)[source]

Set the tomograms or Tilt Series associated with this set of coordinates. Params:

tomograms: Either a SetOfTomograms or Tilt Series object or a pointer to it.

setSamplingRate(sampling)[source]

Set the sampling rate of the particles.

class tomo.objects.SetOfLandmarkModels(**kwargs)[source]

Bases: EMSet

Represents a class that groups a set of landmark models.

ITEM_TYPE

alias of LandmarkModel

completeLandmarkModel(lm)[source]

This method completes a landmark model object setting in execution time the tilt-series associated to it, since it is not possible to save pointers in the item classes of the set.

IMPORTANT: this method must be implement every time it is necesary to retrive information from the tilt-series associated to the landmark models that compose the set.

getLandmarkModelFromTsId(tsId)[source]

This method return the landmark model belonging to the set that has a coincident input tsId.

Parameters

tsId – tilt-series ID to search the landmark model into the set.

getSetOfTiltSeries(pointer=False)[source]

Return the set of tilt-series associated with this set of landmark models.

setSetOfTiltSeries(setOfTiltSeries)[source]

Set the set of tilt-series from which this set of landmark models were calculted. :param tiltSeries: Either a TiltSeries object or a pointer to it.

class tomo.objects.SetOfMeshes(**kwargs)[source]

Bases: SetOfCoordinates3D

Store a series of meshes.

ITEM_TYPE

alias of MeshPoint

getNumberOfMeshes()[source]
setNumberOfMeshes(n)[source]
class tomo.objects.SetOfSubTomograms(**kwargs)[source]

Bases: SetOfVolumes

ITEM_TYPE

alias of SubTomogram

REP_TYPE

alias of SubTomogram

copyInfo(other)[source]

Copy basic information (sampling rate and ctf) from other set of images to current one

getCoordinates3D()[source]

Returns the SetOfCoordinates associated with this SetOfSubTomograms

getTomogram(subtomo)[source]

returns and caches the tomogram related with a subtomogram. If the subtomograms were imported and not associated to any tomogram returns None.

hasCoordinates3D()[source]
iterSubtomos(volume=None, orderBy='id')[source]

Iterates over the sutomograms, enriching them with the related tomogram if apply so coordinate getters and setters will work If volume=None, the iteration is performed over the whole set of subtomograms.

IMPORTANT NOTE: During the storing process in the database, Coordinates3D will lose their pointer to the associated Tomogram. This method overcomes this problem by retrieving and relinking the Tomogram as if nothing would ever happened.

It is recommended to use this method when working with subtomograms, anytime you want to properly use its coordinate3D attached object.

Example:

>>> for subtomo in subtomos.iterItems()
>>>     print(subtomo.getCoordinate3D().getX(SCIPION))
>>>     Error: Tomogram associated to Coordinate3D is NoneType (pointer lost)
>>> for subtomo in subtomos.iterSubtomos()
>>>     print(subtomo.getCoordinate3D().getX(SCIPION))
>>>     330 retrieved correctly
setCoordinates3D(coordinates)[source]

Set the SetOfCoordinates associates with this set of particles.

class tomo.objects.SetOfTiltSeries(**kwargs)[source]

Bases: SetOfTiltSeriesBase

ITEM_TYPE

alias of TiltSeries

class tomo.objects.SetOfTiltSeriesBase(**kwargs)[source]

Bases: SetOfImages

EXPOSE_ITEMS = True
USE_CREATE_COPY_FOR_SUBSET = True

Base class for SetOfTiltImages and SetOfTiltImagesM.

copyInfo(other)[source]

Copy information (sampling rate and ctf) from other set of images to current one

copyItems(inputTs, orderByTs='id', updateTsCallback=None, orderByTi='id', updateTiCallback=None)[source]

Copy items (TiltSeries and TiltImages) from the input Set. Params:

inputTs: input TiltSeries (or movies) from where to copy elements. orderByTs: optional orderBy value for iterating over TiltSeries updateTsCallback: optional callback after TiltSeries is created orderByTi: optional orderBy value for iterating over TiltImages updateTiCallback: optional callback after TiltImage is created

getAnglesCount()[source]
getFirstItem()[source]

Return the first item in the Set.

getScannedPixelSize()[source]
iterClassItems(iterDisabled=False)[source]

Iterate over the images of a class. Params:

iterDisabled: If True, also include the disabled items.

iterItems(**kwargs)[source]

Redefine iteration to set the acquisition to images.

setAnglesCount(value)[source]
updateDim()[source]

Update dimensions of this set base on the first element.

class tomo.objects.SetOfTiltSeriesCoordinates(**kwargs)[source]

Bases: EMSet

Encapsulate the logic of a set of tilt series coordinates. Each coordinate has a (x,y,z) position in scipion’s convention. Scipion’s convention is the center of a theoretical volume when applying the tilt series transformation matrix: X0 –> half x dimension Y0 –> half y dimension Z0 –> half z of a theoretical volume?

ITEM_TYPE

alias of TiltSeriesCoordinate

copyInfo(other)[source]

Copy basic information (id and other properties) but not _mapperPath or _size from other set of objects to current one.

getSummary()[source]
getTiltSeries()[source]

Returns the Tilt Series associated with this SetOfTiltSeriesCoordinates

setTiltSeries(tiltseries)[source]

Set the Tilt Series associated with this set of coordinates.

Params:

tiltseries: Tilt Series object or a pointer to it.

class tomo.objects.SetOfTiltSeriesM(**kwargs)[source]

Bases: SetOfTiltSeriesBase

ITEM_TYPE

alias of TiltSeriesM

copyInfo(other)[source]

Copy SoM specific information plus inherited

getDark()[source]
getFramesRange()[source]
getGain()[source]
setDark(dark)[source]
setFramesRange(value)[source]
setGain(gain)[source]
class tomo.objects.SetOfTomoMasks(*args, **kwargs)[source]

Bases: SetOfTomograms

EXPOSE_ITEMS = True
ITEM_TYPE

alias of TomoMask

class tomo.objects.SetOfTomograms(*args, **kwargs)[source]

Bases: SetOfVolumes

EXPOSE_ITEMS = True
ITEM_TYPE

alias of Tomogram

updateDim()[source]

Update dimensions of this set base on the first element.

class tomo.objects.SubTomogram(**kwargs)[source]

Bases: Volume

getAcquisition()[source]
getCoordinate3D()[source]

Since the object Coordinate3D needs a volume, use the information stored in the SubTomogram to reconstruct the corresponding Tomogram associated to its Coordinate3D

getTransform(convention=None)[source]
getVolId()[source]

Return the tomogram id if the coordinate is not None. or have set the _volId property.

getVolName()[source]

Return the tomogram filename if the coordinate is not None. or have set the _volName property.

getVolumeOrigin(angstrom=False)[source]

Return the a vector that can be used to move the position of the Coordinate3D associated to the SubTomogram (referred to the center of the Tomogram or other origin specified by the user) to the bottom left corner of the Tomogram

hasAcquisition()[source]
hasCoordinate3D()[source]
setAcquisition(acquisition)[source]
setCoordinate3D(coordinate)[source]
setTransform(newTransform, convention=None)[source]
setVolId(volId)[source]
setVolName(volName)[source]
class tomo.objects.TiltImage(location=None, **kwargs)[source]

Bases: Image, TiltImageBase

Tilt image

copyInfo(other, copyId=False, copyTM=True)[source]

Copy basic information

parseFileName(suffix='', extension=None)[source]

This method returns the filename of the Tilt-Image adding a specified suffix and changing its extension. :param suffix: String to be added at the end of the location path (before extension). :param extension: String containing the new extension of the filename. :return: String containing the parsed filename with the specified suffix and extension.

class tomo.objects.TiltImageBase(tsId=None, tiltAngle=None, acquisitionOrder=None, **kwargs)[source]

Bases: object

Base class for TiltImageM and TiltImage.

copyInfo(other, copyId=False, copyTM=True)[source]
getAcquisitionOrder()[source]
getTiltAngle()[source]
getTsId()[source]

Get unique TiltSerie ID, usually retrieved from the file pattern provided by the user at the import time.

setAcquisitionOrder(value)[source]
setTiltAngle(value)[source]
setTsId(value)[source]
class tomo.objects.TiltImageM(location=None, **kwargs)[source]

Bases: Movie, TiltImageBase

Tilt movie.

copyInfo(other, copyId=False, copyTM=True)[source]

Copy basic information

class tomo.objects.TiltSeries(**kwargs)[source]

Bases: TiltSeriesBase

ITEM_TYPE

alias of TiltImage

applyTransform(outputFilePath, swapXY=False)[source]
writeImodFiles(folderName, **kwargs)[source]
writeNewstcomFile(ts_folder, **kwargs)[source]

Writes an artificial newst.com file

writeTiltcomFile(ts_folder, **kwargs)[source]

Writes an artificial tilt.com file

writeTltFile(ts_folder)[source]
writeXfFile(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.

writeXtiltFile(ts_folder)[source]
class tomo.objects.TiltSeriesBase(**kwargs)[source]

Bases: SetOfImages

append(tiltImage)[source]

Add a image to the set.

clone(ignoreAttrs=('_mapperPath', '_size'))[source]

Override the clone defined in Object to avoid copying _mapperPath property

close()[source]
copyInfo(other, copyId=False)[source]

Copy basic information (id and other properties) but not _mapperPath or _size from other set of tomograms to current one.

generateTltFile(tltFilePath, reverse=False)[source]

Generates an angle file in .tlt format in the specified location. If reverse is set to true the angles in file are sorted in the opposite order. :param tltFilePath: String containing the path where the file is created. :param reverse: Boolean indicating if the angle list must be reversed.

getAnglesCount()[source]
getOrigin(force=False)[source]

Method to get the origin associated to the TiltSeries. If there is no origin associated to the the object it may create a default one. :param force: Boolean indicating if the method must return a default origin in case the object has no one associated.

getScannedPixelSize()[source]
getShiftsFromOrigin()[source]

Method to return the origin shift from the Scipion Transform object.

getTsId()[source]

Get unique TiltSerie ID, usually retrieved from the file pattern provided by the user at the import time.

hasOrigin()[source]

Method indicating if the TiltSeries object has a defined origin.

setAnglesCount(value)[source]
setOrigin(newOrigin)[source]

Method to set the origin of the TiltSeries object. :param newOrigin: Scipion Transform object indicating the origin to be set to the TiltSeries.

setTsId(value)[source]
updateOriginWithResize(resizeFactor)[source]

Method to update the origin after resizing the TiltSeries.

class tomo.objects.TiltSeriesCoordinate(**kwargs)[source]

Bases: EMObject

This class holds the (x,y,z) positions, in angstroms, and other information associated with a coordinate related to a tilt series

copyInfo(coord)[source]

Copy information from other coordinate.

getPosition(sampling_rate=1)[source]

Returns the position a TiltSeriesCoordinate in a tuple at a specific sampling rate (optional)

getTsId()[source]
getX()[source]

Returns the X dimension (Å) of the coordinate

getY()[source]

Returns the Y dimension (Å) of the coordinate

getZ()[source]

Returns the Z dimension (Å) of the coordinate

setPosition(x, y, z, sampling_rate)[source]

Set the position of the coordinate :param int x: Position of the coordinate in the X axis :param int y: Position of the coordinate in the Y axis :param int z: Position of the coordinate in the Z axis :param flat sampling_rate: sampling rate in which x,y,z are measured. Default 1 = Å

setTsId(tsId)[source]
setX(x)[source]

Sets the x dimension (Å) of the coordinate

setY(y)[source]

Sets the Y dimension of (Å) the coordinate

setZ(z)[source]

Sets the Z dimension (Å) of the coordinate

class tomo.objects.TiltSeriesDict(inputSet=None, outputSet=None, newItemsCallback=None, doneItemsCallback=None)[source]

Bases: object

Helper class that to store TiltSeries and TiltImage but using dictionaries for quick access. This class also contains some logic related to the streaming: - Check for new input items that needs to be processed - Check for items already done that needs to be saved.

addTi(ti)[source]
addTs(ts, includeTi=False)[source]

Add a clone of the tiltseries.

allDone()[source]

Return True if input stream is closed and all task are done.

getTi(tsId, tiObjId)[source]
getTiDict(tsId)[source]
getTiList(tsId)[source]
getTs(tsId)[source]
hasTs(tsId)[source]
setFinished(*tsIdList)[source]

Notify that all TiltSeries in the list of ids are finished.

update()[source]
class tomo.objects.TiltSeriesM(**kwargs)[source]

Bases: TiltSeriesBase

ITEM_TYPE

alias of TiltImageM

class tomo.objects.TomoAcquisition(angleMin=None, angleMax=None, step=None, angleAxis1=None, angleAxis2=None, accumDose=None, tiltAxisAngle=None, **kwargs)[source]

Bases: Acquisition

getAccumDose()[source]
getAngleAxis1()[source]
getAngleAxis2()[source]
getAngleMax()[source]
getAngleMin()[source]
getStep()[source]
getTiltAxisAngle()[source]
setAccumDose(value)[source]
setAngleAxis1(value)[source]
setAngleAxis2(value)[source]
setAngleMax(value)[source]
setAngleMin(value)[source]
setStep(value)[source]
setTiltAxisAngle(value)[source]
class tomo.objects.TomoMask(**kwargs)[source]

Bases: Tomogram

Object used to represent segmented tomograms

getTomogram()[source]

Generate the reference tomogram object for the current tomoMask.

getVolName()[source]

Get the reference tomogram file for the current tomoMask.

setVolName(tomoName)[source]

Set the reference tomogram file for the current tomoMask.

class tomo.objects.Tomogram(**kwargs)[source]

Bases: Volume

Class to hold the tomogram abstraction inside Scipion. The origin (self._origin) of the volume is set as the location of the first coordinate loaded from the binary file. The volume may be displaced by setting a different origin using the methods implemented in the inherited class data.Image in scipion-em plugin.

copyInfo(other)[source]

Copy basic information

getAcquisition()[source]
getDim()[source]

Return image dimensions as tuple: (Xdim, Ydim, Zdim)

getTsId()[source]

Get unique TiltSeries ID, usually retrieved from the file pattern provided by the user at the import time.

hasAcquisition()[source]
setAcquisition(acquisition)[source]
setTsId(value)[source]
tomo.objects.convertMatrix(M, convention=None, direction=None)[source]
Parameters:
  • M –> Transformation matrix

  • convention –> One of the valid conventions to convert M. It can be:
    • None : Return the matrix stored in the metadata (Scipion convention).

    • relion (str) : Relion matrix convention

    • eman (str) : Eman matrix convention

  • direction –> Determine how to perform the conversion (not considered if convention is None):
    • ‘get’ (str) : Convert the matrix stored in metadata (Scipion definition) to the given ‘convention’

    • ‘set’ (str) : Convert the matrix from the given ‘convention’ to Scipion definition

Scipion transformation matrix definition is described in detailed below:

Notation:
  • r –> A 3D position vector

  • f’(r) –> Moved map

  • f(r) –> Reference

  • M –> Matrix to be stored by Scipion

  • @ –> Matrix product

Definition:

f’(r) = f(M@r)

Example:

If r = (0,0,0,1) = o (origin vector) and M is a translation only transformation matrix of the form:

M = [[1,0,0,0],[0,1,0,0],[0,0,0,1],[-dx,-dy,-dz,1]]

Being dx, dy, and dz a infinitesimally small displacement, then our transformation verifies that:

f’(o) = f(M@o) = [-dx,-dy,-dz,1]

We include conversions to the following matrix conventions:

  • Eman: Same as Scipion convention

  • Relion:
    Notation:
    • X’ –> inverse of a matrix

    • T –> translation matrix

    • R —> rotation matrix

    • M –> Scipion transformation matrix

    • N –> Relion transformation matrix

    • @ –> Matrix multiplication

    Conversion Scipion –> Relion

    M = R@T’ => T = M’@R * N = T@R = M’@R@R *

    Conversion Relion –> Scipion

    N = M’@R@R => M’ = N@R’@R’ => * M = R@R@N’ *