Vessel-adaptive suppression and signal quantification method for neuro-transmitter imaging

CN122989623APending Publication Date: 2026-10-27ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611167090.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-03
Publication Date
2026-10-27

AI Technical Summary

Technical Problem

[0011]本发明的目的在于提供一种面向神经递质成像的血管自适应抑制与信号量化方法,解决神经递质sensor成像中血管漏检、sensor信号误删、硬边缘伪影、基线漂移、运动时序不稳定及掩膜时序抖动等关键技术问题

Benefits of technology

[0066]1. 血管检测灵敏度高、特异性强。通过结构暗管、deltaF/F高响应及边缘暗环三重判据融合,充分挖掘血管在基线灰度、动态响应及边缘特征上的互补信息;配合sensor信号保护与大血管完整性保护机制,在避免神经递质探针信号误删的同时显著降低血管漏检率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122989623A_ABST
    Figure CN122989623A_ABST
Patent Text Reader

Abstract

The application discloses a kind of blood vessel adaptive inhibition and signal quantification method for neurotransmitter imaging.The application includes: input source analysis and edge dark area adaptive detection, two-stage interframe motion correction is carried out on the whole image sequence obtained;Initial robust baseline estimation is carried out on the whole image sequence after correction, multi-modal blood vessel joint detection is carried out based on initial baseline image;Self-supervised deep blood vessel feature learning is carried out, mask stabilization and false detection self-checking, adaptive stimulation window detection, non-blood vessel area robust baseline estimation and drift correction, soft edge feather filling to obtain unified hard mask and unified deltaF / F response graph calculation and output.The application solves the key technical problems such as blood vessel missing detection, sensor signal false deletion, hard edge artifact, baseline drift, motion timing instability and mask timing jitter in neurotransmitter sensor imaging.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of biomedical image processing and neuroscience technology, specifically relating to a method for adaptive vascular suppression and signal quantization for neurotransmitter imaging. This invention is particularly applicable to the processing of in vivo imaging sequences of gene-encoded neurotransmitter probes (sensors) acquired by a miniscope, including dynamic observation scenarios of neurotransmitter release such as dopamine, norepinephrine, acetylcholine, and glutamate. Furthermore, the method and system of this invention also have the ability to generalize to a wider range of fluorescence microscopy imaging scenarios, such as in vivo calcium imaging and voltage imaging. This invention achieves high-fidelity suppression of vascular artifacts and high-precision quantification of neurotransmitter signals by accurately distinguishing between tubular dark structures of brain blood vessels and circular or elliptical bright spots representing neurotransmitter sensor expression regions. Background Technology

[0002] Miniscopes have become one of the core tools in neuroscience in recent years, enabling high-time-resolution imaging of neuronal activity in deep brain regions while worn on the head of freely moving animals. With the rapid development of gene-encoded fluorescent probe technology, in addition to traditional calcium ion probes (such as the GCaMP series), gene-encoded sensors targeting specific neurotransmitters (such as dopamine, norepinephrine, acetylcholine, glutamate, etc.) (such as the dLight and GRAB series) have been widely used for in vivo dynamic observation of neurotransmitter release. The expression patterns of these neurotransmitter probes differ significantly from those of calcium probes: sensors are typically expressed around the target neuron or in the extracellular space, appearing as scattered circular or elliptical bright spots in baseline images, with a grayscale slightly brighter than or close to the background; however, under electrical stimulation or behavioral induction, neurotransmitter release leads to a significant increase in probe fluorescence intensity, forming localized, clumped high-response areas.

[0003] However, the neurotransmitter probe imaging sequences acquired by Miniscope face the following key technical bottlenecks:

[0004] First, vascular artifacts severely interfere with neurotransmitter signal extraction. The rich vascular network in brain tissue appears as a tubular dark structure in fluorescence images, exhibiting rhythmic brightness fluctuations associated with heartbeat and respiration. In neurotransmitter probe imaging, blood vessels and sensor signals exhibit complex distinguishability in terms of grayscale, morphology, and dynamic response: blood vessels appear as tubular dark structures with a dark baseline and rhythmic fluctuations associated with heartbeat and respiration; sensors appear as round or elliptical bright spots with a slightly bright or near-background baseline and produce localized, clustered high responses during the stimulation-evoked phase. Traditional methods typically rely on simple thresholds or fixed templates to exclude vascular regions, making it difficult to simultaneously address both missed vascular detection and incorrect sensor signal deletion: conservative thresholds lead to residual vascular contamination in the digital image (DFF), while aggressive thresholds easily misclassify high-response sensors as blood vessels and incorrectly suppress them.

[0005] Second, the robustness of blood vessel detection under low contrast conditions is insufficient. Miniscopes are limited by optical throughput and illumination power, resulting in typically low signal-to-noise ratios in fluorescence images and weak grayscale differences between blood vessels and surrounding tissues. Methods based on global thresholds or single filter responses struggle to balance fine blood vessel detection with noise suppression, often leading to issues such as blood vessel breakage, fragmentation, or over-expansion, which in turn disrupt the spatial integrity of the sensor signal.

[0006] Third, hard edge suppression introduces significant artifacts. Existing methods typically employ hard truncation at the mask boundary (directly replacing the mask with a fixed value), resulting in grayscale jumps on both sides of the boundary. This produces false edge response artifacts in deltaF / F calculations, severely interfering with the weak dff signal generated by neurotransmitter release.

[0007] Fourth, baseline estimation is contaminated by stimulus response and vascular fluctuations. Neurotransmitter release is usually induced by electrical stimulation or specific behaviors. If strong responses during stimulation are included in baseline statistics, it will lead to a systematic underestimation of deltaF / F. At the same time, rhythmic brightness fluctuations in vascular regions will be mixed into the baseline, causing systematic bias in deltaF / F in non-vascular regions. Traditional baseline estimation often uses the arithmetic mean or simple median, which is sensitive to outliers and lacks spatial drift correction.

[0008] Fifth, the temporal stability of motion is poor. Free animal movement inevitably introduces inter-frame displacement. Existing single-stage registration methods are not accurate enough in low-contrast fluorescence scenes, and the linear filtering in the registration process weakens the weak sensor signal. In addition, there is a lack of a reference frame quality assessment mechanism, which makes registration drift prone to occur in long-term recording.

[0009] Sixth, mask timing jitter disrupts signal continuity. Updating the mask independently frame by frame causes the vascular suppression region to change continuously in time. This results in pixels at the same spatial location being suppressed in some frames and not suppressed in others, generating false timing jump signals and causing fatal interference to neurotransmitter release timing analysis.

[0010] To address the aforementioned issues, this invention proposes a comprehensive technical solution that integrates multimodal vascular joint detection, self-supervised deep feature learning, two-stage motion correction, mask stabilization and misjudgment self-checking, soft edge feathering and filling, and Huber robust baseline estimation. Based on accurately distinguishing tubular dark blood vessels from circular or elliptical bright spot sensor signals, it achieves high-fidelity vascular suppression and high-precision quantification of neurotransmitter signals. Summary of the Invention

[0011] The purpose of this invention is to provide a method for adaptive vascular suppression and signal quantization for neurotransmitter imaging, which solves key technical problems in neurotransmitter sensor imaging such as missed vascular detection, accidental deletion of sensor signals, hard edge artifacts, baseline drift, unstable motion timing, and mask timing jitter.

[0012] A blood vessel adaptive inhibition and signal quantization method for neurotransmitter imaging includes the following steps:

[0013] Step 1: Parse the input source and adaptively detect dark areas at the edges to obtain the entire image sequence.

[0014] Step 2: Perform two-stage inter-frame motion correction on the entire image sequence.

[0015] Step 3: Perform initial robust baseline estimation on the entire corrected image sequence to obtain the initial baseline image set.

[0016] Step 4: Construct a multimodal vascular mask and perform joint multimodal vascular detection based on the initial baseline image.

[0017] Step 5: Self-supervised deep vascular feature learning, which integrates multi-scale Frangi vascular enhancement response maps, Hessian vascularity, and local contrast according to set weights, and then performs block-adaptive threshold segmentation, breakpoint connection, and fine morphological repair.

[0018] Step 6: Mask stabilization and misjudgment self-check, pre-run stabilization period, calculation of consensus vascular mask, verification of recent mask consistency and elimination of misjudged sensor signals.

[0019] Step 7: Adaptive stimulation window detection, based on dual threshold stimulation window detection using the signal change rate and sliding variance in non-vascular areas.

[0020] Step 8: Robust baseline estimation and drift correction in non-vascular areas, performing three levels of baseline drift correction: large-scale, medium-scale, and marginal halo.

[0021] Step 9: Soft edge feathering and filling are used to obtain a uniform hard mask, based on adaptive feathering and calculation of local adaptive filling values ​​using distance transformation.

[0022] Step 10: Calculate and output the unified deltaF / F response map, perform baseline re-estimation after unified suppression of the entire frame, statistically analyze the global colorbar range, and output the streaming heatmap video.

[0023] Furthermore, step 1 is implemented as follows:

[0024] The system parses single .raw files, multi-frame single .tif files, or multiple .tif folders from the input source to obtain the image width, height, and total number of frames N, thus obtaining the entire image sequence. Streaming edge dark area detection is then performed on the entire image sequence to generate an edge mask.

