Disclosure of Invention
The invention aims to provide a multi-magnification digital slice image storage and browsing method which is high in speed, strong in robustness and good in universality aiming at the application requirement of large-scale concurrent access of digital slices, and provides a digital slice image storage and browsing system which is easy to realize and deploy based on the method.
In order to achieve the purpose, the invention adopts the following technical scheme to solve the problem:
a method for storing and browsing multiple-rate digital slice images comprises the following steps:
step 1: acquiring a digital slice, and acquiring a whole preview image of the digital slice;
step 2: dividing an organized part in the overall preview image of the digital slice and generating an original magnification scanning map;
and step 3: constructing an exclusive directory of the digital slice in a file system, storing metadata contents such as patient clinical information, tissue part information, slice scanning information and the like of the digital slice, and storing a whole preview image, a label image and an original magnification scanning map of the slice;
and 4, step 4: dividing the digital slice into a plurality of tile images with the same size according to an original multiplying power scanning map, and storing the tile images according to path information generated by a map projection transformation formula;
and 5: the method comprises the steps of generating a plurality of low-magnification scanning maps according to original-magnification scanning map downsampling, downsampling a digital slice according to a newly generated low-magnification scanning map, dividing the digital slice into a plurality of tile images with the same size, and storing the tile images according to path information generated by a map projection transformation formula;
step 6: and browsing the digital slices, converting the digital slices into path information of the required tile image according to the initial longitude and latitude coordinates and the scale information, and reconstructing the digital slices according to the map coordinates.
In the method, the mode of acquiring the digital slice is one of the following modes: the digital slice scanning device creates, parses an existing digital slice file, invokes a commercial digital slice system programming interface.
The size of the original magnification scan map is determined by the following method: assuming that the width of the digital slice is W, the height of the digital slice is H, the width of the tile image is m-th power of 2, and the height of the tile image is n-th power of 2, the width W of the original magnification scanning map is W0=ceil(W/2m) Height h of original magnification scan map0=ceil(H/2n). m and n preferably have values of 7, 8, 9, 10,the optimal value is m-n-8.
Under different multiplying powers, the size of the scanning map is represented by multiplying power z, and the width of the z multiplying power scanning map
Height of z-magnification scan map
Under different multiplying powers, the size of the reconstructed digital slice is represented by the multiplying power z, and the width W of the reconstructed digital slicez=wz×2mReconstructing the height H of the digital slicez=hz×2n。
In the above, ceil is the smallest integer not less than a given value.
In the method, the map projection transformation formula adopted in the step 4 is one of the following formulas:
mercator projection, gaussian-Kruger projection, universal transverse axis Mercator (UTM) projection, and Lambert equiangular (Lambert) projection. A preferred map projection transformation formula is the Mercator projection.
In the method, a tile image path is composed of information such as an exclusive directory dir, a multiplying power z, a longitude mapping value lon, a latitude mapping value lat and the like of a digital slice.
The calculation method of the superior longitude mapping value and latitude mapping value comprises the following steps:
describing the position of the tile image in the digital slice by using the pixel position (x, y) of the scan map corresponding to the magnification z, the longitude mapping value lon corresponding to x is:
the latitude mapping value lat corresponding to y is:
wherein Lo is a longitude value corresponding to the center of the digital slice, and La is a latitude value corresponding to the center of the digital slice; w is a
zWidth of the scanned map, h, corresponding to magnification z
zThe height of the scanned map corresponding to the multiplying power z; ceil is the minimum integer not less than the given value, round is the rounding evaluation of the given value, floor is the minimum integer not more than the given value, log is the natural logarithm of the given value, tan is the tangent value of the given value, and cos is the cosine value of the given value; n is a positive integer, and the value is larger than the maximum value of the multiplying power z. The longitude map value lon and the latitude map value lat are calculated as integers.
The preferred tile image path organization method is as follows:
and generating a corresponding magnification subdirectory according to the magnification z under the exclusive directory dir of the digital slice, generating a corresponding longitude subdirectory according to the longitude mapping value lon under the magnification subdirectory, and using the latitude mapping value lat as the file name of the tile image. For the tile image with the file suffix name of type, the corresponding path information is dir \ N-z \ lon \ lat.
A system for multiple-rate digital slice image storage and browsing, comprising:
the metadata read-write module: the method is used for writing and reading the metadata contents such as patient clinical information, tissue part information, slice scanning information and the like of the digital slice;
the file directory management module: for the creation and management of a digital slice-specific directory, a corresponding tile image storage directory;
a longitude and latitude coordinate and image path analysis module: generating longitude and latitude coordinates and a file path for the tile image;
the tile image reading and writing module: the tile image is stored and read according to the longitude and latitude coordinates and the file path generated by the image path analysis module;
a preview image reading and writing module: writing and reading of the slice whole preview image;
the map scanning read-write module: down-sampling and segmenting from a global preview image of the digital slice, scanning positions for recording and reading tile images;
a label image reading and writing module: for storage and reading of slice label images;
the digital slice reconstruction and browsing module comprises: automatically retrieving the required tile images according to the clinical information, the tissue part information, the slice scanning information and the image storage information of the patient of the digital slice, and arranging the tile images according to the longitude mapping value and the latitude mapping value in a browsing window to realize the reconstruction and the browsing of the digital slice;
a file system: a file management system for managing and storing the above metadata file, tile image, preview image, scan map, label image.
In the system, the digital slice reconstruction and browsing module is provided with a boundary consisting of longitude and latitude coordinates, the center longitude of the boundary is a longitude value Lo corresponding to the center of the digital slice, and the center latitude of the boundary is a latitude value La corresponding to the center of the digital slice. A preferred value is Lo ═ La ═ 0 °.
In the system, a browsing window of a digital slice reconstruction and browsing module comprises elements such as a reconstructed slice image, a label image, a preview navigation part, a magnification selection part, a scale part, slice copyright information and the like. The label image, the preview navigation component and the magnification selection component float above the reconstructed slice image, can be dragged and can be combined. The elements have two states of display and hiding, become a schematic button in the hidden state, and click the button to switch to the display state.
The invention has the following beneficial effects:
the invention converts the storage and browsing of the digital slice into the standard storage and display of the map data, the organization of the file system meets the requirement of large-scale concurrent access, and the rapid browsing of the multi-magnification digital slice image is realized based on an open map browsing mode.
The method has good universality, is convenient and quick to retrieve and position, and is suitable for large-scale concurrent access of the digital slices;
the invention provides a method for storing and browsing multi-magnification digital slice images, which has high speed, strong robustness and good universality and aims at the application requirement of large-scale concurrent access of digital slices.
Detailed Description
The present invention will be described in detail with reference to the accompanying drawings and examples.
The invention belongs to the field of digital slicing, and particularly relates to a method and a system for storing and browsing a multi-magnification digital slice image. The invention is used for carrying out standardized splitting, storage and browsing on digital slice images generated by different scanning devices.
As shown in fig. 1, a method for storing and browsing multiple-rate digital slice images includes the following operations:
firstly, acquiring a digital slice (101), and acquiring a digital slice whole preview image (102);
then, an organized part is divided in the whole preview image of the digital slice, and an original magnification scanning map (103) is generated according to the size proportional relation of the digital slice and the tile image;
then, constructing an exclusive directory of the digital slice in a file system, storing metadata contents such as patient clinical information, tissue part information, slice scanning information and the like of the digital slice, and storing a preview image, a label image and a scanning map of the slice;
then, dividing the digital slice into a plurality of tile images with the same size according to the original multiplying power scanning map, and storing the tile images according to path information generated by a map projection transformation formula (104);
then, a plurality of low-magnification scanning maps (105) are generated according to the original-magnification scanning map by down-sampling, the digital slices are down-sampled according to the newly generated low-magnification scanning map and are divided into a plurality of tile images with the same size, and the tile images (106) are stored according to path information generated by a map projection transformation formula;
and browsing the digital slices, converting the digital slices into path information of the required tile image according to the initial longitude and latitude coordinates and the scale information, and reconstructing the digital slices according to the map coordinates (107).
In the method, the digital slice (101) can be acquired by any one of the following modes: the digital slice scanning device creates, parses an existing digital slice file, invokes a commercial digital slice system programming interface.
The manner in which the digital slice preview image (102) is acquired may be by any of the following: photographing the actual integral slice which exists physically; down-sampling from the digital slice; and calling a commercial digital slicing system programming interface to obtain the data.
As shown in fig. 2, 201 is a digital slice whole preview image obtained by photographing a physically existing actual whole slice in the present embodiment, and 202 is a digital slice whole preview image obtained by down-sampling a digital slice in the present embodiment. The digital slice preview image 202 is segmented into regions of interest to obtain organized regions on the digital slice. And generating a scanning map, wherein the organized area is 1, the unorganized background area is 0, and the area with the median value of 1 in the scanning map generates the tile image.
The size of the original magnification scanning map is determined by the following method: assuming that the width of the digital slice is W, the height of the digital slice is H, the width of the tile image is m-th power of 2, and the height of the tile image is n-th power of 2, the width W of the original magnification scanning map is W0=ceil(W/2m) Height h of original magnification scan map0=ceil(H/2n) Ceil is the smallest integer not less than a given value. m and n preferably have values of 7, 8, 9 and 10, and most preferably have values of m ═ n ═ 8. In fig. 2, if the pixel width of the digital slice is W40128, the pixel height of the digital slice is H96944, the width of the tile image is 256 (i.e., m 8), and the height of the tile image is 256 (i.e., n 8), the width W of the generated original magnification scan map 203 is W0157, height h0=379。
Down-sampling generation is lowMagnification scan map (105): under different multiplying powers, the size of the scanning map is represented by multiplying power z, and the width of the z multiplying power scanning map
Height of z-magnification scan map
As shown in fig. 2: when z is 0, characterizing an original
magnification scan map 203; when z is 1, the width w of the
scan map 204 is 1-magnification
179, height h
1190; when z is 2, the width w of the
scan map 205 is 2-fold
2Height h 40
295; when z is 3, the width w of the
scan map 206 is 3-fold
320, height h
3=48。
Under different multiplying powers, the size of the reconstructed digital slice is represented by the multiplying power z, and the width W of the reconstructed digital slicez=wz×2mReconstructing the height H of the digital slicez=hz×2n。
And (4) dividing the digital slice to generate and store tile images with different multiplying powers, and calculating a storage path for generating the tile images by using a map projection transformation formula. 104 and 106 is one of the following: mercator projection, gaussian-Kruger projection, universal transverse axis Mercator (UTM) projection, and Lambert equiangular (Lambert) projection. A preferred map projection transformation formula is the Mercator projection.
In this embodiment, the tile image path is composed of information such as the exclusive directory dir of the digital slice, the magnification z, the longitude mapping value lon, and the latitude mapping value lat.
In this embodiment, the longitude mapping value and the latitude mapping value are calculated by: describing the position of the tile image in the digital slice by using the pixel position (x, y) of the scan map corresponding to the magnification z, the longitude mapping value lon corresponding to x is:
the latitude mapping value lat corresponding to y is:
wherein Lo is a longitude value corresponding to the center of the digital slice, and La is a latitude value corresponding to the center of the digital slice; w is a
zWidth of the scanned map, h, corresponding to magnification z
zThe height of the scanned map corresponding to the multiplying power z; ceil is the minimum integer not less than the given value, round is the rounding evaluation of the given value, floor is the minimum integer not more than the given value, log is the natural logarithm of the given value, tan is the tangent value of the given value, and cos is the cosine value of the given value; n is a positive integer, and the value is larger than the maximum value of the multiplying power z. The longitude map value lon and the latitude map value lat are calculated as integers.
In the embodiment of the invention, the adopted tile image path organization method comprises the following steps: and generating a corresponding magnification subdirectory according to the magnification z under the exclusive directory dir of the digital slice, generating a corresponding longitude subdirectory according to the longitude mapping value lon under the magnification subdirectory, and using the latitude mapping value lat as the file name of the tile image. For the tile image with the file suffix name of type, the corresponding path information is dir \ N-z \ lon \ lat. Suppose that the exclusive directory dir of a digital slice is "D: \ Slides \ 001", when N ═ 18, the longitude mapping value under 1 magnification is 65580, the latitude mapping value is 65636, and the image file suffix name is png, then the path corresponding to the tile image is "D: \ Slides \001\17\65580\65636. png".
Referring to fig. 3, a system for storing and browsing multiple-rate digital slice images according to an embodiment of the present invention includes:
the metadata read-write module 301: the method is used for writing and reading the metadata contents such as patient clinical information, tissue part information, slice scanning information and the like of the digital slice;
file directory management module 302: for the creation and management of a digital slice-specific directory, a corresponding tile image storage directory;
a longitude and latitude coordinate and image path analysis module 303: generating longitude and latitude coordinates and a file path for the tile image;
tile image read-write module 304: the tile image is stored and read according to the longitude and latitude coordinates and the file path generated by the image path analysis module;
scan map read/write module 305: down-sampling and segmenting from a global preview image of the digital slice, scanning positions for recording and reading tile images;
the tag image read-write module 306: for storage and reading of slice label images;
preview image reading and writing module 307: writing and reading of the slice whole preview image;
digital slice reconstruction and browsing module 308: automatically retrieving the required tile images according to the clinical information, the tissue part information, the slice scanning information and the image storage information of the patient of the digital slice, and arranging the tile images according to the longitude mapping value and the latitude mapping value in a browsing window to realize the reconstruction and the browsing of the digital slice;
file system 309: a file management system for managing and storing the above metadata file, tile image, preview image, scan map, label image.
In this embodiment, the digital slice reconstructing and browsing module 308 has a boundary composed of longitude and latitude coordinates, where the center longitude of the boundary is the longitude value Lo corresponding to the center of the digital slice, and the center latitude of the boundary is the latitude value La corresponding to the center of the digital slice. A preferred value is Lo ═ La ═ 0 °.
Referring to fig. 4, a browse window of the digital slice reconstruction and browse module 308 includes elements of a reconstructed slice image 401, a tab image 402, a preview navigation section 403, a magnification selection section 404, a scale section 405, slice copyright information 406, and the like. In the present embodiment, the label image 402, the preview navigation part 403, and the magnification selection part 404 float above the reconstructed slice image 401.
The tab image 402, the preview navigation part 403, the magnification selection part 404, and the scale part 405 may be dragged by using a mouse, or may be dragged by a finger or a touch pen when supported by a touch device. As shown in fig. 5, the manner of operation on a touch screen display device is given. The above elements have two states of display and hiding. The tag image 402 is in a display state, and clicking on the header portion of the tag image 402 brings the element into a hidden state. In the hidden state, a gesture button 501 is formed, and clicking the button 501 switches back to the display state. The tag image 402 and the preview navigation section 403 may be combined into one switchable function section when the positions overlap. When the label image 402 is dragged over the preview navigation feature 403, both will combine into one function switchable feature 502, and clicking on the icon switches the function.
The preview navigation part 403 has a viewing area box 503 thereon, and dragging the viewing area box 503 can control the contents displayed in the browse window. When the viewing area box 503 changes position, the viewing window will load a new set of tile images and generate a new reconstructed slice image 504. The display magnification of the current digital section can be selected by the magnification selection unit 404, and the display magnification is organized according to the magnification of a conventional biological microscope objective, and includes options of 40 times, 20 times, 10 times, 5 times, 2.5 times and the like, and also supports manual setting. The scale section 405 displays the relationship between the pixel size at the current display magnification and the physical size. When the magnification is switched, the scale and content of the scale component 405 will be updated. The slice copyright information 406 shows information on a digital slice creation unit and a software authoring unit.
The above-described embodiments are merely preferred embodiments of the present invention, which should not be construed as limiting the invention. Various changes and modifications may be made by one of ordinary skill in the pertinent art without departing from the spirit and scope of the present invention. Therefore, the technical scheme obtained by adopting the mode of equivalent replacement or equivalent transformation is within the protection scope of the invention.