# Job: Import Micrographs

## At A Glance

Import one or more micrographs into CryoSPARC for processing.

## Description

The Import Micrographs job imports single-frame micrographs into CryoSPARC for downstream processing. Typically, these micrographs will have been pre-processed through motion correction tools outside of CryoSPARC, or come from a camera that does was imaging single frames rather than movies.

Importantly, the micrograph files that are imported by this job are *not copied* — they are merely linked (via a symbolic link) into the CryoSPARC project directory where this job is running. It is thus critical that the micrograph files are not deleted or moved while they are being processed in CryoSPARC.

The Import Micrographs job accepts an optional input of movies (e.g., from an Import Movies job). This links the micrographs (and therefore, particles extracted from the micrographs) to their source movies, which allows for workflows that require movies such as Reference Based Motion Correction. Thus, although this input is optional, we recommend connecting the movies if they are available.

## **Inputs**

### Source movies (optional)

Imported movies from an Import Movies job. If jobs which require movies (such as [Reference Based Motion Correction](https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/motion-correction/job-reference-based-motion-correction-beta)) will be used later, this input should be connected so that resulting particles are properly linked to their movies. See the [relevant section](#linking-micrographs-to-input-movies) for more information.

## **Commonly Adjusted Parameters**

### Micrographs data path

The absolute path to the micrographs to import (in MRC format). Wildcards can be used to select multiple micrographs.

### Length of prefix to cut

These parameters are used to properly link micrographs to their input movies. See the [Linking Micrographs to Input Movies](#linking-micrographs-to-input-movies) section for help setting these parameters.

### Microscope parameters

`Raw pixel size` and `Total exposure dose` are typically selected during data collection, while `Accelerating voltage` and `Spherical aberration` are properties of the microscope. It is best to specify these properties if they are known. Note that the pixel size of the micrographs may not be the physical detector pixel size if the original movies were downsampled during motion correction or if they were collected in a super-resolution mode.

### Negative stain data

If `Negative Stain Data` is on, this indicates that there are light particles on dark background (-1). If it's off, this indicates the micrographs have dark particles on light background (cryo-em data, +1).

### Skip header check

Turned on by default in v4.2+, off by default in prior versions.

When `Skip header check` is turned off, each micrograph file's header is read by the job to ensure that all micrographs are of the same size in pixels and physical extent. The header check helps to detect corrupt files which otherwise may cause errors in downstream jobs, but also can take a long time due to the number of file system operations needed to read the headers.

When this parameter is turned off (i.e., when the header check is used), set the `Number of CPUs to parallelize during header check` parameter to parallelize reading of exposure headers.

## **Outputs**

### Imported micrographs

The imported micrographs are ready for further processing.

### Failed micrographs

If `Skip Header Check` is off, micrographs with an inconsistent size are output here and are typically not used in downstream processing.

## **Common Next Steps**

Imported micrographs are typically taken into a [Patch CTF](https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/ctf-estimation/job-patch-ctf-estimation) job to estimate their contrast transfer function parameters.

## Linking Micrographs to Input Movies

In the scenario where you want to link your micrographs to a movie dataset that is already in CryoSPARC, you can connect the movies to the inputs of this job.

<figure><img src="https://1916621962-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7DGv3GkRvGGpbVPCgg%2Fuploads%2FrAfNxi5oZQRnXsxxC4ad%2Fimport-micrographs_job-builder.png?alt=media&#x26;token=5093ec17-0ff0-4929-b778-a881a9dae9ea" alt=""><figcaption></figcaption></figure>

Since CryoSPARC does not know how the micrograph names correspond to movie names, you will have to help the job connect the correct movie and micrograph. Most motion correction packages add characters to the beginning and/or end of a filename, but leave some identifying region in the middle of the filename unchanged. The Import Micrographs job thus provides four parameters, each of which accepts a number telling the job how many characters to trim from the beginning and end of the micrograph and movie filenames to be left with this identifying region.

Consider the following case:

```
Importing movies from /bulk8/data/rposert-dev/CS-rposert-guide-work/J4/motioncorrected/*.mrc
Importing 24 files
Attempting to find corresponding filenames in imported micrographs and connected input movies..
  Example source (input) movie filename:
 003573716055357609725_CB1__00006_Feb18_23.39.55.tif
  Example query (imported) micrograph filename:
 001334752721923690937_CB1__01978_Feb20_11.29.13_background.mrc
```

In these lines from the Import Micrographs job log, we see that the movies have a unique ID (twenty-one numbers) added to the front, and they end in `.tif`. The micrographs also have a (different) twenty-one character ID, but end in `_background.mrc`. We therefore need to cut twenty-one characters off the front of both the movies and the micrographs, four characters off the end of the movies, and fifteen characters off the end of the movies.

<figure><img src="https://1916621962-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M7DGv3GkRvGGpbVPCgg%2Fuploads%2F5bOFESyOamaUhX8relzi%2Fimport-micrographs_micrograph-file-trim.png?alt=media&#x26;token=4ea3742a-e892-486b-99c8-9c688c3a77f3" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
The Import Micrographs job displays the first filename in *alphabetical order* in the job log. Since many programs add a unique ID to the beginning of the filename during import and motion correction, the filenames displayed in the log will likely not have any part of their filename in common. You are looking for the part of the filename which *would match* for a movie derived from an imported micrograph.
{% endhint %}

The parameters for the job should therefore be:

```
Length of movie path prefix to cut : 21
Length of movie path suffix to cut : 4
Length of mic. path prefix to cut  : 21
Length of mic. path suffix to cut  : 15
```

Now the imported micrographs will be linked to the movies in CryoSPARC, allowing you to come back to preprocessing steps easily.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.cryosparc.com/processing-data/all-job-types-in-cryosparc/import/job-import-micrographs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