[0025] Furthermore, step 2 is implemented as follows:

[0026] The first stage uses a multi-scale phase correlation algorithm for coarse alignment of integer pixels;

[0027] The second stage uses the ECC enhanced correlation coefficient algorithm for sub-pixel refinement;

[0028] During motion correction, an adaptive reference frame update mechanism based on mutual information is introduced. Each time the update interval is reached, the mutual information score between the current frame and the reference frame is calculated. When the score exceeds a specified multiple of the historical best score or the number of running frames reaches three times the update interval, the reference frame is automatically replaced. Finally, median filtering is applied to the sequence for smoothing.

[0029] In the implementation of the multi-scale phase correlation algorithm, contrast normalization is first performed on the reference frame and the current frame, then global linear stretching is performed, and finally a multi-scale pyramid is constructed, where the degree factor is... ,in (In formula form); After weighting each layer of the multi-scale pyramid through the Hanning window, the cross-power spectrum of FFT is calculated, the phase correlation peak is obtained by inverse FFT, and sub-pixel refinement is achieved by quadratic interpolation;

[0030] The subpixel refinement involves cropping a boundary region of a specified size, calculating the cross-correlation coefficient between the reference frame and the current alignment frame, and introducing a gradient weighting strategy to suppress the interference of low-gradient noise regions on registration.

[0031] The specified margin size is:

[0032] The weights in the gradient-weighted strategy are set as follows:

[0033] Furthermore, step 4 is implemented as follows:

[0034] 4-1. Detection of structural dark tubes: Illumination normalization is performed on the initial baseline image, and multi-scale Frangi vessel enhancement response maps are calculated, with the scale set covering pixels [1,2,3,4,5,6]. After excluding edge masks, an adaptive threshold th_dark is set based on the background median and MAD statistics. Tubular topological constraints are applied to regions above the adaptive threshold, requiring that the extension rate of the connected components is greater than the set extension rate threshold, or the area of ​​the connected components is greater than the area threshold. ;

[0035] in, Indicates the background median. MAD represents absolute deviation;

[0036] 4-2. deltaF / F high-response tubular detection: Select the min(30, N) frames with the strongest response from the entire image sequence, calculate the average absolute deltaF / F response map, and perform Frangi multi-scale enhancement on the response map again, with the scale set being [1,2,3,4,5]. Use the same MAD statistical setting to set an adaptive threshold to extract high-response tubular regions.

[0037] 4-3. Detection of Dark Rings Alongside the Edge: In the structural dark tube region and high-response tubular region of the detected blood vessel, dark rings accompanying the edge of the blood vessel are detected based on gradient amplitude and local darkness.

[0038] 4-4. Triple criterion fusion: The structural dark tube region, the high-response tubular region, and the edge dark ring region are logically ORed and fused. Connectivity verification is applied to the generated fusion mask, requiring that each connected region satisfies at least one of the characteristics of the structural dark tube region or the high-response tubular region.

[0039] 4-5. Large vessel integrity protection: Detect single large vessel regions in the fusion mask that may be misidentified as two thin vessels. Check the baseline grayscale continuity in the structural dark tube region and the high-response tubular region. If the average darkness of the middle region between two separated vessel segments is greater than the set darkness threshold, then merge the entire connected region into a single large vessel region to obtain the updated fusion mask.

[0040] 4-6. Perform edge smoothing and area control on the updated fusion mask;

[0041] Furthermore, step 5 is implemented as follows:

[0042] 5-1. Constructing a fused enhancement map: Fusing the multi-scale Frangi vascular enhancement response map, Hessian vascularity, and local contrast according to set weights;

[0043] 5-2. Block Adaptive Threshold Segmentation: Divide the fused enhancement map into multiple pixel blocks, and set a threshold based on MAD statistics within each pixel block;

[0044] 5-3. Continuity Restoration: Filling tiny gaps in the fusion enhancement map using closing operations;

[0045] 5-4. Response Verification and Morphological Constraints: Apply tubular topological constraints based on the fused enhancement map; simultaneously exclude circular or elliptical bright spot regions;

[0046] 5-4. Fine-grained repair: Based on vascular morphology, dilation search is performed on each connected region, and neighboring pixels with enhancement values ​​higher than the enhancement threshold or lower than the background threshold are recovered to the vascular mask;

[0047] Furthermore, step 6 is implemented as follows:

[0048] 6-1. Pre-run stabilization period: Set the number of frames for the stabilization period to min(N, max(300, round(N)). 0.20))), during the stable period, the vascular mask is renewed at fixed intervals;

[0049] 6-2. Calculate consensus vascular mask: Only 50% of historical vascular masks after the stabilization period are used for voting. The voting threshold is set to 50% of the number of vascular masks after the stabilization period. If the consensus area exceeds the median area threshold, the voting threshold is gradually increased to 95% of the number of vascular masks after the stabilization period to suppress excessive expansion.

[0050] 6-3. Nearest Mask Consistency Check: Calculate the Intersection over Union (IoU) between the nearest vessel mask and the consensus vessel mask. If the IoU is greater than the set upper threshold of the IoU and the area is within the allowable range, then the nearest vessel mask is used; if the IoU is less than or equal to the set upper threshold of the IoU and greater than the lower threshold of the IoU, then the intersection of the consensus vessel mask and the expanded nearest vessel mask is used for refinement.

[0051] 6-4. Eliminating misjudged sensor signals: Based on the deltaF / F response map, a quadruple criterion check is performed on each connected region in the consensus vascular mask: non-tubular shape, region area within a set pixel range, baseline not dark, and significantly higher than background response; for regions that simultaneously meet the quadruple criteria, it is checked whether they remain at a set distance threshold from the remaining consensus vascular mask.

[0052] Furthermore, step 4 also includes a sensor signal protection mechanism. Based on baseline brightness and morphology dual verification, effective sensor signal regions are pre-identified. On the normalized baseline map, regions with gray values ​​higher than a specified gray value threshold are marked as non-dark connected regions. For each non-dark connected region, its second-order moment eigenvalue is calculated to obtain the elongation rate, and the ratio of the region's average brightness to the brightness of the surrounding multi-pixel ring-shaped background is statistically analyzed. Only when the connected region simultaneously satisfies the elongation rate, brightness ratio, and absolute brightness threshold is it determined to be an effective neurotransmitter sensor signal and protected.

[0053] Grayscale specified threshold , where global_median is the global median of the normalized baseline image, and global_mad is the absolute deviation of the gray values ​​of the normalized baseline image relative to the global median.

[0054] Furthermore, the present invention also provides a vascular adaptive inhibition and signal quantization system for neurotransmitter imaging, the system comprising:

[0055] Input parsing module: used to parse .raw single files, .tif multi-frame single files or multiple .tif folders in the input source, obtain the image width, height and total number of frames N, and obtain the entire image sequence; perform streaming edge dark area detection on the entire image sequence and generate edge masks.

[0056] The two-stage motion correction module is used to perform multi-scale phase-correlation coarse alignment and ECC sub-pixel refinement, and supports mutual information-driven adaptive reference frame update. In addition, an adaptive reference frame update mechanism based on mutual information is introduced during the motion correction process. Finally, median filtering is applied to the sequence for smoothing.

[0057] Robust baseline estimation module: Select the first min(60, N) frames as the initial baseline frame set, use a streaming block strategy to divide each image into multiple blocks along the row direction, calculate the Huber robust mean for the pixels of each block in the temporal dimension, and obtain the initial baseline image set.

[0058] The multimodal vessel detection module performs structural dark tube detection, deltaF / F high-response tubular detection, edge dark ring detection, and triple criterion fusion. It also includes a built-in sensor signal protection submodule to distinguish tubular dark vessels from circular or elliptical bright spot sensor signals. Within this module, it detects single large vessel regions in the fusion mask that might be misidentified as two thin vessels. It checks baseline grayscale continuity in structural dark tube regions and high-response tubular regions. If the average darkness of the intermediate region between two separated vessel segments exceeds a set darkness threshold, the entire connected region is merged into a single large vessel region, resulting in an updated fusion mask.

[0059] The self-supervised deep feature learning module fuses multi-scale Frangi vessel enhancement response maps, Hessian vessel density, and local contrast according to set weights, followed by block-based adaptive threshold segmentation, breakpoint connection, and fine-grained morphological restoration. This module first performs preliminary detection of the vessel mask to extract the skeleton and locate endpoints. If the number of endpoints exceeds a set endpoint threshold P, only the top P high-enhancement endpoints are retained, sorted by their enhancement values. Subsequently, for endpoint pairs with a distance less than a specified pixel threshold, equidistant sampling is performed along a straight path, and the enhancement map is queried. If the average enhancement value along the path is greater than a set average threshold or the median enhancement value is greater than a set median threshold, all pixels along the path are added to the vessel mask, achieving bridging and restoration of broken vessels under low-contrast conditions.

[0060] Mask stabilization and misjudgment self-check module: used for pre-running the stabilization period, calculating consensus vascular masks, verifying the consistency of the most recent masks, and eliminating misjudged sensor signals.

[0061] Adaptive stimulus detection module: Dual threshold stimulus window detection based on the rate of change of signal in non-vascular areas and the sliding variance.

[0062] Spatial drift correction module: used to perform three levels of baseline drift correction: large-scale, medium-scale, and edge vignetting.

