<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Archiving and Interchange DTD v2.3 20070202//EN" "archivearticle.dtd">
<article xml:lang="EN" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" article-type="methods-article">
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">Front. Neural Circuits</journal-id>
<journal-title>Frontiers in Neural Circuits</journal-title>
<abbrev-journal-title abbrev-type="pubmed">Front. Neural Circuits</abbrev-journal-title>
<issn pub-type="epub">1662-5110</issn>
<publisher>
<publisher-name>Frontiers Media S.A.</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="doi">10.3389/fncir.2022.891825</article-id>
<article-categories>
<subj-group subj-group-type="heading">
<subject>Neuroscience</subject>
<subj-group>
<subject>Methods</subject>
</subj-group>
</subj-group>
</article-categories>
<title-group>
<article-title>An Open-Source Real-Time Motion Correction Plug-In for Single-Photon Calcium Imaging of Head-Mounted Microscopy</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author">
<name><surname>Li</surname> <given-names>Mingkang</given-names></name>
<xref ref-type="aff" rid="aff1"><sup>1</sup></xref>
<xref ref-type="aff" rid="aff2"><sup>2</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/1701007/overview"/>
</contrib>
<contrib contrib-type="author">
<name><surname>Liu</surname> <given-names>Changhao</given-names></name>
<xref ref-type="aff" rid="aff1"><sup>1</sup></xref>
<xref ref-type="aff" rid="aff2"><sup>2</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/1853667/overview"/>
</contrib>
<contrib contrib-type="author">
<name><surname>Cui</surname> <given-names>Xin</given-names></name>
<xref ref-type="aff" rid="aff3"><sup>3</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/1233811/overview"/>
</contrib>
<contrib contrib-type="author">
<name><surname>Jung</surname> <given-names>Hayoung</given-names></name>
<xref ref-type="aff" rid="aff3"><sup>3</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/1855027/overview"/>
</contrib>
<contrib contrib-type="author">
<name><surname>You</surname> <given-names>Heecheon</given-names></name>
<xref ref-type="aff" rid="aff3"><sup>3</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/1246592/overview"/>
</contrib>
<contrib contrib-type="author" corresp="yes">
<name><surname>Feng</surname> <given-names>Linqing</given-names></name>
<xref ref-type="aff" rid="aff4"><sup>4</sup></xref>
<xref ref-type="corresp" rid="c001"><sup>&#x0002A;</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/228013/overview"/>
</contrib>
<contrib contrib-type="author" corresp="yes">
<name><surname>Zhang</surname> <given-names>Shaomin</given-names></name>
<xref ref-type="aff" rid="aff1"><sup>1</sup></xref>
<xref ref-type="aff" rid="aff2"><sup>2</sup></xref>
<xref ref-type="corresp" rid="c002"><sup>&#x0002A;</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/558637/overview"/>
</contrib>
</contrib-group>
<aff id="aff1"><sup>1</sup><institution>Key Laboratory of Biomedical Engineering of Education Ministry, Zhejiang Provincial Key Laboratory of Cardio-Cerebral Vascular Detection Technology and Medicinal Effectiveness Appraisal, Department of Biomedical Engineering, School of Biomedical Engineering and Instrument Science, Zhejiang University</institution>, <addr-line>Hangzhou</addr-line>, <country>China</country></aff>
<aff id="aff2"><sup>2</sup><institution>Qiushi Academy for Advanced Studies, Zhejiang University</institution>, <addr-line>Hangzhou</addr-line>, <country>China</country></aff>
<aff id="aff3"><sup>3</sup><institution>Department of Industrial and Management Engineering, Pohang University of Science and Technology</institution>, <addr-line>Pohang</addr-line>, <country>South Korea</country></aff>
<aff id="aff4"><sup>4</sup><institution>Research Institute of Artificial Intelligence, Zhejiang Lab</institution>, <addr-line>Hangzhou</addr-line>, <country>China</country></aff>
<author-notes>
<fn fn-type="edited-by"><p>Edited by: Jean-Claude B&#x000E9;&#x000EF;que, University of Ottawa, Canada</p></fn>
<fn fn-type="edited-by"><p>Reviewed by: Dawen Cai, University of Michigan, United States; Giovanni Barbera, National Institutes of Health (NIH), United States; Jinghao Lu, Massachusetts Institute of Technology, United States</p></fn>
<corresp id="c001">&#x0002A;Correspondence: Linqing Feng <email>fenglq&#x00040;zhejianglab.edu.cn</email></corresp>
<corresp id="c002">Shaomin Zhang <email>shaomin&#x00040;zju.edu.cn</email></corresp>
</author-notes>
<pub-date pub-type="epub">
<day>24</day>
<month>06</month>
<year>2022</year>
</pub-date>
<pub-date pub-type="collection">
<year>2022</year>
</pub-date>
<volume>16</volume>
<elocation-id>891825</elocation-id>
<history>
<date date-type="received">
<day>08</day>
<month>03</month>
<year>2022</year>
</date>
<date date-type="accepted">
<day>01</day>
<month>06</month>
<year>2022</year>
</date>
</history>
<permissions>
<copyright-statement>Copyright &#x000A9; 2022 Li, Liu, Cui, Jung, You, Feng and Zhang.</copyright-statement>
<copyright-year>2022</copyright-year>
<copyright-holder>Li, Liu, Cui, Jung, You, Feng and Zhang</copyright-holder>
<license xlink:href="http://creativecommons.org/licenses/by/4.0/"><p>This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.</p></license></permissions>
<abstract>
<p>Single-photon-based head-mounted microscopy is widely used to record the brain activities of freely-moving animals. However, during data acquisition, the free movement of animals will cause shaking in the field of view, which deteriorates subsequent neural signal analyses. Existing motion correction methods applied to calcium imaging data either focus on offline analyses or lack sufficient accuracy in real-time processing for single-photon data. In this study, we proposed an open-source real-time motion correction (RTMC) plug-in for single-photon calcium imaging data acquisition. The RTMC plug-in is a real-time subpixel registration algorithm that can run GPUs in UCLA Miniscope data acquisition software. When used with the UCLA Miniscope, the RTMC algorithm satisfies real-time processing requirements in terms of speed, memory, and accuracy. We tested the RTMC algorithm by extending a manual neuron labeling function to extract calcium signals in a real experimental setting. The results demonstrated that the neural calcium dynamics and calcium events can be restored with high accuracy from the calcium data that were collected by the UCLA Miniscope system embedded with our RTMC plug-in. Our method could become an essential component in brain science research, where real-time brain activity is needed for closed-loop experiments.</p></abstract>
<kwd-group>
<kwd>calcium imaging</kwd>
<kwd>motion correction</kwd>
<kwd>single-photon microscopy</kwd>
<kwd>real-time</kwd>
<kwd>open-source</kwd>
</kwd-group>
<contract-num rid="cn001">2017YFE0195500</contract-num>
<contract-sponsor id="cn001">National Key Research and Development Program of China<named-content content-type="fundref-id">10.13039/501100012166</named-content></contract-sponsor>
<counts>
<fig-count count="7"/>
<table-count count="0"/>
<equation-count count="10"/>
<ref-count count="35"/>
<page-count count="12"/>
<word-count count="7279"/>
</counts>
</article-meta>
</front>
<body>
<sec sec-type="intro" id="s1">
<title>1. Introduction</title>
<p>In neuroscience research, the efficient recording and decoding of neural signals is essential. Although multielectrode extracellular recordings can continuously record hundreds of neurons (Buzs&#x000E1;ki, <xref ref-type="bibr" rid="B2">2004</xref>), the spatial relationships between the recorded samples cannot be captured (Gobel and Helmchen, <xref ref-type="bibr" rid="B15">2007</xref>). Of the newly developed recording techniques, optical recording methods provide high-resolution image features and can be used with awake animals (Denk et al., <xref ref-type="bibr" rid="B7">1990</xref>; Garaschuk et al., <xref ref-type="bibr" rid="B11">2006</xref>). Among them, head-mounted microscopy (Ghosh et al., <xref ref-type="bibr" rid="B13">2011</xref>)-based single-photon calcium imaging has been widely adopted as a tool for observing large neural populations in free-moving mice to explore neural coding mechanisms, such as how the anterior cingulate cortex mediates effort-based decisions (Hart et al., <xref ref-type="bibr" rid="B18">2020</xref>), how the brain links memories across time (Cai et al., <xref ref-type="bibr" rid="B3">2016</xref>) and how spatial coding breaks down in epilepsy (Shuman et al., <xref ref-type="bibr" rid="B29">2020</xref>). However, when used with freely-moving mice, the activities of the animals can induce shaking in the imaging field of view (FOV), interfering with subsequent analyses of neuronal activity. Most current solutions to this issue involve postprocessing the acquired data with offline processing algorithms or toolboxes. For example, MIN1PIPE (Lu et al., <xref ref-type="bibr" rid="B19">2018</xref>) is a single-photon-based calcium imaging signal extraction pipeline with high motion correction precision. This method scores the overall data, then divides the data into several groups for motion correction. As a result, parallel processing can be applied to multiple sections. This hierarchical approach can reduce the required time due to the balanced assignment of processing tasks. However, the motion correction module in MIN1PIPE still consumes most of the processing time and therefore cannot be used for real-time analysis. Other postprocessing toolboxes, such as CAVE (Tegtmeier et al., <xref ref-type="bibr" rid="B31">2018</xref>), Suite2p (Pachitariu et al., <xref ref-type="bibr" rid="B23">2017</xref>) and EZcalcium (Cantu et al., <xref ref-type="bibr" rid="B4">2020</xref>), also include motion correction modules. Similar to MIN1PIPE, these toolboxes can only be used for <italic>post hoc</italic> analysis and cannot be used in closed-loop experiments that require real-time processing of the video stream during head-mounted microscopy.</p>
<p>The first requirement of real-time processing is that the flow of the algorithm satisfies the requirements of online processing. NoRMCorre (Pnevmatikakis and Giovannucci, <xref ref-type="bibr" rid="B26">2017</xref>) is an online nonrigid subpixel registration method. It divides the imaging field into several overlapping patches and calculates the displacement of each patch. However, this method requires that all patches contain some salient image features after segmentation. In addition, because of the translation estimates for the patches and the overlap regions, the computation cost is higher than that of the rigid method; thus, its speed cannot meet the requirements of real-time processing. Although NoRMCorre also provides a rigid version for online processing, its speed is limited to real-time processing for small images or low frame rates. In terms of speed, Mitani (Mitani and Komiyama, <xref ref-type="bibr" rid="B20">2018</xref>) provided a real-time motion correction tool for two-photon calcium imaging data. This was the first reported real-time calcium data processing pipeline to be used in closed-loop experiments. This method first shrinks the input frames, then registers them with the OpenCV template matching method before amplifying the detected translation to the original scale as the true translation. This method can process a 512 &#x000D7; 512 &#x000D7; 1,000 movie in less than 3 s. However, its accuracy on single-photon calcium imaging data is less reliable, most likely due to light scattering at the focal plane (Grienberger and Konnerth, <xref ref-type="bibr" rid="B16">2012</xref>) and the fact that it includes fewer spatial features than the two-photon imaging data. Therefore, no algorithm or software can meet the requirements for acquiring single-photon calcium imaging videos without movement artifacts in real time.</p>
<p>To address this issue, we propose a real-time motion correction (RTMC) plug-in for single-photon calcium imaging of head-mounted microscopy that focuses on rigid translation correction. The RTMC algorithm can be embedded in UCLA Miniscope data acquisition (DAQ) software and used to directly capture stable single-photon calcium imaging videos on a microscope by running an online registration algorithm on a GPU. We show that the RTMC algorithm can correct a single frame with high accuracy in approximately 15 ms, and that it can be used in real-time experiments with behaving mice.</p>
</sec>
<sec sec-type="materials and methods" id="s2">
<title>2. Materials and Methods</title>
<sec>
<title>2.1. Algorithm Description</title>
<p>The workflow of the motion correction algorithm is shown in <xref ref-type="fig" rid="F1">Figure 1</xref>, with the procedures in the red dotted box being GPU accelerated. Before running the RTMC algorithm, the plug-in generates a template by determining the mean image of a prerecorded video of the experimental animal. Next, each frame is continuously filtered and aligned with the template. The corrected filtered frames are stored in a buffer that can hold a maximum of k frames (e.g., <italic>k</italic> = 200). When the number of frames in the buffer reaches k, the template is updated by averaging the previous template and the mean value of the buffer content. As a result, the spatial features in the FOV that do not change over time, such as blood vessels, can be preserved to the maximum extent, improving the reliability of the template throughout the experiment. During the registration step, only the current frame and a subset of the previously registered frames are used. Therefore, the algorithm satisfies the online registration requirements of calcium data streams. The specific operation of the workflow is implemented by PyTorch. When applied to real-time experiments, the motion correction function is embedded in UCLA Miniscope DAQ software with Python/C API. The RTMC algorithm receives the frame sent by the hardware and outputs the corrected frames to the DAQ software for display and saving. The Python version of the algorithm and the implementation of RTMC plug-in are available at <ext-link ext-link-type="uri" xlink:href="https://github.com/ChanghaoStudy/Real-time-Motion-Correction-Plug-In">https://github.com/ChanghaoStudy/Real-time-Motion-Correction-Plug-In</ext-link>.</p>
<fig id="F1" position="float">
<label>Figure 1</label>
<caption><p>Flow chart of the RTMC algorithm. The initial template is generated based on a prerecorded video. Next, the input frame is copied and filtered. Each filtered frame is aligned with the template and translated with the raw frame. The colored procedures in the chart represent the specific processing in single frame registration. Then, the fixed filtered frame is stored in a buffer to update the template. Finally, the fixed raw frame is output, displayed and saved. The procedures in the red dotted box run on the GPU.</p></caption>
<graphic mimetype="image" mime-subtype="tiff" xlink:href="fncir-16-891825-g0001.tif"/>
</fig>
<sec>
<title>2.1.1. High Pass Filter</title>
<p>Due to light scattering from different focal planes, the high-frequency structure of the spatial information is significantly suppressed. Therefore, we used a high-pass spatial filter (Pnevmatikakis and Giovannucci, <xref ref-type="bibr" rid="B26">2017</xref>; Zhou et al., <xref ref-type="bibr" rid="B35">2018</xref>) to enhance the spatial features and contrast. The kernel was generated from a Gaussian filter,</p>
<disp-formula id="E1"><label>(1)</label><mml:math id="M1"><mml:mtable class="eqnarray" columnalign="right center left"><mml:mtr><mml:mtd><mml:mi>h</mml:mi><mml:mrow><mml:mo stretchy="false">(</mml:mo><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi></mml:mrow><mml:mo stretchy="false">)</mml:mo></mml:mrow><mml:mo>=</mml:mo><mml:msup><mml:mrow><mml:mi>e</mml:mi></mml:mrow><mml:mrow><mml:mo>-</mml:mo><mml:mfrac><mml:mrow><mml:msup><mml:mrow><mml:mrow><mml:mo stretchy="false">(</mml:mo><mml:mrow><mml:mi>x</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mrow><mml:mi>x</mml:mi></mml:mrow><mml:mrow><mml:mn>0</mml:mn></mml:mrow></mml:msub></mml:mrow><mml:mo stretchy="false">)</mml:mo></mml:mrow></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msup><mml:mo>&#x0002B;</mml:mo><mml:msup><mml:mrow><mml:mrow><mml:mo stretchy="false">(</mml:mo><mml:mrow><mml:mi>y</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mrow><mml:mi>y</mml:mi></mml:mrow><mml:mrow><mml:mn>0</mml:mn></mml:mrow></mml:msub></mml:mrow><mml:mo stretchy="false">)</mml:mo></mml:mrow></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msup></mml:mrow><mml:mrow><mml:mn>2</mml:mn><mml:msup><mml:mrow><mml:mi>l</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:mfrac></mml:mrow></mml:msup></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
<disp-formula id="E2"><label>(2)</label><mml:math id="M2"><mml:mtable class="eqnarray" columnalign="right center left"><mml:mtr><mml:mtd><mml:mover accent="true"><mml:mrow><mml:mi>h</mml:mi></mml:mrow><mml:mo>&#x0007E;</mml:mo></mml:mover><mml:mrow><mml:mo stretchy="false">(</mml:mo><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi></mml:mrow><mml:mo stretchy="false">)</mml:mo></mml:mrow><mml:mo>=</mml:mo><mml:mi>h</mml:mi><mml:mrow><mml:mo stretchy="false">(</mml:mo><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi></mml:mrow><mml:mo stretchy="false">)</mml:mo></mml:mrow><mml:mo>-</mml:mo><mml:mover accent="true"><mml:mrow><mml:mi>h</mml:mi></mml:mrow><mml:mo>&#x00304;</mml:mo></mml:mover><mml:mrow><mml:mo stretchy="false">(</mml:mo><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi></mml:mrow><mml:mo stretchy="false">)</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
<p>where <italic>h</italic>(<italic>x, y</italic>) is a Gaussian convolution kernel used for background removal and (<italic>x</italic><sub>0</sub>, <italic>y</italic><sub>0</sub>) is the center of the kernel. The standard deviation of the Gaussian kernel is the width of neuron. For the data captured by the UCLA miniscope, we observed that the diameter of a neuron in the FOV is usually around 10 pixels. Based on empirical evidence, the size of the kernel should be three times the size of the neuron. Then, the kernel subtracts its spatial mean value <inline-formula><mml:math id="M3"><mml:mover accent="true"><mml:mrow><mml:mi>h</mml:mi></mml:mrow><mml:mo>&#x00304;</mml:mo></mml:mover><mml:mrow><mml:mo stretchy="false">(</mml:mo><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi></mml:mrow><mml:mo stretchy="false">)</mml:mo></mml:mrow></mml:math></inline-formula> to generate a new kernel <inline-formula><mml:math id="M4"><mml:mover accent="true"><mml:mrow><mml:mi>h</mml:mi></mml:mrow><mml:mo>&#x0007E;</mml:mo></mml:mover><mml:mrow><mml:mo stretchy="false">(</mml:mo><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi></mml:mrow><mml:mo stretchy="false">)</mml:mo></mml:mrow></mml:math></inline-formula> for filtering. In addition to removing the blurred background and increasing the image contrast, the component of the filter kernel with a positive value approximates the size of the cells, thus retaining the neuron shape and calcium fluorescence during the subsequent signal extraction.</p>
</sec>
<sec>
<title>2.1.2. Normalized Cross-Correlation Calculation</title>
<p>To efficiently calculate the similarity between each frame and the template during frame alignment, we adopted the method proposed by Padfield (<xref ref-type="bibr" rid="B24">2010</xref>), which reduces the computational complexity by calculating the normalized cross-correlation (NCC) in the Fourier domain. Assume a reference image <italic>f</italic><sub>1</sub>(<italic>x, y</italic>) and a moving image <italic>f</italic><sub>2</sub>(<italic>x</italic>&#x02212;<italic>u, y</italic>&#x02212;<italic>v</italic>), with <italic>f</italic><sub>2</sub> shifted by (<italic>u, v</italic>). Then, the spatial form of the NCC can be defined as</p>
<disp-formula id="E3"><label>(3)</label><mml:math id="M5"><mml:mrow><mml:mtable columnalign='left'><mml:mtr columnalign='left'><mml:mtd columnalign='left'><mml:mrow><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi><mml:mo stretchy='false'>)</mml:mo><mml:mo>=</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr columnalign='left'><mml:mtd columnalign='left'><mml:mrow><mml:mfrac><mml:mrow><mml:mstyle displaystyle='true'><mml:munder><mml:mo>&#x02211;</mml:mo><mml:mrow><mml:mi>D</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi><mml:mo stretchy='false'>)</mml:mo></mml:mrow></mml:munder><mml:mrow><mml:mo stretchy='false'>[</mml:mo><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>f</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo stretchy='false'>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mover accent='true'><mml:mrow><mml:msub><mml:mi>f</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi></mml:mrow></mml:msub></mml:mrow><mml:mo stretchy='true'>&#x000AF;</mml:mo></mml:mover><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x000B7;</mml:mo><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>f</mml:mi><mml:mn>2</mml:mn></mml:msub><mml:mo stretchy='false'>(</mml:mo><mml:mi>x</mml:mi><mml:mo>&#x02212;</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>&#x02212;</mml:mo><mml:mi>v</mml:mi><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mover accent='true'><mml:mrow><mml:msub><mml:mi>f</mml:mi><mml:mrow><mml:mn>2</mml:mn><mml:mo>,</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi></mml:mrow></mml:msub></mml:mrow><mml:mo stretchy='true'>&#x000AF;</mml:mo></mml:mover><mml:mo stretchy='false'>)</mml:mo><mml:mo stretchy='false'>]</mml:mo></mml:mrow></mml:mstyle></mml:mrow><mml:mrow><mml:msqrt><mml:mrow><mml:mstyle displaystyle='true'><mml:munder><mml:mo>&#x02211;</mml:mo><mml:mrow><mml:mi>D</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi><mml:mo stretchy='false'>)</mml:mo></mml:mrow></mml:munder><mml:mrow><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>f</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo stretchy='false'>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mover accent='true'><mml:mrow><mml:msub><mml:mi>f</mml:mi><mml:mrow><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi></mml:mrow></mml:msub></mml:mrow><mml:mo stretchy='true'>&#x000AF;</mml:mo></mml:mover><mml:mo stretchy='false'>)</mml:mo></mml:mrow></mml:mstyle></mml:mrow></mml:msqrt><mml:mo>&#x000B7;</mml:mo><mml:msqrt><mml:mrow><mml:mstyle displaystyle='true'><mml:munder><mml:mo>&#x02211;</mml:mo><mml:mrow><mml:mi>D</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi><mml:mo stretchy='false'>)</mml:mo></mml:mrow></mml:munder><mml:mrow><mml:msup><mml:mrow><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>f</mml:mi><mml:mn>2</mml:mn></mml:msub><mml:mo stretchy='false'>(</mml:mo><mml:mi>x</mml:mi><mml:mo>&#x02212;</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>&#x02212;</mml:mo><mml:mi>v</mml:mi><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mover accent='true'><mml:mrow><mml:msub><mml:mi>f</mml:mi><mml:mrow><mml:mn>2</mml:mn><mml:mo>,</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi></mml:mrow></mml:msub></mml:mrow><mml:mo stretchy='true'>&#x000AF;</mml:mo></mml:mover><mml:mo stretchy='false'>)</mml:mo></mml:mrow><mml:mn>2</mml:mn></mml:msup></mml:mrow></mml:mstyle></mml:mrow></mml:msqrt></mml:mrow></mml:mfrac></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mrow></mml:math></disp-formula>
<p>where <italic>D</italic>(<italic>u, v</italic>) is the overlap region of the two images and <inline-formula><mml:math id="M6"><mml:mover accent="false" class="mml-overline"><mml:mrow><mml:msub><mml:mrow><mml:mi>f</mml:mi></mml:mrow><mml:mrow><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi></mml:mrow></mml:msub></mml:mrow><mml:mo accent="true">&#x000AF;</mml:mo></mml:mover></mml:math></inline-formula> and <inline-formula><mml:math id="M7"><mml:mover accent="false" class="mml-overline"><mml:mrow><mml:msub><mml:mrow><mml:mi>f</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn><mml:mo>,</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi></mml:mrow></mml:msub></mml:mrow><mml:mo accent="true">&#x000AF;</mml:mo></mml:mover></mml:math></inline-formula> represent the mean intensity of <italic>f</italic><sub>1</sub> and <italic>f</italic><sub>2</sub> in <italic>D</italic>(<italic>u, v</italic>). Since the cross-correlation of two images can be calculated in the Fourier domain by <inline-formula><mml:math id="M8"><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>f</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>f</mml:mi><mml:mn>2</mml:mn></mml:msub><mml:mo stretchy='false'>)</mml:mo><mml:mo>=</mml:mo><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>F</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>F</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo></mml:math></inline-formula>, we can also infer the components in Equation (3) in the Fourier domain. The two images can be represented as <italic>F</italic><sub>1</sub> &#x0003D; <italic>F</italic>(<italic>f</italic><sub>1</sub>) and <inline-formula><mml:math id="M9"><mml:msubsup><mml:mi>F</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo>=</mml:mo><mml:mi>&#x02131;</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>f</mml:mi><mml:mn>2</mml:mn></mml:msub><mml:mo>&#x02032;</mml:mo><mml:mo stretchy='false'>)</mml:mo></mml:math></inline-formula>, where <italic>F</italic>(&#x000B7;) represents the FFT operation, <inline-formula><mml:math id="M10"><mml:msubsup><mml:mrow><mml:mi>F</mml:mi></mml:mrow><mml:mrow><mml:mn>2</mml:mn></mml:mrow><mml:mrow><mml:mo>*</mml:mo></mml:mrow></mml:msubsup></mml:math></inline-formula> is the complex conjugate of the Fourier transform and <inline-formula><mml:math id="M11"><mml:msub><mml:mi>f</mml:mi><mml:mn>2</mml:mn></mml:msub><mml:mo>&#x02032;</mml:mo></mml:math></inline-formula> is <italic>f</italic><sub>2</sub> is rotated by 180&#x000B0;. In addition, assuming that <italic>i</italic><sub>1</sub> and <italic>i</italic><sub>2</sub> are images of ones with the same size as <italic>f</italic><sub>1</sub> and <italic>f</italic><sub>2</sub>, respectively, we can define <italic>I</italic><sub>1</sub> &#x0003D; <italic>F</italic>(<italic>i</italic><sub>1</sub>) and <inline-formula><mml:math id="M12"><mml:msubsup><mml:mi>I</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo>=</mml:mo><mml:mi>&#x2131;</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>i</mml:mi><mml:mn>2</mml:mn></mml:msub><mml:mo>&#x2032;</mml:mo><mml:mo stretchy='false'>)</mml:mo></mml:math></inline-formula>. Based on the results of Padfield (<xref ref-type="bibr" rid="B25">2011</xref>), the Fourier version of the NCC can be represented as</p>
<disp-formula id="E4"><label>(4)</label><mml:math id="M13"><mml:mtable columnalign='left'><mml:mtr><mml:mtd><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:mi>u</mml:mi><mml:mo>,</mml:mo><mml:mi>v</mml:mi><mml:mo stretchy='false'>)</mml:mo><mml:mo>=</mml:mo></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mfrac><mml:mrow><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>F</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>F</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mfrac><mml:mrow><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>F</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>I</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x000B7;</mml:mo><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>I</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>F</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo></mml:mrow><mml:mrow><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>I</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>I</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo></mml:mrow></mml:mfrac></mml:mrow><mml:mrow><mml:msqrt><mml:mrow><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:mi>&#x02131;</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>f</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msub><mml:mi>f</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>I</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mfrac><mml:mrow><mml:msup><mml:mrow><mml:mo stretchy='false'>(</mml:mo><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>F</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>I</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo><mml:mo stretchy='false'>)</mml:mo></mml:mrow><mml:mn>2</mml:mn></mml:msup></mml:mrow><mml:mrow><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>I</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>I</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo></mml:mrow></mml:mfrac></mml:mrow></mml:msqrt><mml:mo>&#x000B7;</mml:mo><mml:mtext>&#x000A0;</mml:mtext><mml:msqrt><mml:mrow><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>I</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:mi>&#x02131;</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msubsup><mml:mi>f</mml:mi><mml:mn>2</mml:mn><mml:mo>&#x02032;</mml:mo></mml:msubsup><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>f</mml:mi><mml:mn>2</mml:mn><mml:mo>&#x02032;</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mfrac><mml:mrow><mml:msup><mml:mrow><mml:mo stretchy='false'>(</mml:mo><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>I</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>F</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo><mml:mo stretchy='false'>)</mml:mo></mml:mrow><mml:mn>2</mml:mn></mml:msup></mml:mrow><mml:mrow><mml:msup><mml:mi>&#x02131;</mml:mi><mml:mrow><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>I</mml:mi><mml:mn>1</mml:mn></mml:msub><mml:mo>&#x000B7;</mml:mo><mml:msubsup><mml:mi>I</mml:mi><mml:mn>2</mml:mn><mml:mo>*</mml:mo></mml:msubsup><mml:mo stretchy='false'>)</mml:mo></mml:mrow></mml:mfrac></mml:mrow></mml:msqrt></mml:mrow></mml:mfrac></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
<p>The motivation for using this approach is that computations in the Fourier domain have lower order complexities (<italic>O</italic>(<italic>n</italic>&#x000B7;<italic>log</italic>(<italic>n</italic>))) than those in the spatial domain (<italic>O</italic>(<italic>n</italic><sup>2</sup>)), where <italic>n</italic> indicates the number of pixels in the computation. In addition, because of the normalization, NCC can be invariant to the linear gray value changes (Emmenlauer et al., <xref ref-type="bibr" rid="B8">2009</xref>; Yu and Peng, <xref ref-type="bibr" rid="B34">2011</xref>), which can reduce the influence of the illumination changes caused by the mice movements, out of focus brightness as well as wires poor contact at different time steps in the real-time experiments.</p>
<p>The displacement estimated by the NCC only has pixel-level accuracy. To further improve the accuracy, subpixel registration is necessary. The most commonly used subpixel registration methods include upsampling with different interpolation methods and curve fitting (Shimizu and Okutomi, <xref ref-type="bibr" rid="B28">2002</xref>; Debella-Gilo and K&#x000E4;&#x000E4;b, <xref ref-type="bibr" rid="B6">2011</xref>). Although some upsampling methods may be more accurate, the number of pixels used in the computation will be greatly increased, whereas the parabolic curve fitting method can be computed more efficiently. In parabola fitting, the matching integer pixel point (<italic>x</italic><sub>0</sub>, <italic>y</italic><sub>0</sub>) can be obtained through the NCC map. The subpixel location can be calculated by independently fitting a one-dimensional quadratic function based on the position with the highest correlation and its adjacent location in the NCC map: (<italic>x</italic><sub>0</sub> &#x02212; 1, <italic>y</italic><sub>0</sub>) and (<italic>x</italic><sub>0</sub> &#x0002B; 1, <italic>y</italic><sub>0</sub>) in the <italic>X</italic>-direction and (<italic>x</italic><sub>0</sub>, <italic>y</italic><sub>0</sub> &#x02212; 1) and (<italic>x</italic><sub>0</sub>, <italic>y</italic><sub>0</sub> &#x0002B; 1) in the <italic>Y</italic>-direction. The subpixel position can be estimated by Equations (5) and (6):</p>
<disp-formula id="E5"><label>(5)</label><mml:math id="M14"><mml:mtable columnalign='left'><mml:mtr><mml:mtd><mml:mtext>&#x00394;</mml:mtext><mml:mi>x</mml:mi><mml:mo>=</mml:mo></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mtext>&#x000A0;&#x000A0;&#x000A0;&#x000A0;</mml:mtext><mml:mfrac><mml:mrow><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo stretchy='false'>)</mml:mo></mml:mrow><mml:mrow><mml:mn>2</mml:mn><mml:mo>&#x000D7;</mml:mo><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mn>4</mml:mn><mml:mo>&#x000D7;</mml:mo><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo stretchy='false'>)</mml:mo><mml:mo>+</mml:mo><mml:mn>2</mml:mn><mml:mo>&#x000D7;</mml:mo><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:mn>1</mml:mn><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo stretchy='false'>)</mml:mo></mml:mrow></mml:mfrac></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
<disp-formula id="E6"><label>(6)</label><mml:math id="M15"><mml:mtable columnalign='left'><mml:mtr><mml:mtd><mml:mtext>&#x00394;</mml:mtext><mml:mi>y</mml:mi><mml:mo>=</mml:mo></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mfrac><mml:mrow><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:mn>1</mml:mn><mml:mo stretchy='false'>)</mml:mo></mml:mrow><mml:mrow><mml:mn>2</mml:mn><mml:mo>&#x000D7;</mml:mo><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>&#x02212;</mml:mo><mml:mn>1</mml:mn><mml:mo stretchy='false'>)</mml:mo><mml:mo>&#x02212;</mml:mo><mml:mn>4</mml:mn><mml:mo>&#x000D7;</mml:mo><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo stretchy='false'>)</mml:mo><mml:mo>+</mml:mo><mml:mn>2</mml:mn><mml:mo>&#x000D7;</mml:mo><mml:mi>N</mml:mi><mml:mi>C</mml:mi><mml:mi>C</mml:mi><mml:mo stretchy='false'>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mn>0</mml:mn></mml:msub><mml:mo>+</mml:mo><mml:mn>1</mml:mn><mml:mo stretchy='false'>)</mml:mo></mml:mrow></mml:mfrac></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
<p>where <italic>NCC</italic>(<italic>x</italic><sub>0</sub>, <italic>y</italic><sub>0</sub>), <italic>NCC</italic>(<italic>x</italic><sub>0</sub> &#x02212; 1, <italic>y</italic><sub>0</sub>), <italic>NCC</italic>(<italic>x</italic><sub>0</sub> &#x0002B; 1, <italic>y</italic><sub>0</sub>), <italic>NCC</italic>(<italic>x</italic><sub>0</sub>, <italic>y</italic><sub>0</sub> &#x02212; 1) and <italic>NCC</italic>(<italic>x</italic><sub>0</sub>, <italic>y</italic><sub>0</sub> &#x0002B; 1) indicate the integer matching locations and their adjacent points in the NCC map. Finally, the offsets can be estimated by adding the detected subpixel displacements to the integer offsets.</p>
</sec>
</sec>
<sec>
<title>2.2. Accuracy Assessment</title>
<p>To illustrate the performance of the RTMC registration algorithm, the rigid NoRMCorre and OpenCV template matching methods were selected for comparison. Since OpenCV template matching has previously been mainly used for two-photon data registration, we modified it to make it more suitable for single-photon registration by adding the high-pass filtering and template updating functions used in the RTMC algorithm. In addition, we skipped the step of shrinking the image to improve the accuracy and implemented the above method by Python. On the other hand, NoRMCorre has already been utilized for online processing in CaImAn (Giovannucci et al., <xref ref-type="bibr" rid="B14">2019</xref>) which integrates NoRMCorre with high-pass filter for single photon data. Hence, we adopt the above integrated method in the online version of CaImAn for comparison.</p>
<sec>
<title>2.2.1. Assessment on Simulated Data</title>
<p>To quantitatively analyze the accuracy, we generated a simulated video by shifting a single frame 5,000 times. The artificial offset at each time step was random and within 10 pixels. Then, we investigated the impact of applying a high-pass filter on the registration precision. Next, we used OpenCV template matching, rigid NoRMCorre and RTMC to detect offsets in the simulated video and calculated the deviations for statistical analysis. In this step, we focused on evaluating how each algorithm detected random rigid translations.</p>
</sec>
<sec>
<title>2.2.2. Assessment on Real Data</title>
<p>Although simulated data can provide the ground truth for quantitative analyses of registration performance, this data does not reflect all the characteristics of the calcium imaging data. Therefore, we also collected single-photon calcium data from the mouse motor cortex <italic>in vivo</italic>. We used the mean (CM) metric (Pnevmatikakis and Giovannucci, <xref ref-type="bibr" rid="B26">2017</xref>; Tegtmeier et al., <xref ref-type="bibr" rid="B31">2018</xref>) to quantify the motion correction performance of the different algorithms on real data. The CM metric is based on the correlation coefficients (CC) between the mean image of a video and each individual frame after motion correction. A higher CC score indicates a better match between the current frame and the template; thus, this metric can be used to compare the performance of different algorithms at the single-frame level. In addition, to eliminate the influence of different interpolation methods on the CC score when a frame is translated, all the interpolation methods used in the testing approaches were bilinear interpolations. Prior to performing the analysis, we removed the black border generated by shifting the frames during registration.</p>
</sec>
</sec>
<sec>
<title>2.3. Speed and Memory Assessment</title>
<p>For real-time experiments, as the workflow of the algorithm needs to satisfy the requirements for online processing, the registration time of a single frame should not exceed the interval between two frames. We used a PC running Windows 10 64-bit with an Intel Core i7-8700 processor, 64 GB RAM and an NVIDIA GeForce RTX 2080 TI graph card to compare the processing speeds of the OpenCV template matching, rigid NoRMCorre and RTMC algorithms. To assess the long-term stability, we used the RTMC algorithm to perform real-time acquisition and motion correction on calcium imaging data from freely-moving mice while monitoring the memory usage of the software.</p>
</sec>
<sec>
<title>2.4. Real-Time Experimental Design</title>
<sec>
<title>2.4.1. Calcium Imaging Procedure</title>
<p>All the equipment and surgical procedures used for data acquisition were described in our previous study (Wang et al., <xref ref-type="bibr" rid="B32">2019</xref>). In brief, the UCLA Miniscope was used to capture the data, and a 1.5 mm-diameter glass coverslip was pressed against the brain tissue through a skull hole. The imaging data were acquired at a rate of 20 frames per second with custom DAQ software.</p>
</sec>
<sec>
<title>2.4.2. Comparison of Traces With and Without Applying RTMC</title>
<p>First, to illustrate the importance of motion correction, we manually labeled some neurons. The spatial calcium fluorescence intensity of each observed neuron was modeled as the neural spontaneous fluorescence plus the background fluorescence fluctuation (Pnevmatikakis et al., <xref ref-type="bibr" rid="B27">2016</xref>). In single-photon calcium imaging data, the background can be decomposed into the global background and the local background, with the local background fluctuation more noticeably affecting the observed neuronal fluorescence (Zhou et al., <xref ref-type="bibr" rid="B35">2018</xref>). Therefore, the neural calcium signal was calculated by subtracting the mean value of the region covered by the neuron from the fluorescence value of the local background, where the local background was an annular region with a radius slightly larger than the neuron. Thus, small differences in the neurons before and after registration could be compared. Furthermore, in most cases, neuroscientists use deconvolution to extract the spike activities from the calcium fluorescence traces. In our experiment, we used OASIS (Friedrich et al., <xref ref-type="bibr" rid="B10">2017</xref>) to deconvolve the traces to illustrate the influence of motion correction on spike extraction.</p>
</sec>
<sec>
<title>2.4.3. Comparison of Calcium Events Between Online and Offline Detection</title>
<p>To further demonstrate the performance of RTMC in real-time experiments, we designed a real-time neuronal calcium event detection task. When the calcium signal exceeded a specific threshold, such as 3 standard deviations from the fluorescence intensity of the target neuron, and then returned to this threshold, a calcium event was recorded (Yaksi and Friedrich, <xref ref-type="bibr" rid="B33">2006</xref>; Mukamel et al., <xref ref-type="bibr" rid="B21">2009</xref>). For real-time experiments, we used a prerecorded video to label the target neurons and generate the thresholds. After collecting all the data for the real-time experiment, we processed the recorded videos with MIN1PIPE and determined the number of calcium events of the labeled neurons using the same method, then compared the results with those of the real-time experiment. MIN1PIPE is an offline processing pipeline that uses a neural enhancement function to remove the background of each frame and a deconvolution function to denoise the traces before and after motion correction. As a result, MIN1PIPE can protect the calcium traces from the effects of fluctuating background fluorescence and noise. The MIN1PIPE result can be regarded as the offline ground truth. In addition, during the experiment, we counted the number of motion-corrected frames output from the GPU and computed the equivalent output frame rate. In theory, if the system has no delay and motion correction is used, the equivalent output frame rate should be equal to the acquisition frame rate of the scope.</p>
</sec>
</sec>
</sec>
<sec sec-type="results" id="s3">
<title>3. Results</title>
<sec>
<title>3.1. Accuracy Assessment of Motion Correction</title>
<sec>
<title>3.1.1. Assessment of Simulated Data</title>
<p>We first investigated the impact of high-pass filtering on motion correction. Light scattering from outside the focal plane blurs the whole background (<xref ref-type="fig" rid="F2">Figure 2A</xref>), while high-pass filtering can produce visible textures such as mark points (<xref ref-type="fig" rid="F2">Figure 2B</xref>). When calculating the similarity between each frame and the template during motion correction, the fuzzy background causes relatively high correlations in the region around the matching point in the NCC map (<xref ref-type="fig" rid="F2">Figure 2C</xref>). In contrast, the NCC map has a more concentrated peak when using filtered frames (<xref ref-type="fig" rid="F2">Figure 2D</xref>). After verification with the simulated data, the deviations in the frame offsets calculated after high-pass filtering can be as low as 0.1 pixels, while those calculated using raw frames for registration can reach 1.2 pixels (<xref ref-type="fig" rid="F2">Figures 2E,F</xref>, <italic>p</italic> &#x0003C; 0.001, Wilcoxon test, <italic>n</italic> = 500 frames).</p>
<fig id="F2" position="float">
<label>Figure 2</label>
<caption><p>Influence of applying the high-pass filter. <bold>(A,B)</bold>: Raw calcium image <bold>(A)</bold> and filtered calcium image <bold>(B)</bold>. <bold>(C,D)</bold>: The NCC map calculated by 2 raw calcium images <bold>(C)</bold> and 2 filtered calcium images <bold>(D)</bold>. <bold>(E,F)</bold>: The deviations of a subset of a simulated video <bold>(E)</bold> and the box-plot of the deviations <bold>(F)</bold> with and without a high-pass filter during RTMC registration. (&#x0002A;&#x0002A;&#x0002A;<italic>p</italic> &#x0003C; 0.001, Wilcoxon test).</p></caption>
<graphic mimetype="image" mime-subtype="tiff" xlink:href="fncir-16-891825-g0002.tif"/>
</fig>
<p>Next, we used the OpenCV template matching, rigid NoRMCorre and RTMC algorithms to register the simulated data to compare the precision of the three methods on single photon data. <xref ref-type="fig" rid="F3">Figure 3A</xref> shows that RTMC has the smallest error and performs significantly better than the other two methods (RTMC vs. OpenCV, <italic>p</italic> &#x0003C; 0.001; RTMC vs. NoRMCorre, <italic>p</italic> &#x0003C; 0.001, Wilcoxon test, <italic>n</italic> = 5,000 frames). In terms of detecting offsets, RTMC produces a more accurate match between the frames and the template. The same result can be observed from the histogram of the deviations (<xref ref-type="fig" rid="F3">Figure 3B</xref>). The deviations of RTMC and NoRMCorre were less than 0.2 pixels, while the error distribution of the OpenCV-based approach ranged from 0 to 1.2 pixels.</p>
<fig id="F3" position="float">
<label>Figure 3</label>
<caption><p>Precision comparison of the OpenCV template matching, rigid NoRMCorre and RTMC algorithms applied on a simulated video with 5,000 frames. <bold>(A)</bold>: Box plot of the deviations of the above 3 methods (RTMC vs. OpenCV, &#x0002A;&#x0002A;&#x0002A;<italic>p</italic> &#x0003C; 0.001; RTMC vs. NoRMCorre, &#x0002A;&#x0002A;&#x0002A;<italic>p</italic> &#x0003C; 0.001, Wilcoxon test). <bold>(B)</bold>: Histogram of the deviations. The shadowed area indicates an enlarged range from 0 to 0.1 pixels.</p></caption>
<graphic mimetype="image" mime-subtype="tiff" xlink:href="fncir-16-891825-g0003.tif"/>
</fig>
</sec>
<sec>
<title>3.1.2. Assessment of Mouse Motor Cortex Data</title>
<p>Since the simulated data only reconstruct the offsets in the FOV, we also needed to evaluate the accuracy of our method with real data. <xref ref-type="fig" rid="F4">Figure 4</xref> demonstrates the CM metric of the OpenCV template matching, rigid NoRMCorre and RTMC algorithms on three 5,000-frame mouse motor cortex videos from layer 2/3 and layer 5 of different animals. RTMC performs consistently well on datasets with different spatial characteristics such as blood vessels, illumination distribution, exposure intensity, etc. (<xref ref-type="fig" rid="F4">Figure 4A</xref>). <xref ref-type="fig" rid="F4">Figure 4B</xref> shows the CM metric for a subset of frames in each dataset; the OpenCV-based method had the lowest correlations for almost all the frames, while the other two methods had very close correlations. The scatter diagrams (<xref ref-type="fig" rid="F4">Figures 4C,D</xref>) show the same trend: the correlation coefficients of RTMC were not significantly different from those of NoRMCorre (<italic>p</italic> &#x0003E; 0.05, Wilcoxon test, <italic>n</italic> = 5,000 frames), while both significantly exceeded those of OpenCV template matching (<italic>p</italic> &#x0003C; 0.01, Wilcoxon test, <italic>n</italic> = 5,000 frames) on nearly every frame. By observing the video (<xref ref-type="supplementary-material" rid="SM2">Supplementary Video S1</xref>) after motion correction, we found that there are still obvious motion residues in the FOV corrected by OpenCV template matching, whereas no visible motion artifacts in the videos corrected by the other two methods. In contrast to the results on the simulated data, there was no significant difference between the CM scores of RTMC and NoRMCorre. This is most likely because the pixel-shift difference between the two methods was approximately 0.2 pixels, which had little effect on the overall FOV. Moreover, fluctuations in the neuron population activity and local background fluorescence can lead to differences in the spatial features of the frames and the template. For the CM metric, the correlation between the frames and the template is more sensitive to changes in spatial features with hundreds of pixels than the difference between the 2 well-behaved methods. In addition, we also tested the effect of buffer size for updating template. We tested different buffer sizes ranging from 50 to 200 and found no difference in the accuracy of motion correction (<xref ref-type="supplementary-material" rid="SM1">Supplementary Figure S1</xref>). Therefore, we can set this parameter to 200, the same as the value used in CaImAn.</p>
<fig id="F4" position="float">
<label>Figure 4</label>
<caption><p>Accuracy comparison of OpenCV template matching, rigid NoRMCorre and RTMC applied to three <italic>in vivo</italic> mouse motor cortex datasets from layer 2/3 and layer 5, with 5,000 frames in each dataset. <bold>(A)</bold>: Temporal mean projection images of three datasets <bold>(B)</bold>: Correlation with mean (CM) metric for a subset frames in each dataset. <bold>(C,D)</bold>: Scatter plots of frame-by-frame CM from 3 datasets of RTMC vs. OpenCV <bold>(C)</bold> and RTMC vs. NoRMCorre <bold>(D)</bold>. RTMC has no significant difference with NoRMCorre and they both improve over OpenCV template matching (RTMC vs. OpenCV, <italic>p</italic> &#x0003C;0.01; RTMC vs. NoRMCorre, <italic>p</italic> &#x0003E;0.05, Wilcoxon test).</p></caption>
<graphic mimetype="image" mime-subtype="tiff" xlink:href="fncir-16-891825-g0004.tif"/>
</fig>
</sec>
</sec>
<sec>
<title>3.2. Evaluation of Speed and Memory</title>
<p>In addition to the satisfaction of accuracy requirements, the computational performance of the RTMC algorithm should satisfy the requirements of real-time processing. According to <xref ref-type="fig" rid="F5">Figure 5A</xref>, RTMC consumes the least amount of time (15 ms) for single-frame registration, which has no delay at a frame rate of 20 Hz, while rigid NoRMCorre requires approximately 62 ms for one frame. In addition, although OpenCV template matching has a much faster rate of 23 ms per frame, its accuracy is significantly lower than that of the other two methods (<xref ref-type="fig" rid="F3">Figures 3</xref>, <xref ref-type="fig" rid="F4">4</xref>). Due to GPU acceleration, the three key steps of the RTMC algorithm can be improved to varying degrees, with 228 times, 20 times and 9.9 times faster speeds achieved for high-pass filtering, the NCC calculation and applying shifts, respectively (<xref ref-type="fig" rid="F5">Figure 5B</xref>). On the other hand, data transmission between the RAM and GPU adds extra processing time, which accounts for the second largest proportion (33.9%) of the process. Next, we used the RTMC algorithm to process a 5,000-frame video and counted the total processing time and memory occupation every 500 frames (<xref ref-type="fig" rid="F5">Figure 5C</xref>). The cumulative time increased almost linearly at a rate of 15 ms per frame, which is consistent with the result shown in <xref ref-type="fig" rid="F5">Figure 5A</xref>. Furthermore, the memory usage during the 5,000 frame registration is nearly constant (approximately 2,110 Mb), which demonstrates that high-throughput data streams can be processed by the RTMC algorithm.</p>
<fig id="F5" position="float">
<label>Figure 5</label>
<caption><p>Computing speed and resources of RTMC. <bold>(A)</bold>: Time to process one frame with OpenCV template matching, rigid NoRMCorre and RTMC. <bold>(B)</bold>: The proportion of time consumed by each step while registering one frame in the RTMC workflow. The parentheses indicate the speed enhancement of the GPU over the CPU. <bold>(C)</bold>: Cumulative time consumption (blue, square dots) and memory occupation (red, triangle dots) of RTMC, measured per 500 frames. The dashed lines indicate the linear fit.</p></caption>
<graphic mimetype="image" mime-subtype="tiff" xlink:href="fncir-16-891825-g0005.tif"/>
</fig>
</sec>
<sec>
<title>3.3. Application to Signal Extraction With Freely-Moving Mice</title>
<sec>
<title>3.3.1. RTMC Leads to Better Calcium Trace Quality</title>
<p>When applied to a freely-moving mouse, RTMC can improve the quality of the extracted traces (<xref ref-type="fig" rid="F6">Figure 6</xref>). The calcium traces of the labeled neurons with motion correction (<xref ref-type="fig" rid="F6">Figure 6A</xref>) have larger amplitudes and lower noise values than the traces extracted without motion correction (<xref ref-type="fig" rid="F6">Figures 6B,D</xref>). These traces were calculated based on the mean intensities of the areas covered by the labeled ROIs, and these amplitudes are reduced when the actual neuron coverage area deviates from the labeled area. When the deviation between the two coverage regions changes frequently, the calculated fluorescence fluctuates frequently, resulting in noise. The movement-induced fluctuations in fluorescence also increase the energy of the traces, which is reflected in the power spectra and is consistent with the results of Victoria (Griffiths et al., <xref ref-type="bibr" rid="B17">2020</xref>) (<xref ref-type="fig" rid="F6">Figure 6C</xref>). Furthermore, since measurable calcium fluorescence is induced by neural action potentials (or spikes), the extracted traces influence the detection of action potentials (or spikes). Therefore, the transient response in the calcium traces can be evoked by the movement artifacts in the FOV, resulting in additional false positive spikes. After thresholding with 3 standard deviations of the spike activities, the inferred spikes in the motion-corrected traces are sparser and more concentrated (<xref ref-type="fig" rid="F6">Figure 6E</xref>), which is consistent with the calcium dynamics model proposed in OASIS. The total number of spikes in the traces (mean&#x000B1;SD=118&#x000B1;44.6, <italic>n</italic>=15) was significantly less than that in the uncorrected traces (152&#x000B1;32.9, <italic>n</italic>=15), indicating that movement-induced false positive spikes were highly suppressed (<xref ref-type="fig" rid="F6">Figure 6F</xref>). Therefore, the traces acquired by RTMC more accurately reflect the calcium fluorescence induced by neuronal spikes.</p>
<fig id="F6" position="float">
<label>Figure 6</label>
<caption><p>Traces comparison when RTMC is on and off. <bold>(A)</bold>: Positions of the 5 observed neurons (red dots) and the local background (white circles). The trace of each neuron is obtained by subtracting the mean fluorescence values of the regions covered by the neuron from the local background. <bold>(B)</bold>: The traces of the 5 neurons in <bold>(A)</bold>. The black traces were extracted without motion correction, while the red traces were extracted with motion correction using RTMC. <bold>(C)</bold>: Mean power spectrum of the traces with (red) and without (black) motion correction from 3 mice (15 neurons). The shaded area indicates the s.e.m. <bold>(D)</bold>: Enlarged example trace of the third neuron in <bold>(A)</bold> before and after motion correction. <bold>(E)</bold>: Spikes of the third neuron in <bold>(A)</bold> extracted by OASIS before and after motion correction. The spikes were thresholded by 3 SD of the inferred spikes activities. <bold>(F)</bold>: Mean number of spikes from the neurons in <bold>(C)</bold> extracted by OASIS. The error bar indicates the SD.</p></caption>
<graphic mimetype="image" mime-subtype="tiff" xlink:href="fncir-16-891825-g0006.tif"/>
</fig>
</sec>
<sec>
<title>3.3.2. Real-Time Calcium Event Detection Using RTMC in Comparison With Offline Detection Using MIN1PIPE</title>
<p>For real-time calcium event detection, RTMC also has high performance. <xref ref-type="fig" rid="F7">Figure 7</xref> shows the results of RTMC on a real-time calcium event detection task with a target neuron (<xref ref-type="fig" rid="F7">Figure 7A</xref>). The real-time detection results were the same as those of offline detection extracted by MIN1PIPE (<xref ref-type="fig" rid="F7">Figure 7B</xref>). Moreover, at a frame rate of 20 Hz with motion correction, the cumulative received frame number at each 5 s timestep was nearly equal to the theoretical number, despite the occasional frame drop (<xref ref-type="fig" rid="F7">Figure 7C</xref>). After linear fitting, the growth rate of the received frame number was 20 frames per second, which is consistent with the acquisition frame rate, ensuring that RTMC can align frames during real-time data acquisition. Further analysis of these results revealed that all the traces in the 5 sessions of the 2 scenarios had similar shapes, including the peaks in each session (<xref ref-type="fig" rid="F7">Figure 7D</xref>). Furthermore, the onset times of the calcium events extracted by RTMC matched the offline ground truth (<xref ref-type="fig" rid="F7">Figure 7F</xref>). However, the directly extracted traces during real-time acquisition had more noise due to background fluctuations, resulting in a lower peak signal-to-noise ratio (PSNR) (<xref ref-type="fig" rid="F7">Figure 7E</xref>), while MIN1PIPE dramatically improved the PSNR with its complex signal enhancement and deconvolution algorithms. In other words, although RTMC provides a real-time signal extraction approach for single-photon calcium data, motion correction is not the only factor that can influence the calcium signal quality. For example, background removal and deconvolution can improve the signal quality before and after signal extraction. To obtain higher PSNR signals, the above preprocessing and postprocessing are necessary, which is another challenge for real-time calcium signal extraction.</p>
<fig id="F7" position="float">
<label>Figure 7</label>
<caption><p>Calcium event detection in real-time with RTMC and offline with MIN1PIPE. The data were collected at 20 Hz. <bold>(A)</bold>: The target neuron (red dot) and local background (white circle). <bold>(B)</bold>: Number of detected calcium events in 5 sessions (each session lasts 250 seconds). Real-time detection was implemented by RTMC and manual labeling (red square and solid line), while offline detection was implemented by MIN1PIPE (blue triangle and dashed line). <bold>(C)</bold>: Cumulative number of frames received every 5 seconds while RTMC is running with motion correction enabled. The linear fit represents the equivalent frame rate. <bold>(D)</bold>: The traces extracted in real-time by RTMC and offline by MIN1PIPE in 5 sessions. <bold>(E)</bold>: The peak signal-to-noise ratio (PSNR) of the traces extracted in real-time by RTMC and offline by MIN1PIPE. <bold>(F)</bold>: Enlarged example of the trace of the first session in <bold>(D)</bold>. The dotted line indicates the threshold for calcium events, and the arrows indicate the temporal position of the events.</p></caption>
<graphic mimetype="image" mime-subtype="tiff" xlink:href="fncir-16-891825-g0007.tif"/>
</fig>
</sec>
</sec>
</sec>
<sec sec-type="discussion" id="s4">
<title>4. Discussion</title>
<p>In this study, we demonstrate an open-source real-time motion correction plug-in for single-photon calcium imaging data. To meet the real-time requirement, we used rigid motion correction and GPU acceleration, which had a similar or better accuracy to other rigid registration methods. In the real-time calcium event detection experiment, RTMC extracted neuron activities and achieved the same results as offline processing. Although the PSNR of the real-time extracted signals was lower than those of the offline analysis, this was due to the absence of signal enhancement and deconvolution functions rather than registration errors. Thus, RTMC can provide motion correction for signal extraction, but additional algorithms for higher signal quality need to be developed.</p>
<p>The OpenCV-based method of Mitani et al. performed well in two-photon calcium image registration and has been used in real-time closed-loop experiments. Because two-photon absorption is a nonlinear process, fluorophores are only excited in a diffraction-limited focal volume. Thus, the out-of-focus excitation and bleaching were significantly lower than those in one-photon data (Svoboda and Yasuda, <xref ref-type="bibr" rid="B30">2006</xref>). In addition, the wavelengths of the extraction light in two-photon microscopy are in the near-IR spectrum, which has better tissue penetration than the visible light used in single-photon microscopy (Oheim et al., <xref ref-type="bibr" rid="B22">2001</xref>). However, the above features do not exist in single-photon imaging data, whose spatial information is affected by light scattering. Hence, due to the difference between two-photon and single-photon calcium data, the OpenCV-based method does not account for the complexity of the data and thus cannot accurately detect displacements between frames. Because of the unique nature of single-photon imaging data, different processing methods are required. In this study, we incorporated high-pass filtering to improve the registration accuracy of single-photon data. We anticipate that our current pipeline can be further improved by using adapted filtering, adapted region/feature selection as well as morphological operations as the preprocessng steps before motion correction, which can also be accelerated and will be implemented in future work.</p>
<p>To a large extent, the presence of nonrigid artifacts in a frame during two-photon imaging is related to varying motion during a period of raster scanning. However, due to the different imaging methods, this type of nonrigid artifact cannot be observed in single-photon calcium data. On the other hand, although elastic brain deformation within the FOV can also lead to nonrigid artifacts, the lens is in direct contact with the brain tissue, which results in synchronous movement between the lens and the tissue and thus reduces nonrigid motion in the FOV to some degree. Finally, the most obvious motion artifacts in single-photon data are translations. When the lens is firmly anchored to the micro camera, other transformations, such as rotations and shears, are relatively rare. Some researches (Gauthier et al., <xref ref-type="bibr" rid="B12">2018</xref>; Bollimunta et al., <xref ref-type="bibr" rid="B1">2021</xref>) also adopted translation correction methods to process their single photon data before the experiments or analyses. Therefore, rigid translation correction can provide satisfactory results in most cases. In the future, we will integrate fast and accurate nonrigid registration algorithms into the software to handle more complex deformation and satisfy the demands of real-time processing.</p>
<p>RTMC, an open-source plug-in for capturing single-photon calcium imaging videos without movement artifacts in the FOV, has a wide range of applications in real-time closed-loop experiments. By manually labeling neurons and extracting their signals in real time, researchers can target specific neurons in experimental animals and extract their activities in response to specific behaviors. For example, RTMC can be used in brain-computer interface experiments to extract neural activities in real time and provide feedback to the experimental object (Clancy et al., <xref ref-type="bibr" rid="B5">2014</xref>). Currently, at a capture frame rate of 20 Hz, the RTMC algorithm only takes approximately 15 ms; thus, we can perform more operations between two frames. For example, RTMC can be used together with online deconvolution algorithms, such as OASIS, to infer spikes from fluorescent calcium signals of the target neurons in real time and to denoise the fluorescent signals, providing higher quality signals for real-time experiments. RTMC can also be used as a preprocess step of real-time automatic neuron extraction algorithm, such as ONACID-E (Friedrich et al., <xref ref-type="bibr" rid="B9">2021</xref>). We look forward to ONACID-E to be implemented on GPU in order to achieve real-time automatic extraction of neuron signals from single-photon calcium imaging data together with RTMC, thus providing a platform for closed-loop experiments based on single-photon calcium imaging.</p>
</sec>
<sec sec-type="data-availability" id="s5">
<title>Data Availability Statement</title>
<p>The raw data supporting the conclusions of this article will be made available upon reasonable request.</p>
</sec>
<sec id="s6">
<title>Ethics Statement</title>
<p>The animal study was reviewed and approved by the Animal Care Committee of Zhejiang University, China.</p>
</sec>
<sec id="s7">
<title>Author Contributions</title>
<p>ML, LF, and SZ conceived the project. ML drafted the manuscript. ML and CL performed the algorithm and software development. XC, HJ, and HY provided technical support for software design. All authors contributed to manuscript revision and approved the submitted version.</p>
</sec>
<sec sec-type="funding-information" id="s8">
<title>Funding</title>
<p>This research was supported by the National Key Research and Development Program of China (2017YFE0195500), Key Research and Development Program of Zhejiang Province (2021C03003, 2021C03107, and 2022C03029), and Zhejiang Lab (2021KI0PI02).</p>
</sec>
<sec sec-type="COI-statement" id="conf1">
<title>Conflict of Interest</title>
<p>The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.</p>
</sec>
<sec sec-type="disclaimer" id="s9">
<title>Publisher&#x00027;s Note</title>
<p>All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.</p>
</sec> 
</body>
<back>
<ack><p>We thank Ruixue Wang and Jiawei Han for providing support and help in animal experiments. We also thank Xiaopeng Yang and Ha Lim Kim for technical assistance.</p>
</ack><sec sec-type="supplementary-material" id="s10">
<title>Supplementary Material</title>
<p>The Supplementary Material for this article can be found online at: <ext-link ext-link-type="uri" xlink:href="https://www.frontiersin.org/articles/10.3389/fncir.2022.891825/full#supplementary-material">https://www.frontiersin.org/articles/10.3389/fncir.2022.891825/full#supplementary-material</ext-link></p>
<supplementary-material xlink:href="Data_Sheet_1.PDF" id="SM1" mimetype="application/pdf" xmlns:xlink="http://www.w3.org/1999/xlink"/>
<supplementary-material xlink:href="Data_Sheet_2.ZIP" id="SM2" mimetype="application/zip" xmlns:xlink="http://www.w3.org/1999/xlink"/>
</sec>
<ref-list>
<title>References</title>
<ref id="B1">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Bollimunta</surname> <given-names>A.</given-names></name> <name><surname>Santacruz</surname> <given-names>S. R.</given-names></name> <name><surname>Eaton</surname> <given-names>R. W.</given-names></name> <name><surname>Xu</surname> <given-names>P. S.</given-names></name> <name><surname>Morrison</surname> <given-names>J. H.</given-names></name> <name><surname>Moxon</surname> <given-names>K. A.</given-names></name> <etal/></person-group>. (<year>2021</year>). <article-title>Head-mounted microendoscopic calcium imaging in dorsal premotor cortex of behaving rhesus macaque</article-title>. <source>Cell Rep</source>. 35, 109239. <pub-id pub-id-type="doi">10.1016/j.celrep.2021.109239</pub-id><pub-id pub-id-type="pmid">34133921</pub-id></citation></ref>
<ref id="B2">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Buzs&#x000E1;ki</surname> <given-names>G.</given-names></name></person-group> (<year>2004</year>). <article-title>Large-scale recording of neuronal ensembles</article-title>. <source>Nat. Neurosci</source>. <volume>7</volume>, <fpage>446</fpage>&#x02013;<lpage>451</lpage>. <pub-id pub-id-type="doi">10.1038/nn1233</pub-id><pub-id pub-id-type="pmid">15114356</pub-id></citation></ref>
<ref id="B3">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Cai</surname> <given-names>D. J.</given-names></name> <name><surname>Aharoni</surname> <given-names>D.</given-names></name> <name><surname>Shuman</surname> <given-names>T.</given-names></name> <name><surname>Shobe</surname> <given-names>J.</given-names></name> <name><surname>Biane</surname> <given-names>J.</given-names></name> <name><surname>Song</surname> <given-names>W.</given-names></name> <etal/></person-group>. (<year>2016</year>). <article-title>A shared neural ensemble links distinct contextual memories encoded close in time</article-title>. <source>Nature</source> <volume>534</volume>, <fpage>115</fpage>&#x02013;<lpage>118</lpage>. <pub-id pub-id-type="doi">10.1038/nature17955</pub-id><pub-id pub-id-type="pmid">27251287</pub-id></citation></ref>
<ref id="B4">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Cantu</surname> <given-names>D. A.</given-names></name> <name><surname>Wang</surname> <given-names>B.</given-names></name> <name><surname>Gongwer</surname> <given-names>M. W.</given-names></name> <name><surname>He</surname> <given-names>C. X.</given-names></name> <name><surname>Goel</surname> <given-names>A.</given-names></name> <name><surname>Suresh</surname> <given-names>A.</given-names></name> <etal/></person-group>. (<year>2020</year>). <article-title>Ezcalcium: open-source toolbox for analysis of calcium imaging data</article-title>. <source>Front. Neural Circ</source>. 14, 25. <pub-id pub-id-type="doi">10.3389/fncir.2020.00025</pub-id><pub-id pub-id-type="pmid">32499682</pub-id></citation></ref>
<ref id="B5">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Clancy</surname> <given-names>K. B.</given-names></name> <name><surname>Koralek</surname> <given-names>A. C.</given-names></name> <name><surname>Costa</surname> <given-names>R. M.</given-names></name> <name><surname>Feldman</surname> <given-names>D. E.</given-names></name> <name><surname>Carmena</surname> <given-names>J. M.</given-names></name></person-group> (<year>2014</year>). <article-title>Volitional modulation of optically recorded calcium signals during neuroprosthetic learning</article-title>. <source>Nat. Neurosci</source>. <volume>17</volume>, <fpage>807</fpage>&#x02013;<lpage>809</lpage>. <pub-id pub-id-type="doi">10.1038/nn.3712</pub-id><pub-id pub-id-type="pmid">24728268</pub-id></citation></ref>
<ref id="B6">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Debella-Gilo</surname> <given-names>M.</given-names></name> <name><surname>K&#x000E4;&#x000E4;b</surname> <given-names>A.</given-names></name></person-group> (<year>2011</year>). <article-title>Sub-pixel precision image matching for measuring surface displacements on mass movements using normalized cross-correlation</article-title>. <source>Remote Sens. Environ</source>. <volume>115</volume>, <fpage>130</fpage>&#x02013;<lpage>142</lpage>. <pub-id pub-id-type="doi">10.1016/j.rse.2010.08.012</pub-id></citation>
</ref>
<ref id="B7">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Denk</surname> <given-names>W.</given-names></name> <name><surname>Strickler</surname> <given-names>J. H.</given-names></name> <name><surname>Webb</surname> <given-names>W. W.</given-names></name></person-group> (<year>1990</year>). <article-title>Two-photon laser scanning fluorescence microscopy</article-title>. <source>Science</source> <volume>248</volume>, <fpage>73</fpage>&#x02013;<lpage>76</lpage>. <pub-id pub-id-type="doi">10.1126/science.2321027</pub-id><pub-id pub-id-type="pmid">2321027</pub-id></citation></ref>
<ref id="B8">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Emmenlauer</surname> <given-names>M.</given-names></name> <name><surname>Ronneberger</surname> <given-names>O.</given-names></name> <name><surname>Ponti</surname> <given-names>A.</given-names></name> <name><surname>Schwarb</surname> <given-names>P.</given-names></name> <name><surname>Griffa</surname> <given-names>A.</given-names></name> <name><surname>Filippi</surname> <given-names>A.</given-names></name> <etal/></person-group>. (<year>2009</year>). <article-title>Xuvtools: free, fast and reliable stitching of large 3d datasets</article-title>. <source>J. Microsc</source>. <volume>233</volume>, <fpage>42</fpage>&#x02013;<lpage>60</lpage>. <pub-id pub-id-type="doi">10.1111/j.1365-2818.2008.03094.x</pub-id><pub-id pub-id-type="pmid">19196411</pub-id></citation></ref>
<ref id="B9">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Friedrich</surname> <given-names>J.</given-names></name> <name><surname>Giovannucci</surname> <given-names>A.</given-names></name> <name><surname>Pnevmatikakis</surname> <given-names>E. A.</given-names></name></person-group> (<year>2021</year>). <article-title>Online analysis of microendoscopic 1-photon calcium imaging data streams</article-title>. <source>PLoS Comput. Biol</source>. 17, e1008565. <pub-id pub-id-type="doi">10.1371/journal.pcbi.1008565</pub-id><pub-id pub-id-type="pmid">33507937</pub-id></citation></ref>
<ref id="B10">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Friedrich</surname> <given-names>J.</given-names></name> <name><surname>Zhou</surname> <given-names>P.</given-names></name> <name><surname>Paninski</surname> <given-names>L.</given-names></name></person-group> (<year>2017</year>). <article-title>Fast online deconvolution of calcium imaging data</article-title>. <source>PLoS Comput. Biol</source>. 13, e1005423. <pub-id pub-id-type="doi">10.1371/journal.pcbi.1005423</pub-id><pub-id pub-id-type="pmid">28291787</pub-id></citation></ref>
<ref id="B11">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Garaschuk</surname> <given-names>O.</given-names></name> <name><surname>Milos</surname> <given-names>R.-I.</given-names></name> <name><surname>Grienberger</surname> <given-names>C.</given-names></name> <name><surname>Marandi</surname> <given-names>N.</given-names></name> <name><surname>Adelsberger</surname> <given-names>H.</given-names></name> <name><surname>Konnerth</surname> <given-names>A.</given-names></name></person-group> (<year>2006</year>). <article-title>Optical monitoring of brain function <italic>in vivo</italic>: from neurons to networks</article-title>. <source>Pfl&#x000FC;gers Arch.</source> <volume>453</volume>, <fpage>385</fpage>&#x02013;<lpage>396</lpage>. <pub-id pub-id-type="doi">10.1007/s00424-006-0150-x</pub-id><pub-id pub-id-type="pmid">17047983</pub-id></citation></ref>
<ref id="B12">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Gauthier</surname> <given-names>J. L.</given-names></name> <name><surname>Koay</surname> <given-names>S. A.</given-names></name> <name><surname>Nieh</surname> <given-names>E. H.</given-names></name> <name><surname>Tank</surname> <given-names>D. W.</given-names></name> <name><surname>Pillow</surname> <given-names>J. W.</given-names></name> <name><surname>Charles</surname> <given-names>A. S.</given-names></name></person-group> (<year>2018</year>). <article-title>Detecting and correcting false transients in calcium imaging</article-title>. <source>Nat. Methods</source> <volume>19</volume>, <fpage>470</fpage>&#x02013;<lpage>8</lpage>. <pub-id pub-id-type="doi">10.1101/473470</pub-id><pub-id pub-id-type="pmid">35347320</pub-id></citation></ref>
<ref id="B13">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Ghosh</surname> <given-names>K. K.</given-names></name> <name><surname>Burns</surname> <given-names>L. D.</given-names></name> <name><surname>Cocker</surname> <given-names>E. D.</given-names></name> <name><surname>Nimmerjahn</surname> <given-names>A.</given-names></name> <name><surname>Ziv</surname> <given-names>Y.</given-names></name> <name><surname>El Gamal</surname> <given-names>A.</given-names></name> <etal/></person-group>. (<year>2011</year>). <article-title>Miniaturized integration of a fluorescence microscope</article-title>. <source>Nat. Methods</source> <volume>8</volume>, <fpage>871</fpage>&#x02013;<lpage>878</lpage>. <pub-id pub-id-type="doi">10.1038/nmeth.1694</pub-id><pub-id pub-id-type="pmid">21909102</pub-id></citation></ref>
<ref id="B14">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Giovannucci</surname> <given-names>A.</given-names></name> <name><surname>Friedrich</surname> <given-names>J.</given-names></name> <name><surname>Gunn</surname> <given-names>P.</given-names></name> <name><surname>Kalfon</surname> <given-names>J.</given-names></name> <name><surname>Brown</surname> <given-names>B. L.</given-names></name> <name><surname>Koay</surname> <given-names>S. A.</given-names></name> <etal/></person-group>. (<year>2019</year>). <article-title>Caiman an open source tool for scalable calcium imaging data analysis</article-title>. <source>Elife</source> <volume>8</volume>, <fpage>e38173</fpage>. <pub-id pub-id-type="doi">10.7554/eLife.38173</pub-id><pub-id pub-id-type="pmid">30652683</pub-id></citation></ref>
<ref id="B15">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Gobel</surname> <given-names>W.</given-names></name> <name><surname>Helmchen</surname> <given-names>F.</given-names></name></person-group> (<year>2007</year>). <article-title>In vivo calcium imaging of neural network function</article-title>. <source>Physiology</source> <volume>22</volume>, <fpage>358</fpage>&#x02013;<lpage>365</lpage>. <pub-id pub-id-type="doi">10.1152/physiol.00032.2007</pub-id><pub-id pub-id-type="pmid">18073408</pub-id></citation></ref>
<ref id="B16">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Grienberger</surname> <given-names>C.</given-names></name> <name><surname>Konnerth</surname> <given-names>A.</given-names></name></person-group> (<year>2012</year>). <article-title>Imaging calcium in neurons</article-title>. <source>Neuron</source> <volume>73</volume>, <fpage>862</fpage>&#x02013;<lpage>885</lpage>. <pub-id pub-id-type="doi">10.1016/j.neuron.2012.02.011</pub-id><pub-id pub-id-type="pmid">22405199</pub-id></citation></ref>
<ref id="B17">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Griffiths</surname> <given-names>V. A.</given-names></name> <name><surname>Valera</surname> <given-names>A. M.</given-names></name> <name><surname>Lau</surname> <given-names>J. Y.</given-names></name> <name><surname>Ro&#x00161;</surname> <given-names>H.</given-names></name> <name><surname>Younts</surname> <given-names>T. J.</given-names></name> <name><surname>Marin</surname> <given-names>B.</given-names></name> <etal/></person-group>. (<year>2020</year>). <article-title>Real-time 3d movement correction for two-photon imaging in behaving animals</article-title>. <source>Nat. Methods</source> <volume>17</volume>, <fpage>741</fpage>&#x02013;<lpage>748</lpage>. <pub-id pub-id-type="doi">10.1038/s41592-020-0851-7</pub-id><pub-id pub-id-type="pmid">32483335</pub-id></citation></ref>
<ref id="B18">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Hart</surname> <given-names>E. E.</given-names></name> <name><surname>Blair</surname> <given-names>G. J.</given-names></name> <name><surname>O&#x00027;Dell</surname> <given-names>T. J.</given-names></name> <name><surname>Blair</surname> <given-names>H. T.</given-names></name> <name><surname>Izquierdo</surname> <given-names>A.</given-names></name></person-group> (<year>2020</year>). <article-title>Chemogenetic modulation and single-photon calcium imaging in anterior cingulate cortex reveal a mechanism for effort-based decisions</article-title>. <source>J Neurosci</source>. <volume>40</volume>, <fpage>5628</fpage>&#x02013;<lpage>5643</lpage>. <pub-id pub-id-type="doi">10.1523/JNEUROSCI.2548-19.2020</pub-id><pub-id pub-id-type="pmid">32527984</pub-id></citation></ref>
<ref id="B19">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Lu</surname> <given-names>J.</given-names></name> <name><surname>Li</surname> <given-names>C.</given-names></name> <name><surname>Singh-Alvarado</surname> <given-names>J.</given-names></name> <name><surname>Zhou</surname> <given-names>Z. C.</given-names></name> <name><surname>Fr&#x000F6;hlich</surname> <given-names>F.</given-names></name> <name><surname>Mooney</surname> <given-names>R.</given-names></name> <etal/></person-group>. (<year>2018</year>). <article-title>Min1pipe: a miniscope 1-photon-based calcium imaging signal extraction pipeline</article-title>. <source>Cell Rep</source>. <volume>23</volume>, <fpage>3673</fpage>&#x02013;<lpage>3684</lpage>. <pub-id pub-id-type="doi">10.1016/j.celrep.2018.05.062</pub-id><pub-id pub-id-type="pmid">29925007</pub-id></citation></ref>
<ref id="B20">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Mitani</surname> <given-names>A.</given-names></name> <name><surname>Komiyama</surname> <given-names>T.</given-names></name></person-group> (<year>2018</year>). <article-title>Real-time processing of two-photon calcium imaging data including lateral motion artifact correction</article-title>. <source>Front. Neuroinform</source>. 12, 98. <pub-id pub-id-type="doi">10.3389/fninf.2018.00098</pub-id><pub-id pub-id-type="pmid">30618703</pub-id></citation></ref>
<ref id="B21">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Mukamel</surname> <given-names>E. A.</given-names></name> <name><surname>Nimmerjahn</surname> <given-names>A.</given-names></name> <name><surname>Schnitzer</surname> <given-names>M. J.</given-names></name></person-group> (<year>2009</year>). <article-title>Automated analysis of cellular signals from large-scale calcium imaging data</article-title>. <source>Neuron</source> <volume>63</volume>, <fpage>747</fpage>&#x02013;<lpage>760</lpage>. <pub-id pub-id-type="doi">10.1016/j.neuron.2009.08.009</pub-id><pub-id pub-id-type="pmid">19778505</pub-id></citation></ref>
<ref id="B22">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Oheim</surname> <given-names>M.</given-names></name> <name><surname>Beaurepaire</surname> <given-names>E.</given-names></name> <name><surname>Chaigneau</surname> <given-names>E.</given-names></name> <name><surname>Mertz</surname> <given-names>J.</given-names></name> <name><surname>Charpak</surname> <given-names>S.</given-names></name></person-group> (<year>2001</year>). <article-title>Two-photon microscopy in brain tissue: parameters influencing the imaging depth</article-title>. <source>J. Neurosci. Methods</source> <volume>111</volume>, <fpage>29</fpage>&#x02013;<lpage>37</lpage>. <pub-id pub-id-type="doi">10.1016/S0165-0270(01)00438-1</pub-id><pub-id pub-id-type="pmid">11574117</pub-id></citation></ref>
<ref id="B23">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Pachitariu</surname> <given-names>M.</given-names></name> <name><surname>Stringer</surname> <given-names>C.</given-names></name> <name><surname>Dipoppa</surname> <given-names>M.</given-names></name> <name><surname>Schr&#x000F6;der</surname> <given-names>S.</given-names></name> <name><surname>Rossi</surname> <given-names>L. F.</given-names></name> <name><surname>Dalgleish</surname> <given-names>H.</given-names></name> <etal/></person-group>. (<year>2017</year>). <article-title>Suite2p: beyond 10,000 neurons with standard two-photon microscopy</article-title>. <source>BioRxiv</source>. <pub-id pub-id-type="doi">10.1101/061507</pub-id></citation>
</ref>
<ref id="B24">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Padfield</surname> <given-names>D.</given-names></name></person-group> (<year>2010</year>). <article-title>&#x0201C;Masked fft registration,&#x0201D;</article-title> in <source>2010 IEEE Computer Society Conference on Computer Vision and Pattern Recognition</source> (<publisher-loc>San Francisco, CA</publisher-loc>: <publisher-name>IEEE</publisher-name>), <fpage>2918</fpage>&#x02013;<lpage>2925</lpage>.</citation>
</ref>
<ref id="B25">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Padfield</surname> <given-names>D.</given-names></name></person-group> (<year>2011</year>). <article-title>Masked object registration in the fourier domain</article-title>. <source>IEEE Trans. Image Process</source>. <volume>21</volume>, <fpage>2706</fpage>&#x02013;<lpage>2718</lpage>. <pub-id pub-id-type="doi">10.1109/TIP.2011.2181402</pub-id><pub-id pub-id-type="pmid">22203712</pub-id></citation></ref>
<ref id="B26">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Pnevmatikakis</surname> <given-names>E. A.</given-names></name> <name><surname>Giovannucci</surname> <given-names>A.</given-names></name></person-group> (<year>2017</year>). <article-title>Normcorre: An online algorithm for piecewise rigid motion correction of calcium imaging data</article-title>. <source>J. Neurosci. Methods</source> <volume>291</volume>, <fpage>83</fpage>&#x02013;<lpage>94</lpage>. <pub-id pub-id-type="doi">10.1016/j.jneumeth.2017.07.031</pub-id><pub-id pub-id-type="pmid">28782629</pub-id></citation></ref>
<ref id="B27">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Pnevmatikakis</surname> <given-names>E. A.</given-names></name> <name><surname>Soudry</surname> <given-names>D.</given-names></name> <name><surname>Gao</surname> <given-names>Y.</given-names></name> <name><surname>Machado</surname> <given-names>T. A.</given-names></name> <name><surname>Merel</surname> <given-names>J.</given-names></name> <name><surname>Pfau</surname> <given-names>D.</given-names></name> <etal/></person-group>. (<year>2016</year>). <article-title>Simultaneous denoising, deconvolution, and demixing of calcium imaging data</article-title>. <source>Neuron</source> <volume>89</volume>, <fpage>285</fpage>&#x02013;<lpage>299</lpage>. <pub-id pub-id-type="doi">10.1016/j.neuron.2015.11.037</pub-id><pub-id pub-id-type="pmid">26774160</pub-id></citation></ref>
<ref id="B28">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Shimizu</surname> <given-names>M.</given-names></name> <name><surname>Okutomi</surname> <given-names>M.</given-names></name></person-group> (<year>2002</year>). <article-title>&#x0201C;An analysis of sub-pixel estimation error on area-based image matching,&#x0201D;</article-title> in <source>2002 14th International Conference on Digital Signal Processing Proceedings. DSP 2002 (Cat. No. 02TH8628), Vol. 2</source> (<publisher-loc>Santorini</publisher-loc>: <publisher-name>IEEE</publisher-name>), <fpage>1239</fpage>&#x02013;<lpage>1242</lpage>.</citation>
</ref>
<ref id="B29">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Shuman</surname> <given-names>T.</given-names></name> <name><surname>Aharoni</surname> <given-names>D.</given-names></name> <name><surname>Cai</surname> <given-names>D. J.</given-names></name> <name><surname>Lee</surname> <given-names>C. R.</given-names></name> <name><surname>Chavlis</surname> <given-names>S.</given-names></name> <name><surname>Page-Harley</surname> <given-names>L.</given-names></name> <etal/></person-group>. (<year>2020</year>). <article-title>Breakdown of spatial coding and interneuron synchronization in epileptic mice</article-title>. <source>Nat. Neurosci</source>. <volume>23</volume>, <fpage>229</fpage>&#x02013;<lpage>238</lpage>. <pub-id pub-id-type="doi">10.1038/s41593-019-0559-0</pub-id><pub-id pub-id-type="pmid">31907437</pub-id></citation></ref>
<ref id="B30">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Svoboda</surname> <given-names>K.</given-names></name> <name><surname>Yasuda</surname> <given-names>R.</given-names></name></person-group> (<year>2006</year>). <article-title>Principles of two-photon excitation microscopy and its applications to neuroscience</article-title>. <source>Neuron</source> <volume>50</volume>, <fpage>823</fpage>&#x02013;<lpage>839</lpage>. <pub-id pub-id-type="doi">10.1016/j.neuron.2006.05.019</pub-id><pub-id pub-id-type="pmid">16772166</pub-id></citation></ref>
<ref id="B31">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Tegtmeier</surname> <given-names>J.</given-names></name> <name><surname>Brosch</surname> <given-names>M.</given-names></name> <name><surname>Janitzky</surname> <given-names>K.</given-names></name> <name><surname>Heinze</surname> <given-names>H.-J.</given-names></name> <name><surname>Ohl</surname> <given-names>F. W.</given-names></name> <name><surname>Lippert</surname> <given-names>M. T.</given-names></name></person-group> (<year>2018</year>). <article-title>Cave: an open-source tool for combined analysis of head-mounted calcium imaging and behavior in matlab</article-title>. <source>Front. Neurosci</source>. 12, 958. <pub-id pub-id-type="doi">10.3389/fnins.2018.00958</pub-id><pub-id pub-id-type="pmid">30618581</pub-id></citation></ref>
<ref id="B32">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Wang</surname> <given-names>R.</given-names></name> <name><surname>Han</surname> <given-names>J.</given-names></name> <name><surname>Chen</surname> <given-names>J.</given-names></name> <name><surname>Li</surname> <given-names>M.</given-names></name> <name><surname>Feng</surname> <given-names>L.</given-names></name> <name><surname>Zhang</surname> <given-names>S.</given-names></name></person-group> (<year>2019</year>). <article-title>&#x0201C;Decoding with calcium signals from layer 2/3 motor cortex during a pressing movement,&#x0201D;</article-title> in <source>2019 41st Annual International Conference of the IEEE Engineering in Medicine and Biology Society (EMBC)</source> (<publisher-loc>Berlin</publisher-loc>: <publisher-name>IEEE</publisher-name>), <fpage>3054</fpage>&#x02013;<lpage>3057</lpage>.<pub-id pub-id-type="pmid">31946532</pub-id></citation></ref>
<ref id="B33">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Yaksi</surname> <given-names>E.</given-names></name> <name><surname>Friedrich</surname> <given-names>R. W.</given-names></name></person-group> (<year>2006</year>). <article-title>Reconstruction of firing rate changes across neuronal populations by temporally deconvolved ca2&#x0002B; imaging</article-title>. <source>Nat. Methods</source> <volume>3</volume>, <fpage>377</fpage>&#x02013;<lpage>383</lpage>. <pub-id pub-id-type="doi">10.1038/nmeth874</pub-id><pub-id pub-id-type="pmid">16628208</pub-id></citation></ref>
<ref id="B34">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Yu</surname> <given-names>Y.</given-names></name> <name><surname>Peng</surname> <given-names>H.</given-names></name></person-group> (<year>2011</year>). <article-title>&#x0201C;Automated high speed stitching of large 3d microscopic images,&#x0201D;</article-title> in <source>2011 IEEE International Symposium on Biomedical Imaging: From Nano to Macro</source> (<publisher-loc>Chicago, IL</publisher-loc>: <publisher-name>IEEE</publisher-name>), <fpage>238</fpage>&#x02013;<lpage>241</lpage>.</citation>
</ref>
<ref id="B35">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Zhou</surname> <given-names>P.</given-names></name> <name><surname>Resendez</surname> <given-names>S. L.</given-names></name> <name><surname>Rodriguez-Romaguera</surname> <given-names>J.</given-names></name> <name><surname>Jimenez</surname> <given-names>J. C.</given-names></name> <name><surname>Neufeld</surname> <given-names>S. Q.</given-names></name> <name><surname>Giovannucci</surname> <given-names>A.</given-names></name> <etal/></person-group>. (<year>2018</year>). <article-title>Efficient and accurate extraction of in vivo calcium signals from microendoscopic video data</article-title>. <source>Elife</source> <volume>7</volume>, <fpage>e28728</fpage>. <pub-id pub-id-type="doi">10.7554/eLife.28728</pub-id><pub-id pub-id-type="pmid">29469809</pub-id></citation></ref>
</ref-list> 
</back>
</article>
