A method for automatically generating rodent brain clearing templates

The method automates the generation of transparent rodent brain templates from PDF atlases, addressing inefficiencies in existing methods by enabling batch processing and adjustable line characteristics for improved image registration efficiency.

CN116823982BActive Publication Date: 2024-12-27XIANGYANG CENT HOSPITAL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310656416.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-05
Publication Date
2024-12-27
Estimated Expiration
2043-06-05

AI Technical Summary

Technical Problem

Existing methods for generating rodent brain transparency templates for image registration are cumbersome and inefficient, requiring complex post-processing of PDF-formatted rodent brain atlases, which hinders batch processing and automation in neuroscience research.

Method used

A method for automatically converting PDF rodent brain atlases to JPG format, processing them into RGB and grayscale matrices, preprocessing, cropping, and generating transparent templates with adjustable line thickness and color, suitable for batch processing and registration of magnetic resonance and immunohistochemistry images.

Benefits of technology

Facilitates efficient, automated generation of transparent rodent brain templates, enabling batch processing and reducing manual effort, while allowing for adjustable line characteristics for various brain map sizes and proportions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116823982B_ABST
    Figure CN116823982B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for automatically generating a transparent template of a rodent brain, extracting a whole brain atlas picture to be processed based on a rodent template; converting the whole brain atlas picture into three-color matrix data; converting the three-color matrix data into grayscale matrix data; preprocessing the grayscale matrix data based on the distribution of feature data; cutting the grayscale matrix data to generate a template picture; performing transparent processing on the final template matrix to obtain a transparent brain atlas and atlas file; setting the line thickness and color of the atlas file, and performing stroke processing on the lines. The present invention can automatically generate a transparent brain atlas for brain image registration, has an automation function compared to the prior art, and saves time and effort.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image processing, and in particular to a method for automatically generating a rodent brain transparency template, which is suitable for extracting key atlas information from rodent brain maps and for registering later magnetic resonance images and rodent brain immunohistochemical maps. Background Art

[0002] Brain science is a major challenge facing mankind in the 21st century. Understanding the working mechanism of the brain is of great significance to brain health, brain protection and seizing the commanding heights of international competition. On the other hand, the human brain neural network is composed of about 10 11 Various types of neurons with specific morphology and function, through about 10 15 The complex structure formed by synaptic connections is the structural basis for the brain to perform cognitive, learning, memory, and other emotional functions. Brain mapping is an indispensable key tool for systematic research on brain networks.

[0003] At present, most of the neuroscience research groups in the world use rodents (mice and rats) as animal models to study the neural mechanisms of brain function under physiological conditions. This is mainly because the experimental methods of rodent research have been highly developed, and many neural circuit mechanisms may be conserved between rodents and humans. On the other hand, the atlas of rodents has been maturely established and the results have been shared. For example, the mouse atlas The Mouse Brain in Stereotaxic Coordinates Third Edition (Keith BJ Fraklin & George Paxinos, 2007) and the rat atlas The rat brain in stereotaxic coordinates, 5 th edition (George Paxinos & Charles Watson), etc. However, these atlases are in PDF format, and image registration requires complex post-processing, which brings great inconvenience to users.

[0004] For example, magnetic resonance imaging and immunohistochemistry techniques commonly used in brain science research can produce living images of the brain or brain slice images. In order to locate and process specific signals in the brain or on brain slices, the above-mentioned maps need to be matched and preprocessed before they can be used in subsequent image registration work.

[0005] In brain science research, a large amount of image data often needs to be processed in batches, so there is an urgent need to generate a set of transparent rodent templates that can be used for brain image registration. However, at present, there is no new method for automatically generating transparent rodent templates that can be used for brain image registration for ordinary researchers. Summary of the invention

[0006] The present invention aims to solve the above-mentioned technical problems existing in the prior art and provides a method for automatically generating a rodent brain transparency template, which can be adapted to extract key atlas information in rodent brain maps and used for subsequent registration of magnetic resonance images and rodent brain immunohistochemistry maps.

[0007] The above technical problems of the present invention are mainly solved by the following technical solutions:

[0008] A method for automatically generating a rodent brain clearing template comprises the following steps:

[0009] Step 1: Convert the pdf file of the rodent template into a whole-brain atlas image file in jpg format, and extract the whole-brain atlas image to be processed;