[0063] Soft edge feathering and fill module: used for calculating adaptive feathering and local adaptive fill values ​​based on distance transformation.

[0064] Unified deltaF / F calculation module: used for baseline re-estimation after full-frame unified suppression, global colorbar range statistics, and streaming heatmap video output.

[0065] Beneficial effects of the present invention

[0066] 1. High sensitivity and specificity in vascular detection. By fusing three criteria—structural dark tube, deltaF / F high response, and edge dark ring—the complementary information of blood vessels in baseline grayscale, dynamic response, and edge features is fully explored. Combined with sensor signal protection and large vessel integrity protection mechanisms, the false negative rate of blood vessels is significantly reduced while avoiding the accidental deletion of neurotransmitter probe signals.

[0067] 2. Accurately distinguish between blood vessel and sensor signals. Addressing the fundamental difference in neurotransmitter fluorescence probe imaging—blood vessels appearing as tubular dark structures while sensors appear as circular or elliptical bright spots with a baseline slightly brighter than the background—a dual baseline brightness-morphology check, a four-criteria misjudgment self-check, and a sensor exclusion constraint in self-supervised learning are designed to fundamentally prevent erroneous suppression of sensor signals.

[0068] 3. Extraction of vascular integrity in low-contrast scenes. A self-supervised deep feature learning mechanism integrates Hessian, Frangi, and local contrast features. Through breakpoint connection and fine morphological restoration, it can maintain the topological continuity of the vascular network even under conditions of minimal gray-level difference.

[0069] 4. The mask timing is highly stable. The pre-run stabilization period and the consensus voting mechanism in the later stage ensure the time consistency of the final mask; the misjudgment self-checking mechanism further eliminates misjudgments from isolated sensors and avoids the inclusion of non-vascular regions in the stable mask.

[0070] 5. Hard edge artifacts are completely eliminated. Soft edge feathering filling is based on Gaussian attenuation of distance transformation and adaptively determines the feathering radius according to the vessel width, achieving a natural and smooth transition between the vessel inhibition region and the background. This fundamentally eliminates deltaF / F boundary artifacts caused by traditional hard truncation and ensures that the weak dff signal generated by neurotransmitter release is not overwhelmed by false edge responses.

[0071] 6. Robust baseline estimation with controllable drift. Huber robust mean preserves information from normal samples while suppressing outlier stimulus responses; three levels of spatial drift correction address global trends, regional gradients, and edge haloing, ensuring baseline stability over long-term recordings.

[0072] 7. High motion registration accuracy, long-term stability, and no weakening of sensor signal. The two-stage registration combines integer pixel coarse alignment with sub-pixel refinement, and ECC iterative optimization has strong robustness to low-contrast fluorescence scenes under gradient weighting; the registration process avoids additional linear filtering and fully preserves weak sensor response; the mutual information-driven reference frame update mechanism avoids long-term drift.

[0073] 8. Adaptive stimulus response detection. The dual-threshold strategy takes into account both strong and weak stimuli, and the minimum interval constraint avoids erroneous merging, ensuring that the baseline estimate strictly excludes the neurotransmitter release period and improving the accuracy of deltaF / F quantification.

[0074] 9. Strong generalization ability. Although the method of this invention is designed for the feature differences between blood vessels and sensors in neurotransmitter fluorescent probe imaging, its core technology modules such as multimodal blood vessel detection, self-supervised feature learning, two-stage motion correction, soft edge feathering and filling, and Huber robust baseline estimation are also applicable to other fluorescence microscopy imaging scenarios such as calcium imaging and voltage imaging, and have the ability to be transferred to a wider range of biomedical imaging applications.

[0075] 10. The computation process is efficient and scalable. Streaming chunking, optimized batch writing, adaptive frame rate video encoding, and dynamic subsampling strategies enable the system to handle long-term recordings of thousands to tens of thousands of frames, and can run on ordinary workstations. Attached Figure Description

[0076] Figure 1 : Screenshot of the system's interactive main interface.

[0077] Figure 2 System overall architecture and processing flowchart.

[0078] Figure 3 Schematic diagram of the principle of multimodal vascular joint detection.

[0079] Figure 4 Flowchart of self-supervised deep vascular feature learning.

[0080] Figure 5 Schematic diagram of the two-stage exercise correction principle.

[0081] Figure 6 Schematic diagram of mask stabilization and misjudgment self-checking mechanism.

[0082] Figure 7 Comparison chart of actual processing results. Detailed Implementation

[0083] The present invention will now be described in detail with reference to the accompanying drawings and embodiments. The following embodiments are only for illustrating the technical solutions of the present invention and are not intended to limit the scope of protection of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0084] This invention specifically addresses the characteristic differences in neurotransmitter fluorescent probe imaging, where blood vessels appear as tubular dark structures and sensors as circular or elliptical bright spots with a baseline slightly brighter than the background. It designs a multi-discrimination mechanism to accurately suppress blood vessels while effectively protecting the sensor signal. For example... Figure 2 As shown, the overall system architecture of this invention demonstrates the complete processing flow from the input parsing module, the two-stage motion correction module, the robust baseline estimation module, the multimodal blood vessel detection module, the self-supervised deep feature learning module, the mask stabilization and misjudgment self-checking module, the adaptive stimulus detection module, the spatial drift correction module, the soft edge feathering and filling module, and the unified deltaF / F calculation module, as well as the data dependencies and control logic between each module.

[0085] This invention is achieved through the following technical solution:

[0086] I. Input Source Analysis and Adaptive Detection of Dark Edge Areas

[0087] This invention supports three input formats: .raw single file, .tif multi-frame single file, and multiple .tif folders. The system first parses the image dimensions (width W, height H) and total number of frames N of the input source to obtain the entire image sequence; and extracts the root path for subsequent output directory organization. Before formal processing, adaptive edge dark area detection is performed: based on the grayscale distribution statistics of the image mean map, abnormal dark bands at the edges caused by optical vignetting or uneven illumination are identified, generating a binary edge mask (edge_mask). This edge mask is used throughout the entire subsequent processing flow to eliminate interference from unreliable regions on baseline estimation, vessel detection, and deltaF / F calculation, preventing edge dark bands from being misidentified as vessels or sensor signal areas.

[0088] II. Two-stage inter-frame motion correction

[0089] To address the inter-frame displacement problem in imaging of freely moving animals, this invention proposes a two-stage motion correction strategy that balances computational efficiency and registration accuracy. Furthermore, it avoids additional linear low-pass filtering during registration to fully preserve the weak fluorescence response generated by neurotransmitter probes. Figure 5 As shown, the two-stage motion correction of the present invention includes: a first stage using a multi-scale phase correlation algorithm for coarse alignment of integer pixels; a second stage using an ECC-enhanced correlation coefficient algorithm for sub-pixel refinement; and an adaptive reference frame update mechanism driven by mutual information.

[0090] The first stage involves performing contrast normalization on both the reference frame and the current frame (based on linear stretching at the 1st and 99th percentiles) to eliminate insufficient dynamic range in low-contrast scenes. Subsequently, a multi-scale pyramid is constructed from coarse to fine, with a scale factor of [missing value]. The nlevels are adaptively determined by the short side size of the image. After suppressing spectral leakage by weighting with a Hanning window at each layer, the cross-power spectrum of the FFT is calculated, and the phase correlation peak is obtained by inverse FFT. The displacement estimated by the coarse layer is used as the initial offset of the fine layer, and the displacements are accumulated layer by layer to obtain integer pixel displacements. At the same time, sub-pixel refinement of the peak position is performed by quadratic interpolation to further improve the accuracy of the coarse stage. No additional smoothing or filtering operations are introduced in this stage to avoid weakening the weak sensor fluorescence signal.

[0091] The second stage involves cropping the boundary margin region to avoid boundary effects and performing ECC optimization on the remaining common effective region. ECC is based on the Lucas-Kanade optical flow concept and uses a Gaussian-Newton iterative optimization of the cross-correlation coefficient: the mean-free images of the current aligned frame and the reference frame are calculated, with the sum of pointwise products as the numerator and the square root of the product of their respective energies as the denominator, to obtain the normalized cross-correlation coefficient score. The Jacobian matrix is ​​composed of the spatial gradient of the current frame, and the residual is the gray-level difference between the reference frame and the current frame. To suppress noise interference in low-contrast fluorescence images, a gradient weighting strategy is introduced: weights... This allows the high-gradient structural region to dominate the optimization, while the contribution of the low-gradient noise region is weakened. For the normal equation matrix... Apply Regularization avoids ill-conditioned scenarios and limits the single-step increment to within 0.5 pixels; if the cumulative translation exceeds 2 pixels, the step size is reduced by 50% to prevent iteration divergence. The convergence criterion is that the change in score between two consecutive iterations is less than 0.5 pixels. The maximum number of iterations is 15.

[0092] Adaptive Reference Frame Update: Traditional methods use fixed reference frames, which are prone to registration quality degradation due to illumination drift or tissue deformation during long-term recording. This invention calculates the mutual information (MI) between the current frame and the reference frame every update_interval frame. When the MI score exceeds 1.15 times the historical best score (indicating a significant difference between the current frame and the original reference frame) or reaches three times the update interval, the current frame is automatically replaced with a new reference frame. This mechanism ensures that the registration model always adapts to the latest image statistical characteristics.

