Search

CN-122025035-A - Intelligent conversion method and system for medical image format and electronic equipment

CN122025035ACN 122025035 ACN122025035 ACN 122025035ACN-122025035-A

Abstract

The application relates to the technical field of medical image processing, in particular to an intelligent conversion method, an intelligent conversion system and electronic equipment for medical image formats, wherein the method comprises the steps of constructing tag information into a metadata dictionary; traversing all DICOM slices, acquiring an actual physical value matrix through the linear transformation tag, stacking the actual physical value matrix along a preset third dimension direction to form a three-dimensional NumPy array, calculating an affine matrix of the DICOM slices, combining the three-dimensional NumPy array and the affine matrix into a NIfTI image object, and compressing the NIfTI image object and the NIfTI header file information. The application can realize the conversion from DICOM images to standardized NIfTI files, ensure the high quality, high consistency and traceability of conversion results, and the generated NIfTI file information can adapt to multi-center collaboration and large-scale AI model training.

Inventors

  • XIE YINAN
  • ZHANG HAORUI
  • Liang Luxia

Assignees

  • 杭州英放生物科技有限公司

Dates

Publication Date
20260512
Application Date
20260414

Claims (10)

  1. 1. An intelligent conversion method for medical image formats is characterized by comprising the following steps: obtaining a DICOM file list, wherein the DICOM file list is a DICOM slice set which is orderly arranged; Extracting corresponding tag information based on the DICOM file list, and constructing the tag information into a metadata dictionary, wherein the metadata dictionary comprises metadata information and linear transformation tags; traversing all DICOM slices, reading corresponding pixel arrays, and performing linear transformation on pixel values in the pixel arrays through the linear transformation tags to obtain an actual physical value matrix; stacking the actual physical value matrix along a preset third dimension direction to form a three-dimension NumPy array, calculating an affine matrix of the DICOM slice, and combining the three-dimension NumPy array and the affine matrix into a NIfTI image object; Converting the metadata dictionary into character strings, and writing the character strings into a header file of NIfTI image objects to obtain NIfTI header file information, wherein NIfTI data in the NIfTI header file information are mapped with the metadata information; Compressing the NIfTI image objects and the NIfTI header file information to obtain NIfTI file information corresponding to the DICOM file information.
  2. 2. The intelligent conversion method for medical image formats according to claim 1, wherein the metadata dictionary comprises a spatial direction tag and a position coordinate tag, the spatial direction tag is used for determining slice orientation, the position coordinate tag is used for determining slice absolute position, the calculating affine matrix of the DICOM slice comprises the steps of: generating a row direction vector and a column direction vector corresponding to a DICOM slice based on the spatial direction label, and performing cross multiplication on the row direction vector and the column direction vector to obtain a third dimension vector corresponding to the preset third dimension; forming a local orthogonal base according to the row direction vector, the column direction vector and the unit vector, and rotating or scaling the local orthogonal base to obtain a scaling matrix; determining a space origin based on the position coordinate label, and generating a translation vector according to the position coordinate label; the scaling matrix and the translation vector are combined to determine an affine matrix.
  3. 3. The intelligent conversion method for medical image formats according to claim 2, wherein the metadata dictionary comprises slice thickness labels, the scaling matrix is a 3 x 3 matrix, the scaling matrix is generated based on a direction vector, comprising the steps of: acquiring a row spacing based on the DICOM slice, and multiplying the row direction vector by the row spacing to acquire a first column value of the scaling matrix; Acquiring column spacing based on the DICOM slice, and multiplying the column direction by the column spacing to acquire a second column value of the scaling matrix; And acquiring the interlayer spacing based on the updated slice thickness label, and multiplying the unit vector by the interlayer spacing to acquire a third column value of the scaling matrix.
  4. 4. The intelligent conversion method for medical image format according to claim 3, wherein an interlayer distance is acquired based on the updated slice thickness label, wherein the update manner of the slice thickness label includes the steps of: determining the number of DICOM slices based on the DICOM file list, and judging whether the number of DICOM slices is larger than a preset threshold value or not; if yes, reading the position coordinates of adjacent DICOM slices in the DICOM file list, and calculating the vector difference of the adjacent DICOM slices; And acquiring a corresponding layer direction based on a third dimension vector corresponding to the DICOM file list, projecting the vector difference in the layer direction to acquire an actual layer interval, and updating the slice thickness label based on the actual layer interval.
  5. 5. The intelligent conversion method for medical image formats according to claim 2, further comprising the steps of, before combining the scaling matrix and the translation vector to determine an affine matrix: Calculating a determinant of the scaling matrix and judging whether the determinant is close to a second preset threshold value; if so, generating a detection alarm signal based on whether the column direction vector and the row direction vector are orthogonal, and updating a scaling matrix based on the detection alarm signal if not.
  6. 6. The intelligent conversion method for medical image format according to claim 1, wherein the NIfTI file information includes NIfTI file path, and the NIfTI image object and the NIfTI header file information are compressed to obtain NIfTI file information corresponding to DICOM file information, further comprising the steps of: setting a multi-dimensional quality evaluation rule, inputting the NIfTI file path into the multi-dimensional quality evaluation rule, sequentially auditing and obtaining an auditing result set, wherein the auditing result set at least comprises one auditing result; determining a quality adjustment parameter according to the auditing result set, and summing the quality adjustment parameter with the initial quality score to obtain an actual quality score; Determining a conversion utilization grade of the NIfTI file information through the actual quality score, wherein the conversion utilization grade characterizes the credibility of the NIfTI file information for subsequent AI training.
  7. 7. The intelligent conversion method for medical image formats according to claim 6, wherein said conversion utilization level includes a primary utilization level and a secondary utilization level, and wherein said conversion utilization level of NIfTI file information is determined by said actual quality score, comprising the steps of: Comparing the actual mass fraction with a third preset threshold; When the actual quality score is not smaller than the third preset threshold, judging that the conversion utilization grade is a primary utilization grade, wherein the primary utilization grade characterizes the NIfTI file information and can be directly used for subsequent AI auditing; And when the actual quality score is smaller than the third preset threshold, judging that the conversion utilization grade is a secondary utilization grade, wherein the secondary utilization grade characterizes that the NIfTI file information cannot be directly used for subsequent AI auditing.
  8. 8. The intelligent conversion method for medical image formats as claimed in claim 1, wherein the DICOM file information includes an input root directory and a designated output root directory, and further comprising the steps of, before obtaining the DICOM file list: sequentially scanning all files to be processed under the input root directory, wherein the files to be processed are provided with unique identifiers; And grouping all files to be processed based on the unique identification to determine the DICOM file list.
  9. 9. An intelligent conversion system for medical image formats, characterized in that an intelligent conversion method for medical image formats according to any of claims 1-8 is performed, comprising: The slice acquisition module is used for acquiring a DICOM file list, wherein the DICOM file list is a DICOM slice set which is orderly arranged; The DICOM analysis module extracts corresponding tag information based on the DICOM file list, and constructs the tag information into a metadata dictionary, wherein the metadata dictionary comprises metadata information and linear transformation tags; the slice processing module traverses all DICOM slices, reads corresponding pixel arrays, and carries out linear transformation on the pixel values through the linear transformation tag so as to obtain an actual physical value matrix; NIfTI a conversion module, wherein the NIfTI conversion module is configured to stack the actual physical value matrix along a preset third dimension to form a three-dimensional NumPy array, calculate an affine matrix of the DICOM slice, and combine the three-dimensional NumPy array and the affine matrix into a NIfTI image object; The metadata embedding module is used for converting the metadata dictionary into character strings and writing the character strings into header files of NIfTI image objects to obtain NIfTI header file information, and NIfTI data in the NIfTI header file information are mapped with metadata information; And the conversion compression module is used for compressing the NIfTI image objects and the NIfTI header file information to obtain NIfTI file information corresponding to the DICOM file information.
  10. 10. An electronic device comprising a processor and a memory coupled to each other, the memory having stored thereon a computer program executable on the processor; The computer program, when executed by the processor, implements the intelligent conversion method for medical image formats as claimed in any one of claims 1-8.

