A kind of bianry image connected region paralleled detection method and system
Technical field
The present invention relates to bianry image connected region detection field, particularly relate to a kind of bianry image connected region paralleled detection method and system.
Background technology
In high flux biological detection, reaction site identification a large amount of in data image is one of core procedure.Image obtains through early stage the bianry image reflecting chip hole configuration state after process.How to determine the number of connected region in the images fast, key that center and size (i.e. the number in hole, position, size) are recognition technology, directly affect the performance of image detection algorithm.
Current connected region detection algorithm is mainly based on Run-Length Coding.The thinking of the method is: first carry out once complete scanning to bianry image, while marking all target pixel points, obtains and records equal tag pair.Equal tag to (hereinafter referred to as equivalence to) generation be difference due to scanning sequence, cause thinking when starting two different connected regions, going deep into afterwards along with scanning, finds that again these two regions are communicated with.So, need record of equal value right, to show that they are under the jurisdiction of same connected region, to revise after the first time end of scan.In whole distance of swimming labeling process, need consider and process some special circumstances simultaneously.There is following problem in this algorithm: first, needs repeatedly to scan, compare, and required storage space is large, and logic is complicated; Secondly, cannot parallel computation, speed is slow, inefficiency; Finally, lower for a large amount of connected region test problems efficiency.
Summary of the invention
The present invention makes in view of the foregoing, its objective is and a kind of bianry image connected region paralleled detection method and system are provided, only need single pass, compare, required storage space is little, logic is simple, can parallel computation, and speed is fast, efficiency is high, is particularly useful for a large amount of connected region test problems.
According to an aspect of the present invention, provide a kind of bianry image connected region paralleled detection method, described method comprises:
Initiation multichannel calculates, and is multiple part by Iamge Segmentation.
Independently extreme value structure is carried out to each part after segmentation.
The result of calculation of each several part is carried out synchronously, obtain the data result measure-alike with original image.
The number and the position that obtain extreme point are scanned to described data result.
Further, when carrying out extreme value structure independently to each part after segmentation, every part all performs an identical extreme value constructed fuction.
Preferably, describedly extreme value is carried out independently to each part after segmentation be configured to parallel carrying out.
Preferably, described scanning is once.
Further, the number of described extreme point is the number in image connectivity region, the position in the corresponding image connectivity region corresponded, position of each described extreme point.
According to a further aspect in the invention, a kind of bianry image connected region paralleled detection system is provided, comprises:
Primary module, calculating for initiating multichannel, being multiple part, and the result of calculation of each several part being carried out synchronously, obtaining the data result measure-alike with original image by Iamge Segmentation;
Extreme value constructing module, for carrying out extreme value structure independently to each part after segmentation;
Extremum extracting module, for scanning to obtain extreme point number and position to described data result.
Further, image is divided into subimage according to ranks by principal function by described primary module.
Further, described extreme value constructing module is corroded described subimage by extreme value constructed fuction, and cumulative, thus forms extreme point.
Further, described extremum extracting module is combined rear image by extremum extracting function and carries out mean filter, and described extremum extracting module is detected filtered image by principal function, the number of mark extreme point and position.
Further, the number of described extreme point is the number in image connectivity region, the position in the corresponding image connectivity region corresponded, position of each described extreme point.
Accompanying drawing explanation
Fig. 1 is bianry image connected region paralleled detection method processing flow chart of the present invention;
Fig. 2 is the structural representation of bianry image connected region paralleled detection system of the present invention;
Fig. 3 is the image connectivity area schematic of the embodiment of the present invention;
Fig. 4 is the Iamge Segmentation schematic diagram of the embodiment of the present invention;
Fig. 5 is the digital pcr testing result schematic diagram of the embodiment of the present invention;
Fig. 6 is the partial enlarged drawing of the digital pcr testing result schematic diagram of the embodiment of the present invention;
Fig. 7 is the some position mark result schematic diagram of the embodiment of the present invention.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly understand, below in conjunction with embodiment also with reference to accompanying drawing, the present invention is described in more detail.Should be appreciated that, these describe just exemplary, and do not really want to limit the scope of the invention.In addition, in the following description, the description to known features and technology is eliminated, to avoid unnecessarily obscuring concept of the present invention.
The invention provides a kind of bianry image connected region paralleled detection method and system, only need single pass, compare, required storage space is little, and logic is simple, can parallel computation, and speed is fast, and efficiency is high, is particularly useful for a large amount of connected region test problems.
Fig. 1 is bianry image connected region paralleled detection method processing flow chart of the present invention.
As shown in Figure 1, a kind of bianry image connected region paralleled detection method, described method comprises step:
Step 101, initiating multichannel and calculate, is multiple part by Iamge Segmentation.
By principal function, image is divided into subimage according to ranks, and each subimage is sent into parallel thread or kernel.
Step 102, carries out extreme value structure independently to each part after segmentation.
Step 103, is undertaken the result of calculation of each several part synchronously, obtains the data result measure-alike with original image.
By extreme value constructed fuction, each part (i.e. each subimage) is corroded, and cumulative, thus form extreme point.The parameter of extreme value constructed fuction comprises: Erosion Width (size requirements according to connected region in image sets, and affect travelling speed, be defaulted as 1, this hourly velocity is the slowest), corrosion number of times (being defaulted as corrosion is all extremely 0).
Step 104, scans to described data result the number and the position that obtain extreme point.
Be combined rear image by extremum extracting function and carry out mean filter, the window width of filtering equals Erosion Width.
And by principal function, filtered image is detected, the number of mark extreme point and position.This wherein, principal function scan image, marks 2 class points:
1. extreme point: gray-scale value is not less than the point of all neighbors.For the detection of convex domain, calculate and complete, extreme point is connected region central point, and extreme point number is areal (this numerical value is unique Output rusults be concerned about in chip site identifies, without the need to marking Equations of The Second Kind point).
2. saddle point: longitudinally greatly laterally minimum point (or longitudinally minimum transverse direction is very big).Outwards expand from extreme point, run into zero point or saddle point stopping.The extreme point sharing saddle point is marked as same area.
In step 104, the number of extreme point is the number in image connectivity region, the position in the corresponding image connectivity region corresponded, position of each described extreme point.
In step 102, when carrying out extreme value structure independently to each part after segmentation, every part all performs an identical extreme value constructed fuction.
In step 102, extreme value is carried out independently to each part after segmentation and is configured to parallel carrying out.
In step 104, the number of times of scanning is once.
Fig. 2 is the structural representation of bianry image connected region paralleled detection system of the present invention.
As shown in Figure 2, a kind of bianry image connected region paralleled detection system, comprising:
Primary module 201, calculating for initiating multichannel, being multiple part, and the result of calculation of each several part being carried out synchronously, obtaining the data result measure-alike with original image by Iamge Segmentation;
Extreme value constructing module 202, for carrying out extreme value structure independently to each part after segmentation;
Extremum extracting module 203, for scanning to obtain extreme point number and position to described data result.
Image is divided into subimage according to ranks by principal function by primary module 201, and each subimage is sent into parallel thread or kernel.
Extreme value constructing module 202 is corroded described subimage by extreme value constructed fuction, and cumulative, thus forms extreme point.The parameter of extreme value constructed fuction comprises: Erosion Width (size requirements according to connected region in image sets, and affect travelling speed, be defaulted as 1, this hourly velocity is the slowest), corrosion number of times (being defaulted as corrosion is all extremely 0).
Extremum extracting module 203 is combined rear image by extremum extracting function and carries out mean filter, and the window width of filtering equals Erosion Width.
Extremum extracting module 203 is detected filtered image by principal function, the number of mark extreme point and position.This wherein, principal function scan image, marks 2 class points:
1. extreme point: gray-scale value is not less than the point of all neighbors.For the detection of convex domain, calculate and complete, extreme point is connected region central point, and extreme point number is areal (this numerical value is unique Output rusults be concerned about in chip site identifies, without the need to marking Equations of The Second Kind point).
2. saddle point: longitudinally greatly laterally minimum point (or longitudinally minimum transverse direction is very big).Outwards expand from extreme point, run into zero point or saddle point stopping.The extreme point sharing saddle point is marked as same area.
Wherein, the number of extreme point is the number in image connectivity region, the position in the corresponding image connectivity region corresponded, position of each described extreme point.
Embodiment
For a width by 0,1 bianry image formed, bianry image connected region paralleled detection method of the present invention identifies the connected region in image, exports the number of connected region.
Such as, there are 3 connected regions in Fig. 3.
Bianry image connected region paralleled detection method of the present invention can process image in a parallel fashion.This mode refers to and Iamge Segmentation is some pieces, adopts multiple computing unit, and each cell processing one piece of subregion, calculates simultaneously, thus significantly improve operation efficiency.Such as, be that 16*16 block loads row relax of going forward side by side by 256 GPU computing kernel by Iamge Segmentation simultaneously, can only use the time of 1/256th to obtain result in theory.Wherein so-called segmentation step does not need really to split, image is exactly a matrix, as long as know start address and the length of each submatrix (subimage) when load image, rising makes the calculating of address from two-dimensional array (0,0) start, every a fixing address offset (i.e. the length of every block) as start address, this step calculates and is generally completed by CPU, then instruction is passed to called GPU process.
Concrete treatment step:
According to desired subimage size, determine the concrete mode of Iamge Segmentation.For Fig. 3, original image is 200*200 matrix, ites is desirable to be divided into 4 subimages to carry out 4 tunnel parallel computations, and so this figure should be divided into 2*2 submatrix, each submatrix is the minor matrix of 100*100, as shown in Figure 4.So can draw, the start address of each submatrix is respectively (0,0), (0,100), (100,0), and (100,100), the length of two dimensions is 100.Each computing unit (such as thread) directly loads according to carrying out reading according to address parameter logistic.For some Heterogeneous Computing equipment, more general equipment needs data to be copied to GPU computing unit according to address parameter by CPU, for the more professional computing equipment (the HSA core of such as AMD) with shared drive, GPU directly can carry out High-speed I/O according to address parameter equally.In actual applications, the size of subimage can set according to the problem of reality, does not limit in the present invention.Depend primarily on the parallel computation element number that computing equipment has, such as, the kernel amount of parallelism upper limit of OPENCL in general personal computer graphic process unit is 256, then has up to ten thousand for large-scale isomeric group equipment, and the size of connected region to be measured.The size of submatrix, should be not too small compared to the diameter of minimum connected region, otherwise thinner segmentation is to raising counting yield limited use.
For each submatrix, carry out synchronous corrosion treatment by the computing unit of some, corrosion adopt square template, radius from 1, by 1,2,3 ..., n.Wherein the size of n is obtained by balance parallel computation element number and largest connected zone radius equally, and general recommendations can be set as 10 (if maximum radius is estimated to be less than 10, being then set to this value).The image that etching operation obtains directly adds up, and judging whether image has been corroded is afterwards 0, if not 0, then gets last Corrosion results and repeats corrosion and accumulation operations, until image is 0.
Accumulation result is scanned, obtains all extreme point positions.
Merged according to former figure position by the accumulation result of all subimages, whole scan detects saddle point.The position of extreme point according to saddle point is merged.
Export the number of extreme value, the connected region number namely obtained.
Embodiment
Fig. 5 is the response diagram picture obtained in digitizing PCR testing process, and contain nearly 30,000 points in this image, its partial enlarged drawing is as shown in Fig. 6-a, and the bianry image that this partial enlarged drawing obtains after routine processes is as shown in Fig. 6-b.Need in practical application to carry out quick position to tens thousand of connected regions in view picture bianry image, could the reaction on each site be analyzed, detect to realize high flux.But prior art cannot meet the requirements of speed, according to bianry image connected region paralleled detection method of the present invention, entire image is divided into the submatrix of 1280 32*34 in logic, by 5 GPU cores respectively concurrent 256 road computing units each self-corresponding data are directly read, and implement extreme point structure and position detection, once calculating and exportable final recognition result, and one-off recognition goes out 26870 reaction site.After loci mark, Output rusults is as shown in Fig. 7-a, and its partial enlargement result is as shown in Fig. 7-b.This site localization method directly determines goal response thing at the position of each sampling instant and Signal analysis.On this basis, then judged by the curve changed each site signal, can output detections result (the dPCR testing result obtained according to above-mentioned image and correlation-corrected curve is 142 DNA).
Bianry image connected region paralleled detection method of the present invention is applicable to a large amount of sites test problems.Especially, in high flux biochemistry detection problem, one-time detection result usual site quantity mean is in ten thousand, and such as, digitizing PCR testing result in Fig. 5 has 2 × 10
4above site, the time complexity that the method calculates is suitable with a small amount of site situation, and for the detection means of larger flux, as ISFET chip, site can reach up to ten million, and the method is with the obvious advantage.
Simultaneously, the parallelization processing mode that the method can set flexibly, the processing power of modern parallel computation equipment can be given full play to, introduce super market of calculating based on the computation requirement in fluorescence and image detection means provide possibility for by a series of in the subject such as biological, chemical.
Should be understood that, above-mentioned embodiment of the present invention only for exemplary illustration or explain principle of the present invention, and is not construed as limiting the invention.Therefore, any amendment made when without departing from the spirit and scope of the present invention, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.In addition, claims of the present invention be intended to contain fall into claims scope and border or this scope and border equivalents in whole change and modification.