sem tomo flow
Sem Tomo pipeline overview:
Single directory is used to contain a set of gifs, which make up a single stack.
tifs compiled into a single mrc file (source.mrc) in convert_tif_to_mrc()
two metadata files (align xf, and align xg, are generated to allow creation of aligned mrc file (align.mrc)
another mrc file is created, which tries to correct for stage tilt (needs stretch file).
This file is called corrected.mrc. Note, if no correction is needed, a correction.mrc is still created, but without any actual correction of angle.
The corrected mrc file is then contrast adjusted with mean std dev magic numbers “150,40” in gen_newstack_norm_command() this is referred to as the base mrc - A movie is created using the base.mrc file. - the midpoint of that file is computed, and snapshots are created using this midpoint. - We now want to create the pyramid assets, for neuroglancer / viewer. - Firstly create nifti file using the base mrc, then convert this to ng format. - To conclude, send callback stating the location of the various outputs.
- em_workflows.sem_tomo.flow.gen_xfalign_comand(fp_in: FilePath) None
eg:
xfalign -pa -1 -pr source.mrc align.xf
- em_workflows.sem_tomo.flow.gen_align_xg(fp_in: FilePath) None
eg:
xftoxg -ro -mi 2 {WORKDIR}/align.xf {WORKDIR}/align.xg
- em_workflows.sem_tomo.flow.convert_tif_to_mrc(file_path: FilePath) int
- Generates source.mrcassumes there’s tifs in input dir, uses all the tifs in direg::
tif2mrc {DATAPATH}/*.tif {WORKDIR}/Source.mrc
- em_workflows.sem_tomo.flow.create_stretch_file(tilt: float, fp_in: FilePath) None
- Creates stretch.xf used to gen corrected.mrcFile looks like:
1 0 0 {TILT_PARAMETER} 0 0
where TILT_PARAMETER is calculated as 1/cos({TILT_ANGLE}).Note that tilt angle is input in degrees, however cos method expects radians
- em_workflows.sem_tomo.flow.gen_newstack_mid_mrc_command(fp_in: FilePath) None
Generates mid.mrc. eg:
newstack -secs {MIDZ}-{MIDZ} {WORKDIR}/{BASENAME}.mrc {WORKDIR}/mid.mrc
- em_workflows.sem_tomo.flow.gen_keyimg(fp_in: FilePath) Dict
Generates keyimg (large thumb), eg:
mrc2tif -j -C 0,255 mid.mrc {WORKDIR}/keyimg_{BASENAME}.jpg
- em_workflows.sem_tomo.flow.gen_keyimg_small(fp_in: FilePath) Dict
eg:
convert -size 300x300 {WORKDIR}/hedwig/keyimg_{BASENAME}.jpg -resize 300x300 -sharpen 2 -quality 70 {WORKDIR}/hedwig/keyimg_{BASENAME}_s.jpg
- em_workflows.sem_tomo.flow.gen_ng_metadata(fp_in: FilePath) Dict
- Initialize HedwigZarrImages instace from .zarr group arrayFor each HedwigZarrImage obtain their metadata, consisting of:
shader_type
dimension
neuroglancer shader parameters
Note; the seemingly redundancy of working and asset fp here.However asset fp is in the network file system and is deployed for access to the usersWorking fp is actually used for getting the metadata