MicroED data acquisition and image correction system and method based on software linkage
By linking Instamatic with SerialEM software, and combining CameraSerialEM class and background correction module, the data acquisition challenge of MicroED without API camera was solved, realizing stable and automated data acquisition and efficient image correction, improving data quality and system reliability.
Patent Information
- Application Number
- CN202511656297.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-12
- Publication Date
- 2026-03-03
AI Technical Summary
Existing MicroED data acquisition software, such as Instamatic, cannot directly control cameras that lack API support, which limits the application of MicroED technology on older or highly integrated TEM devices. Furthermore, existing methods are not universally applicable and are difficult to implement.
By using software linkage, the Instamatic and SerialEM software are used to collaboratively control TEM equipment. Combined with the CameraSerialEM class and background correction module, automated acquisition and batch background correction of MicroED data from interfaceless cameras are achieved, including electron microscope control, camera control, image correction and format conversion.
It achieves stable data acquisition and efficient background correction on cameras without open APIs, improves data signal-to-noise ratio and structural reliability, overcomes the limitations of device encapsulation, supports multi-format output, and improves data processing efficiency and system robustness.
Smart Images

Figure CN121595616A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of microcrystalline structure analysis, and particularly relates to a software-linked MicroED data acquisition and image correction system and method, specifically to a software-linked microcrystalline electron diffraction data acquisition and background correction-based image post-processing system and method. Background Technology
[0002] Microcrystalline electron diffraction (MicroED) is an important characterization technique that has rapidly developed in recent years in fields such as structural chemistry and materials science. It can resolve crystal structures at the nanoscale and even sub-nanometer scale, and has gradually shown considerable potential in pharmaceutical science, materials science, and nanotechnology. MicroED, which uses an electron beam instead of X-rays as the incident light source, can collect effective diffraction data from crystals smaller than 500 nm, ranging from a few milligrams (actual sample consumption is only at the microgram level). This allows it to address "microcrystalline" problems that conventional single-crystal X-ray diffraction cannot solve, offering a unique advantage in the fine structural analysis of micro and nanocrystals. However, existing commercial MicroED electron diffractometers are expensive (approximately US$1.5 million). Therefore, most users prefer to build a microcrystalline structure analysis platform based on their existing laboratory TEM (transmission electron microscope) at a lower cost, such as by modifying the sample holder, configuring acquisition and analysis software, and developing MicroED technology.
[0003] Currently, the mainstream data acquisition software internationally is Instamatic (an open-source MicroED data acquisition software developed by Xiaodong Zou's research group). This open-source software can not only control the equipment and automatically acquire rotating electron diffraction data, but also perform periodic defocusing of the intermediate mirror during the acquisition process, facilitating crystal tracking. The built-in executable file "instamatic.autoconfig.exe" in Instamatic can be used to install and calibrate electron microscope and camera parameters for some brands. However, the successful deployment of Instamatic depends on the TEM camera providing an open Application Programming Interface (API). In practical applications, many older or highly integrated TEM models are equipped with cameras that lack API support, preventing Instamatic from directly controlling the camera for image acquisition, severely limiting the application of MicroED technology on these devices.
[0004] In existing technologies, some work has attempted to achieve camera control through modifications to the underlying driver. For example, the paper "Programming Conventional Electron Microscopes for Solving Ultrahigh-Resolution Structures of Small and Macro-Molecules" developed eTasED software, which synchronizes the behavior of the camera and the sample stage through software. This ensures that the sample stage rotates only during the camera's actual effective exposure time, remaining stationary for the rest of the time to await camera readiness. This allows data collected by a single frame to fully cover the reciprocal space without information loss. The paper "High-throughput structure determination of polycrystalline functional materials: a platform for automated 3DED / MicroED data collection" discloses the construction of a state-of-the-art 3DED / MicroED data acquisition device by integrating a hybrid pixel detector with a script developed for SerialEM, thus successfully developing an automated 3DED / MMicroED method for high-throughput structure determination. However, such methods have poor versatility, require a large workload, and are often difficult to implement due to the closed nature of the equipment. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a software-linked MicroED data acquisition and image correction system and method, which enables automated acquisition of MicroED data and batch background correction of interface-less cameras, provided that the underlying camera driver is not compromised.
[0006] In a first aspect, the present invention provides a software-linked MicroED data acquisition and image correction system, comprising an interconnected data acquisition module and a background correction and format conversion module; the data acquisition module is used to control a transmission electron microscope to capture microcrystalline electron diffraction images of the sample under test, and output the diffraction images to the background correction and format conversion module; the background correction and format conversion module is used to perform dark background and bright background correction on the diffraction images; and convert the corrected images into a target format; The data acquisition module includes an electron microscope control unit and a camera control unit. The electron microscope control unit and the camera control unit can interact with each other. The electron microscope control unit is used to control the operation of the electron microscope, and the camera control unit is used to control the camera to acquire images from the electron microscope and output standardized data packets. The camera control unit includes a CameraSerialEM class, which controls the camera's acquisition and parameter settings through software SerialEM.
[0007] According to an embodiment of the present invention, the background correction and format conversion module includes a background and gain correction unit, an image orientation adaptation unit, a multi-format output unit, and a batch processing and error prevention unit.
[0008] According to an embodiment of the present invention, the background and gain correction unit performs background subtraction and gain correction on the acquired diffraction image based on the following formula: Corrected_Image=(Raw_Image Dark_Image)×Gain_Image.
[0009] Where Raw_Image is the original image, Dark_Image is the dark field image, and Gain_Image is the gain image.
[0010] According to an embodiment of the present invention, the image orientation adaptation unit is used to perform functions such as rotating (0°, 90°, 180°, 270°) and flipping (up and down, left and right) and binning the image to ensure that the background image and the diffraction image are consistent in orientation and size.
[0011] According to an embodiment of the present invention, the multi-format output unit is used to convert the corrected image into multiple formats such as DM3, DM4, MRC, IMG, and TIFF to meet the needs of different processing software.
[0012] According to an embodiment of the present invention, the batch processing and error prevention unit is used to automatically and recursively search the experiment folder under the specified directory and batch process all diffraction data; it is also used to automatically traverse the experimental directory, verify the file format and size, and support recursive processing and subfolder output.
[0013] According to an embodiment of the present invention, the electron microscope control unit utilizes the TEM control interface and incorporates the executable file "instamatic.autoconfig.exe" within the software instamatic to connect to and control the tilting, periodic defocusing, and beam spot switching operations of the TEM. The initialization configuration and command mapping of the TEM are completed through the executable file "instamatic.autoconfig.exe".
[0014] According to an embodiment of the present invention, the communication triggering mechanism in the CameraSerialEM class includes: a. Ensure that only one instance of the CameraSerialEM class exists for communication with SerialEM at any given time. The initialization process of the CameraSerialEM class is as follows: The user initiates a call to the CameraSerialEM class to check... — The instance state determines whether a CameraSerialEM instance already exists. If so, it proceeds to the instance creation process (initialization process); otherwise, it skips the initialization process and returns the existing instance to avoid communication conflicts caused by duplicate creation (such as multiple connections occupying the SerialEM port). The CameraSerialEM class only establishes a connection with SerialEM during initialization.
[0015] According to an embodiment of the present invention, the singleton pattern working mechanism of the CameraSerialEM class includes the following steps: 1) The user initiates a call to the CameraSerialEM class, and initialization begins; 2) Determine whether — If the instance status is none, create a new CameraSerialEM instance; otherwise, return the existing one. — instance, ensuring a globally unique instance; 3) Judgment — If initialized is True, skip the initialization process and return the instance; otherwise, proceed to step 4. 4) First, execute the initialization process, set the basic attributes of the initialization class, then load_defaults to load the default configuration, read the preset camera parameters and SerialEM communication configuration; establish a Socket connection, clean up the SerialEM environment, obtain the camera parameters, complete the environment initialization, register the exit handling function, set the acquisition parameters (i.e., the parameters required for the MicroED experiment), and mark... — If initialized is True, an instance is returned, and initialization is complete.
[0016] According to an embodiment of the present invention, the communication triggering mechanism in the CameraSerialEM class further includes the following steps: b. Embed the API call in Instamatic, receive the acquisition command through the get_movie() method, pass the exposure time, binning and other parameters to SerialEM, call the Record function of SerialEM to trigger image acquisition and return image data.
[0017] According to an embodiment of the present invention, the image acquisition includes the following steps: 1) Send the acquisition command. Instamatic triggers MicroED to generate an acquisition task according to the experimental requirements, automatically calls the get_movie() method, and SerialEM controls the camera to complete the image sequence acquisition and automatically outputs standardized data packets (including MRC, TIFF, IMG and other formats). 2) Check if the binsize parameter is passed. If so, use the passed binsize value; otherwise, use the default value of self.binning. 3) Set the SerialEM acquisition parameters: Execute SetExposure('exposure'): configure the exposure time (e.g., 0.5 seconds); Execute SetBinning('binsize'): configure the pixel merging mode; Execute SetProcessing('0'): set the image preprocessing mode (e.g., no image processing). 4) Send a capture command to the SerialEM to trigger the camera exposure and wait for the exposure to complete; 5) Read buffer data, read raw image data from the SerialEM cache; 6) Convert to NumPy array format: Converts raw data into a processable numeric array; 7) Determine whether to call get_image or get_movie based on the numerical array: If it is get_image: return a single image array for single-frame diffraction pattern acquisition; if it is get_movie: return multiple frames through the generator yield for rotational diffraction series acquisition.
[0018] 8) Complete image acquisition and return image data.
[0019] Secondly, the present invention also provides a method for acquiring microcrystalline electron diffraction data and correcting images using the above-described system, comprising the following steps: S1) The electron microscope is tilted by instamatic and diffraction images are acquired by calling SerialEM to realize image acquisition of cameras without open interfaces; S2) After acquisition, use the background correction plugin to perform dark background and bright background correction on the image, and provide batch processing and file verification functions; convert the corrected image into the target format for subsequent structural analysis.
[0020] According to an embodiment of the present invention, in step S1, the electron microscope control unit uses the TEM control interface to connect to and control the tilting, periodic defocusing, and spot switching operations of the TEM by embedding the executable file "instamatic.autoconfig.exe" in the software instamatic. The initial configuration and command mapping of the TEM are completed through the executable file "instamatic.autoconfig.exe". The camera control unit uses SerialEM to connect to the camera externally via a script.
[0021] According to an embodiment of the present invention, the camera mediation control module encapsulates the SerialEM call interface using a singleton pattern to ensure that only one communication instance exists in the system.
[0022] According to an embodiment of the present invention, the image processing module supports image rotation and flipping operations, and provides batch processing and file verification functions.
[0023] Beneficial effects 1. This invention uses the linkage between Instamatic and SerialEM software to collaboratively control TEM devices, providing a universal and stable data acquisition framework. It overcomes the data acquisition difficulties of MicroED cameras without open APIs and avoids modifying camera control code at the underlying driver level. At the same time, this invention also overcomes the problem of interruption in dark background correction during continuous image acquisition. While ensuring the continuity of acquisition, it achieves efficient background correction post-processing and format conversion of the original image, improving the data signal-to-noise ratio and structural reliability.
[0024] 2. High versatility: By using SerialEM as an intermediary, the limitation of cameras lacking APIs is avoided, and the connection problem of highly integrated cameras is solved, enabling Instamatic to be deployed on a variety of old or enclosed TEM electron microscopes.
[0025] 3. Stable continuous acquisition: A global singleton camera control class (CameraSerialEM class) is used to avoid conflicts between multiple instances; automatic dark background update of SerialEM is disabled to ensure the continuity of MicroED data acquisition.
[0026] 4. High data quality: The background correction post-processing plugin effectively removes camera noise and improves the signal-to-noise ratio of diffraction images, providing a high-quality data foundation for subsequent structural analysis.
[0027] 5. Convenient and efficient operation: The graphical interface guides users to complete parameter settings and batch processing, supports multiple output formats, and is compatible with the formats required by mainstream processing software (such as REDp, XDS, Shelx, etc.), which greatly improves data processing efficiency.
[0028] 6. The system is robust: It integrates multiple error prevention checks to avoid processing failures due to file format or size mismatches, thereby improving system reliability. Attached Figure Description
[0029] Figure 1 This is a schematic diagram of the data acquisition module architecture that integrates Instamatic and SerialEM software. Figure 2 This is the initialization process of the CameraSerialEM class; Figure 3 It uses the singleton pattern mechanism. Figure 4 It is the image acquisition process; Figure 5 This is the graphical user interface for GainCorrection (displayed in green after the correct document is selected); Figure 6 It is the graphical user interface of the data acquisition framework (a software-linked data acquisition platform based on Instamatic and SerialEM). Figure 7 The left and right images are diffraction data photographs before and after background correction (the intensity display range of the images is the same). Figure 8 This is a structural diagram of CuIBDT; Figure 9 This is a comparison chart of structural information before and after backplane correction. Detailed Implementation
[0030] The structure of the present invention will be further described in detail below with reference to specific embodiments. It should be understood that the following embodiments are merely illustrative and explanatory of the present invention and should not be construed as limiting the scope of protection of the present invention. All technologies implemented based on the above content of the present invention are covered within the scope of protection intended by the present invention.
[0031] In the description of this invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0032] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0033] Example 1 This embodiment provides a software-linked MicroED data acquisition and image correction system, including a data acquisition module and a background correction and format conversion module.
[0034] 1. Data Acquisition Module: This module controls the transmission electron microscope to capture microcrystalline electron diffraction images of the sample under test and outputs the diffraction images.
[0035] The data acquisition module includes an electron microscope control unit and a camera control unit. The electron microscope control unit and the camera control unit can interact with each other. The electron microscope control unit is used to control the operation of the electron microscope, and the camera control unit is used to control the camera to acquire images from the electron microscope and output standardized data packets.
[0036] The electron microscope control unit utilizes the TEM control interface and has an executable file "instamatic.autoconfig.exe" built into the software instamatic (a Python program for automating the collection of electron diffraction data). This file connects to and controls the tilting, periodic defocusing, and beam spot switching of the TEM. The initial configuration and command mapping of the TEM are completed through the executable file "instamatic.autoconfig.exe".
[0037] The camera control unit includes the CameraSerialEM class. The CameraSerialEM class controls the camera's acquisition, parameter settings, and other functions through the software SerialEM. SerialEM connects externally via scripts, ensuring broad compatibility with various camera brands. It is used as a camera control intermediary to achieve image acquisition. Instamatic can interact with SerialEM, which controls the camera to acquire images and output standardized data packets. SerialEM has broad compatibility with multiple camera brands. Using SerialEM as part of the camera's software control component can overcome... —Instamatic's dependency on the camera API (Application Programming Interface) allows for indirect camera control via SerialEM scripts, provided SerialEM supports the camera driver. SerialEM is based on most existing cameras.
[0038] The communication triggering mechanism in this embodiment is as follows (including a and b): a. Ensure that only one instance of the CameraSerialEM class exists for communication with SerialEM at any given time to avoid multi-threaded conflicts. See [link / reference]. Figure 2 The diagram shows the initialization process of the CameraSerialEM class; when a user initiates a call request to the CameraSerialEM class, it checks... — The instance state determines whether a CameraSerialEM instance already exists. If so, it proceeds to the instance creation process (initialization process); otherwise, it skips the initialization process and returns the existing instance to avoid communication conflicts caused by duplicate creation (such as multiple connections occupying the SerialEM port). The CameraSerialEM class only establishes a connection with SerialEM during initialization.
[0039] See Figure 3 As shown, the working mechanism of the CameraSerialEM class singleton pattern includes the following steps: 1) The user initiates a call request to the CameraSerialEM class to begin initialization.
[0040] 2) Determine whether — If the instance status is none, create a new CameraSerialEM instance; otherwise, return the existing one. — instance, ensuring a globally unique instance.
[0041] 3) Judgment — If initialized is True, skip the initialization process and return the instance; otherwise, proceed to step 4.
[0042] 4) First, execute the initialization process (loading configuration, establishing connection, obtaining parameters, etc.), set the basic attributes of the initialization class (such as name, counter, etc.), then load_defaults loads the default configuration, reads the preset camera parameters (such as exposure time, pixel binning method, etc.) and SerialEM communication configuration; establish a Socket connection, clean up the SerialEM environment (such as resetting the camera control state to ensure no residual configuration interference), obtain the camera parameters (binning and dimensions, etc.), complete the environment initialization (confirm the connection between SerialEM and the camera, and that the parameters match correctly), register the exit handling function (define the resource release logic when the program exits abnormally, such as closing the Socket connection, saving temporary data, etc.), set the acquisition parameters, i.e., the parameters required for the MicroED experiment, and mark... — If initialized is True, an instance is returned, and initialization is complete.
[0043] b. Embed the API call in Instamatic, receive the acquisition command through the get_movie() method, pass the exposure time, binning and other parameters to SerialEM, call the Record function of SerialEM to trigger image acquisition and return image data.
[0044] The data collection process is as follows: Figure 4 As shown: 1) Send the acquisition command. Instamatic triggers MicroED to generate an acquisition task according to the experimental requirements, automatically calls the get_movie() method, and SerialEM controls the camera to complete the image sequence acquisition and automatically outputs standardized data packets (including MRC, TIFF, IMG and other formats).
[0045] 2) Determine if the binsize parameter is passed. If so, use the passed binsize value; otherwise, use the default value of self.binning.
[0046] 3) Set the SerialEM acquisition parameters. Execute SetExposure('exposure'): configure the exposure time (e.g., 0.5 seconds); execute SetBinning('binsize'): configure the pixel merging mode; execute SetProcessing('0'): set the image preprocessing mode (e.g., no image processing).
[0047] 4) Send an acquisition command to the SerialEM to trigger the camera exposure and wait for the exposure to complete.
[0048] 5) Read buffer data, read raw image data from SerialEM cache.
[0049] 6) Convert to NumPy array format: Convert the raw data into a processable numeric array.
[0050] 7) Determine whether to call get_image or get_movie based on the numerical array (this time, select whether to acquire continuously or in single frames based on the user interface; if it is single frame acquisition, call get_image; if it is continuous acquisition, call get_movie): If it is get_image: return a single image array for single frame diffraction pattern acquisition; if it is get_movie: return multiple frames through the generator yield for rotation diffraction series acquisition.
[0051] 8) Complete image acquisition and return image data (standardized data packet).
[0052] II. Background Correction and Format Conversion Module: This module is used to process the image data returned by the data acquisition module, including: background and gain correction unit, image orientation adaptation unit, multi-format output unit, and batch processing and error prevention unit.
[0053] Background and gain correction unit: Based on the following formula, background subtraction and gain correction are performed on the acquired raw image (the normalized data packet returned from the data acquisition module): Corrected_Image=(Raw_Image Dark_Image)×Gain_Image.
[0054] Wherein, Raw_Image is the original image, Dark_Image is the dark field image (the image acquired with the electron beam turned off (or the sample blocked) under the same acquisition parameters as the original image, i.e., the dark background image), and Gain_Image is the gain image (the correction matrix obtained after normalizing the image acquired by a uniform light source, reflecting the difference in response sensitivity of each pixel of the camera).
[0055] Image orientation adaptation unit: used to rotate (0°, 90°, 180°, 270°) and flip (up and down, left and right) the image and perform binning functions to ensure that the background image and the diffraction image are consistent in orientation and size.
[0056] Multi-format output unit: used to convert the corrected image into multiple formats such as DM3, DM4, MRC, IMG, TIFF, etc., to meet the needs of different processing software.
[0057] Batch processing and error-proofing unit: It is used to automatically and recursively search the experiment folder under a specified directory to process all diffraction data in batches; it is also used to automatically traverse the experimental directory, verify file format and size, and supports recursive processing and subfolder output.
[0058] Example 2 Building a software-integrated data acquisition platform 1. Deploy Instamatic and SerialEM software on the electron microscope control computer and ensure that they are on the same local area network.
[0059] 2. In the camera module of Instamatic, introduce the CameraSerialEM class. This class initializes the connection with SerialEM (port 48888, IP 127.0.0.1) on the first call and sets it to singleton mode.
[0060] 3. Modify the Instamatic configuration file to specify CameraSerialEM as the image acquisition interface.
[0061] 4. Users set acquisition parameters (such as exposure time 0.5s, binning 2, etc.) through the Instamatic interface. After clicking "Start Acquisition," the system automatically calls the get_movie() method, and SerialEM controls the camera to complete the image sequence acquisition (the graphical user interface during acquisition is shown in the image sequence diagram). Figure 6 As shown), it automatically outputs standardized data packets (including MRC, TIFF, IMG, and other formats).
[0062] Use of backrest correction plug 1. Users launch the Gatan DigitalMicrograph software, load the gain_correction plugin, and perform background correction (correction of dark background and gain), format conversion, and batch processing of MicroED diffraction data.
[0063] 2. In the interface, select the Dark File (TIFF format) and the Gain File (REF format). After correctly selecting the files, the graphical user interface will display in green (e.g., ...). Figure 5 As shown in the error-proof design verification document.
[0064] 3. Set the rotation mode (e.g., 180°) and flip mode (e.g., flip left and right) according to the actual image orientation.
[0065] 4. Specify the output format (such as IMG, MRC), check the "Batch Processing" option, and select the root directory containing multiple experimental data.
[0066] 5. After automatically verifying the validity of the file, the plugin performs background correction and format conversion to generate a data package that can be used in software such as XDS.
[0067] Comparison of data before and after backrest correction See Figure 7 As shown, the left and right images are before and after background removal, respectively. It can be seen that after Gain_Correction processing, the background noise of the image is reduced from more than 200 to less than 5, which greatly reduces the noise.
[0068] Example 3 This embodiment provides a method for acquiring and correcting microcrystalline electron diffraction image data based on the system in Embodiment 1, including the following steps: S1) The electron microscope tilt is controlled by instamatic and diffraction images are acquired by calling SerialEM to realize image acquisition of cameras without open interfaces. During the acquisition process, the SerialEM call interface is encapsulated in singleton mode to ensure that only one communication instance exists in the system. S2) After acquisition, the background correction plugin is used to perform dark background and bright background correction on the image. The image processing module supports image rotation and flipping operations, and provides batch processing and file verification functions. The corrected image is converted into the target format for subsequent structural analysis.
[0069] In step S1, the electron microscope control unit uses the TEM control interface and the executable file "instamatic.autoconfig.exe" built into the software instamatic to connect to and control the tilting, periodic defocusing, and slant switching of the TEM. The initial configuration and command mapping of the TEM are completed through the executable file "instamatic.autoconfig.exe". The camera control unit uses SerialEM to connect to the camera externally via a script.
[0070] Example 4 Using the method of Example 3, MicroED data of CuIBDT were collected. The same set of data, before and after background subtraction (i.e., the operation of Example 2), was used for crystal data reconstruction, structure analysis, and refinement using similar methods. The resulting structure is shown below. Figure 8 As shown. See also Figure 9 As shown, this is a comparison chart of the data before and after background correction. After correction using the method in Example 2, the obtained dataset has a higher signal-to-noise ratio and a smaller r-factor in its structure, making it more accurate.
[0071] The specific embodiments of the present invention have been described above by way of example. However, the scope of protection of the present invention is not limited to the above exemplary embodiments. Any modifications, equivalent substitutions, improvements, etc., made by those skilled in the art within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.
[0072] Test steps and procedures for collecting MicroED data from CuIBDT: 1. Place the microcrystalline powder on a copper grid, load it onto the sample holder, and then insert it into the electron microscope tube.
[0073] 2. After the vacuum stabilizes, turn on the electron beam and complete the alignment when the spot size is 3.
[0074] 3. After selecting the region of interest, use the selection aperture to capture the microcrystalline particles and switch to diffraction mode.
[0075] 4. Open SerialEM and Instamatic software in sequence.
[0076] 5. In the SerialEM software interface, set parameter set to Record, binning to 2, processing to unprocessed, and exposure time to 1 sec.
[0077] 6. In the Instamatic software interface, set the storage path, under the cRED tab, select the exposure time (1 second), defocus frequency (once every 10 frames), Diff defocus to 1500, and check beam unblanker and enable imageinterval.
[0078] 7. After rotating the goniometer to -45°, confirm that the crystal is within the aperture using the Toggle defocus.
[0079] 8. While clicking "start collection", control the goniometer to tilt towards the positive angle at a speed of about 0.2° per second, and record the diffraction image during this period.
[0080] 9. When the angle measuring stage is tilted to +50°, stop tilting and click "stop collection".
[0081] 10. The corresponding experiment_x folder can be found in the storage interface, which contains the output standardized data package.
Claims
1. A software-linked MicroED data acquisition and image correction system, characterized in that, The system includes an interconnected data acquisition module and a background correction and format conversion module. The data acquisition module controls the transmission electron microscope to capture microcrystalline electron diffraction images of the sample under test and outputs the diffraction images to the background correction and format conversion module. The background correction and format conversion module performs dark and bright background correction on the diffraction images and converts the corrected images into the target format. The data acquisition module includes an electron microscope control unit and a camera control unit. The electron microscope control unit and the camera control unit can interact with each other. The electron microscope control unit is used to control the operation of the electron microscope, and the camera control unit is used to control the camera to acquire images from the electron microscope and output standardized data packets. The camera control unit includes a CameraSerialEM class, which controls the camera's acquisition and parameter settings through software SerialEM.
2. The MicroED data acquisition and image correction system based on software linkage according to claim 1, characterized in that, The background correction and format conversion module includes a background and gain correction unit, an image orientation adaptation unit, a multi-format output unit, and a batch processing and error prevention unit.
3. The MicroED data acquisition and image correction system based on software linkage according to claim 2, characterized in that, The background and gain correction unit performs background subtraction and gain correction on the acquired diffraction image based on the following formula: Corrected_Image=(Raw_Image Dark_Image)×Gain_Image, where Raw_Image is the original image, Dark_Image is the dark field image, and Gain_Image is the gain image; The image orientation adaptation unit is used to perform rotation, flipping, and binning functions on the image, and the multi-format output unit is used to convert the corrected image into multiple formats.
4. The MicroED data acquisition and image correction system based on software linkage according to claim 2, characterized in that, The batch processing and error prevention unit is used to automatically and recursively search the experiment folder under the specified directory to process all diffraction data in batches; it is also used to automatically traverse the experimental directory, verify the file format and size, and support recursive processing and subfolder output.
5. The MicroED data acquisition and image correction system based on software linkage according to claim 1, characterized in that, The electron microscope control unit utilizes the TEM control interface and has an executable file "instamatic.autoconfig.exe" built into the software instamatic to connect to and control the tilting, periodic defocusing, and beam spot switching of the TEM. The executable file "instamatic.autoconfig.exe" completes the initial configuration and command mapping of the TEM.
6. The MicroED data acquisition and image correction system based on software linkage according to any one of claims 1-5, characterized in that, The communication triggering mechanism in the CameraSerialEM class includes either a or b: a. Ensure that only one instance of the CameraSerialEM class exists for communication with SerialEM at any given time. The initialization process of the CameraSerialEM class is as follows: The user initiates a call to the CameraSerialEM class to check... — The instance status checks whether a CameraSerialEM instance already exists. If so, it proceeds to the instance creation process. Otherwise, skip the initialization process and return the existing instance to avoid communication conflicts caused by duplicate creation. The CameraSerialEM class only establishes a connection with SerialEM during initialization. b. Embed the API call in Instamatic, receive the acquisition command through the get_movie() method, pass the exposure time, binning and other parameters to SerialEM, call the Record function of SerialEM to trigger image acquisition and return image data.
7. The MicroED data acquisition and image correction system based on software linkage according to claim 6, characterized in that, The working mechanism of the CameraSerialEM class singleton pattern includes the following steps: 1) The user initiates a call to the CameraSerialEM class, and initialization begins; 2) Determine whether — If the instance status is none, create a new CameraSerialEM instance. Otherwise, return to the existing... — instance, ensuring a globally unique instance; 3) Judgment — If initialized is True, skip the initialization process and return the instance; otherwise, proceed to step 4. 4) First, execute the initialization process, set the basic attributes of the initialization class, then load_defaults to load the default configuration, read the preset camera parameters and SerialEM communication configuration; establish a Socket connection, clean up the SerialEM environment, obtain the camera parameters, complete the environment initialization, register the exit handling function, set the acquisition parameters (i.e., the parameters required for the MicroED experiment), and mark... — If initialized is True, an instance is returned, and initialization is complete.
8. The MicroED data acquisition and image correction system based on software linkage according to claim 6, characterized in that, The image acquisition includes the following steps: 1) Send the acquisition command. Instamatic triggers MicroED to generate an acquisition task according to the experimental requirements, automatically calls the get_movie() method, and SerialEM controls the camera to complete the image sequence acquisition and automatically outputs standardized data packets. 2) Check if the binsize parameter is passed. If so, use the passed binsize value; otherwise, use the default value of self.binning. 3) Set the SerialEM acquisition parameters: Execute SetExposure('exposure'): configure the exposure time; Execute SetBinning('binsize'): configure the pixel merging mode; Execute SetProcessing('0'): set the image preprocessing mode; 4) Send a capture command to the SerialEM to trigger the camera exposure and wait for the exposure to complete; 5) Read buffer data, read raw image data from the SerialEM cache; 6) Convert to NumPy array format: Converts raw data into a processable numeric array; 7) Determine whether to call get_image or get_movie based on the numerical array: If it is get_image: return a single image array for single-frame diffraction pattern acquisition; if it is get_movie: return multiple frames through the generator yield for rotational diffraction series acquisition. 8) Complete image acquisition and return image data.
9. A method for acquiring and correcting microcrystalline electron diffraction data using the system shown in any one of claims 1-8, characterized in that, Includes the following steps: S1) The electron microscope is tilted by instamatic and diffraction images are acquired by calling SerialEM to realize image acquisition of cameras without open interfaces; S2) After acquisition, use the background correction plugin to perform dark background and bright background correction on the image, and provide batch processing and file verification functions; convert the corrected image into the target format for subsequent structural analysis. According to an embodiment of the present invention, in step S1, the electron microscope control unit uses the TEM control interface to connect to and control the tilting, periodic defocusing, and slant switching operations of the TEM by embedding the executable file "instamatic.autoconfig.exe" in the software instamatic. The initial configuration and command mapping of the TEM are completed through the executable file "instamatic.autoconfig.exe". The camera control unit uses SerialEM to connect to the camera externally via a script.
10. The method according to claim 9, characterized in that, The camera intermediary control module uses a singleton pattern to encapsulate the SerialEM call interface, ensuring that only one communication instance exists in the system; the image processing module supports image rotation and flipping operations, and provides batch processing and file verification functions.
Citation Information
Patent Citations
X-ray optical grating phase-contrast imaging device and method
CN106290414A
Crystal electron diffraction data acquisition method and device
CN111351811A
Time sequence synchronization and correction method and system for X-ray flat panel detector
CN116531005A
Control method of flat panel detector for synchrotron radiation diffraction experiment
CN119023718A
Sensitivity unevenness correction method and device of camera for transmission electron microscope
JP2011003336A