Cryosparc-tools open tiff

Hello, I was wondering if there is a way to open non-gain normalized LZW .tiff movie into a numpy array using CS-tools?

if this is possible, then to apply the gain, would one just divide each section of the resulting array (from tiff) by the array read in from the gain?

thanks in advance for your help

You should be able to do this without CS-tools… just tifffile and mrcfile, along with the usual array of scientific Python packages (numpy, scipy, etc)…?

2 Likes

Thanks, tifffile does what I want. I was curious if there is a solution in CS tools, as I want the file reading to be as CS-like as possible. but tifffile does work.

One should multiply movie and gain values.

This capability is not built-in to cryosparc_tools.

1 Like

Thanks, @wtempel and @rbs_sci, for the comments and suggestions. Do you know if Tifffile opens the files like CS? I mean that there is no flipping of the axis or anything when the two are compared.

Hi @frozenfas! In my testing, tiffile.imread() opens the image using the same conventions as CryoSPARC so no flipping should be necessary. You will still need to apply the appropriate transformations to your gain (i.e., if the gain needs to be flipped in X, you’ll have to do this manually before multiplying).

I would also like to make sure you know that during motion correction we perform a background subtraction step, so even if you average together all the frames in a movie your result won’t look like what CryoSPARC produces from motion correction.

1 Like

Thanks, @rposert, for confirming that tiffile.imread() works like cryosparc :slight_smile: I did not know about the background subtraction tip, so thanks for this info.

I am, in fact, trying to determine if I am flipping/rotating the gain in the correct way. What I have been doing is reading in the frames from 300 movies, applying the gain (original, flipped in X or flipped in Y), and averaging the gain-correct frames. I then looked at this final image to see which was the most uniform. Does this strategy make sense?

I have two other questions if you have time. (1) I read in this forum that cryosparc interprets pixels with a value of zero in the gain file as a defect. Is this true? (2) if I plot the pixel values of the super-resolution gain image (K3, super-resolution, DM4), I get a bimodal distribution for the values:
Screenshot 2024-02-07 at 10.27.47

Is this expected? If so why? It goes to a normal distribution about 1 when I bin by 2.

Hi @frozenfas – we have found that when collecting in superres mode, some cameras prefer to put an electron on the left or top halves of the 2x2 upsampled pixel, which would create this bimodal distribution.

And as for hot pixels — we detect hot pixels by a value which is 5 standard deviations above or below the mean for the micrograph, and replace them with Gaussian noise that has the same mean and sd as the micrograph.

1 Like