[0093] Post-displacement processing: A median filter with a window size of 7 is applied to the cumulative displacement sequence of all frames to eliminate occasional abnormal jumps and ensure the temporal smoothness of the displacement curve.

[0094] III. Multimodal vascular combined detection

[0095] In neurotransmitter fluorescent probe imaging, blood vessel and sensor signals are essentially distinguishable: blood vessels appear as tubular dark structures, forming dark tubular shapes in the baseline image, and exhibit rhythmic brightness fluctuations associated with heartbeat and respiration; sensor signals appear as circular or elliptical bright spots, with a baseline slightly brighter than or close to the background, and produce localized, patchy high responses during stimulation. For example... Figure 3As shown, based on the aforementioned feature differences, this invention proposes a multimodal vascular joint detection architecture with triple criterion fusion, including three parallel channels: structural dark tube detection, deltaF / F high-response tubular detection, and edge dark ring-associated detection. Simultaneously, it introduces a sensor signal protection mechanism and a large vessel integrity protection mechanism, balancing detection sensitivity and specificity. The sensor signal protection is specifically designed to address the characteristic of sensors appearing as circular or elliptical bright spots with a baseline slightly brighter than the background in neurotransmitter fluorescent probe imaging.

[0096] 3.1 Illumination Normalization and Preprocessing. Due to the uneven illumination problem in Miniscope, directly applying a threshold to the original image will introduce systematic bias. This invention first performs Gaussian background estimation on the baseline image F0 (…). Low-frequency illumination gradients are eliminated by division normalization, and the results are normalized to the [0,1] interval to provide a consistent contrast benchmark for subsequent detection.

[0097] 3.2 Detection of Dark Tube Structures. Blood vessels appear as tubular dark structures in the baseline image. This invention employs a multi-scale Frangi vessel enhancement filter, with a scale set covering pixels [1,2,3,4,5,6], accommodating various vessel diameters from thin to thick. The Frangi filter, based on eigenvalue analysis of the Hessian matrix, exhibits high selectivity for tubular structures. After excluding edge masks and sensor-protected regions, background statistics are performed on the enhanced response map: the background median bg_median and the absolute deviation of the median bg_mad are calculated, and an adaptive threshold is set to... This threshold strategy exhibits stronger scene adaptability compared to a fixed threshold, maintaining a stable detection rate under varying signal-to-noise ratios. A tubular topological constraint is applied to regions exceeding the threshold, requiring a certain extension rate of the connected components. Either the area is greater than 40 pixels, or the skeleton complexity is greater than 0.08 and the area is greater than 15 pixels, thus effectively excluding circular or elliptical sensor signal areas.

[0098] 3.3 High-Response Tubular Detection in DeltaF / F Mode. Blood vessels exhibit rhythmic brightness fluctuations accompanying heartbeat and respiration, displaying significant high-response tubular features in the deltaF / F response frames. In contrast, the high response of sensor signals during stimulation appears as localized clumps, with a spatial morphology fundamentally different from the tubular high response of blood vessels. This invention selects the min(30, N) frames with the strongest response from the entire sequence, calculates the average absolute deltaF / F map, and then performs Frangi multi-scale enhancement on this response map (scale [1,2,3,4,5] pixels). The high-response tubular region is extracted using the same MAD adaptive thresholding strategy as for structural dark tubes. When the total number of frames N > 800, a strategy of uniform subsampling to 600 frames is adopted to reduce computational load. This modality effectively captures vascular segments with small baseline grayscale differences but significant dynamic responses, complementing the structural dark tube modality.

[0099] 3.4 Detection of Dark Rings at the Edge. Dark rings often accompany the edges of blood vessels due to optical scattering or tissue absorption. This invention detects accompanying dark rings within the expanded annular region (expansion radius 6 pixels) of the detected blood vessel mask based on gradient amplitude and local darkness. The fusion result is only added when the dark ring is spatially adjacent to the main mask, thus avoiding the introduction of irrelevant background noise.

[0100] 3.5 Triple criterion fusion and connected component verification. The structural dark tube region, high-response tubular region, and edge dark ring region are logically ORed and fused. Connected component verification is applied to the generated fusion mask, requiring each connected component to satisfy at least one of the characteristics of the structural dark tube region or the high-response tubular region, ensuring that all selected regions have the core discriminative features of blood vessels.

[0101] 3.6 Protection of Large Blood Vessel Integrity. Large blood vessels are easily misidentified as two or more separate thin blood vessels due to uneven internal grayscale (such as local brightness changes caused by differences in blood flow velocity). This invention generates a ring-shaped search region by performing an expansion operation (radius 3 pixels) on the fusion mask, and identifies vessels separated from the original mask but with a lower baseline darkness (…) within the ring-shaped region. (Continuous pixels). Specifically, for each connected region after dilation, if the original mask accounts for 20% to 80% of the area, and the average darkness of the intermediate region between separated segments is greater than 0.12, then these separated segments are determined to belong to the same large blood vessel, and the entire connected region is merged and repaired. This mechanism effectively avoids misjudgment of large blood vessel splits.

[0102] 3.7 Sensor Signal Protection. Neurotransmitter fluorescent probe sensor signals often appear as round or elliptical spots slightly brighter than or close to the background in baseline images. These spots have a non-tubular morphology and exhibit a significantly high response during stimulation, making them easily misinterpreted as blood vessels and suppressed. This invention pre-identifies and protects effective sensor signal regions: on the normalized baseline image, regions with gray values ​​higher than […] are […]. The regions are marked as non-dark regions. For each non-dark connected region (area 8~800 pixels), its second-order moment eigenvalue is calculated to obtain the elongation, and the ratio of the region's average brightness to the brightness of the surrounding 5-pixel annular background is calculated. Only when the connected region simultaneously satisfies the following conditions is the elongation less than 2.2, the brightness ratio greater than 0.75, and the absolute brightness greater than or equal to the dark_threshold, it is determined to be a sensor signal and protected to prevent it from being incorrectly suppressed in subsequent blood vessel detection.

[0103] IV. Self-supervised deep vascular feature learning

[0104] In low-contrast or complex backgrounds, traditional vessel detection methods based on single features (such as the Frangi response) may face problems such as vessel rupture or missed detection. Figure 4 As shown, this invention proposes a self-supervised deep vascular feature learning mechanism that integrates six stages without relying on manual annotation: enhancement map construction, block-based adaptive threshold segmentation, continuity repair (closing operation and breakpoint connection), response verification, relaxed tubular topology constraints, and fine repair based on vascular morphology. In the response verification stage, sensor signal exclusion constraints are integrated to prevent circular or elliptical bright spot sensor regions from being misidentified as blood vessels.

[0105] 4.1 Constructing the Fusion Enhancement Map. Three complementary vascular features are fused according to their weights: Frangi multiscale enhancement (weight 0.5) exhibits high selectivity for tubular structures; Hessian vascularity (weight 0.3), based on second-derivative eigenvalue analysis, is sensitive to fine vessels; and local contrast (weight 0.2), through morphological dilation of the background difference, enhances dark vessels with minimal grayscale differences. Hessian vascularity and local contrast can be directly obtained and are not the focus of this calculation. The fused enhancement map combines structural selectivity and contrast sensitivity.

[0106] 4.2 Block-based Adaptive Threshold Segmentation. Global thresholds are difficult to adapt to lighting differences in different regions of an image. This invention divides the image into blocks of approximately 200×200 pixels, performs background statistics (median and MAD) independently within each block, and sets a lenient threshold. This strategy prioritizes thorough inspection over omission, ensuring sufficient candidate pixels are available for subsequent continuous repair.

[0107] 4.3 Continuity Restoration Based on Skeleton Endpoint Analysis. Vascular networks often exhibit breaks after initial detection. This invention extracts the skeleton from the detection mask and locates endpoints. If the number of endpoints exceeds 80, only the top 80 high-enhancement endpoints are retained, sorted by their enhancement values, to avoid computational overload caused by noisy endpoints. For endpoint pairs less than 30 pixels apart, equidistant sampling is performed along a straight path, and the enhancement map is queried. If the average enhancement value along the path is greater than 0.15 or the median enhancement value is greater than 0.10, all pixels along the path are added to the mask, achieving bridging and restoration of broken blood vessels.

[0108] 4.4 Response Verification and Morphological Constraints. After fusing the structural detection and response verification results, a loose tubular topological constraint is applied: the connected component elongation must be > 1.6 and the area > 50 pixels, or the skeleton complexity must be > 0.10 and the area > 100 pixels, or the average enhancement value must be > 0.4 and the area > 30 pixels. Simultaneously, circular or elliptical bright spot regions are excluded: if the connected component elongation is < 2.2 and the average brightness of the region is greater than 0.75 times the brightness of the surrounding background, it is identified as a sensor signal region and excluded to prevent neurotransmitter probe signals from being misidentified as blood vessels. This constraint excludes significant non-vascular noise while preserving real vascular segments under low contrast.

[0109] 4.5 Fine-grained restoration based on vascular morphology. For each connected region that passes the constraints, a search for surrounding candidate pixels is performed by dilating it with a radius of 4 pixels. Neighboring pixels with enhancement values ​​higher than 0.08 or darker than the background by more than 0.92 times are recycled to the vascular mask to restore the vascular edges lost due to overly strict thresholding. Finally, the continuity of the main vascular trunk is ensured by a large-scale closing operation (radius of 4 pixels).

