Filament tracer export images

Hey @aaron.p.p,

Thanks for giving more details! I do think recreating the skeletons in a notebook is a more systematic way to go about this. The result you have via photoshop is good — though I worry about issues with keeping the cropping parameters consistent between this image and the image of the manually drawn filament from the other software. In a previous comment, the fields written out by the filament tracer are described here: Transferring helical coordinate picks to Relion - #5 by mmclean – I’d take a look at the descriptions for the following fields of the particle dataset:

  • filament/position_A
  • filament/filament_uid

You would also need the following fields from the particle dataset:

  • location/micrograph_uid: unique identifier for the micrograph that this particle was picked from
  • location/center_x_frac: x-coordinates of the particle pick, in units of fractional distance along the micrograph
  • location/center_y_frac: y-coordinates of the particle pick, in units of fractional distance along the micrograph

To recreate the skeletons in a notebook, I’d follow the steps roughly:

  1. Load the outputted particle and micrograph datasets from filament tracer into a jupyter notebook via cryosparc-tools
  2. Partition particles into groups based on their location/micrograph_uid. This can be done using the split_by method of the Dataset class
  3. Each group above now corresponds to the picks from a micrograph. For each of these groups, further partition them based on their filament/filament_uid, using split_by. This is a field that contains a unique ID number for each filament.
  4. Use filament/position_A to sort these picks in ascending order. This could be accomplished using numpy.argsort and the Dataset take method
  5. For all the picks in a filament (i.e. all the picks in the second set of subgroups), multiply location/center_x_frac by location/micrograph_shape and likewise for the y coords. This will give you the coordinates of the pick locations for that filament.
  6. Now you have a list of coordinates, in the original shape of the micrograph, that define every filament. Connecting subsequent coordinates in this list with a line would give you the skeleton. But, depending on how you are computing the metric above, perhaps it isn’t necessary to re-convert these into an image of the skeleton and maybe it’s possible to work directly with these coordinates. If you need an image, you could look into image libraries like PIL (specifically the ImageDraw class and the line function may be helpful). It would be important to ensure images are saved to an adequate resolution and the aspect ratio and alignment of the images are identical when comparing

I hope this helps, and let us know if you have more questions!

Best,
Michael

2 Likes