Hi all,
I’m interested in extracting images of individual picked particles from a 2D classification job. I’m able to access particle location by parsing the .cs file generated by a Select 2D Classes job like so:
from cryosparc_compute import dataset
import mrcfile
# This is the path to the cs file generated by the Select 2D Particles job
cs_path = "path/to/exports/P2_J36_particles_selected_exported.cs"
particle_dataset = dataset.Dataset().from_file(cs_path)
# This points to the mrc file that cointains the particle in the cs file above
# This looks at the 5th particle in the cs file, the choice of 5 is arbitrary
particles_path = f"/path/to/data/{particle_dataset.data['blob/path'][5][1:]}"
with mrcfile.open(particle_path) as mrc:
stack = mrc.data
This gives me an object called stack
that represents the data in the mrc file. It is a 3D numpy array, with the second and third dimensions matching up with my box size (360 px, Fourier-cropped to 90 px). What, though, is the first dimension?
stack.shape # Output: (144, 90, 90)
Most of the mrc files that I’ve looked at generate 3D arrays that have 150-200 objects in that dimension, that I assume represent individual particles. If I plot any slice of the stack
object along that first dimension (0-144), I get something like the following:
Taking the mean of the stack along that dimension (np.mean(stack, axis = 0)
) suggests that each of these might be an individual particle (there is some density in the middle of the image). I also know that there is an index field in the original .cs file ( particle_dataset.data['blob/idx']
). Is this index in that first dimension in the 3D numpy array my particle of interest? If so, why are the .mrc files bundled this way, with a seemingly random selection of particles in a single .mrc file?
Thanks!