relion.convert.convert_utils module

Utility functions for conversions that will be used from both newer Relion3.1 routines and old ones.

relion.convert.convert_utils.convertBinaryFiles(imgSet, outputDir, extension='mrcs', forceConvert=False)[source]

Convert binary images files to a format read by Relion. Or create links if there is no need to convert the binary files.

Params:

imgSet: input image set to be converted. outputDir: where to put the converted file(s) extension: extension accepted by the program forceConvert: if True, the files will be converted and no root will be used

Return:

A dictionary with old-file as key and new-file as value If empty, not conversion was done.

relion.convert.convert_utils.convertBinaryVol(vol, outputDir)[source]

Convert binary volume to a format read by Relion. Params:

vol: input volume object to be converted. outputDir: where to put the converted file(s)

Return:

new file name of the volume (converted or not).

relion.convert.convert_utils.convertMask(img, outputPath, newPix=None, newDim=None, threshold=True, invert=False)[source]

Convert mask to mrc format read by Relion. Params:

img: input image to be converted. outputPath: it can be either a directory or a file path.

If it is a directory, the output name will be inferred from input and put into that directory. If it is not a directory, it is assumed is the output filename.

newPix: output pixel size (equals input if None) newDim: output box size

Return:

new file name of the mask.

relion.convert.convert_utils.getVolumesFromPostprocess(postStar)[source]

Return the filenames of half1, half2 and mask from a given postprocess.star file.

relion.convert.convert_utils.locationToRelion(index, filename)[source]

Convert an index and filename location to a string with @ as expected in Relion.

relion.convert.convert_utils.relativeFromFileName(imgRow, prefixPath)[source]

Remove some prefix from filename in row.

relion.convert.convert_utils.relionToLocation(filename)[source]

Return a location (index, filename) given a Relion filename with the index@filename structure.