[0010] Step 2: Read the whole brain atlas image and convert it into three-color matrix data in RGB format;

[0011] Step 3: Convert the three-color matrix data into grayscale matrix data;

[0012] Step 4: Preprocess the gray matrix data based on the distribution of feature data;

[0013] Step 5: Crop the grayscale matrix data and generate the corresponding template image in jpg format;

[0014] Step 6: Batch read the final template matrix corresponding to each template image, make the grayscale values ​​greater than 200 in the final template matrix transparent, and further generate each transparent brain map, and save each transparent brain map as a transparent map file in png format;

[0015] Step 7: Set the line thickness and color of the transparent image file in png format, select the lines in the transparent image file in png format and stroke the lines.

[0016] As described above, step 4 includes the following steps: assigning grayscale values ​​less than 100 and greater than 140 in the grayscale matrix data to 255, and assigning grayscale values ​​greater than or equal to 100 and less than or equal to 140 in the grayscale matrix data to 0.

[0017] Step 5 as described above includes the following steps:

[0018] Step 5.1: Subtract each gray value of the gray matrix data from 255 to obtain a new graphic data matrix;

[0019] Step 5.2: Sum the grayscale values ​​of the same row of the new graphic data matrix to obtain a one-dimensional column matrix C1; Sum the grayscale values ​​of the same column of the new graphic data matrix to obtain a one-dimensional row matrix R1;

[0020] Step 5.3: The first position where a non-zero gray value appears from left to right in the one-dimensional row matrix R1 is the leftmost position L of the graphic data matrix. Loc , the first position with a non-zero gray value from right to left is the rightmost position R of the graphic data matrix Loc ;

[0021] Step 5.4: The first position where a non-zero gray value appears from top to bottom in the one-dimensional column matrix C1 row matrix is ​​the top position U of the graphic data matrix. Loc , the first position with a non-zero gray value from bottom to top is the bottom position D of the graphic data matrix Loc ;

[0022] Step 5.5: The final template matrix is ​​the leftmost position L in the new graphic data matrix Loc , rightmost position R Loc , top position U Loc and the bottom position D Loc The limited data matrix saves the final template matrix as a template image in jpg format.

[0023] Step 6 as described above includes the following steps:

[0024] Step 6.1: Set the alpha matrix. The size of the alpha matrix is ​​consistent with the size of the final template matrix. Set the positions in the alpha matrix corresponding to the positions of the grayscale values ​​greater than 200 in the final template matrix to 0;

[0025] Step 6.2: The final template matrix and the alpha matrix are jointly saved as a transparent brain map, and each transparent brain map is saved as a transparent map file in png format.

[0026] A computer-readable storage medium stores a computer program, which implements steps 1-7 when executed by a processor.

[0027] An electronic device includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the instructions are executed by the processor, the processor executes steps 1-7.

[0028] Compared with the prior art, the present invention has the following advantages:

[0029] 1. This method can automatically generate transparent brain maps for brain image registration, which has automation functions and saves time and effort compared with the existing technology;

[0030] 2. This method can automatically generate a whole-brain atlas of the rodent brain, which has the advantage of batch processing and is much more efficient than the existing single-image manual processing;

[0031] 3. The line color and thickness of the transparent brain map obtained by this method are adjustable, which is suitable for the registration of brain maps of various sizes and proportions. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 This is a schematic diagram of a whole-brain atlas image of a rat.

[0033] Figure 2 It is a flow chart of the present invention.

[0034] Figure 3 is the preprocessed grayscale matrix data Matrix gray 's graph.

[0035] Figure 4 It is the map corresponding to the final template matrix after removing the boundary.

[0036] Figure 5 It is the cut template image corresponding to all the rat whole brain atlas images in the embodiment.

[0037] Figure 6 This is a brain map after being made transparent.

[0038] Figure 7 It is the brain atlas processed with transparency corresponding to all the rat whole brain atlas images in the embodiment.

[0039] Figure 8 This is a diagram showing the outline of a transparent brain map.

[0040] Fig. 9 This is a picture of fine-tuning the color of the borders of the transparent brain map. DETAILED DESCRIPTION

[0041] In order to facilitate those skilled in the art to understand and implement the present invention, the present invention is further described in detail below in conjunction with embodiments. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention and are not used to limit the present invention.

