A method and system for generating a three-dimensional neural fiber mask with adaptive volume constraint
Patent Information
- Application Number
- CN202610845512.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-12
- Publication Date
- 2026-09-15
- Estimated Expiration
- 2046-06-12
AI Technical Summary
[0003]神经元钙信号的精准提取,是解码神经元活动、构建脑功能图谱的基础,而神经纤维信号扣除是钙信号校正的核心步骤,神经纤维是目标神经元周围其他神经元的轴突、树突集合,其荧光信号会与目标神经元的胞体信号发生串扰,若无法精准生成神经纤维掩膜并扣除其背景信号,会导致神经元钙信号的dFF计算失真、活动检测假阳性率升高,直接影响脑科学实验结论的可靠性
[0045] This invention provides a method and system for generating three-dimensional neural fiber masks with adaptive volume constraints. Compared with the prior art, the beneficial effects include at least the following:
Smart Images

Figure CN122415933B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically to a method and system for generating three-dimensional neural fiber masks with adaptive volume constraints. Background Technology
[0002] In modern brain science research, volumetric 3D functional imaging techniques (two-photon microscopy, light sheet microscopy, confocal microscopy, etc.) are the core means of analyzing the activity of neuronal networks.
[0003] Accurate extraction of neuronal calcium signals is fundamental to decoding neuronal activity and constructing brain functional maps. Nerve fiber signal subtraction is the core step in calcium signal correction. Nerve fibers are collections of axons and dendrites of other neurons surrounding the target neuron. Their fluorescence signals can crosstalk with the cell body signals of the target neuron. If a nerve fiber mask cannot be accurately generated and its background signal subtracted, it will lead to distortion in the dFF calculation of neuronal calcium signals and an increase in the false positive rate of activity detection, directly affecting the reliability of the conclusions of brain science experiments.
[0004] Currently, as imaging technology advances towards whole-brain scale and high resolution, 3D neuronal imaging data exhibits two main characteristics: First, the size range of neurons is extremely wide, ranging from large cone neurons with cell bodies exceeding 1000 voxels to tiny inhibitory neurons and immature neurons from young mice with cell bodies of only 1-8 voxels; second, the imaging data exhibits significant anisotropy, with the Z-axis (axial) resolution typically only 1 / 3 to 1 / 10 of that in the XY plane (lateral), and single isotropic processing leads to spatial information distortion. These characteristics render existing neural fiber mask generation techniques, such as 2D planar expansion, fixed-radius 3D dilation, and regional 3D generation, inadequate for current needs; specifically:
[0005] The 2D planar expansion method is represented by traditional image processing software such as ImageJ and Fiji. It can only expand the neuron mask in a single Z-plane to generate the nerve fiber region, while completely ignoring the spatial continuity of 3D volume. The nerve fiber regions in the Z-axis direction are unrelated and cannot adapt to the volume characteristics of 3D imaging data. The generated mask is broken and misaligned in the Z-axis direction, introducing a large amount of irrelevant background signal.
[0006] Fixed-radius 3D dilation methods are represented by early versions of Suite2p and CaImAn, which use spherical structural elements of a fixed radius to perform 3D isotropic dilation of the neuron mask to generate the neural fiber region. However, they have the following drawbacks: ① They cannot adapt to neurons of different sizes; large neurons are under-dilated, while small neurons are over-dilated, resulting in extremely poor volume control precision; ② They do not consider the anisotropy of imaging, dilating the Z-axis and XY-axis with equal weight, causing the axial neural fiber region to deviate significantly from the actual surrounding environment of the neuron; ③ They lack a regional design, making it impossible to reduce signal crosstalk through multi-region averaging, resulting in limited correction effects.
[0007] The regional 3D generation method is the approach adopted by current mainstream scientific research tools. It divides the nerve fiber region into multiple sub-regions based on 3D expansion, and improves the stability of signal correction by averaging the sub-regions. However, it has the following shortcomings: ① Complete lack of micromask adaptability: The expansion-segmentation logic of existing methods depends on a sufficient number of voxels. For micro neuron masks of 1-8 voxels, it is impossible to generate 4 non-empty sub-regions adjacent to the neuron after expansion. The volume difference rate is large, which makes it impossible to perform signal correction of micro neurons; ② Uneven expansion spatial distribution, which does not match the imaging characteristics: Using a single isotropic expansion, it is impossible to take into account the resolution difference of the XY and Z axes. The expanded nerve fiber region is prone to axial stretching and planar offset, and a large amount of irrelevant background signals far away from the neuron are introduced; ③ No priority of volume constraints, resulting in serious loss of signal correlation: Existing volume constraints use random or indiscriminate cropping, which prioritizes the loss of voxels closest to the neuron and with the highest signal correlation, while retaining irrelevant voxels far away, and may even introduce additional noise; ④ Insufficient automation robustness: The success rate of processing irregularly shaped neurons, edge neurons, and broken masks is low. Problems such as expansion exceeding the boundary, empty sub-regions, and infinite loops are prone to occur, and it cannot be adapted to the automated processing pipeline of large-scale whole-brain 3D imaging data.
[0008] Therefore, overcoming the above-mentioned defects is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0009] In view of the above problems, the present invention is proposed to provide an adaptive volume-constrained three-dimensional neural fiber mask generation method and system that overcomes or at least partially solves the above problems.
[0010] To achieve the above objectives, the present invention adopts the following technical solution:
[0011] In a first aspect, embodiments of the present invention provide a method for generating a three-dimensional neural fiber mask that adapts to volume constraints. First, 3D neuron mask data is acquired, and the volume attributes of the 3D neuron mask data are classified. Then, the neuron mask is differentially extended based on the classification results to obtain an initial neural fiber mask.
[0012] Then, the initial neural fiber mask is adaptively segmented, including:
[0013] Determine whether the total number of voxels in the initial neural fiber mask exceeds the preset number of segments.
[0014] If not, the voxels in the initial neural fiber mask are distributed to each sub-region in a polling manner;
[0015] If so, determine the three-dimensional centroid coordinates of the neuron mask; based on the three-dimensional centroid coordinates, adaptively segment the initial neural fiber mask by polar quantile division to obtain multiple neural fiber sub-regions.
[0016] Preferably, after acquiring the 3D neuron mask data, preprocessing is performed, including converting the 3D neuron mask data into a Boolean three-dimensional array and performing binary expansion on the broken and discontinuous neuron masks in the array.
[0017] Preferably, the differential expansion of the neuron mask based on the classification results includes:
[0018] When the neuron mask is a conventional mask, the expansion along the principal axis of the three-dimensional Cartesian coordinate system, the expansion along the spatial diagonal, and the expansion along the diagonal of a specified plane are performed through multiple rounds of iterative loops; wherein, in the expansion along the principal axis of the three-dimensional Cartesian coordinate system, the expansion frequency for the Z-axis is lower than the expansion frequency for the X-axis and Y-axis.
[0019] When the neuron mask is a tiny mask, a 3D dilation operation is performed.
[0020] Preferably, determining the neuron mask in three-dimensional centroid coordinates includes:
[0021] Extract the coordinates of all voxels in the neuron mask;
[0022] Calculate the arithmetic mean of the coordinates of all voxels, and use it as the coordinates of the three-dimensional centroid.
[0023] Preferably, based on the three-dimensional centroid coordinates, the initial neural fiber mask is adaptively segmented using polar quantile division to obtain multiple neural fiber sub-regions, including:
[0024] Calculate the planar polar angle of each voxel in the initial neural fiber mask relative to the centroid;
[0025] The polar angle of the plane is offset and corrected;
[0026] Based on the corrected polar angle, the number of segments is adaptively adjusted, and the segmentation boundary is determined by the quantile to generate multiple nerve fiber sub-regions.
[0027] Preferably, the offset correction of the plane polar angle includes:
[0028] Construct a histogram of the planar polar angle, the histogram containing multiple equal-width intervals;
[0029] Determine the interval with the fewest voxels in the histogram;
[0030] The offset is calculated based on the center position of the interval with the fewest voxels; the offset is then used to correct the polar angle of the plane.
[0031] Preferably, the number of segments is adaptively adjusted based on the corrected polar angle, including determining the current proportion of non-empty intervals and adjusting the number of segments using the proportion of non-empty intervals.
[0032] Preferably, it further includes:
[0033] For any sub-region of a neural fiber that exceeds the volume of the neuron mask, based on the three-dimensional centroid coordinates, voxels in the sub-region of the neural fiber that exceeds the volume are clipped according to a preset priority order, so that the volume of the clipped sub-region does not exceed the volume of the neuron mask.
[0034] Preferably, the priority order is determined based on the axial distance and planar distance from the voxel to the three-dimensional centroid coordinates, including:
[0035] Prioritize cropping voxels that are farther away from the Z-axis of the three-dimensional centroid coordinate system;
[0036] For voxels with the same axial distance, voxels that are farther away from the three-dimensional centroid coordinate XY plane are preferentially clipped;
[0037] Prioritize the cropped voxels;
[0038] The top K voxels in the sorting are retained to generate a new sub-region mask.
[0039] Secondly, embodiments of the present invention provide an adaptive volume-constrained three-dimensional neural fiber mask generation system, which is used to implement the adaptive volume-constrained three-dimensional neural fiber mask generation method as described in any of the preceding claims, including:
[0040] The neural fiber mask extension module is used to acquire 3D neuron mask data, classify the 3D neuron mask data based on its volume attributes, and perform differential extension of the neuron mask based on the classification results to obtain an initial neural fiber mask.
[0041] A neural fiber mask segmentation module adaptively segments the initial neural fiber mask, including:
[0042] Determine whether the total number of voxels in the initial neural fiber mask exceeds the preset number of segments.
[0043] If not, the voxels in the initial neural fiber mask are distributed to each sub-region in a polling manner;
[0044] If so, determine the three-dimensional centroid coordinates of the neuron mask; based on the three-dimensional centroid coordinates, adaptively segment the initial neural fiber mask by polar quantile division to obtain multiple neural fiber sub-regions.
[0045] This invention provides a method and system for generating three-dimensional neural fiber masks with adaptive volume constraints. Compared with the prior art, the beneficial effects include at least the following:
[0046] 1. An expansion-segmentation logic specifically designed for micromasks is constructed, which enables precise neural fiber signal correction for micro-inhibitory neurons and immature neurons, and ensures that the sub-regions of the micromask are non-empty and uniform, thereby solving the problem of lack of adaptability of micro-volume 3D neuron masks in the existing technology.
[0047] 2. A multi-mode alternating expansion strategy is proposed, which takes into account the different weights of the XY plane and the Z axis, so as to achieve 100% adjacency between the expanded region and the neurons and reduce the crosstalk phenomenon when the neurons are closely distributed, thereby solving the problem of uneven spatial distribution and mismatch of imaging characteristics in 3D expansion.
[0048] 3. A priority pruning mechanism based on spatial distance is proposed, which prioritizes the retention of voxels closest to neurons, improves the correlation between nerve fiber signals and target neurons, and maximizes the effectiveness of signal correction, so as to solve the problem of signal correlation loss due to volume constraints.
[0049] 4. By constructing a full-process boundary check, safe iteration, and anomaly handling mechanism, we can achieve unified processing of all types of neuron masks, meet the needs of large-scale automated processing, and solve the robustness problem of full-scene automated processing. Attached Figure Description
[0050] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0051] Figure 1This is a flowchart of the adaptive volume constraint three-dimensional neural fiber mask generation method provided in an embodiment of the present invention. Detailed Implementation
[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0053] This invention discloses an adaptive volume-constrained three-dimensional neural fiber mask generation method and system, aiming to solve the following core technical problems, thereby forming a closed-loop solution for the entire process:
[0054] This paper addresses the issue of poor adaptability of 3D neuron masks with small volumes: Existing expansion-segmentation logic completely fails for 1-8 voxel micromasks, failing to generate non-empty, and approximately sized neural fiber sub-regions adjacent to neurons, thus hindering signal correction for micro-neurons. This application constructs a dedicated expansion-segmentation logic for micromasks, ensuring that the sub-regions of the micromask are non-empty and uniform.
[0055] To address the issue of uneven spatial distribution and mismatch between 3D extensions and imaging characteristics: Existing single isotropic extensions cannot adapt to the anisotropic resolution characteristics of 3D imaging, resulting in poor adjacency between the extended neural fiber region and neurons, and the introduction of a large amount of irrelevant background signal. This application designs a multi-mode alternating extension strategy, taking into account different weights in the XY plane and the Z axis, to achieve 100% adjacency between the extended region and neurons, and to reduce crosstalk when neurons are closely distributed.
[0056] Addressing the issue of signal correlation loss due to volume constraints: Existing indiscriminate pruning methods lose highly correlated neighboring voxels, resulting in insufficient representativeness of nerve fiber signals. This application proposes a spatial distance-based priority pruning mechanism that preferentially retains voxels closest to the neuron, thereby enhancing the correlation between nerve fiber signals and the target neuron and maximizing the effectiveness of signal correction.
[0057] Addressing the robustness issue of full-scene automated processing: Existing methods have low fault tolerance for irregular masks, edge masks, and broken masks, making them unsuitable for high-throughput automated pipelines. This application proposes to construct a full-process boundary checking, safe iteration, and anomaly handling mechanism to achieve unified processing of all types of neuron masks and meet the needs of large-scale automated processing.
[0058] In one specific embodiment, a method for generating three-dimensional neural fiber masks that adapts to volume constraints, such as... Figure 1 As shown, it includes:
[0059] Acquire 3D neuron mask data, classify the 3D neuron mask data based on its volume attributes, and perform differential expansion of the neuron mask based on the classification results to obtain an initial neurofibrillary mask.
[0060] Then, the initial neural fiber mask is adaptively segmented, including:
[0061] Determine whether the total number of voxels in the initial neural fiber mask exceeds the preset number of segments.
[0062] If not, the voxels in the initial neural fiber mask are distributed to each sub-region in a polling manner;
[0063] If so, determine the three-dimensional centroid coordinates of the neuron mask; based on the three-dimensional centroid coordinates, adaptively segment the initial neural fiber mask by polar quantile division to obtain multiple neural fiber sub-regions.
[0064] Preferably, the above steps in this embodiment are implemented through the following scheme. It should be noted that the step numbers below are for descriptive convenience only and do not constitute a strict limitation on the execution order of the steps. In some implementations, some steps can be executed in parallel or their order can be adjusted in an equivalent manner.
[0065] S1. In an optional implementation, 3D neuron mask data is first acquired and preprocessed to ensure the continuity of the mask and provide a reliable basis for subsequent steps. The preprocessing steps include:
[0066] Convert 3D neuron mask data of any format into a Boolean NumPy array, denoted as M, to ensure compatibility in subsequent processing. The formula is as follows:
[0067]
[0068] np.asarray is a data transformation method in the open-source scientific computing tool NumPy; mask is a 3D neuron mask of arbitrary format; dtype is the data type of the converted data that can be specified during the transformation; bool is a boolean data type, that is, the data only contains two values: True and False.
[0069] To further address fragmented and discontinuous neuron masks in the array, the optional parameter `fit_snugly` is provided: if `fit_snugly=False`, a 3×3×3 binary expansion of the entire structuring element `M` is performed to enlarge the continuous base region of the mask and prevent breakages in subsequent expansions. The binary expansion formula is expressed as:
[0070]
[0071] binary_dilation is the binary array dilation function; structure is the dilation structure kernel; np.ones() is the NumPy function for constructing a matrix of all ones; iterations is the number of iterations for the dilation operation; Mdil represents M after the dilation operation.
[0072] S2. In an optional implementation, classification is performed based on the volumetric properties of the 3D neuron mask data, i.e., the true volume of the 3D neuron mask is calculated according to the following formula. (Effective number of voxels), and classify mask types based on volume thresholds;
[0073]
[0074] In the formula, The coordinates in the 3D neuron mask are voxels, , , These represent the extended boundaries of the 3D neuron mask along the Z, Y, and X axes, respectively.
[0075] In some implementation schemes, if If the mask is identified as a micromask, a special micromask processing logic is used; otherwise, it is identified as a regular mask and the standard processing logic is used.
[0076] S3. In an optional embodiment, for the two types of masks divided in S2, an appropriate expansion strategy is designed to solve the problems of uneven expansion space distribution, poor volume control accuracy, and failure of micro-mask expansion in the prior art, so as to generate an initial neural fiber mask with accurate volume and 100% adjacency to the neuron, providing qualified input for subsequent segmentation.
[0077] In this embodiment, the neuron mask is differentially expanded based on the classification results, including:
[0078] S31. When the neuron mask is a conventional mask, expansion along the principal axis of the three-dimensional Cartesian coordinate system, along the spatial diagonal, and along the diagonal of a specified plane are performed through multiple iterative cycles to solve the problems of uneven spatial distribution and mismatch with the anisotropy of existing single isotropic expansion. Exemplarily, the steps include:
[0079] S311, Extended parameter initialization:
[0080] Initialize the extended mask G=M, using the original neuron mask as the starting point for expansion, ensuring that the extended region is 100% adjacent to the neuron;
[0081] Initialize the current expansion volume Iteration counter ;
[0082] Calculate the target expanded volume The total expansion coefficient is the number of sub-regions. Relative volume coefficient of a single region The product of these factors ensures that the initial volume of each sub-region meets the design requirements. The formula is:
[0083]
[0084] This represents the actual volume of a conventional 3D neuron mask.
[0085] In this embodiment, the relative volume coefficient of a single region is adjustable, and preferably 1, indicating that the target volume of each sub-region should be consistent with the volume of the original 3D neuron mask.
[0086] S312, Multi-mode Loop Extension:
[0087] The expansion operation is executed repeatedly. In each iteration, the case selects the corresponding expansion mode based on the remainder of count divided by 3, ensuring uniform coverage in all directions of the three-dimensional space; this continues until the stopping condition is met. Or reach the boundary ), The actual volume of the 3D neuron mask. The total volume of the imaging volume; , , , These represent the extended boundaries of the 3D neuron mask in the Z, Y, and X axes, respectively, to prevent the extension from exceeding the imaging range.
[0088] First, let's explain the common symbols used in each extended mode:
[0089] Before the start of this iteration, a complete copy of the current initial extended mask G is used to ensure that all extension operations in this iteration are based on the same benchmark, thus avoiding extension bias caused by dynamic mask updates during the iteration process.
[0090] The translation operator is used to perform non-cyclic translation of a 3D Boolean array along a specified axis. Its mathematical definition is:
[0091]
[0092] In the formula The 3D Boolean array to be translated The pixel step size for a single translation. The direction of translation. Translation operations can be implemented using the open-source mathematical computation package NumPy;
[0093] Image dimensions: (Total number of layers along the Z-axis) (Total number of layers on the y-axis) (Total number of layers on the x-axis), all operations must meet the coordinate range. .
[0094] Furthermore, the extended modes include:
[0095] 1) Expansion along the principal axes of the three-dimensional Cartesian coordinate system (case=0);
[0096] That is, it extends along the six orthogonal principal axes (+Z, -Z, +Y, -Y, +X, -X) of the three-dimensional Cartesian coordinate system to adapt to the anisotropic resolution characteristics of 3D imaging. The resolution of the Z-axis is much lower than that of the XY plane, so a frequency limit is set for the Z-axis extension to avoid excessive axial stretching.
[0097] In this embodiment, the Z-axis is extended bidirectionally as follows:
[0098] Define Z-axis extended counter Only if the frequency condition is met
[0099] When adapting to the conventional XY / Z resolution ratio of biological imaging, bidirectional Z-axis expansion is performed. The frequency condition is used to achieve frequency differentiation between the Z-axis and XY-axis expansions. 10 represents the system's Z-axis resolution, 3.76 represents the camera pixel size, and 7.85 represents the microscope magnification. Therefore, 3.76 / 7.85 represents the system's XY-plane resolution, and 10 / (3.76 / 7.85) represents the ratio of the system's Z-axis to XY-axis resolution. Thus, countz%(10 / (3.76 / 7.85))=0 indicates that the current countz round is an integer multiple of the system's Z-axis to XY-axis resolution ratio. When this condition is met, a Z-axis expansion is performed, thus achieving the preset goal.
[0100]
[0101] The Y-axis is extended bidirectionally as follows:
[0102]
[0103] The X-axis is extended bidirectionally as follows:
[0104]
[0105] Execute after completing one round of spindle direction extension. .
[0106] 2) Expansion along the diagonal of space (case=1);
[0107] In this mode, the expansion extends along the eight diagonal directions of the XYZ space to fill the gaps in the expansion of the principal axis in the plane, ensuring the uniformity and continuity of the expansion in the XYZ space and avoiding the occurrence of "cross-shaped" expansion offsets.
[0108] Specifically, by traversing all displacement combinations Δz∈{−1,0,1}, Δy∈{−1,1}, and Δx∈{−1,1}, a three-dimensional cascaded translation is performed on each displacement combination, and the effective regions after translation are merged into the extended mask G:
[0109]
[0110] In the formula, the translation is first along the Z-axis by Δz, then along the Y-axis by Δy, and finally along the X-axis by Δx, thus achieving a three-dimensional expansion along the diagonal direction of the XYZ space.
[0111] 3) Extend along the diagonal of the specified plane (case=2);
[0112] In this embodiment, the designated plane refers to the YZ plane and the XZ plane, that is, it extends along the diagonal direction of the YZ plane and the XZ plane to fill the expansion gap in the plane where the axial (Z-axis) and lateral (XY-axis) axes intersect, ensuring uniform coverage in all directions of three-dimensional space and avoiding expansion faults between the Z-axis and the XY-axis.
[0113] In the YZ plane diagonal expansion (no displacement along the X-axis, Δx=0): traverse the displacement combinations Δz∈{−1,1} and Δy∈{−1,1}, perform cascaded translations and merge regions:
[0114]
[0115] XZ plane diagonal expansion (no displacement along the Y-axis, Δy=0): Traverse displacement combinations Δz∈{−1,1}, Δx∈{−1,1}, perform cascaded translations and merge regions:
[0116]
[0117] After each expansion is completed, update the current expansion volume and the iteration counter to provide a basis for the next iteration. The formula is:
[0118]
[0119]
[0120] Indicates the current expanded volume. This represents the actual volume of the 3D neuron mask.
[0121] Simultaneously, after expansion, the original neuron mask region is completely removed from the expanded mask to ensure that the nerve fiber region and the neuron cell body region do not overlap, thus avoiding cell body signal contamination during subsequent signal correction. The formula is expressed as:
[0122]
[0123] in To obtain the complement of M.
[0124] This embodiment, through the cyclical alternation of three expansion modes, takes into account the different weights of the XY plane and the Z axis, which can ensure that the nerve fiber region is uniformly distributed in three-dimensional space and closely adjacent to the neuron.
[0125] S32. When the neuron mask is a micromask, an initial neural fiber mask closely adjacent to and continuous with the neuron is rapidly generated through binary expansion of omnidirectional 3D structural elements, ensuring sufficient effective voxels for subsequent segmentation. In one embodiment, the steps include:
[0126] S321, Extended parameter initialization:
[0127] Initialize extended mask Target volume , Indicator of the true volume of the tiny 3D neuron mask, dilation counter Set a maximum safe iteration count of 20 to avoid infinite loops;
[0128] S322. Repeatedly execute the 3D expansion operation until the stopping condition is met. ≥ (reaching the imaging boundary or reaching the maximum safe number of iterations), the formula is:
[0129]
[0130]
[0131]
[0132]
[0133] S4. In an optional embodiment, the initial neural fiber mask generated in S3 is adaptively segmented to solve the problems of misaligned fixed-angle segmentation boundaries, poor spatial continuity, empty small mask sub-regions, and boundary overflow of peripheral neuron sub-regions in the prior art, thereby generating neural fiber sub-regions that are approximately the same volume, spatially continuous, and 100% distributed around neurons.
[0134] In this embodiment, the adaptive segmentation step includes:
[0135] S41. Determine whether the total number of voxels in the initial neural fiber mask exceeds the preset number of segments.
[0136] S42. If not, allocate the voxels in the initial neural fiber mask to each sub-region in a polling manner; in some implementations, for ultra-small scenarios where the number of voxels in the initial neural fiber mask is ≤ the number of segments, polling allocation ensures that each sub-region is allocated at least one voxel (if there are enough voxels) to achieve a 100% non-empty rate for sub-regions. Exemplarily, the steps include:
[0137] S421. Extract the effective voxel coordinates of the initial neural fiber mask: The total number of voxels is ;
[0138] This represents a function used to query the coordinates of non-zero elements in a 3D neural mask G. This represents a list of z-axis, y-axis, and x-axis coordinates for all retrieved elements. This represents a function used to calculate the length of a list, by calculating... The number of non-zero valid voxels can be obtained by determining the list length. ;
[0139] S422. Initialize the sub-mask list: Generate A set of all False boolean arrays of the same size as G, denoted as:
[0140]
[0141] This represents the number of submasks to be generated, consistent with the previous description. for A collection of sub-mask arrays For each sub-mask array;
[0142] S423, Voxel Allocation During Rotation: Allocate the k-th voxel to the k-th voxel. Individual masks ensure even voxel distribution. This indicates the calculation of the current k-th voxel pair. The remainder is given by the formula:
[0143]
[0144] S43. If so, determine the three-dimensional centroid coordinates of the neuron mask; based on the three-dimensional centroid coordinates, adaptively segment the initial neural fiber mask by polar quantile division to obtain multiple neural fiber sub-regions.
[0145] In some implementations, the three-dimensional centroid coordinates are first determined to provide a core anchoring reference for subsequent nerve fiber segmentation, using the neuron's own centroid as the segmentation center to ensure that all segmented sub-regions are distributed around the neuron. In this implementation, the steps include:
[0146] Extract the coordinates of all valid voxels in the neuron mask; that is, obtain the Z, Y, and X coordinates of all voxels in M with a value of True, denoted as: ;
[0147] Calculate the arithmetic mean of the coordinates of all voxels, and use it as the coordinates of the three-dimensional centroid. The formula is expressed as:
[0148]
[0149] Furthermore, for common scenarios where the number of voxels exceeds the number of segments, polar angle offset correction and adaptive segment number adjustment are used to ensure that the segmented sub-regions have approximately the same volume, spatial continuity, and are uniformly distributed around the neurons. Specific steps include:
[0150] S431. Calculate the planar polar angle of each voxel in the initial nerve fiber mask relative to the centroid;
[0151] In this embodiment, the polar angle θ of the XY plane relative to the centroid of the neuron is calculated for each voxel within the neural fiber mask, converting the three-dimensional spatial coordinates into a two-dimensional angle. This simplifies the segmentation logic and ensures the uniformity of segmentation within the plane. The formula is as follows:
[0152]
[0153] in , where is the plane polar angle of the voxel relative to the center of mass.
[0154] S432. The planar polar angle is offset and corrected to address the problem that fixed-angle segmentation boundaries easily pass through voxel-dense regions, causing sub-region breakage. The segmentation boundary is adjusted to a voxel-sparse region to improve the spatial continuity of the sub-region. In some implementations, the steps include:
[0155] Construct a histogram of the planar polar angles, the histogram containing multiple equal-width intervals; that is... Divided into equal-width intervals Count the number of voxels in each interval. ; Indicates the total number of voxels;
[0156] Determine the index of the interval with the fewest voxels in the histogram. ;
[0157] The offset is calculated based on the center position of the interval with the fewest voxels. ; The number of equal-width intervals is represented by bins, which is an array of angle interval separators. bins[i] represents the i-th element in this array. In this example, bins[idxmin] represents the starting angle of the sparsest angle interval, and π / nbins is half the interval width.
[0158] The plane polar angle is corrected using the offset. .
[0159] S433. Based on the corrected polar angle, the number of segments is adaptively adjusted to avoid the problem of some sub-regions completely exceeding the imaging boundary and being empty; the specific steps include:
[0160] Determine the current percentage of non-empty intervals:
[0161]
[0162] This indicates the number of voxels within each interval.
[0163] The number of segments is adjusted using the proportion of non-empty intervals. ,in, and
[0164]
[0165] S434. Determine the segmentation boundary by quantiles to generate multiple nerve fiber sub-regions.
[0166] In this embodiment, based on the corrected polar angle, the segmentation boundary is divided by quantiles to ensure that the number of voxels in each sub-region is approximately equal, thus solving the problem of uneven volume in fixed-angle segmentation. The formula is:
[0167]
[0168] in Percentile function, Let be the polar angle value of the i-th dividing boundary; This indicates the adjusted number of partitions. This indicates the corrected plane polar angle.
[0169] Furthermore, based on the segmentation boundaries, a corresponding Boolean mask is generated for each sub-region:
[0170] The 0th sub-mask: contains all voxels whose corrected polar angle is less than or equal to the first boundary, and is defined by the following formula:
[0171]
[0172] The i-th sub-mask contains all voxels whose corrected polar angles lie between two adjacent boundaries, as shown in the formula:
[0173]
[0174] To further optimize the above technical solution, in this embodiment, the adaptive volume-constrained three-dimensional neural fiber mask generation method further includes:
[0175] S5. For any sub-region of a neural fiber that exceeds the volume of the neuron mask, based on the three-dimensional centroid coordinates, the voxels in the sub-region of the neural fiber that exceeds the volume are truncated according to a preset priority order, so that the volume of the truncated sub-region does not exceed the volume of the neuron mask, thereby solving the problem of loss of highly correlated voxels in existing indiscriminate truncating.
[0176] In some implementation schemes, specific steps include:
[0177] S51, Sub-region Volume Verification: Calculate the volume of each sub-mask. Determine whether the maximum allowable volume (i.e., neuron volume) is exceeded. The formula is:
[0178]
[0179] If all If the submask is oversized, output the submask directly; otherwise, perform priority pruning on the submask.
[0180] S52. Based on the three-dimensional centroid coordinates, the voxels in the neural fiber sub-region of the hypervolume are clipped according to a preset priority order.
[0181] In this embodiment, the cutting principles include:
[0182] ① Axial Priority: Prioritize cropping voxels that are furthest from the neuron's centroid along the Z-axis, adapting to the characteristics of low axial resolution and weak signal correlation in 3D imaging; for example, the absolute Z-axis distance between each voxel and the centroid is: ;
[0183] ② Planar Priority: Within the same Z layer, voxels furthest from the centroid in the XY plane are pruned first, ensuring that the retained voxels are all highly correlated voxels closest to the neuron. The Euclidean distance between each voxel and the centroid in the XY plane is as follows:
[0184]
[0185] Clipping voxels in the supervolume of the aforementioned nerve fiber subregions includes:
[0186] Prioritize the cropped voxels; for example, first sort them by... Sort in descending order (higher priority for items further from the Z-axis, prioritize cropping), same as above. Internal Press Sort in descending order (higher priority for items farther in the XY plane, prioritize cropping); take the first few items after sorting. Individual pixels (volume meets requirements) generate new submasks using the following formula:
[0187]
[0188] Finally, all the cropped submasks are output in their original order, which is the final 3D neural fiber submask.
[0189] This embodiment uses a two-layer distance priority sorting method to prioritize the pruning of voxels farthest from neurons while retaining highly correlated neighboring voxels. This ensures that the volume of each sub-region does not exceed the volume of the neuron, while maximizing the representativeness of nerve fiber signals.
[0190] Compared with existing technologies, this application, through a closed-loop design of the entire process, brings improvements in five dimensions: adaptability to all scenarios, accuracy of signal correction, rationality of spatial distribution, engineering robustness, and scientific research application value.
[0191] 1. Full-scene adaptation, filling the technological gap in micro-neuron processing.
[0192] For 1-8 voxel micro-neuron masks, precise neural fiber signal correction for micro-inhibitory neurons and immature neurons was achieved, solving the core technical bottleneck in the study of inhibitory neural networks in the brain. For irregularly shaped neurons, fragmented masks, and imaging edge neurons, the problems of out-of-bounds expansion, empty sub-regions, and severe volume unevenness were solved, achieving standardized processing of all types of 3D neuron masks.
[0193] 2. The representativeness of nerve fiber signals was significantly improved, and the accuracy of calcium signal correction was increased.
[0194] By employing a distance-priority pruning mechanism, the signal correlation between neurofibrillary voxels and target neurons was improved, providing more reliable signal data for brain science experiments.
[0195] 3. Spatial distribution is comprehensively optimized, and irrelevant background noise is significantly reduced.
[0196] The multi-mode alternating expansion strategy adapts to the anisotropic resolution characteristics of 3D imaging. The centroid-anchored adaptive segmentation ensures that the sub-regions are 100% distributed around the neurons, thereby improving the adjacency rate between the nerve fiber region and the neuron and the uniformity of the sub-regions. It also ensures that there are no outliers or irrelevant voxels, avoiding interference from irrelevant signals on neuron correction.
[0197] 4. Significantly improved engineering robustness and processing efficiency, adaptable to large-scale automated processing.
[0198] The entire process is equipped with boundary checks, safe iteration, and anomaly handling mechanisms, eliminating issues such as infinite loops and program crashes. It can run stably 24 / 7 in large-scale automated processing pipelines. The processing time for a single 100×100×30 3D neuron mask data is ≤1s, meeting the processing requirements of high-throughput 3D imaging data at the whole brain scale.
[0199] 5. It has significant scientific research application value, providing standardized tools for brain science research.
[0200] For the first time, standardized generation of neural fiber masks, ranging from microscopic to full-size 3D neuronal masks, has been achieved, providing a unified processing standard for neuronal research in different brain regions and developmental stages. This solves the problem of inconsistent processing results from different laboratories and researchers. It can be widely applied to multiple core areas of brain science, such as neuronal functional atlas construction, neural circuit analysis, and neurological disease model research, providing a reliable basic tool for the analysis of neuronal network activity at the whole brain scale.
[0201] Furthermore, based on the same inventive concept, embodiments of the present invention also provide an adaptive volume-constrained three-dimensional neural fiber mask generation system, the system comprising:
[0202] The neural fiber mask extension module is used to acquire 3D neuron mask data, classify the 3D neuron mask data based on its volume attributes, and perform differential extension of the neuron mask based on the classification results to obtain an initial neural fiber mask.
[0203] A neural fiber mask segmentation module adaptively segments the initial neural fiber mask, including:
[0204] Determine whether the total number of voxels in the initial neural fiber mask exceeds the preset number of segments.
[0205] If not, the voxels in the initial neural fiber mask are distributed to each sub-region in a polling manner;
[0206] If so, determine the three-dimensional centroid coordinates of the neuron mask; based on the three-dimensional centroid coordinates, adaptively segment the initial neural fiber mask by polar quantile division to obtain multiple neural fiber sub-regions.
[0207] The technical effects produced by the system in this embodiment are the same as those in the aforementioned embodiment of the adaptive volume constraint three-dimensional neural fiber mask generation method. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the aforementioned method embodiment, and will not be repeated here.
[0208] Meanwhile, any content or technical means not mentioned in the embodiments of this invention can be obtained by referring to the prior art. This disclosure does not limit the scope of the invention and therefore will not be elaborated further.
[0209] The embodiments of the present invention have been described in detail above, and the principles and implementation methods of the present invention have been explained. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of the present invention. Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, computer software program products, or electronic devices, etc. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0210] It should be noted that the word "comprising" does not exclude the presence of components or steps not listed in the claims. The words "a" or "an" preceding a component do not exclude the presence of a plurality of such components. This invention can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer.
[0211] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0212] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating a three-dimensional neural fiber mask with adaptive volume constraints, characterized in that, Acquire 3D neuron mask data, classify the 3D neuron mask data based on its volume attributes, and perform differential expansion of the neuron mask based on the classification results to obtain an initial neurofibrillary mask. Adaptive segmentation of the initial neural fiber mask includes: Determine whether the total number of voxels in the initial neural fiber mask exceeds the preset number of segments. If not, the voxels in the initial neural fiber mask are distributed to each sub-region in a polling manner; If so, determine the three-dimensional centroid coordinates of the neuron mask; based on the three-dimensional centroid coordinates, adaptively segment the initial neural fiber mask by polar quantile division to obtain multiple neural fiber sub-regions.
2. The adaptive volume-constrained three-dimensional neural fiber mask generation method as described in claim 1, characterized in that, After acquiring the 3D neuron mask data, preprocessing is performed, including converting the 3D neuron mask data into a Boolean three-dimensional array, and performing binary expansion on the broken and discontinuous neuron masks in the array.
3. The adaptive volume-constrained three-dimensional neural fiber mask generation method as described in claim 1, characterized in that, Differential expansion of the neuron mask based on classification results includes: When the neuron mask is a conventional mask, the expansion along the principal axis of the three-dimensional Cartesian coordinate system, the expansion along the spatial diagonal, and the expansion along the diagonal of a specified plane are performed through multiple rounds of iterative loops. When the neuron mask is a tiny mask, a 3D dilation operation is performed.
4. The adaptive volume-constrained three-dimensional neural fiber mask generation method as described in claim 1, characterized in that, Determining the three-dimensional centroid coordinates of the neuron mask includes: Extract the coordinates of all voxels in the neuron mask; Calculate the arithmetic mean of the coordinates of all voxels, and use it as the coordinates of the three-dimensional centroid.
5. The adaptive volume-constrained three-dimensional neural fiber mask generation method as described in claim 1, characterized in that, Based on the three-dimensional centroid coordinates, the initial neural fiber mask is adaptively segmented using polar quantile partitioning to obtain multiple neural fiber sub-regions, including: Calculate the planar polar angle of each voxel in the initial neural fiber mask relative to the three-dimensional centroid; The polar angle of the plane is offset and corrected; Based on the corrected polar angle, the number of segments is adaptively adjusted, and the segmentation boundary is determined by the quantile to generate multiple nerve fiber sub-regions.
6. The adaptive volume-constrained three-dimensional neural fiber mask generation method as described in claim 5, characterized in that, The offset correction of the plane polar angle includes: Construct a histogram of the planar polar angle, the histogram containing multiple equal-width intervals; Determine the interval with the fewest voxels in the histogram; The offset is calculated based on the center position of the interval with the fewest voxels; the offset is then used to correct the polar angle of the plane.
7. The method for generating a three-dimensional neural fiber mask with adaptive volume constraints as described in claim 5, characterized in that, Based on the corrected polar angle, the number of segments is adaptively adjusted, including determining the current proportion of non-empty intervals and adjusting the number of segments using the proportion of non-empty intervals.
8. The method for generating a three-dimensional neural fiber mask with adaptive volume constraints as described in claim 1, characterized in that, Also includes: For any sub-region of a neural fiber that exceeds the volume of the neuron mask, based on the three-dimensional centroid coordinates, voxels in the sub-region of the neural fiber that exceeds the volume are clipped according to a preset priority order, so that the volume of the clipped sub-region does not exceed the volume of the neuron mask.
9. The method for generating a three-dimensional neural fiber mask with adaptive volume constraints as described in claim 8, characterized in that, The priority order is determined based on the axial and planar distances from the voxel to the three-dimensional centroid coordinates, including: ① Axial priority: Voxels that are farther away from the Z-axis of the three-dimensional centroid coordinate system are preferentially cut; ② Plane priority: For voxels with the same axial distance, voxels that are farther away from the three-dimensional centroid coordinate XY plane are preferentially clipped; Prioritize the cropped voxels; retain those that appear earlier in the sort. Individual elements generate new sub-region masks. The target volume of the neuron mask is denoted as .
10. An adaptive volume-constrained three-dimensional neural fiber mask generation system, characterized in that, A method for generating a three-dimensional neural fiber mask with adaptive volume constraints as described in any one of claims 1-9, comprising: The neural fiber mask extension module is used to acquire 3D neuron mask data, classify the 3D neuron mask data based on its volume attributes, and perform differential extension of the neuron mask based on the classification results to obtain an initial neural fiber mask. A neural fiber mask segmentation module adaptively segments the initial neural fiber mask, including: Determine whether the total number of voxels in the initial neural fiber mask exceeds the preset number of segments. If not, the voxels in the initial neural fiber mask are distributed to each sub-region in a polling manner; If so, determine the three-dimensional centroid coordinates of the neuron mask; based on the three-dimensional centroid coordinates, adaptively segment the initial neural fiber mask by polar quantile division to obtain multiple neural fiber sub-regions.
Citation Information
Patent Citations
Method, device, equipment, product and storage medium for identifying skull defect by constructing characteristic spectrum through nuclear magnetic image
CN120953270A
Image segmentation for sets of objects
US20230207106A1