tomo.objects module

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

Bases: tomo.objects.SubTomogram

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

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

Bases: pwem.objects.data.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.

getCutOnFreq()[source]
getCutOnFreqList()[source]
getDefocusAngleList()[source]
getDefocusUList()[source]
getDefocusVList()[source]
getIndex()[source]
getPhaseShiftList()[source]
hasAstigmatismInfoAsList()[source]

This method checks if the CTFTomo object contains astigmatism 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.

setCutOnFreq(value)[source]
setCutOnFreqList(cutOnFreqList)[source]
setDefocusAngleList(defList)[source]
setDefocusUList(defList)[source]
setDefocusVList(defList)[source]
setIndex(value)[source]
setPhaseShiftList(defList)[source]
class tomo.objects.CTFTomoSeries(**kwargs)[source]

Bases: pwem.objects.data.EMSet

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

ITEM_TYPE

alias of CTFTomo

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

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

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: tomo.objects.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: pwem.objects.data.EMObject

This class holds the (x,y) 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()[source]
getPosition()[source]

Return the position of the coordinate as a (x, y, z) tuple. mode: select if the position is the center of the box or in the top left corner.

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

Return the micrograph object to which this coordinate is associated.

getX()[source]
getY()[source]
getZ()[source]
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)[source]
setPosition(x, y, z)[source]
setVolId(volId)[source]
setVolume(volume)[source]

Set the micrograph to which this coordinate belongs.

setX(x)[source]
setY(y)[source]
setZ(z)[source]
shiftX(shiftX)[source]
shiftY(shiftY)[source]
class tomo.objects.Ellipsoid(**kwargs)[source]

Bases: pwem.objects.data.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: pwem.objects.data.EMObject

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

addLandmark(xCoor, yCoor, tiltIm, chainId, xResid, yResid)[source]
getFileName()[source]
getModelName()[source]
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]
setTsId(tsId)[source]
class tomo.objects.MeshPoint(**kwargs)[source]

Bases: tomo.objects.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: tomo.objects.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: pwem.objects.data.EMSet

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

ITEM_TYPE

alias of CTFTomoSeries

getFirstItem()[source]

Return the first item in the Set.

getSetOfTiltSeries()[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: pwem.objects.data.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: pwem.objects.data.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 tomogram=None, the iteration is performed over the whole set of coordinates.

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: pwem.objects.data.EMSet

Represents a class that groups a set of landmark models.

ITEM_TYPE

alias of LandmarkModel

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

Bases: tomo.objects.SetOfCoordinates3D

Store a series of meshes.

ITEM_TYPE

alias of MeshPoint

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

Bases: pwem.objects.data.SetOfVolumes

ITEM_TYPE

alias of SubTomogram

REP_TYPE

alias of SubTomogram

getCoordinates3D()[source]

Returns the SetOfCoordinates associated with this SetOfParticles

hasCoordinates3D()[source]
setCoordinates3D(coordinates)[source]

Set the SetOfCoordinates associates with this set of particles.

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

Bases: tomo.objects.SetOfTiltSeriesBase

ITEM_TYPE

alias of TiltSeries

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

Bases: pwem.objects.data.SetOfImages

EXPOSE_ITEMS = True

Base class for SetOfTiltImages and SetOfTiltImagesM.

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
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(orderBy='id', direction='ASC')[source]

Redefine iteration to set the acquisition to images.

updateDim()[source]

Update dimensions of this set base on the first element.

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

Bases: tomo.objects.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(**kwargs)[source]

Bases: pwem.objects.data.SetOfVolumes

EXPOSE_ITEMS = True
ITEM_TYPE

alias of TomoMask

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

Bases: pwem.objects.data.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: pwem.objects.data.Volume

getAcquisition()[source]
getCoordinate3D()[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.

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

Bases: pwem.objects.data.Image, tomo.objects.TiltImageBase

Tilt image

copyInfo(other, copyId=False)[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(**kwargs)[source]

Bases: object

Base class for TiltImageM and TiltImage.

copyInfo(other, copyId=False)[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.

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

Bases: pwem.objects.data.Movie, tomo.objects.TiltImageBase

Tilt movie.

copyInfo(other, copyId=False)[source]

Copy basic information

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

Bases: tomo.objects.TiltSeriesBase

ITEM_TYPE

alias of TiltImage

applyTransform(outputFilePath)[source]
class tomo.objects.TiltSeriesBase(**kwargs)[source]

Bases: pwem.objects.data.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

getScannedPixelSize()[source]
getTsId()[source]

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

setTsId(value)[source]
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: tomo.objects.TiltSeriesBase

ITEM_TYPE

alias of TiltImageM

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

Bases: pwem.objects.data.Acquisition

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

Bases: pwem.objects.data.Volume

Object used to represent segmented tomograms/subtomograms

getVolName()[source]

Get the reference tomogram for the current mask.

setVolName(tomoName)[source]

Set the reference tomogram for the current mask.

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

Bases: pwem.objects.data.Volume

getAcquisition()[source]
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]