[0110] V. Mask Stabilization and Misjudgment Self-Check

[0111] Updating the mask independently frame by frame can lead to temporal jitter, and changes in the suppression state of the same spatial location across different frames can generate spurious neural signals. For example... Figure 6 As shown, the present invention designs a mask stabilization and misjudgment self-checking mechanism to ensure that the mask finally applied to the whole sequence has high temporal consistency and spatial accuracy, while further eliminating isolated sensor signal regions that are misjudged as blood vessels.

[0112] 5.1 Pre-run stabilization period. Before the final output, a stabilization period is run to obtain a high-quality mask. The number of frames in the stabilization period is set to... Ensure coverage of at least 300 frames or 20% of the total frames. During the stabilization period, at intervals... Update the mask.

[0113] 5.2 Consensus Stabilization Mask Calculation. After the stabilization period, consensus is calculated using only the last 50% of historical masks, discarding the first 50% of potentially unstable early masks. The median area of ​​the later masks is used as the area constraint benchmark, with a maximum allowed area of ​​1.15 times the median area or median area + 200 pixels, and a minimum allowed area of ​​max(median area * 0.85, 30). Consensus is generated through voting on the later masks: the initial voting threshold is 50% of the later masks; if the consensus area exceeds the maximum allowed area, the voting threshold is gradually increased to 95% to suppress excessive expansion. This strategy ensures that the stable mask has both temporal consistency and avoids area runaway.

[0114] 5.3 Nearest Mask Consistency Check. Calculate the Intersection over Union (IoU) between the most recent mask and the consensus vessel mask: if IoU > 0.80 and the area is within acceptable limits, the nearest mask is preferred (usually the highest quality); if IoU is less than 0.60 and less than or equal to 0.80, refine using the intersection of the consensus vessel mask and the expanded nearest mask; if IoU is less than or equal to 0.60, degenerate to a pure consensus vessel mask. This check strikes a balance between consistency and timeliness.

[0115] 5.4 Removal of Misidentified Sensor Signals. Even after multimodal detection and self-supervised learning, a small number of sensor signals may still be misidentified as blood vessels. This invention performs a four-fold criterion screening based on high-response frames: select the min(30, N) frame with the strongest global response, and accumulate the average absolute deltaF / F response map within the mask area; for each connected region of 8~500 pixels in the mask, check (1) the elongation is less than 2.0 (non-tubular, consistent with the bright spot morphology of a sensor), (2) the gray level of the region is greater than or equal to 75% of the background and greater than or equal to the global median (the baseline is not dark, consistent with the baseline characteristics of a sensor), (3) the response within the mask on the high-response frame is greater than 2.5 times that of the background MAD (significantly high response, consistent with the sensor stimulation response characteristics). The above four criteria are specifically designed for the characteristics of neurotransmitter fluorescent probe sensor signals, which are slightly bright circular or elliptical bright spots during the baseline period and produce significant high responses during the stimulation period, thus forming an essential distinction from the tubular dark structure of blood vessels and the rhythmic fluctuations accompanied by heartbeat and respiration. For candidate regions that simultaneously meet the above conditions, morphological dilation is used to check whether they maintain a distance of more than 4 pixels from the remaining mask. Only isolated misjudged regions that are not spatially connected to real blood vessels are deleted, thereby avoiding the accidental deletion of blood vessel bifurcations or small branches.

[0116] VI. Adaptive Stimulus Window Detection

[0117] Neurotransmitter release is typically induced by electrical stimulation or specific behaviors. Baseline estimation must strictly exclude the stimulus response period; otherwise, strong neural activity will be incorrectly included in the baseline statistics, leading to a systematic underestimation of deltaF / F. This invention proposes a dual-threshold adaptive stimulation window detection method based on the rate of change of signal in non-vascular regions and the sliding variance.

[0118] Median signal temporal data was extracted frame-by-frame from non-vascular and non-edge regions. A robust detrending process was performed using median filtering (window min(21,N)) to preserve abrupt changes while eliminating slow drift. The signal change rate (absolute value of the first-order difference) and the sliding window variance were calculated, normalized, and summed to construct a comprehensive response index. The baseline median and MAD were estimated from the previous min(80, N) frames. A high threshold was set as baseline median + 4 * MAD (strong stimulus confirmation), and a low threshold as baseline median + 2 * MAD (weak stimulus extension).

[0119] Detection process: First, identify all consecutive segments above the low threshold. Merge nearby segments using morphological closing operations (structural element length is round(window_size / 6)). For each segment, check if there are any points within it above the high threshold—if so, it is confirmed as a real stimulus window; if not, but the segment length exceeds window_size / 2, it is also retained. The interval between adjacent windows must be no less than min_gap / 2. Very close windows with an interval of less than 10 frames are merged and expanded; the rest are retained as independent windows to avoid erroneously merging multiple independent stimulus events.

[0120] VII. Huber Robust Baseline Estimation and Spatial Drift Correction

[0121] Baseline estimation is the core of deltaF / F quantization, and its accuracy directly determines the signal-to-noise ratio and quantitative reliability of neurotransmitter signals. This invention uses Huber robust mean for streaming block baseline estimation and combines it with three-level spatial drift correction to eliminate systematic bias.

[0122] 7.1 Stimulus Frame Exclusion and Region Masking. Based on the detected stimulus window, frames from the stimulus response period are strictly excluded from baseline statistics. Simultaneously, vascular mask areas, edge dark areas, and bright spot artifact areas are excluded from pixel selection. Bright spot artifact areas are identified based on baseline brightness and morphological constraints to eliminate interference from neurotransmitter sensor expression regions on baseline estimation; only… Regional cumulative baseline statistics.

[0123] 7.2 Streaming Block Huber Robust Mean. To avoid memory overflow caused by loading all frames at once, the image is divided into multiple 64-row blocks along the row direction, and valid frames are loaded block by block. A robust Huber mean is calculated for the temporal value of each pixel: using the median as the initial value mu0, the residual r = x - mu is iteratively calculated. Samples with |r| <= delta retain a weight of 1, and samples with |r| > delta are given a Huber weight w = delta / |r|. The update formula is mu_{new} = sum(w.* x) / sum(w). The iteration is limited to a maximum of 20 times, and convergence occurs when the change in mu between two consecutive iterations is less than 1e-4. The Huber mean is more robust to outliers than the arithmetic mean, and retains more information about normal samples than the median, maintaining baseline stability even when stimulus-response frames are occasionally mixed in. If the baseline number of frames exceeds 800, automatic uniform subsampling to 800 frames is performed to prevent OOM (Out of Memory).

[0124] 7.3 Spatial baseline drift correction. Low-frequency spatial gradients caused by illumination drift or camera thermal noise often exist in long-term recordings. This invention performs three levels of correction: (1) Large-scale global trend correction, using... (1) Gaussian filtering is used to estimate the global trend, and the mean of the effective region is corrected to the global mean; (2) Mesoscale region correction is performed using... Gaussian filtering estimates the regional trend and corrects the difference in gradients left and right or up and down; (3) Edge vignetting correction detects the brightness difference between the edge region (width 8%W, height 6%H) and the center region. When the median brightness of the edge is lower than 85% of the median brightness of the center, a correction field of 0.6 times the difference is applied according to the square relationship of the distance from the pixel to the center of the image to specifically eliminate the optical vignetting effect.

[0125] 8. Soft-edge feathered fill

[0126] Traditional hard truncation suppression produces grayscale jumps at the mask boundary, leading to spurious edge responses in deltaF / F calculations and severely interfering with the weak dff signal generated by neurotransmitter release. This invention proposes a soft-edge feathering filling technique based on distance transformation to achieve a natural and smooth transition between the vascular region and the background.

[0127] Calculate the internal distance transformation for the final stabilized mask. (Distance from pixel to nearest background) and external distance transformation (Distance from pixel to nearest mask). Feathering radius is adaptively determined based on blood vessel width: The maximum size is 15 pixels. The soft mask is set to 1.0 inside the blood vessel and at a distance from the edge. The transition region within the range is calculated using a Gaussian function. Attenuation, in which Apply a slight Gaussian smoothing (sigma=0.8) to the results to eliminate numerical discrepancies.