[0042] Example:

[0043] like Figure 2A method for automatically generating a rodent brain clearing template is shown, comprising the following steps:

[0044] Step 1: First, convert the pdf file of the rodent template into a whole brain atlas image file in jpg format, and extract the whole brain atlas image to be processed. In this embodiment, the whole brain atlas image is the mouse whole brain atlas image The Mouse Brain in Stereotaxic Coordinates Third Edition (Keith BJ Fraklin & George Paxinos, 2007) pages 28-127; and the rat whole brain atlas image The rat brain in stereotaxic coordinates, 5 th ed.(George Paxinos & Charles Watson), pp. 41-201.

[0045] Step 2: Read the whole brain atlas images in sequence based on the program (such as MATLAB, etc.), that is, convert the whole brain atlas images into RGB format ( Figure 1 )'s three-color matrix data (Matrix rgb );

[0046] Step 3: Matrix the three-color matrix data rgb Convert to grayscale matrix data Matrix gray , gray matrix data Matrix gray The pixel value range is 0-255; through comprehensive research, the gray matrix data Matrix gray The characteristic data mainly includes the grayscale value corresponding to the white pixel (the grayscale value is 255), the grayscale value corresponding to the black pixel (the grayscale value is 0), and the grayscale value corresponding to the gray pixel (representing the grid line - such as Figure 1 As shown - the gray value is between 140 and 160), the gray value corresponding to the pixel point of the light blue line of the spectrum (representing the spectrum line - such as Figure 1 As shown, the grayscale value is between 100 and 140) and the grayscale values ​​corresponding to other corner annotation pixels (representing bright blue annotations - such as Figure 1 As shown, the grayscale value is between 90 and 100).

[0047] Step 4: Given the grayscale matrix data Matrix gray The distribution range of the characteristic data is firstly gray The data values ​​of the medium gray pixels and the black pixels become white pixels, that is:

[0048] Gray matrix data Matrixgray The grayscale values ​​less than 100 (black and light blue notes) and greater than 140 (gray) are assigned a value of 255 to make them white pixel data values; the grayscale matrix data Matrix gray The grayscale values ​​(light blue line) between 100 and 140 are assigned a value of 0, which is a black line. Finally, the preprocessed grayscale matrix data Matrix is ​​obtained. gray ,like Figure 3 shown.

[0049] Step 5: Crop the shape ( Figure 3 ), only the remaining template part ( Figure 4 ), as follows:

[0050] Step 5.1: Subtract the preprocessed grayscale matrix data Matrix from 255 gray Each gray value is obtained to obtain a new graphic data matrix (Matrix new );

[0051] Step 5.2: Create a new graphic data matrix Matrix new Sum the grayscale values ​​of each row to obtain a one-dimensional column matrix (C1); for the new graphic data matrix Matrix new Sum the gray values ​​in the same column to obtain a one-dimensional row matrix (R1);

[0052] Step 5.3: For the one-dimensional row matrix R1, the first position where a non-zero gray value appears from left to right is the graphic data matrix Matrix new The leftmost position (L Loc ), the first position with a non-zero gray value from right to left is the graphic data matrix Matrix new The rightmost position (R Loc );

[0053] Step 5.4: For the one-dimensional column matrix C1, the first position where a non-zero gray value appears from top to bottom is the graphic data matrix Matrix new The uppermost position (U Loc ), the first position with a non-zero gray value from bottom to top is the graphic data matrix Matrix new The lowest position (D Loc );

[0054] Step 5.5: Final Template Matrix template ) is the new graphic data matrix Matrix new From the leftmost position L Loc , rightmost position R Loc , top position ULoc and the bottom position D Loc The limited data matrix is Figure 4 As shown, the final template matrix (Matrix template )Save as a template image in jpg format.

[0055] Batch read the whole brain atlas images, implement the above steps, and obtain the corresponding final template matrices and the corresponding cut template images, such as Figure 5 shown.

[0056] Step 6: Batch read the final template matrix Matrix corresponding to each cut template image template , the final template matrix Matrix template The grayscale values ​​greater than 200 are transparentized, and each transparentized brain map is further generated, and each transparentized brain map is saved as a transparently processed map file in png format, such as Figure 7 As shown, the specific steps include:

