Gain reference in dm4 format: what should I do?

Hi everyone, I downloaded a dataset from EMPIAR (EMPIAR-11376) and noticed that the gain reference file is in dm4 format (SuperRef_2020-11-20_20.18.53_screen_g3_130_0001.dm4).

CryoSPARC fails when trying to import that:

Traceback (most recent call last):
  File "cryosparc_master/cryosparc_compute/run.py", line 96, in cryosparc_compute.run.main
  File "/opt/cryosparc/cryosparc_master/cryosparc_compute/jobs/imports/run.py", line 967, in run_import_movies_or_micrographs
    gshapey, gshapex = read_gain_reference(gainref_abs_path, shape_only=True, data_format=data_format)
  File "/opt/cryosparc/cryosparc_master/cryosparc_compute/jobs/imports/run.py", line 951, in read_gain_reference
    assert False, "Cannot read gain reference of type %s" % extn
AssertionError: Cannot read gain reference of type dm4

so, what should I do? I assume there should be a way to convert a dm4 into mrc, but I have actually no idea how to do that.

oh, also: the gain reference is checked after all the images are read, so it took me ~2h to figure that out.

I guess it’d be nice to have it read first (in case there are some errors with it), and all the frames after that.

You could use IMOD’s dm2mrc.

Addendum: Also, I think dm2mrc flips the image along the Y-axis, though I’m not entirely sure on this point. Best to double-check the orientation relative to your moviestacks.

Cheers,
Yang

Hi @marinegor, How did you finally convert your .dm4 gain ref to mrc? I am struggling with the same problem.
Thanks

I have used dm2mrc and it works fine

@olibclarke do in need to install IMOD or EMAN2 for this?

@Das yes you need IMOD for dm2mrc. Probably there is a way to do it using EMAN also

@olibclarke Thanks. will do that.

Hi @olibclarke. I installed IMOD and converted the K3-Gain Ref. x1.m1.kv[300].dm4 to mrc, by “dm2mrc” command. After that, I used the command “newstack -in gain. mrc -ou gainbin2.mrc -bi 2” as the data was collected in Counted SR bin2. The microscopist suggested a horizontal flip for the gain, which I applied during the import movies in cryosparc by “Flip gain ref & defect file in X= YES”
Have I done it correctly? kindly suggest.
Thank you.

1 Like

Yes this looks fine - Re the flip I would just try both X and Y (and no flip) - an incorrectly oriented gain will usually give obvious artefacts.