Description

Intelligent conversion method and system for medical image format and electronic equipment Technical Field The present application relates to the field of medical image processing technologies, and in particular, to an intelligent conversion method, system and electronic device for medical image formats. Background Medical imaging formats include DICOM format, which is a standard output format of medical imaging equipment, and NIfTI format, where each slice is an independent file including metadata (patient information, device parameters, scan protocol, etc.), but one sequence in DICOM format contains hundreds of files, which is relatively complex to manage, and where the coordinate system in DICOM format is complex to define (Image Orientation Patient, image Position Patient, etc. tags), and vendor proprietary tags are numerous. However, NIfTI is a standard format in the field of neuroimaging, and is widely used in other image AI research, so in practical applications, it is necessary to convert DICOM format into NIfTI format. The existing conversion mode is to derive image data from a workstation, judge whether the image data is in DICOM format, if yes, read a sketch file of the image data, convert the sketch file into NIfTI format output images marked with outlines of target objects, read a metering file of the image data, map a dose matrix in the dose file onto an image matrix of the image data, output the converted dose matrix, and generate the image data into image images in other formats. The existing conversion method only adjusts the image data in the DICOM format, so that the converted NIfTI format can be used for machine learning. However, DICOM files output by different hospitals and different devices have huge differences, and the converted NIfTI files lack uniform naming standards and directory structures, so that multi-center data integration is difficult. Disclosure of Invention In order to adapt to DICOM files output by different hospitals and different devices and obtain NIfTI files in a unified format so as to improve the integration efficiency of multi-center data, the application provides an intelligent conversion method, an intelligent conversion system and electronic equipment for medical image formats. In a first aspect, the present application provides an intelligent conversion method for medical image formats, which adopts the following technical scheme: an intelligent conversion method for medical image formats comprises the following steps: obtaining a DICOM file list, wherein the DICOM file list is a DICOM slice set which is orderly arranged; Extracting corresponding tag information based on the DICOM file list, and constructing the tag information into a metadata dictionary, wherein the metadata dictionary comprises metadata information and linear transformation tags; Traversing all DICOM slices, reading corresponding pixel arrays, and performing linear transformation on the pixel arrays through the linear transformation tags to obtain an actual physical value matrix; stacking the actual physical value matrix along a preset third dimension direction to form a three-dimension NumPy array, calculating an affine matrix of the DICOM slice, and combining the three-dimension NumPy array and the affine matrix into a NIfTI image object; Converting the metadata dictionary into character strings, and writing the character strings into a header file of NIfTI image objects to obtain NIfTI header file information, wherein NIfTI data in the NIfTI header file information are mapped with the metadata information; Compressing the NIfTI image objects and the NIfTI header file information to obtain NIfTI file information corresponding to the DICOM file information. In one embodiment, the metadata dictionary includes a spatial direction tag for determining slice orientation and a position coordinate tag for determining slice absolute position, the computing the affine matrix of the DICOM slice comprising the steps of: generating a row direction vector and a column direction vector corresponding to a DICOM slice based on the spatial direction label, and performing cross multiplication on the row direction vector and the column direction vector to obtain a third dimension vector corresponding to the preset third dimension; forming a local orthogonal base according to the row direction vector, the column direction vector and the unit vector, and rotating or scaling the local orthogonal base to obtain a scaling matrix; determining a space origin based on the position coordinate label, and generating a translation vector according to the position coordinate label; the scaling matrix and the translation vector are combined to determine an affine matrix. In one embodiment, the metadata dictionary includes a slice thickness tag, the scaling matrix is a 3×3 matrix, and the scaling matrix is generated based on a direction vector, comprising the steps of: acquiring a row spacing based on the DICOM slice, and