[0057] Step 6.1: Set an alpha matrix. alpha ) and the final template matrix Matrix template In Matlab, the alpha value is 0 for transparent and 1 for completely opaque. So the final template matrix Matrix template The grayscale values ​​(white) greater than 200 are extracted and the alpha matrix Matrix alpha The corresponding position is set to 0;

[0058] Step 6.2: The final template matrix Matrix template and the alpha matrix Matrix alpha Combined and saved into a transparent brain map (such as Figure 6 As shown in the figure), each transparent brain map is saved as a transparent map file in png format, which can be used for subsequent registration analysis.

[0059] Step 7: Set the line thickness and color of the transparent png file. Select the lines in the transparent png file and stroke them. Figure 8 As shown, the pixel point of the stroke is 14px; in addition, the color of the line can also be adjusted, such as Fig. 9 shown.

[0060] A computer-readable storage medium stores a computer program, which implements steps 1-7 when executed by a processor.

[0061] An electronic device includes a memory and a processor, wherein the memory stores computer-readable instructions, and when the instructions are executed by the processor, the processor executes steps 1-7.

[0062] It should be noted that the specific embodiments described in the present invention are merely examples of the spirit of the present invention. Those skilled in the art may make various modifications or additions to the specific embodiments described or replace them in similar ways, but they will not deviate from the spirit of the present invention or exceed the scope defined by the attached claims.

Claims

1. A method for automatically generating a rodent brain clearing template, characterized in that: The following steps are involved: Step 1: Convert the pdf file of the rodent template into a whole-brain atlas image file in jpg format, and extract the whole-brain atlas image to be processed; Step 2: Read the whole brain atlas image and convert it into three-color matrix data in RGB format; Step 3: Convert the three-color matrix data into grayscale matrix data; Step 4: Preprocess the gray matrix data based on the distribution of feature data; Step 5: Crop the grayscale matrix data and generate the corresponding template image in jpg format; Step 6: Batch read the final template matrix corresponding to each template image, make the grayscale values ​​greater than 200 in the final template matrix transparent, and further generate each transparent brain map, and save each transparent brain map as a transparent map file in png format; Step 7: Set the line thickness and color of the transparent png file, select the lines in the transparent png file and stroke them. The step 4 comprises the following steps: assigning a grayscale value less than 100 and greater than 140 in the grayscale matrix data to 255, assigning a grayscale value greater than or equal to 100 and less than or equal to 140 in the grayscale matrix data to 0, The step 5 comprises the following steps: Step 5.1: Subtract each gray value of the gray matrix data from 255 to obtain a new graphic data matrix; Step 5.2: Sum the grayscale values ​​of the same row of the new graphic data matrix to obtain a one-dimensional column matrix C1; Sum the grayscale values ​​of the same column of the new graphic data matrix to obtain a one-dimensional row matrix R1; Step 5.3: The first position where a non-zero gray value appears from left to right in the one-dimensional row matrix R1 is the leftmost position L of the graphic data matrix. Loc , the first position with a non-zero gray value from right to left is the rightmost position R of the graphic data matrix Loc ; Step 5.4: The first position where a non-zero gray value appears from top to bottom in the one-dimensional column matrix C1 row matrix is ​​the top position U of the graphic data matrix. Loc , the first position with a non-zero gray value from bottom to top is the bottom position D of the graphic data matrix Loc ; Step 5.5: The final template matrix is ​​the leftmost position L in the new graphic data matrix Loc , rightmost position R Loc , top position U Loc and the bottom position D Loc The limited data matrix saves the final template matrix as a template image in jpg format.

2. A method for automatically generating a rodent brain transparent template according to claim 1, characterized in that: The step 6 comprises the following steps: Step 6.1: Set the alpha matrix. The size of the alpha matrix is ​​consistent with the size of the final template matrix. Set the positions in the alpha matrix corresponding to the positions of the grayscale values ​​greater than 200 in the final template matrix to 0; Step 6.2: The final template matrix and the alpha matrix are jointly saved as a transparent brain map, and each transparent brain map is saved as a transparent map file in png format.

3. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 2 is implemented.

4. An electronic device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the instructions are executed by the processor, the processor executes the method as claimed in any one of claims 1 to 2.