[0128] Fill value calculation takes into account both blood vessel darkness and background brightness: First, the annular region around the blood vessel (expansion radius max(5, Background median) and vascular area In the middle Fill the baseline value and clamped in [ *0.55, Within the range of [*0.92]. Finally, a spatially varying filled value matrix is ​​constructed. and clamped in [ *0.5, *0.95] ensures that the filled vascular region and the background have a continuous grayscale transition, and the spatial distribution retains the slow change characteristics of the original image. Soft edge transition fundamentally eliminates deltaF / F boundary artifacts caused by hard truncation, ensuring that the weak signals generated by neurotransmitter release are not overwhelmed by false edge responses.

[0129] IX. Standardized deltaF / F calculation and output

[0130] To ensure temporal stability and cross-frame comparability, this invention strictly follows the calculation order of unified mask → unified suppression → unified baseline → unified dff.

[0131] 9.1 Unified Hard Mask Suppression Across the Frame. The same stabilized hard mask is used for all N frames. Suppression is applied to values ​​> 0.5, and a stable fill value is used within the masked area. The original grayscale is replaced, while the remaining pixels retain their original values. The unified mask eliminates the temporal jitter caused by frame-by-frame mask changes, ensuring that the same spatial location has a consistent suppression state across all frames, thus avoiding spurious suppression state jumps in the temporal analysis of neurotransmitter signals.

[0132] 9.2 Baseline Re-estimation of the Suppressed Sequence. The baseline is re-estimated on the suppressed full-frame sequence. Accumulation occurs only in the non-masked and non-edge valid_for_baseline regions, avoiding the contamination of the baseline by fixed fill values ​​in suppressed regions. A slight Gaussian smoothing (sigma=2) is applied after averaging the valid regions to eliminate baseline noise.

[0133] 9.3 Calculation of deltaF / F for the entire frame. Calculate for each frame. Set non-finite values ​​to 0, and set the mask and edge region dff to the global minimum (dark color, consistent with the background).

[0134] 9.4 Global colorbar range statistics. A unified visualization range was determined through full sequence scanning: the sampled values ​​of the effective region were first taken from the 1% to 99th percentile, and then stretched and concentrated using the 3% to 97th percentile to exclude extreme outliers, making the effective neurotransmitter signal responses more vivid in the heatmap. The total number of samples was set to an upper limit of 500,000, and after exceeding the limit, the sample size was uniformly and randomly reduced to control memory usage.

[0135] 9.5 Streaming Output. Synchronously output for each frame: a 16-bit uncompressed TIFF original image, a PNG / BMP neurotransmitter activity heatmap, a mask image, and an MP4 heatmap video with color bars. Video output supports adaptive frame rate (min(15, max(5, round(N / 300))))) and downsampling control (maximum dimension 1080 pixels) to meet the efficient storage requirements of long-term recording.

[0136] To enhance the system's usability and engineering deployment capabilities, this invention also developed a graphical user interface, VesselSuppressionApp, based on MATLAB AppDesigner, as the system's human-computer interaction entry point. For example... Figure 1 As shown, this interface uses a partitioned panel layout, including:

[0137] InputPanel: Provides a file / folder selection button, an image size auto-recognition checkbox, width / height / frame number fields, and a data type dropdown list;

[0138] Vessel Detection Strategy Panel: Provides an interactive mask correction enable checkbox and a self-supervised vessel learning enable checkbox;

[0139] MotionPanel: Provides a motion correction enable checkbox, a maximum displacement edit box, and a reference frame update interval edit box;

[0140] Baseline and Stimulus Panel: Provides an automatic stimulus detection checkbox, a stimulus window size edit box, and a minimum interval edit box;

[0141] Output settings panel: provides output format drop-down list, color mapping drop-down list, automatic colorbar range checkbox, and manual range edit box;

[0142] Bottom control area: includes the 'Start Processing' button (ProcessBtn), the 'Run Self-Test' button (TestBtn), the progress label (ProgressLabel), and the log text area (LogTextArea).

[0143] All Chinese characters in the interface are uniformly written in SimSun font, while English letters and numbers are uniformly written in Times New Roman. This is set globally at startup using the `setFontAll` function to ensure consistent and standardized text display. Users can complete parameter configuration, task initiation, progress monitoring, and result output through this graphical interface without coding, significantly lowering the barrier to entry for neuroscience researchers.

[0144] Example 1: Vascular Inhibition and Signal Quantization of Neurotransmitter Fluorescent Probes in In Vivo Imaging

[0145] This embodiment applies to imaging data of fluorescent probes recording neurotransmitters in deep brain regions of experimental animals using a head-mounted miniscope. The experiment employed gene-encoded neurotransmitter sensors. The image sequence comprised over 1,500 frames, with a resolution of approximately 600×600 pixels, a frame rate of approximately 30fps, and a recording duration of approximately 50 seconds, including neurotransmitter release events induced by electrical stimulation. The imaging regions showed abundant vascular networks (tubular dark structures) and scattered sensor expression areas (circular or oval bright spots).

[0146] Step 1: Input Source Parsing and Edge Dark Area Detection. The system parses multiple .tif folders of input sources, recognizing all frame images. Edge dark area detection is performed on the mean image, identifying dark bands around the image caused by optical vignetting, and generating edge data. mask The dark band was excluded in subsequent processing to avoid misidentification as a blood vessel or sensor signal area.

[0147] Step 2, Two-stage motion correction. Activate motion correction, max... shift Set to 18 pixels, update interval The system is set to 50 frames. In the first stage, multi-scale phase correlation is accumulated layer by layer across multiple pyramids. The coarse layer quickly estimates the displacement at low resolution, and the fine layer refines it at full resolution; the accumulated displacement from coarse to fine is approximately on the order of (3, 2) pixels. In the second stage, ECC iteratively optimizes after cropping the boundary. Gradient weighting reduces the weight of low-contrast regions to 0.3–0.5, while maintaining the weight of high-contrast vascular regions at 0.8–1.0. The average number of iterations is approximately 8, and the final refined displacement is on the order of (-0.2, 0.1) pixels. Median filtering significantly reduces aberration amplitude. The reference frame is automatically updated when the mutual information score improves by more than 15%, ensuring stable registration quality over long periods.

[0148] Step 3: Initial Robust Baseline Estimation. The first 60 frames are selected as the initial baseline frames. In the streaming block Huber mean calculation, delta is set to 1.5, and all pixels converge within 20 iterations. The initial baseline map F0_init shows uneven brightness distribution in the imaging area, with the central area slightly higher than the edges, which is improved after subsequent drift correction.

[0149] Step 4: Multimodal vascular mask construction. In structural dark tube detection, Frangi enhancement superimposed responses at six scales, and background MAD statistics were used to set an adaptive threshold, detecting approximately 3%–4% of tubular dark structure candidates. For deltaF / F high-response detection, the 30 frames with the strongest global response were selected. After Frangi enhancement, the mean absolute dff image was used to extract high-response tubular candidates using the same MAD strategy, accounting for approximately 2%–3%. Edge dark ring detection identified accompanying dark rings in the inflated ring-shaped regions. After fusion of the three criteria, the total area accounted for approximately 4%. Multiple fragmented large blood vessels were repaired through large vessel integrity protection, and the sensor signal protection mechanism correctly identified and protected sensor expression regions (circular bright spots) of approximately 300–400 pixels. Protection criterion verification: The elongation of these protected regions was less than 2.2, and the brightness ratio was greater than 0.75, consistent with the characteristics of slightly bright baseline and circular or elliptical shape of neurotransmitter sensor signals.

[0150] Step 5: Self-supervised deep vascular feature learning. Self-supervised mode is enabled, fusing Frangi response-dominant (weight 0.5), Hessian vascularity-assisted capture of fine vessels (weight 0.3), and local contrast enhancement of regions with minimal grayscale differences (weight 0.2). Block-based adaptive thresholding divides the image into 3×3 blocks, with each block's threshold varying between 0.028 and 0.045 after independent statistical analysis to adapt to local illumination differences. Breakpoint connection identifies approximately 40-50 endpoints, bridging over 10 pairs of broken blood vessels with a distance of 15-28 pixels, successfully restoring the originally broken fine vessel branches. Fine morphological restoration recovers approximately 800-900 neighboring candidate pixels, resulting in a final self-supervised mask area of ​​approximately 3.5%-4%. The response verification stage correctly excludes all circular bright spot sensor regions, ensuring no sensor signals are misidentified as blood vessels.

[0151] Step 6: Mask Stabilization and False Positive Check. The stabilization period is set to 20% of the total frames (approximately 300 frames), updated every 2 frames. After the pre-run, consensus is calculated from the last 50% of historical masks, with an initial voting threshold of 50%, and the consensus area is within the allowable range (85%~115% of the median area). The IoU between the nearest mask and the consensus vascular mask is approximately 0.85, so the nearest mask is preferred. In the false positive check, two candidate false positive regions were selected using a quadruple criterion, with a total area of ​​approximately 40~50 pixels. After a 4-pixel distance constraint check, one region was retained because it was less than 4 pixels away from the real blood vessel (possibly a blood vessel bifurcation), while the other isolated false positive region of approximately 30 pixels was removed. The final stabilized mask area is approximately 3.5%~4%. Quadruple criterion verification shows that the removed region has an extension rate of less than 2.0, a non-dark baseline, and a significant high response during the stimulation period, which is consistent with the false positive characteristics of neurotransmitter sensor signals.

[0152] Step 7: Adaptive Stimulation Window Detection. After detrending, the median signal in the non-vascular region is used to estimate the base response index at the baseline period. median With base mad。 Multiple stimulation windows were detected, including electrically evoked windows and spontaneous release event windows. The window intervals all satisfied the minimum interval constraint, and there were no erroneous mergings.

[0153] Step 8: Robust baseline estimation and drift correction in non-vascular areas. After excluding stimulus window frames, the effective baseline frames account for more than 90% of the total. These are subsampled to 800 frames for Huber mean calculation. F0 free After three levels of spatial drift correction, large-scale trend correction eliminated about 5% to 7% of the brightness difference between the center and the edge, mesoscale correction smoothed the local gradient, and edge vignetting correction increased the brightness of the four corners by about 4%, reducing the difference from the center to less than 2%.

[0154] Step 9: Soft edge feathering fill. The median distance within the blood vessel is approximately 3 pixels. radius = max(4, round(3*2.5)) = 8 pixels. The soft mask is 1.0 inside the blood vessel and decays within 16 pixels from the edge according to a Gaussian function, sigma. f ≈ 5.33 pixels. The range of changes in the fill value matrix is ​​clamped to ensure a continuous transition with the background, without hard edge jumps.

[0155] Step 10: Unified deltaF / F calculation and output. A stable hard mask is used to uniformly suppress all frames, resulting in a stable mean of the baseline F0_supp within the effective region after suppression. After full-frame DFF calculation, the global colorbar range is initially determined using the 1%~99th percentile, and then stretched and concentrated using the 3%~97th percentile. In the neurotransmitter activity heatmap, the peak DFF after electrical stimulation is significant, the signal-to-noise ratio is significantly improved compared to traditional hard suppression methods, and hard edge artifacts are completely eliminated. Output includes: 16-bit TIFF suppressed original images of all frames, PNG heatmaps, PNG mask images, and an MP4 heatmap video with adaptive frame rate (with color bars). A comparison of some actual processing effects is shown in Figure 7.

[0156] Example 2: Validation of motion drift and baseline stability in long-term neurotransmitter imaging

[0157] This embodiment is applied to long-term neurotransmitter probe imaging data of experimental animals recorded by a head-mounted Miniscope. The image sequence consists of 5,000 frames with a resolution of approximately 720×540 pixels, a frame rate of 20fps, and a recording duration of approximately 250 seconds, including multiple spontaneous neurotransmitter activities and slight animal movements.

[0158] Motion correction validation: The entire two-stage registration sequence was run. The first stage, the coarse layer, estimated large displacements at low resolution, while the fine layer refined the motion at higher resolution. The average coarse displacement was approximately (2, 1) pixels, and the ECC refinement was approximately (-0.1, 0.1) pixels. Mutual information-driven reference frame updates occurred multiple times, all corresponding to peak animal movement periods, and the MI score remained stable for hundreds of frames following the update. Compared to the single-stage phase-correlation method, the two-stage registration improved the mean mutual information in the vessel edge region by approximately 15%–20%, and reduced long-term drift (cumulative displacement variance per 1000 frames) by approximately 30%–35%. The key improvement lies in avoiding additional linear low-pass filtering throughout the registration process, allowing weak sensor fluorescence responses to be fully preserved after registration.

[0159] Baseline stability verification: F0 when spatial drift correction is not enabled free A slow increase in brightness occurred in the latter part of the sequence, causing a systematic underestimation of the DFF in that segment. After enabling three-level spatial drift correction, large-scale trend correction eliminated the brightness increase in the latter part, mesoscale correction smoothed the local darkening caused by changes in animal posture, and edge vignetting correction improved the brightness ratio of the four corners to the center from approximately 0.81 to approximately 0.94. After correction, the standard deviation of the baseline drift of the entire sequence DFF was reduced by approximately 60% to 70%.

[0160] Mask stability verification: When updating the mask independently frame by frame, the temporal standard deviation of the mask area is large, and the average number of time-series suppression state flips for the same pixel exceeds 100, generating significant spurious signals. After adopting the stabilization mechanism of this invention, the temporal standard deviation of the mask area is reduced by more than 90%, the average number of pixel state flips is reduced to less than 5, and temporal artifacts are basically eliminated.

[0161] Example 3: Extraction and Generalization Validation of Vascular Integrity in Low-Contrast Brain Slice Imaging

[0162] This embodiment is applied to wide-field fluorescence imaging of isolated brain slices, where the grayscale difference between blood vessels and background is extremely small (contrast ratio of about 3%~5%). The image sequence consists of 800 frames with a resolution of about 1024×1024 pixels. Traditional methods are difficult to reliably detect vascular networks.

[0163] Self-supervised deep feature learning validation: The traditional Frangi single-threshold method detected fragmented masks on this data, resulting in severe vessel breaks and numerous misclassifications of noise. Enabling the self-supervised mode of this invention, the Hessian-Frangi-contrast fusion enhancement map significantly enhanced previously invisible fine vessels (2-3 pixels in diameter). Block-based adaptive thresholding was performed independently in the central and edge regions, adapting to local illumination differences. Breakpoint connections successfully bridged multiple pairs of broken vessels, with the longest bridging distance approaching 30 pixels. Fine-grained morphological restoration recovered over a thousand edge pixels. Ultimately, the self-supervised mask vessel recall rate significantly outperformed the traditional Frangi method. Simultaneously, the sensor, excluding constraints, correctly identified possible circular bright spot structures in the brain slices, with no bright spots misclassified as vessels.

[0164] Soft edge feathering verification: Boundary artifacts caused by hard truncation suppression are particularly severe in low-contrast scenarios. Traditional methods generate spurious high-response rings approximately 2-3 pixels wide at blood vessel boundaries, with peak dff values ​​reaching 0.08-0.12, which are easily confused with real neural signals. After soft edge feathering filling in this invention, the dff value in the boundary region drops from the spurious peak value to within 0.02 of the natural background fluctuation, achieving a spurious response suppression rate of approximately 80%, effectively improving the reliability of neural signal quantization in low-contrast scenes.

[0165] Generalization Validation: The method parameters of this embodiment were directly transferred to the in vivo calcium imaging dataset (GCaMP probe, resolution 512×512, 2,000 frames) without modifying the core thresholds and algorithm flow. Only the sensor signal protection module needed to be disabled (there are no bright spot features in calcium imaging). The blood vessel detection and suppression effects were stable, and the DFF baseline drift correction and motion correction functions worked normally, indicating that the core technology module of this invention has good scene transfer capability.

[0166] like Figure 7As shown, from left to right and top to bottom, the images are: (a) a vascular mask overlay generated by multimodal vascular joint detection, with white curves indicating the detected vascular locations and green arrows indicating correctly protected sensor signal areas (circular bright spots are not covered by the mask); (b) the original image after soft-edge feathering and filling, showing that the vascular area is replaced by a naturally smooth background without hard-edge artifacts; (c) a unified deltaF / F neurotransmitter activity heatmap, with colors ranging from blue (low response) to red (high response), indicating the effective neurotransmitter activity. The neurotransmitter signal regions show a clear contrast, with the mask and edge regions uniformly displayed against a dark blue background; (d) the average grayscale image shows the original grayscale distribution of the vascular network (tubular dark structure) and the neurotransmitter sensor region (circular or elliptical bright spots); (e) the initial mask (fragmented), composed of fragmented vascular candidate regions generated in the early detection stage; (f) the stabilized mask (last 50% consensus), after processing by the pre-run stabilization period and consensus voting mechanism, the topological integrity of the vascular network is significantly improved, and misjudged sensor signal regions have been eliminated.

[0167] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims of this application.

[0168] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A method for blood vessel adaptive inhibition and signal quantization for neurotransmitter imaging, characterized in that, Includes the following steps: Step 1: Parse the input source and adaptively detect dark areas at the edges to obtain the entire image sequence; Step 2: Perform two-stage inter-frame motion correction on the entire image sequence; Step 3: Perform initial robust baseline estimation on the entire corrected image sequence to obtain an initial baseline image set; Step 4: Construct a multimodal vascular mask and perform joint multimodal vascular detection based on the initial baseline image; Step 5: Self-supervised deep vascular feature learning, which integrates multi-scale Frangi vascular enhancement response map, Hessian vascularity and local contrast according to set weights, and then performs block adaptive threshold segmentation, breakpoint connection and fine morphological repair. Step 6: Mask stabilization and misjudgment self-check, pre-run stabilization period, calculation of consensus vascular mask, verification of recent mask consistency and elimination of misjudged sensor signals; Step 7: Adaptive stimulation window detection, based on dual threshold stimulation window detection using the signal change rate and sliding variance in non-vascular areas; Step 8: Robust baseline estimation and drift correction in non-vascular areas, performing three levels of baseline drift correction: large-scale, meso-scale, and marginal halo. Step 9: Obtain a uniform hard mask by feathering and filling the soft edges, based on adaptive feathering and calculation of local adaptive fill values ​​using distance transformation; Step 10: Calculate and output the unified deltaF / F response map, perform baseline re-estimation after unified suppression of the entire frame, statistically analyze the global colorbar range, and output the streaming heatmap video.

2. The method for adaptive vascular inhibition and signal quantization for neurotransmitter imaging according to claim 1, characterized in that, Step 1 is implemented as follows: Parse the .raw single file, .tif multi-frame single file, or multiple .tif folders in the input source to obtain the image width, height, and total number of frames N, and obtain the entire image sequence; perform streaming edge dark area detection on the entire image sequence to generate an edge mask.

3. The method for adaptive vascular inhibition and signal quantization for neurotransmitter imaging according to claim 1, characterized in that, Step 2 is implemented as follows: The first stage uses a multi-scale phase correlation algorithm for coarse alignment of integer pixels; The second stage uses the ECC enhanced correlation coefficient algorithm for sub-pixel refinement; During motion correction, an adaptive reference frame update mechanism based on mutual information is introduced. Each time the update interval is reached, the mutual information score between the current frame and the reference frame is calculated. When the score exceeds a specified multiple of the historical best score or the number of running frames reaches three times the update interval, the reference frame is automatically replaced. Finally, median filtering is applied to the sequence for smoothing. In the implementation of the multi-scale phase correlation algorithm, contrast normalization is first performed on the reference frame and the current frame, then global linear stretching is performed, and finally a multi-scale pyramid is constructed, where the scale factor is... , After weighting each layer of the multi-scale pyramid using the Hanning window, the cross-power spectrum of the FFT is calculated. The phase correlation peak is obtained by inverse FFT, and sub-pixel refinement is achieved by quadratic interpolation. The subpixel refinement involves cropping a boundary region of a specified size, calculating the cross-correlation coefficient between the reference frame and the current alignment frame, and introducing a gradient weighting strategy to suppress the interference of low-gradient noise regions on registration. The specified margin size is: The weights in the gradient-weighted strategy are set as follows: .

4. The method for adaptive vascular inhibition and signal quantization for neurotransmitter imaging according to claim 1, characterized in that, Step 4 is implemented as follows: 4-1. Detection of structural dark tubes: Illumination normalization is performed on the initial baseline image, and multi-scale Frangi vessel enhancement response maps are calculated, with the scale set covering pixels [1,2,3,4,5,6]. After excluding edge masks, an adaptive threshold th_dark is set based on the background median and MAD statistics. Tubular topological constraints are applied to regions above the adaptive threshold, requiring that the extension rate of the connected components is greater than the set extension rate threshold, or the area of ​​the connected components is greater than the area threshold. ; in, Indicates the background median. MAD represents absolute deviation; 4-2. deltaF / F high-response tubular detection: Select the min(30, N) frames with the strongest response from the entire image sequence, calculate the average absolute deltaF / F response map, and perform Frangi multi-scale enhancement on the response map again, with the scale set being [1,2,3,4,5]. Use the same MAD statistical setting to set an adaptive threshold to extract high-response tubular regions. 4-3. Detection of Dark Rings Alongside the Edge: In the structural dark tube region and high-response tubular region of the detected blood vessel, dark rings accompanying the edge of the blood vessel are detected based on gradient amplitude and local darkness. 4-4. Triple criterion fusion: The structural dark tube region, the high-response tubular region, and the edge dark ring region are logically ORed and fused. Connectivity verification is applied to the generated fusion mask, requiring that each connected region satisfies at least one of the characteristics of the structural dark tube region or the high-response tubular region. 4-5. Large vessel integrity protection: Detect single large vessel regions in the fusion mask that may be misidentified as two thin vessels. Check the baseline grayscale continuity in the structural dark tube region and the high-response tubular region. If the average darkness of the middle region between two separated vessel segments is greater than the set darkness threshold, then merge the entire connected region into a single large vessel region to obtain the updated fusion mask. 4-6. Perform edge smoothing and area control on the updated fusion mask.

5. The method for adaptive vascular inhibition and signal quantization for neurotransmitter imaging according to claim 1, characterized in that, Step 5 is implemented as follows: 5-1. Constructing a fused enhancement map: Fusing the multi-scale Frangi vascular enhancement response map, Hessian vascularity, and local contrast according to set weights; 5-2. Block Adaptive Threshold Segmentation: Divide the fused enhancement map into multiple pixel blocks, and set a threshold based on MAD statistics within each pixel block; 5-3. Continuity Restoration: Filling tiny gaps in the fusion enhancement map using closing operations; 5-4. Response Verification and Morphological Constraints: Apply tubular topological constraints based on the fused enhancement map; simultaneously exclude circular or elliptical bright spot regions; 5-4. Fine-grained repair: Based on vascular morphology, dilation search is performed on each connected region, and neighboring pixels with enhancement values ​​higher than the enhancement threshold or lower than the background threshold are recycled to the vascular mask.

6. The method for adaptive vascular inhibition and signal quantization for neurotransmitter imaging according to claim 1, characterized in that, Step 6 is implemented as follows: 6-1. Pre-run stabilization period: Set the number of frames for the stabilization period to min(N, max(300, round(N)). 0.20))), during the stable period, the vascular mask is renewed at fixed intervals; 6-2. Calculate consensus vascular mask: Only 50% of historical vascular masks after the stabilization period are used for voting. The voting threshold is set to 50% of the number of vascular masks after the stabilization period. If the consensus area exceeds the median area threshold, the voting threshold is gradually increased to 95% of the number of vascular masks after the stabilization period to suppress excessive expansion. 6-3. Nearest Mask Consistency Check: Calculate the Intersection over Union (IoU) between the nearest vessel mask and the consensus vessel mask. If the IoU is greater than the set upper threshold of the IoU and the area is within the allowable range, then the nearest vessel mask is used; if the IoU is less than or equal to the set upper threshold of the IoU and greater than the lower threshold of the IoU, then the intersection of the consensus vessel mask and the expanded nearest vessel mask is used for refinement. 6-4. Eliminating misjudged sensor signals: Based on the deltaF / F response map, perform a quadruple criterion check on each connected region in the consensus vascular mask: non-tubular shape, region area within a set pixel range, baseline not dark, and significantly higher than background response; for regions that simultaneously meet the quadruple criteria, check whether they remain at a set distance threshold from the remaining consensus vascular mask.

