EmType¶
-
class
emvis.utils.
EmType
¶ Helper class to group functions related to EM types.
-
classmethod
toEmType
(mType, default=None)¶ Return an equivalent emc.TYPE corresponding to this models.Type.
-
classmethod
toModel
(emType, default=None)¶ Return an equivalent models.TYPE corresponding to this emc.Type.
-
classmethod
toNumpy
(emType, default=None)¶ Return an equivalent numpy type corresponding to this emc.Type.
-
classmethod
EmPath¶
-
class
emvis.utils.
EmPath
¶ Helper class to group functions related to path handling in EM.
-
classmethod
exists
(path)¶ Return True if the path exists, after removing special characters.
Special characters are:
@ that is used to name a table in a file, e.g particles@file.star
: that is used to specify format, e.g estimated_psd.ctf:mrc
-
classmethod
isImage
(path)¶ Return True if imagePath has an extension recognized as supported EM-image
-
classmethod
ImageManager¶
-
class
emvis.utils.
ImageManager
(maxCacheSize=100, maxOpenFiles=10)¶ The image manager for centralize read/manage image operations. Contains a internal image cache for loaded image access and thumbnails.
-
__init__
(maxCacheSize=100, maxOpenFiles=10)¶ Initialize self. See help(type(self)) for accurate signature.
-
classmethod
findImagePrefix
(imageSource, rootPath)¶ Find the prefix path from which the imagePath value is accessible. A common use case is when we have a text file pointing to image paths. In such cases, sometimes the image path value is relative to the text file path (used as the rootPath here), or they are relative to a parent folder of the text file.
- :imagePath (str) image path value that should be searched for.
The imagePath value should contain only the path and not other characters (e.g @)
- :rootPath (str) another location from which to check if the imagePath
is valid.
- :returns The prefix that should be added to imagePath to be able to
access the imagePath file. If it is None, it means that no prefix was found from where the imagePath exists. It should be noted that empty prefix means that imagePath already exists and there is no need to prepend any value.
-
getData
(imgSource, copy=False)¶ Similar to getImage, but return a numpy array instead.
-
getDim
(imgSource)¶ Shortcut method to return the dimensions of the given image source (x, y, z, n)
-
getImage
(imgSource, copy=False)¶ Retrieve the image (from cache or from file) from the given imageSource. :param imgSource: Either ImageRef or path :param copy: If True, a copy of the image will be returned.
If False, a reference to the internal buffer image will be returned. The internal image can be modified in further call to other methods from the ImageManager.
-
getInfo
(imgSource)¶ Return some specified info from the given image path. dim : Image dimensions ext : File extension data_type: Image data type
-
classmethod
getRef
(imgSource)¶ Return a ImageRef, either because imgSource is one, or parsing it from path.
-
ImageRef¶
-
class
emvis.utils.
ImageRef
(path=None, index=0, slice=0)¶ The ImageRef class is used to describe the referenced image in a stack or volume. For performance reasons, the access to the member variables is direct.
-
__init__
(path=None, index=0, slice=0)¶ Constructor: path (str): the image path index (int): the image index in the stack volumeIndex (int): volume index in the volume stack axis (int): the axis axis = 0: X axis = 1: Y axis = 2: Z axis = -1: Undefined
-
classmethod
parsePath
(path)¶ Parse the path to return a ImageRef instance.
-