Disclosure of Invention
The invention aims to provide an automatic generation and typesetting method of a text-to-see-once image report which is locally left-right column-divided.
The method comprises the following specific steps:
initializing a graphic report in step (1), which comprises the following specific steps:
a. storing the teletext report data. In order to store the data and format of the image-text report and edit and modify the image-text report in a WYSIWYG mode, the content and format of the text and image data of the image-text report are stored by adopting an RTF document structure. The whole image-text report is composed of a plurality of image-text data templates, and one image-text data template corresponds to one RTF file. All parts of information to be displayed in the image-text report are named as different data sub-items respectively, marked in a specific character mode, and stored in different RTF template files in a classified mode.
b. And setting a template attribute configuration file. Setting attribute information for storing the whole image-text data template in the image-text report, and setting default values of the attributes. The method mainly comprises the name and editability of the image-text data template, the position of the template in the whole template combination sequence, the vertex position of a template area, the type of the image-text data template (picture, character and image-text mixture), the importance of the template, the position importance of the template, a related template set of the template and other parameter information required by automatic typesetting.
c. And reading the template attribute configuration file. Reading the attribute information of each image-text data template in the template attribute configuration file, acquiring a corresponding image-text data template RTF document according to the name of the image-text data template, and generating an image-text data template RTF document information linked list structure.
d. And matching the image-text report data. And storing actual data displayed by the image-text report in a database, reading the data from the database, positioning in a mode of searching for specific character marks, and matching and replacing corresponding data sub-items in the RTF template file with the actual data.
And (2) automatically typesetting and constraining the design of the image-text report. The method comprises the following specific steps:
e. in order to solve the problem of automatic typesetting of the graphic and text report, the problem of automatic typesetting of the graphic and text report is defined as follows: a given teletext report consists of N teletext data templates, denoted
The relative importance of each graphic data template is recorded as
And placing the graphic data template on the panel C, wherein the input marks conform to the formula:
each image-text data template
By sets of variables
Is uniquely determined wherein
As a template for graphic data
At the location of the four vertices in the panel C,
for associating with a graphic data template
And the template set has relative position relation.
Due to the diversity of report styles, the typesetting quality of the reports does not have a uniform evaluation standard, but for a certain type of reports, the report typesetting still follows a common rule, namely: a well-composed graphic report needs to satisfy the optimal design constraints of minimum blank area, mutual matching of the position and importance of the graphic data template, coincidence of the relative positions of the associated graphic data templates, uniform distribution of the graphic data templates, and the like.
f. White space area minimum constraints. Maximizing the utilization of the panel area, should require that the panel C has minimal white space. Blank utilization of panel
Is defined as:
wherein,
is the sum of the areas of the blank on the panel,
is the total area of the panel. According to the size type of the report printing paper and the vertex positions of the N template areas, the blank utilization rate of the panel can be calculated
The value of (c).
g. Location importance constraints. In the plane design, the central position of the plane is generally considered to be most important, therefore, the importance of the position of the template should be matched with the importance of the template to the greatest extent, the whole panel is divided into a plurality of areas, each area is set with different importance, and the conformity degree of the importance of the position of the template and the importance of the template is
The definition is as follows:
wherein,
as a template for graphic data
The importance of the center location in the panel area,
the importance of the image-text data template, the division of the panel and the importance of the panel area can be set by a user.
h. And (5) restricting the relative position of the image-text data template. In the teletext report, some teletext data templates have correlation, and the relative position of typesetting of the teletext data templates has special requirements. For example, the textual descriptions presented in certain text templates are descriptive of certain pictures in a particular picture template. Coincidence of relative positions of graphic data templates
The definition is as follows:
wherein,
for associating with a graphic data template
The total number of relevant and typeset-required graphic data templates,
is a template associated with image-text data
The total number of relevant and actually typeset graphic data templates.
i. And uniformly distributing and constraining the image-text data template. There are many types of teletext data templates in a teletext report, and it should be avoided as much as possible that the same type of teletext data templates are grouped together. Therefore, the whole panel area is divided into T areas, and the variance of each image-text data template of each kind in the T areas is calculated to restrict the distribution situation of the image-text data templates. The definition is as follows:
wherein,
indicates the total number of types of the teletext data template,
is shown falling on
The total number of templates of the i-th type of the area,
represents the average number of the ith template in the T divided regions
,
Indicating the number of the ith template in the whole teletext report.
Is the variance of the worst theoretical distribution of the uniform distribution of the image-text data template,
indicating that the ith template is distributed entirely within the first region, i.e.
Is the total number of the ith template, j =2
Is 0. Further will be
By using
Normalized to [0,1]Range derived uniform distribution constraint for graphic data templates
:
And (3) performing automatic typesetting optimization calculation on the image-text report. And establishing an optimal solution model and solving according to the parameter information input by the automatic typesetting of the image-text report and the constraint design conditions to obtain a stably distributed sample space optimal solution.
And (4) generating a preview of the master plate by the image-text report. Stably distributed optimal sample space calculated according to automatic typesetting constraint conditionsModifying the template attribute configuration file information and the corresponding linked list structure, and according to the related parametersAnd generating image-text data templates in the corresponding areas, finally combining the image-text data templates into an integral image-text report master template, and previewing and displaying the integral image-text report master template. Based on the function of the RTF document format, in each image-text data template with editable attributes, the text and the picture can be edited by the user according to the needs. After the editing operation is finished, the relevant parameters of the template are saved again, and the new image-text report layout is generated by recalculation according to the automatic typesetting constraint conditions.
The whole image-text report is composed of a plurality of image-text data templates, each image-text data template is corresponding to one RTF file, and the image-text report form which can be locally, leftwards, rightwards, fenced and obtained in what you see is realized. And the automatic generation and typesetting of the image-text report are realized by adopting an optimal design constraint calculation method for the automatic typesetting of the image-text report.
Drawings
Fig. 1 is a pictorial report master format description diagram of the present invention.
Detailed Description
The following describes a specific implementation method of the present invention with reference to the accompanying drawings by taking a method for generating and composing a medical ultrasound image-text report as an example.
Referring to fig. 1, the entire teletext report may be formed from N teletext data templates, one teletext data template corresponding to one RTF file. Setting a template attribute configuration file, reading the template attribute configuration file to perform image-text report data matching, calculating a stable distribution optimal sample space according to an automatic typesetting constraint condition, and generating a whole image-text report, thereby realizing the image-text report which can be locally, leftwards, rightwards, separated and obtained in what-you-see manner. In the figure, C is a panel, I1To InIs an image-text data template.
The method comprises the following specific steps:
step (1): initializing a graphic report, which comprises the following specific steps:
a. storing the teletext report data. In order to store the data and format of the image-text report and edit and modify the image-text report in a WYSIWYG mode, the content and format of the text and image data of the image-text report are stored by adopting an RTF document structure. The whole image-text report is composed of a plurality of image-text data templates, and one image-text data template corresponds to one RTF file. All parts of information to be displayed in the image-text report are named as different data sub-items respectively, marked in a specific character mode, and stored in different RTF template files in a classified mode. For example, a medical ultrasound image-text report generally includes image-text data templates such as a report header, a picture, an ultrasound view, an ultrasound prompt, a suggestion, a report trailer and the like. For example, information of hospital names is presented in the report header template, and corresponding data sub-items are labeled in the form of [ HName ]; and displaying a screenshot sequence of the ultrasound examination medical image in an ultrasound image picture template, and marking corresponding data subitems in an ImageList form.
b. And setting a template attribute configuration file. Setting attribute information for storing the whole image-text data template in the image-text report, and setting default values of the attributes. The method mainly comprises the name and editability of the image-text data template, the position of the template in the whole template combination sequence, the vertex position of a template area, the type of the image-text data template (picture, character and image-text mixture), the importance of the template, the position importance of the template, a related template set of the template and other parameter information required by automatic typesetting. The template attribute configuration file may be defined in an XML file format. Taking a medical ultrasound image-text report as an example, a report head template is generally unchangeable, so the attribute of the report head template is set as being uneditable; the template information of the ultrasonic image picture is relatively high in importance, so that the position importance attribute of the template information is set to be the maximum level.
c. And reading the template attribute configuration file. Reading the attribute information of each image-text data template in the template attribute configuration file, acquiring a corresponding image-text data template RTF document according to the name of the image-text data template, and generating an image-text data template RTF document information linked list structure. Taking a medical ultrasonic image-text report as an example, reading a template attribute configuration file, and acquiring a file name attribute value header. And acquiring the attribute value ImageList. And acquiring the contents of the corresponding report header template RTF file and the ultrasonic image picture template RTF file according to a preset path.
d. And matching the image-text report data. And storing actual data displayed by the image-text report in a database, reading the data from the database, positioning in a mode of searching for specific character marks, and matching and replacing corresponding data sub-items in the RTF template file with the actual data. Taking a medical ultrasonic image-text report as an example, reading an actual hospital name from a database, searching for a [ HName ] character mark, positioning to a hospital name data item, and replacing the [ HName ] with the actual hospital name; reading a medical image screenshot sequence saved in the ultrasonic examination process from a database, searching for an [ ImageList ] character identifier, positioning to a picture data item, and replacing the [ ImageList ] with the medical image screenshot sequence.
Step (2): the automatic typesetting constraint design of the image-text report comprises the following specific steps:
e. white space area minimum constraints. Maximizing the utilization of the panel area, minimizing the blank area of the panel C according to the requirement, and utilizing the blank area of the panel
To show that:
wherein,
is the sum of the areas of the blank on the panel,
is the total area of the panel. For example, in the case of medical ultrasound image-text reports, the size of the panel area is generally standardized to a paper size of a4 and B5, depending on the type of paper size used for the report. According to the positions of the top points of the N template areas, the utilization rate of the blank of the panel can be obtained
The value of (c).
f. Location importance constraints. In the plane design, the central position of the plane is generally considered to be most important, therefore, the importance of the position of the template should be matched with the importance of the template to the greatest extent, the whole panel is divided into a plurality of areas, each area is set with different importance, and the conformity degree of the importance of the position of the template and the importance of the template is
The definition is as follows:
wherein,
as a template for graphic data
The importance of the center location in the panel area,
the importance of the image-text data template, the division of the panel and the importance of the panel area can be set by a user. Taking the medical ultrasound image-text report as an example, the whole panel area can be divided into nine-square grids, namely, nine square areas with 3 rows x 3 columns which are divided averagely, the importance of the middle area of the nine-square grids is the highest level, and the importance of the surrounding areas is lower. According to the positions of the top points of the template areas, the importance level corresponding to the fact that the center position of each template falls into the Sudoku area can be obtained.
g. And (5) restricting the relative position of the image-text data template. In the teletext report, some teletext data templates have correlation, and the relative position of typesetting of the teletext data templates has special requirements. For example, some text templates show text description of specific figuresDescription of certain pictures in the slice template. Coincidence of relative positions of graphic data templates
The definition is as follows:
wherein,
for associating with a graphic data template
The total number of relevant and typeset-required graphic data templates,
is a template associated with image-text data
The total number of relevant and actually typeset graphic data templates. Taking a medical ultrasound image-text report as an example, the content displayed by the ultrasound visible text template is description of a B-mode ultrasound image displayed by the ultrasound image template, and the ultrasound image sequence can be loaded into a plurality of ultrasound image templates and displayed by a plurality of lines of images, and the positions of the two types of templates must be adjacent in a special form such as up-down, left-right or surrounding, so in the template attribute configuration file, the name of the ultrasound image template and the adjacent condition must be added in the definition of the associated template set of the ultrasound visible template.
h. And uniformly distributing and constraining the image-text data template. There are many types of teletext data templates in a teletext report, and it should be avoided as much as possible that the same type of teletext data templates are grouped together. Therefore, the whole panel area is divided into T areas, and the variance of each image-text data template of each kind in the T areas is calculated to restrict the distribution situation of the image-text data templates. The definition is as follows:
wherein,
representing the total number of categories of the teletext data template,
is shown falling on
The total number of templates of the i-th type of the area,
represents the average number of the ith template in the T divided regions
,
Indicating the number of the ith template in the whole teletext report.
Is the variance of the worst theoretical distribution of the uniform distribution of the image-text data template,
indicating that the ith template is distributed entirely within the first region, i.e.
Is the total number of the ith template, j =2
Is 0. Further will be
By using
Normalized to [0,1]Range derived uniform distribution constraint for graphic data templates
:
Taking the medical ultrasonic image-text report as an example, the types of the templates comprise three types, namely a text template, an image template and an image-text mixed template, and the panel region division also adopts a nine-square grid form. Obtaining the region of each template according to the vertex position of each template region, thus obtaining the total number of each type of template in each region, and obtaining the uniform distribution constraint of the image-text data template according to the parameter calculation
The value of (c).
And (3): and performing automatic typesetting optimization calculation on the image-text report. And establishing a Bayesian solution model according to the parameter information input by the automatic typesetting of the image-text report and the constraint design conditions, and solving by adopting a Markov chain Monte Carlo method to perform the automatic typesetting optimization calculation of the image-text report. The method comprises the following specific steps:
i. comprehensively considering the graphic and text report typesetting formalized constraints, constructing a Bayesian solving model of the automatic typesetting problem, and inputting the model under certain conditions
Fitness function of
Wherein
In order to be a priori distributed,
is a likelihood model of the degree of conformity of the solution. Which are respectively defined as follows:
,
. Wherein
To represent
Relative to
The specific gravity coefficient of importance of (a). Using medical ultrasound image-text report as an example, the utilization rate of the blank panel
The constraint is more important than the uniform distribution constraint of the image-text data template,
may be set to 0.3.
j. The Markov chain Monte Carlo method has high efficiency in processing complex problems and is relatively easy to realize on a computer. Thus, Markov's solution is adoptedThe chain Monte Carlo method is used for solving the Bayes solving model of the automatic typesetting problem established above. The Markov chain Monte Carlo method searches the state space through a Markov mechanism, and finally achieves a stable distribution optimal sample space
Namely the optimal typesetting position of each image-text data template.
And (4): and generating preview of the image-text report master plate. And automatically typesetting and optimizing the calculation result according to the image-text report to generate the image-text report master preview. Stably distributed optimal sample space calculated according to automatic typesetting constraint conditions
Modifying template attribute configuration file information and corresponding linked list structure, generating image-text data template in corresponding area according to related parameters, finally combining into an integral image-text report mother set, and previewing and displaying. Based on the function of the RTF document format, in each image-text data template with editable attributes, the text and the picture can be edited by the user according to the needs. After the editing operation is finished, the relevant parameters of the template are saved again, and the new image-text report layout is generated by recalculation according to the automatic typesetting constraint conditions.
Taking the medical ultrasonic image-text report as an example, automatically typesetting and optimizing the calculation result according to the image-text report to generate an image-text report master plate, and previewing and displaying the image-text report. The doctor can edit and process the report content to be printed finally in the corresponding area of the RTF template, and after the editing and the modification are finished, the optimal sample space with stable distribution is obtained by recalculating according to the automatic typesetting constraint conditions
And acquiring the position information of each template, updating and storing the position of each template in the whole template combination sequence, the position attribute of the vertex of the template area and other parameter information in the template attribute configuration file, and adjusting the corresponding linked list structure. Constraint condition weight according to automatic typesettingAnd newly calculating and generating a new image-text report layout, and simultaneously saving and updating the adjusted parameters into the template attribute configuration file and the corresponding RTF file.