7. The method for adaptive vascular inhibition and signal quantization for neurotransmitter imaging according to claim 1, characterized in that, Step 4 also includes a sensor signal protection mechanism, which pre-identifies effective sensor signal regions based on baseline brightness and morphology dual verification, and marks regions with gray values ​​higher than a specified gray value threshold as non-dark connected regions on the normalized baseline map. For each non-dark connected component, its second-order moment eigenvalue is calculated to obtain the elongation rate, and the ratio of the average brightness of the region to the brightness of the surrounding multi-pixel ring-shaped background is calculated. Only when the connected component simultaneously satisfies the elongation rate, brightness ratio, and absolute brightness threshold is it determined to be a valid neurotransmitter sensor signal and protected. Grayscale specified threshold , where global_median is the global median of the normalized baseline image, and global_mad is the absolute deviation of the gray values ​​of the normalized baseline image relative to the global median.

8. A blood vessel adaptive inhibition and signal quantization system for neurotransmitter imaging, characterized in that, The system is used to implement any of the methods described in claims 1-7, characterized in that it includes: Input parsing module: used to parse .raw single files, .tif multi-frame single files, or multiple .tif folders in the input source, obtain the image width, height, and total number of frames N, and obtain the entire image sequence; perform streaming edge dark area detection on the entire image sequence and generate edge masks; The two-stage motion correction module is used to perform multi-scale phase-correlation coarse alignment and ECC sub-pixel refinement, and supports mutual information-driven adaptive reference frame update; in addition, a mutual information-based adaptive reference frame update mechanism is introduced during motion correction; finally, median filtering is applied to the sequence for smoothing. Robust baseline estimation module: Select the first min(60, N) frames as the initial baseline frame set, use a streaming block strategy to divide each image into multiple blocks along the row direction, calculate the Huber robust mean for the pixels of each block in the temporal dimension, and obtain the initial baseline image set. Multimodal vessel detection module: used to perform structural dark tube detection, deltaF / F high-response tubular detection, edge dark ring detection and triple criterion fusion, and has a built-in sensor signal protection submodule to distinguish tubular dark vessels from circular or elliptical bright spot sensor signals; Self-supervised deep feature learning module: The multi-scale Frangi vessel enhancement response map, Hessian vessel degree and local contrast are fused according to the set weights, and then block adaptive threshold segmentation, breakpoint connection and fine morphological repair are performed. Mask stabilization and misjudgment self-check module: used for pre-running the stabilization period, calculating consensus vascular masks, verifying the consistency of the most recent masks, and eliminating misjudged sensor signals; Adaptive stimulus detection module: Dual threshold stimulus window detection based on the rate of change of signal in non-vascular areas and the sliding variance; Spatial drift correction module: used to perform three levels of baseline drift correction: large-scale, meso-scale, and edge vignetting; Soft edge feathering and fill module: used for calculating adaptive feathering and local adaptive fill values ​​based on distance transformation; Unified deltaF / F calculation module: used for baseline re-estimation after full-frame unified suppression, global colorbar range statistics, and streaming heatmap video output.

9. The blood vessel adaptive inhibition and signal quantization system for neurotransmitter imaging according to claim 8, characterized in that, In the multimodal blood vessel detection module, a single large blood vessel region that may be misidentified as two thin blood vessels in the fusion mask is detected. The baseline grayscale continuity is checked in the structural dark tube region and the high-response tubular region. If the average darkness of the intermediate region between two separated blood vessel segments is greater than the set darkness threshold, the entire connected domain is merged into a single large blood vessel region to obtain the updated fusion mask.

10. The blood vessel adaptive inhibition and signal quantization system for neurotransmitter imaging according to claim 8, characterized in that, The self-supervised deep feature learning module first performs preliminary detection of the vascular mask to extract the skeleton and locate the endpoints. If the number of endpoints exceeds the set endpoint threshold P, then only the top P high-enhancement endpoints are retained according to the enhancement value at the endpoints. Subsequently, for endpoint pairs whose distance is less than a specified pixel threshold, the enhancement map is sampled at equal intervals along the straight path and queried. If the average enhancement value of the path is greater than the set average threshold or the median enhancement value is greater than the set median threshold, then all pixels on the path are added to the vascular mask to achieve bridging and restoration of broken blood vessels under low contrast conditions.