Intelligent conversion method and system for medical image format and electronic equipment

By extracting the tag information from the DICOM file list and performing linear transformations and affine matrix calculations, the problem of unifying the conversion of DICOM files to NIfTI format was solved, achieving efficient and reliable multi-center data integration and quality inspection, and adapting to multi-parameter research.

CN122025035AActive Publication Date: 2026-05-12FANTASTIC BIOIMAGING CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FANTASTIC BIOIMAGING CO LTD
Filing Date
2026-04-14
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing medical image format conversion methods cannot adapt to the differences in DICOM files output by different hospitals and equipment, resulting in a lack of unified naming conventions and directory structures in the converted NIfTI files, which in turn makes it difficult to integrate multi-center data.

Method used

By obtaining a list of DICOM files, extracting tag information to construct a metadata dictionary, performing linear transformations and affine matrix calculations, the DICOM files are converted to NIfTI format. A multi-dimensional quality inspection mechanism is introduced to ensure the accuracy and consistency of the conversion results.

Benefits of technology

It enables the unified conversion of DICOM files from different hospitals and equipment into the standardized NIfTI format, supports multi-center data integration, improves data reliability and processing efficiency, adapts to multi-parameter and multi-temporal studies, and ensures high quality and traceability of conversion results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122025035A_ABST
    Figure CN122025035A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of medical image processing, in particular to an intelligent conversion method and system for a medical image format and electronic equipment, and the method comprises the steps: building tag information into a metadata dictionary; traversing all DICOM slices, and obtaining an actual physical value matrix through the linear transformation label; stacking the actual physical value matrix along a preset third-dimensional direction to form a three-dimensional NumPy array, calculating an affine matrix of the DICOM slice, and combining the three-dimensional NumPy array and the affine matrix into an NIfTI image object; and compressing the NIfTI image object and the NIfTI header file information. According to the method, the DICOM image can be converted into the standardized NIfTI file, high quality, high consistency and traceability of a conversion result are ensured, and the generated NIfTI file information can adapt to multi-center cooperation and large-scale AI model training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of medical image processing, and in particular to an intelligent conversion method, system, and electronic device for medical image formats. Background Technology

[0002] Medical image formats include DICOM and NIfTI. DICOM is the standard output format for medical imaging equipment, with each slice being an independent file containing metadata (patient information, equipment parameters, scanning protocol, etc.). However, a single sequence in DICOM format contains hundreds of files, making management complex. Furthermore, the coordinate system definition in DICOM is intricate (labels such as Image Orientation Patient and Image Position Patient), with numerous vendor-specific proprietary labels. NIfTI, on the other hand, is the standard format in neuroimaging and is widely used in other imaging AI research. Therefore, in practical applications, it is necessary to convert DICOM to NIfTI format.

[0003] The existing conversion method involves exporting image data from a workstation, determining whether the image data is in DICOM format, and if so, reading the outline file of the image data and converting it into an output image in NIfTI format with the outline of the target object marked; reading the measurement file of the image data, mapping the dose matrix in the dose file onto the image matrix of the image data, and outputting the converted dose matrix; and generating image images in other formats from the image data.

[0004] Existing conversion methods only adjust DICOM format image data to make the converted NIfTI format usable for machine learning. However, DICOM files output from different hospitals and devices vary greatly, and the converted NIfTI files lack a unified naming convention and directory structure, leading to difficulties in integrating multi-center data. Summary of the Invention

[0005] In order to adapt to DICOM files output by different hospitals and different equipment, and to obtain NIfTI files in a unified format, thereby improving the efficiency of multi-center data integration, this application provides an intelligent conversion method, system, and electronic device for medical image formats.

[0006] Firstly, this application provides an intelligent conversion method for medical image formats, employing the following technical solution:

[0007] A smart conversion method for medical image formats includes the following steps:

[0008] Obtain a list of DICOM files, wherein the list of DICOM files is an ordered collection of DICOM slices;

[0009] Based on the DICOM file list, extract the corresponding tag information, and construct a metadata dictionary from the tag information. The metadata dictionary includes metadata information and linear transformation tags.

[0010] Traverse all DICOM slices and read the corresponding pixel arrays. Perform a linear transformation on the pixel arrays using the linear transformation label to obtain the actual physical value matrix.

[0011] The actual physical value matrix is ​​stacked along a preset third dimension to form a three-dimensional NumPy array, and the affine matrix of the DICOM slice is calculated. The three-dimensional NumPy array and the affine matrix are then combined to form an NIfTI image object.

[0012] The metadata dictionary is converted into a string and written into the header file of the NIfTI image object to obtain NIfTI header file information. The NIfTI data in the NIfTI header file information is mapped to the metadata information.

[0013] The NIfTI image object and the NIfTI header information are compressed to obtain the NIfTI file information corresponding to the DICOM file information.

[0014] In one embodiment, the metadata dictionary includes spatial orientation labels and position coordinate labels. The spatial orientation labels are used to determine the slice orientation, while the position coordinate labels are used to determine the slice absolute position. Calculating the affine matrix of the DICOM slice includes the following steps:

[0015] Based on the spatial orientation label, generate the row direction vector and column direction vector corresponding to the DICOM slice, and perform a cross product of the row direction vector and the column direction vector to obtain the third dimension vector corresponding to the preset third dimension.

[0016] A local orthogonal basis is constructed based on the row direction vector, column direction vector and unit vector. The local orthogonal basis is rotated or scaled to obtain a scaling matrix.

[0017] The spatial origin is determined based on the location coordinate labels, and a translation vector is generated based on the location coordinate labels.

[0018] The scaling matrix and the translation vector are combined to determine the affine matrix.

[0019] In one embodiment, the metadata dictionary includes slice thickness labels, the scaling matrix is ​​a 3×3 matrix, and the scaling matrix is ​​generated based on the direction vector, including the following steps:

[0020] The row spacing is obtained based on the DICOM slice, and the row direction vector is multiplied by the row spacing to obtain the value of the first column of the scaling matrix;

[0021] The column spacing is obtained based on the DICOM slice, and the column direction is multiplied by the column spacing to obtain the second column value of the scaling matrix;

[0022] The interlayer spacing is obtained based on the updated slice thickness label, and the unit vector is multiplied by the interlayer spacing to obtain the value of the third column of the scaling matrix.

[0023] In one embodiment, the interlayer spacing is obtained based on the updated slice thickness label, wherein the updating method of the slice thickness label includes the following steps:

[0024] The number of DICOM slices is determined based on the DICOM file list, and it is determined whether the number of DICOM slices is greater than a preset threshold.

[0025] If so, read the position coordinates of adjacent DICOM slices in the DICOM file list and calculate the vector difference between adjacent DICOM slices;

[0026] The corresponding layer direction is obtained based on the third-dimensional vector of the DICOM file list. The vector difference is projected onto the layer direction to obtain the actual layer spacing, and the slice thickness label is updated based on the actual layer spacing.

[0027] In one embodiment, the following step is included before combining the scaling matrix and the translation vector to determine the affine matrix:

[0028] Calculate the determinant of the scaling matrix and determine whether the determinant is close to a second preset threshold;

[0029] If yes, then the column direction vector and the row direction vector are orthogonal; if not, then a detection alarm signal is generated, and the scaling matrix is ​​updated based on the detection alarm signal.

[0030] In one embodiment, the NIfTI file information includes the NIfTI file path, and after compressing the NIfTI image object and the NIfTI header information to obtain the NIfTI file information corresponding to the DICOM file information, the following steps are also included:

[0031] Set up multi-dimensional quality assessment rules, input the NIfTI file path into the multi-dimensional quality assessment rules, review sequentially and obtain a set of review results, the set of review results includes at least one review result;

[0032] The quality adjustment parameters are determined based on the audit result set, and the quality adjustment parameters are summed with the initial quality score to obtain the actual quality score;

[0033] The conversion and utilization level of the NIfTI file information is determined by the actual quality score, and the conversion and utilization level characterizes the credibility of the NIfTI file information for subsequent AI training.

[0034] In one embodiment, the conversion utilization level includes a Level 1 utilization level and a Level 2 utilization level. Determining the conversion utilization level of the NIfTI file information based on the actual quality score includes the following steps:

[0035] Compare the actual quality score with a third preset threshold;

[0036] When the actual quality score is greater than the third preset threshold, the conversion utilization level is determined to be the first-level utilization level. The first-level utilization level indicates that the NIfTI file information can be directly used for subsequent AI review.

[0037] If the actual quality score is not greater than the third preset threshold, the conversion utilization level is determined to be a level 2 utilization level. The level 2 utilization level indicates that the NIfTI file information cannot be directly used for subsequent AI review.

[0038] In one embodiment, the DICOM file information includes an input root directory and a specified output root directory, and the following steps are included before obtaining the list of DICOM files:

[0039] The system sequentially scans all files to be processed in the input root directory, each file having a unique identifier.

[0040] All files to be processed are grouped based on the unique identifier to determine the DICOM file list.

[0041] Secondly, this application provides an intelligent conversion system for medical image formats, employing the following technical solution:

[0042] A smart conversion system for medical image formats, performing the smart conversion method for medical image formats as described in the first aspect, includes:

[0043] A slice acquisition module is used to acquire a list of DICOM files, wherein the list of DICOM files is an ordered collection of DICOM slices;

[0044] The DICOM parsing module extracts corresponding tag information based on the DICOM file list and constructs a metadata dictionary from the tag information, which includes linear transformation tags.

[0045] The slicing processing module traverses all DICOM slices and reads the corresponding pixel arrays. It then performs a linear transformation on the pixel values ​​using the linear transformation tag to obtain the actual physical value matrix.

[0046] The NIfTI conversion module is used to stack the actual physical value matrix along a preset third dimension to form a three-dimensional NumPy array, calculate the affine matrix of the DICOM slice, and combine the three-dimensional NumPy array and the affine matrix into an NIfTI image object.

[0047] Metadata embedding module, which is used to convert the metadata dictionary into a string and write it into the header file of the NIfTI image object to obtain NIfTI header file information, wherein the NIfTI data in the NIfTI header file information is mapped to the metadata;

[0048] A conversion and compression module is used to compress the NIfTI image object and the NIfTI header information to obtain the NIfTI file information corresponding to the DICOM file information.

[0049] Thirdly, this application provides an electronic device that adopts the following technical solution:

[0050] An electronic device includes a processor and a memory coupled to each other, the memory storing a computer program capable of running on the processor;

[0051] When the computer program is executed by the processor, it implements the intelligent conversion method for medical image formats as described in the first aspect.

[0052] In summary, this application includes at least one of the following beneficial technical effects:

[0053] 1. The two core transformation steps of rotation and scaling and translation are separated, and the orientation and position information are processed separately, which facilitates debugging and anomaly correction. The final combined 4×4 affine matrix is ​​fully compatible with the NIfTI format specification and can be directly used for subsequent image analysis.

[0054] 2. The matrix column values ​​are calculated step by step according to the row-column-layer dimension. Each step corresponds to a clear physical meaning, which is convenient for debugging and troubleshooting. It supports non-equidistant scanning scenarios, and the interlayer spacing can be dynamically calculated through the difference of the Image PositionPatient label of adjacent slices.

[0055] 3. By introducing a fully automated, multi-dimensional quality inspection mechanism (geometry, intensity, artifacts) and generating quality inspection reports, manual review can be transformed into automated screening, fundamentally preventing junk data from entering and junk models from exiting, and greatly improving the data reliability of the AI ​​R&D pipeline;

[0056] 4. It can automatically identify and assemble different sequences or temporal data belonging to the same anatomical site, which is crucial for multi-parameter and multi-temporal studies such as dynamic enhancement and perfusion imaging, demonstrating a higher level of scene adaptability and intelligence;

[0057] 5. Based on standard unique identifiers, it does not rely on volatile information such as file names and storage paths, ensuring grouping accuracy from the data source. It adapts to the file storage specifications of different hospitals and equipment, and features recursive scanning and batch grouping for high processing efficiency. It supports recursive scanning of the input root directory and can automatically identify nested DICOM files without the need for manual directory structure organization.

[0058] 6. The grouping process uses a dictionary mapping method, which has low time complexity, can efficiently process large-scale multi-center data, seamlessly link with downstream processes, and has strong compatibility. The list of DICOM files generated by grouping can be directly used as input for subsequent metadata extraction, slice sorting, and format conversion. The grouping results support anomaly filtering and can automatically skip non-DICOM format files, improving process robustness. Attached Figure Description

[0059] Figure 1 This is a block diagram of an intelligent conversion method for medical image formats provided in an embodiment of this application;

[0060] Figure 2 This is a flowchart of the affine matrix calculation method provided in the embodiments of this application;

[0061] Figure 3 This is a method block diagram of the slice thickness label updating method provided in the embodiments of this application;

[0062] Figure 4 This is another method block diagram provided in the embodiments of this application;

[0063] Figure 5 This is a schematic diagram of an intelligent conversion system for medical image formats provided in an embodiment of this application;

[0064] Figure 6This is a structural block diagram of the electronic device provided in this embodiment.

[0065] Explanation of reference numerals in the attached figures: 11, processor; 12, memory; 121, computer program. Detailed Implementation

[0066] To better understand the purpose, technical solutions, and advantages of this application, it has been described and illustrated below with reference to the accompanying drawings and embodiments. However, those skilled in the art should understand that this application can be implemented without these details. In some cases, to avoid obscuring various aspects of this application due to unnecessary description, well-known methods, processes, systems, components, and / or circuits already described at a higher level will not be elaborated upon. It will be apparent to those skilled in the art that various modifications can be made to the embodiments disclosed in this application, and the general principles defined in this application can be applied to other embodiments and application scenarios without departing from the principles and scope of this application. Therefore, this application is not limited to the illustrated embodiments, but conforms to the broadest scope consistent with the scope of protection claimed in this application.

[0067] This application discloses an intelligent conversion method for medical image formats, applied to an intelligent conversion system. This system employs an intelligent conversion pipeline that covers the entire processing chain from raw DICOM images to standardized NIfTI files, including metadata parsing, coordinate system transformation, sequence merging, quality inspection, and standardized output. This enables the conversion of DICOM images to standardized NIfTI files while ensuring high quality, high consistency, and traceability of the conversion results. The generated NIfTI file information is adaptable to multi-center collaboration and large-scale AI model training.

[0068] like Figure 1 As shown, the intelligent conversion method for medical image formats includes the following steps:

[0069] S100, Get DICOM File List.

[0070] The intelligent conversion system acquires a list of DICOM files, which is an ordered collection of DICOM slices. A DICOM slice is a single, minimal unit of data in a two-dimensional image, while the DICOM file list comprises a collection of several groups of DICOM slices. The DICOM slices in the DICOM file list are ordered and belong to the same sequence of files; this "order" refers to the anatomical sequence of the DICOM slices within the DICOM file list. The anatomical sequence includes standard scans and reverse scans. A standard scan is a head-to-toe scan, with the slices sequentially passing through the head, neck, chest, etc., ending at the feet. A reverse scan is a foot-to-head scan, where the slice order is simply the reverse of the standard scan's slice order.

[0071] S200 extracts the corresponding tag information based on the DICOM file list and constructs the tag information into a metadata dictionary.

[0072] The intelligent conversion system reads DICOM files and extracts key DICOM metadata using the pydicom library. This extracted metadata is then used to construct a metadata dictionary, which primarily contains patient information, examination information, sequence information, and acquisition parameters. The metadata dictionary includes metadata information and corresponding tag information. Tag information includes tag names or tag numbers, allowing the intelligent conversion system to access and modify the DICOM metadata via either the tag name or tag number.

[0073] It should be noted that patient information mainly refers to patient ID, name, age, gender, and date of birth. Examination information includes examination instance UID, examination date, time, and description. Sequence information includes sequence instance UID, sequence number, modality, sequence description, and body part examined. Acquisition parameters include slice thickness, pixel pitch, tube voltage, exposure amount, and contrast agent information.

[0074] In addition, the pydicom library is a Python library for processing DICOM files, allowing direct reading, modification, and writing of DICOM data without relying on other software. In medical image processing, the pydicom library is the standard database for handling DICOM files, which will not be elaborated upon further here.

[0075] In the DICOM standard, each piece of metadata is uniquely identified by a tag (group number and element number). The pydicom library maps these tags to easy-to-understand attribute names. Below are some common DICOM tags and their corresponding attribute names in pydicom, along with their meanings.

[0076] For example, taking patient information as an example, tag information 1 is (0010, 0010), the corresponding attribute name 1 is PatientName, and the metadata information 1 is the patient's name. Tag information 2 is (0010, 0020), the corresponding attribute name 2 is PatientID, and the metadata information 2 is the patient ID. Tag information 3 is (0010, 0030), the corresponding attribute name 3 is PatientBirthDate, and the metadata information 3 is the patient's date of birth.

[0077] S300 iterates through all DICOM slices and reads the corresponding pixel array. It then performs a linear transformation on the pixel values ​​in the pixel array using the linear transformation label to obtain the actual physical value matrix.

[0078] For an intelligent conversion system to achieve pipelined intelligent conversion of DICOM files, it needs to assemble the sorted DICOM slice sequence into 3D volume data and convert it into a standard NIfTI format file. The most crucial step is to calibrate the pixel data corresponding to all DICOM slices against actual physical parameters to ensure the accuracy of subsequent DICOM slice data.

[0079] The intelligent conversion system loads the original pixel array (usually of type int16) of each DICOM slice from the DICOM file into memory one by one. It then applies linear transformation tags from the metadata dictionary to the original pixel values: calibrated value = original value × Slope + Intercept. The linear transformation tags include RescaleSlope and RescaleIntercept. The calibrated values ​​from all DICOM slices are then organized into a matrix of actual physical values ​​(e.g., the HU value of CT). This actual physical value matrix is ​​represented as a calibrated, identical-sized two-dimensional matrix.

[0080] It should be noted that in step S300, all DICOM slices are traversed. This DICOM slice list is generated by sorting DICOM files using tags such as ImagePositionPatient (preferred, most accurate) or InstanceNumber. Each DICOM slice in the DICOM file list is arranged in chronological order in 3D space. The DICOM file list represents the original composition of the complete 3D volume data.

[0081] S400 stacks the actual physical value matrix along a preset third dimension to form a three-dimensional NumPy array, calculates the affine matrix of the DICOM slice, and combines the three-dimensional NumPy array and the affine matrix into an NIfTI image object.

[0082] The intelligent conversion system stacks the two-dimensional matrices generated in step S300 along a preset third dimension, outputting a three-dimensional NumPy array with a shape of (height, width, number of layers). The intelligent conversion system calls the `compute_affine_matrix` function to calculate the affine matrix of the DICOM slice and uses the nibabel library to combine the volume data array and the affine matrix into an NIfTI1 image object. The NIfTI1 image object is an in-memory data structure in the nibabel library (the core of the Neuroimaging in Python ecosystem) used to represent NIfTI format medical images.

[0083] NIfTI1 image objects are standardized containers for 3D / 4D volumetric data, uniformly encapsulating pixel values, spatial transformations, and metadata, and supporting NumPy-style array operations and spatial transformations. Intelligent conversion systems can use NIfTI1 image objects to uniformly represent image data in different formats, enabling them to seamlessly integrate into pipelines, receive DICOM conversion results, and provide standardized input for downstream AI / analysis.

[0084] It's important to note that the affine matrix is ​​the matrix needed to map the voxel coordinates of a DICOM slice to the patient's three-dimensional physical space based on the slice's geometric labels. In medical imaging, homogeneous coordinates are typically used; therefore, the affine matrix is ​​a 4×4 NumPy array.

[0085] S500 converts the metadata dictionary into a string and writes it to the header file of the NIfTI image object to obtain NIfTI header file information.

[0086] The intelligent transformation system serializes the complete metadata dictionary into a JSON string and writes it as a custom extended field into the NIfTI header file. The NIfTI data in the NIfTI header file is mapped to the metadata, thus enabling the binding of NIfTI data and metadata.

[0087] When setting file header information, the intelligent conversion system requires explicitly setting the space unit to millimeters and specifying the data storage type.

[0088] S600 compresses the NIfTI image object and NIfTI header information to obtain the NIfTI file information corresponding to the DICOM file information.

[0089] The intelligent conversion system compresses the NIfTI image object and NIfTI header information to obtain the NIfTI file information corresponding to the DICOM file information. The NIfTI file information can be saved as a compressed NIfTI file in .nii.gz format.

[0090] The intelligent conversion system saves the metadata dictionary as a separate JSON file with the same name, making it easy to view and parse directly.

[0091] Based on the geometric labels of the DICOM sequence, the 4×4 affine matrix required to map the voxel coordinates to the patient's three-dimensional physical space (LPS coordinate system) is accurately calculated. The accuracy of the affine matrix directly determines whether the spatial positioning of the converted NIfTI image is correct, and it is the core of processing oblique scans and correcting coordinate system errors.

[0092] Therefore, the metadata dictionary includes spatial orientation labels and location coordinate labels. Spatial orientation labels are used to determine the orientation of the slice, while location coordinate labels are used to determine the absolute location of the slice.

[0093] refer to Figure 2 In one embodiment, calculating the affine matrix of a DICOM slice includes the following steps:

[0094] S410: Generate row direction vectors and column direction vectors corresponding to DICOM slices based on spatial direction labels, and perform cross product of row direction vectors and column direction vectors to obtain the third dimension vector corresponding to the preset third dimension.

[0095] S420: Based on the row direction vector, column direction vector and unit vector, a local orthogonal basis is constructed. The local orthogonal basis is rotated or scaled to obtain the scaling matrix.

[0096] S430 determines the spatial origin based on the position coordinate labels and generates a translation vector based on the position coordinate labels.

[0097] S440 combines the scaling matrix and the translation vector to determine the affine matrix.

[0098] The intelligent conversion system directly extracts row and column direction vectors based on spatial orientation labels, avoiding dependencies on vendor-specific formats. These spatial orientation labels refer to the Image Orientation Patient labels in DICOM. A third-dimensional vector is obtained through the cross product of the row and column vectors, forming a three-dimensional orthogonal basis that strictly matches the spatial dimension definition of medical images. By constructing this three-dimensional locally orthogonal basis, the entire intelligent conversion system can support special scenarios such as oblique scanning and Gantry Tilt, correcting abnormal orientation matrices and preventing coordinate system distortion.

[0099] The intelligent conversion system reads six values ​​from the Image Orientation Patient tag of DICOM: the first three are row direction vectors, and the last three are column direction vectors. A cross product operation is performed on the row and column direction vectors to calculate the layer direction vector, which is the third-dimensional vector. Normalization is then applied to the row, column, and layer direction vectors respectively to ensure that the vector length is 1, eliminating the interference of scaling factors.

[0100] Next, the normalized row, column, and layer direction vectors are arranged column-wise to form a 3×3 rotation matrix, which describes the spatial orientation of the image.

[0101] The intelligent conversion system extracts voxel spacing parameters from the PixelSpacing and SliceThickness tags of DICOM. The row spacing corresponds to the row direction scaling factor, the column spacing corresponds to the column direction scaling factor, and the layer spacing corresponds to the layer direction scaling factor.

[0102] The intelligent conversion system combines the rotation matrix with the scaling factor to obtain a 3×3 rotation-scaling matrix, which is responsible for describing the orientation and pixel size of the image.

[0103] The intelligent conversion system reads three values ​​from the DICOM position coordinate label. These values ​​represent the spatial origin coordinates, corresponding to the top-left corner of the first image slice. Using this origin coordinate as the translation vector, the positions of all subsequent slices are calculated based on this origin. The position coordinate label corresponds to the Image Position Patient label. The Image Position Patient label serves as the spatial origin reference, ensuring that the absolute position of the slices does not shift.

[0104] The affine matrix adopts the 4×4 structure of the NIfTI standard. The first three rows and first three columns are filled with the rotation and scaling matrix obtained in step S420. The first three rows and fourth column are filled with the translation vector obtained in step S430. The fourth row is fixed as [0,0,0,1], forming a complete affine transformation matrix.

[0105] In one embodiment, the metadata dictionary includes slice thickness labels, the scaling matrix is ​​a 3×3 matrix, and the scaling matrix is ​​generated based on the direction vector, including the following steps:

[0106] S421: Obtain the row spacing based on DICOM slicing, and multiply the row direction vector with the row spacing to obtain the value of the first column of the scaling matrix.

[0107] S422: Obtain the column spacing based on DICOM slicing, and multiply the column direction by the column spacing to obtain the value of the second column of the scaling matrix.

[0108] S423, obtain the interlayer spacing based on the updated slice thickness label, and multiply the unit vector by the interlayer spacing to obtain the value of the third column of the scaling matrix.

[0109] Row and column spacing are directly taken from the DICOM PixelSpacing tag, while layer spacing is taken from the SliceThickness tag or calculated values ​​based on the positions of adjacent slices. It is entirely based on DICOM standard fields, does not rely on vendor-specific formats, and is compatible with mainstream devices such as GE, Siemens, and Philips.

[0110] The direction vector defines the spatial orientation, and the spacing parameter defines the physical dimensions. Multiplying the two together achieves an integrated expression of direction and scaling. The resulting 3×3 matrix can be directly used for subsequent affine matrix assembly without additional conversion, reducing calculation errors.

[0111] Specifically, the intelligent conversion system extracts the line spacing from the PixelSpacing tag of the DICOM slice. This parameter corresponds to the voxel physical size of the image in the line direction. It takes the normalized line direction vector, multiplies each element in the vector by the line spacing, and uses the product as the value of the first column of the scaling matrix.

[0112] Next, the column spacing is extracted from the Pi elSpacing label. This parameter corresponds to the voxel physical size of the image in the column direction. The normalized column direction vector is taken, and each element in the vector is multiplied by the column spacing. The product is used as the value of the second column of the scaling matrix.

[0113] The interlayer spacing is first obtained from the updated slice thickness labels. If the label value is invalid, the actual interlayer spacing is obtained by calculating the spatial distance between the ImagePositionPatient labels of two adjacent slices. The normalized layer direction vector is taken, which is obtained by the cross product of the row and column direction vectors, corresponding to the third-dimensional direction of the image.

[0114] Multiply each element of the layer direction vector by the interlayer spacing, and use the product as the third column of the scaling matrix. Combine the three columns of values ​​obtained in the above three steps in order to obtain a 3×3 scaling matrix, the mathematical form of which is:

[0115]

[0116] Among them, [ ] represents the row direction vector, [ ] represents the column direction vector, [ [ ] represents the layer direction vector; It is the pixel column spacing. It is the pixel row spacing. This refers to the interlayer spacing.

[0117] In one embodiment, the intelligent transformation system does not directly rely on the SliceThickness nominal label in the DICOM file, but instead calculates the actual interlayer spacing using the position coordinates of adjacent slices. Updates are triggered only when the number of slices meets a threshold, avoiding calculation errors caused by an insufficient number of slices. Projection calculations are performed based on layer direction vectors, rather than simple coordinate differences, enabling accurate matching of the actual interlayer spacing for non-orthogonal scans such as oblique positions and GantryTilt. The calculation results are completely consistent with the coordinate system transformation logic, ensuring spatial consistency of the subsequent affine matrix. The slice thickness label in the metadata dictionary is updated with the calculated actual interlayer spacing, and subsequent steps can directly call the updated value. The corrected label value is saved with the JSON metadata file, supporting data backtracking and auditing.

[0118] Therefore, refer to Figure 3 The interlayer spacing is obtained based on the updated slice thickness labels. The updating method for the slice thickness labels includes the following steps:

[0119] S424, determine the number of DICOM slices based on the DICOM file list, and determine whether the number of DICOM slices is greater than a preset threshold.

[0120] S425, if yes, then read the position coordinates of adjacent DICOM slices in the DICOM file list and calculate the vector difference between adjacent DICOM slices.

[0121] S426: Obtain the corresponding layer orientation based on the third-dimensional vector of the DICOM file list, project the vector difference onto the layer orientation to obtain the actual layer spacing, and update the slice thickness label based on the actual layer spacing.

[0122] The intelligent conversion system counts the total number of slices from the list of input DICOM files. A preset threshold is used, typically set to 2, because at least two slices are required to calculate the position difference.

[0123] If the number of slices exceeds the threshold, proceed to the next calculation step. If it is less than or equal to the threshold, directly use the nominal SliceThickness value in the DICOM label. Read the Image Position Patient labels of two adjacent DICOM slices in the list. This label represents the absolute position coordinates of the slice, in the format (x, y, z).

[0124] Calculate the vector difference between two coordinates: This yields the spatial offset of adjacent slices.

[0125] in, and This typically refers to the ImagePositionPatient vector values ​​of two adjacent DICOM slices. Each vector is a three-dimensional coordinate (x, y, z), representing the absolute position of the top-left pixel center of that slice in the patient coordinate system (LPS, in mm). It is the spatial displacement vector from the first slice to the second slice.

[0126] In step S426, the actual interlayer spacing is calculated by projection and the labels are updated. The layer direction vector obtained by cross product in step S410 is obtained. This vector is a normalized three-dimensional vector that represents the direction of slice stacking.

[0127] Project the vector difference Δpos onto the layer direction vector. The absolute value of the projection result is the actual layer spacing. Replace the original slice_thickness label value in the metadata dictionary with the calculated actual_slice_spacing to complete the update of the slice thickness label.

[0128] The core of this slice thickness label update scheme is to correct the label value by using the actual spatial position difference between adjacent slices, which solves the problem of inconsistency between the nominal slice thickness of the device and the actual scanning layer spacing, thereby improving the accuracy of the affine matrix of the intelligent conversion system.

[0129] In one embodiment, the scaling matrix is ​​first checked for compliance with the basic requirements of spatial transformation using determinant, and then the accuracy of the direction definition is verified using vector orthogonality. The verification standard matches the spatial geometric characteristics of medical images, effectively identifying matrix errors in scenarios such as oblique scanning and label anomalies. An alarm signal is generated upon detection of an anomaly, simultaneously triggering the scaling matrix update process without manual intervention. The correction logic is linked to the previously described steps of direction vector normalization and interlayer spacing calculation, ensuring data consistency. The second preset threshold is typically set to 1.0, allowing for small errors (e.g., ±0.1) to accommodate differences in label accuracy between different manufacturers' devices. The threshold can be adjusted according to actual business needs, balancing detection stringency and compatibility.

[0130] Therefore, verifying both determinant and vector orthogonality is a crucial step in ensuring the accuracy of coordinate system transformations, preventing distortion of the affine matrix due to abnormal direction vectors.

[0131] Before combining the scaling matrix and translation vector to determine the affine matrix, the following steps are included:

[0132] S431, calculate the determinant of the scaling matrix and determine whether the determinant is close to the second preset threshold.

[0133] S432, if yes, then based on whether the column direction vector and the row direction vector are orthogonal; if no, then generate a detection alarm signal and update the scaling matrix based on the detection alarm signal.

[0134] In step S431, the intelligent transformation system calculates the determinant of the scaling matrix and determines a threshold. For the 3×3 scaling matrix generated in step S422, its determinant value is calculated. The determinant reflects whether the spatial transformation corresponding to the matrix maintains volume invariance; medical image coordinate system transformations require the absolute value of the determinant to be close to 1. The second preset threshold is generally set to 1.0, and the allowable error range is configurable, for example, 0.9. 1.1.

[0135] If the absolute value of the determinant is within the preset threshold range, the scaling matrix is ​​determined to be geometrically valid, and the subsequent affine matrix combination step is initiated. If the absolute value of the determinant deviates from the threshold, the orthogonality check and exception handling process in step S432 are triggered.

[0136] In S432, orthogonality verification and matrix update involve extracting the normalized row direction vector and normalized column direction vector used when constructing the scaling matrix, and calculating their dot product. The dot product of orthogonal vectors should be 0. If the absolute value of the dot product exceeds a preset small threshold (e.g., 0.01), the vectors are determined to be non-orthogonal, and a detection alarm signal is generated.

[0137] The scaling matrix is ​​updated based on the alarm signal. The alarm signal triggers the direction vector correction logic, which performs orthogonalization on the row and column direction vectors. The commonly used method is Gram-Schmidt orthogonalization.

[0138] Using the orthogonalized row and column direction vectors, combined with the updated interlayer spacing, a new scaling matrix is ​​recalculated. The updated scaling matrix undergoes another determinant check using S431 until the threshold requirement is met. The scaling matrix that passes this double check is combined with the translation vector to form a 4×4 affine matrix, according to the following combination rules:

[0139] The scaling matrix is ​​filled into the first three rows and first three columns of the 4×4 matrix. The translation vector (derived from the Image PositionPatient tag) is filled into the fourth column of the first three rows. The fourth row is fixed at [0,0,0,1], completing the affine matrix construction.

[0140] In one embodiment, the evaluation rules cover multiple dimensions, including geometric consistency, intensity reasonableness, and artifact interference, fully aligning with the core logic of the document quality detection module. The rules are flexibly configurable, adaptable to quality standards for different modalities of images such as CT and MRI, and meet diverse AI training needs. Initial scores are dynamically corrected through quality adjustment parameters, avoiding misjudgments of overall quality based on a single indicator. Conversion utilization levels are assigned based on actual quality scores, transforming quality results into intuitive credibility labels for easier downstream data filtering. Evaluation results can guide parameter optimization in the upstream DICOM conversion process, such as recalculating the affine matrix for documents with geometric anomalies. The generated quality report and grading results are saved with the file, supporting full data lifecycle traceability.

[0141] refer to Figure 4 The NIfTI file information includes the NIfTI file path. After compressing the NIfTI image object and NIfTI header information to obtain the NIfTI file information corresponding to the DICOM file information, the following steps are also included:

[0142] S701, set up multi-dimensional quality assessment rules, input the NIfTI file path into the multi-dimensional quality assessment rules, review them sequentially and obtain the set of review results, the set of review results must include at least one review result.

[0143] S702, determine the quality adjustment parameters based on the audit result set, and sum the quality adjustment parameters with the initial quality score to obtain the actual quality score.

[0144] S703 determines the conversion and utilization level of NIfTI file information through the actual quality score. The conversion and utilization level characterizes the credibility of NIfTI file information for subsequent AI training.

[0145] The core of this step is to establish a multi-dimensional quality assessment and grading system for the converted NIfTI files, and to select high-quality data that meets the requirements of AI training. This is a key step in ensuring the reliability of data for downstream tasks.

[0146] In step S701, multi-dimensional quality assessment rules are set and audits are performed. Referring to the core indicators of the quality inspection module in the document, an assessment rule set is constructed, which includes three core dimensions: geometric dimension, intensity dimension, and artifact dimension.

[0147] The geometric dimension checks whether the FOV range, voxel spacing, and affine matrix orthogonality meet preset thresholds. The intensity dimension verifies whether the CT HU value range, image contrast, and signal uniformity meet standards. The artifact dimension detects whether the proportion of metal artifacts and motion artifacts exceeds a set ratio.

[0148] The intelligent conversion system sets weights and judgment criteria for the rules of each dimension. For example, the deduction weight for geometric anomalies is higher than that for contrast anomalies.

[0149] Specifically, the intelligent conversion system performs an audit by inputting the NIfTI file path, loading the NIfTI image object and header information based on the file path. The file is then validated using rules for each dimension, and the audit result for each rule is recorded, forming an audit result set. The audit result includes a pass / fail label and a specific description of the anomaly, such as "FOV anomaly: [80,550,400]mm".

[0150] In S702, the actual quality score is calculated, and an initial quality score is set, usually the full score (e.g., 100 points), as the scoring benchmark.

[0151] The intelligent conversion system determines the quality adjustment parameters, iterates through the audit result set, and assigns the corresponding quality adjustment parameters based on the audit result of each rule. When a rule passes, the adjustment parameter is 0. When a rule fails, corresponding points are deducted according to preset weights, such as 15 points for FOV abnormalities and 5 points for metal artifacts. The actual quality score is calculated as: Actual Quality Score = Initial Quality Score + Σ Quality Adjustment Parameter. Subtraction is performed when the adjustment parameter is negative, ultimately yielding the quantified quality score.

[0152] S703 classifies conversion and utilization levels, refers to the quality inspection grading logic in the reference document, and sets three-level threshold standards.

[0153] High reliability means that the actual quality score is ≥80 points, which is marked as Grade A and can be directly used for AI model training.

[0154] Medium reliability means 60 points ≤ actual quality score < 80 points, marked as Grade B, and requires manual review before use.

[0155] Low credibility means that the actual quality score is <60 points, which is marked as grade C and is not recommended for AI training.

[0156] The intelligent conversion system matches and outputs a level, comparing the calculated actual quality score with a threshold to determine the corresponding conversion utilization level. The level results are stored in association with the quality report, NIfTI file, and metadata JSON file, serving as the core label for data credibility.

[0157] In one embodiment, a single threshold is used to achieve two-level classification. The rules are clear and easy to understand, eliminating the need for complex multi-dimensional weight configurations. The classification results are directly related to the usability of AI review, reducing the decision-making cost of downstream data screening. The threshold can be adapted to different business scenarios, and the third preset threshold can be flexibly adjusted according to the accuracy requirements of the AI ​​task to adapt to different modalities of images. For example, the threshold can be set to 80 points for high-precision lesion detection tasks, while it can be lowered to 70 points for ordinary image classification tasks. First-level utilization level files can directly enter the AI ​​review process, while second-level files require manual review or re-conversion. The classification results are written to the quality inspection log, supporting subsequent traceability and threshold optimization.

[0158] Therefore, the conversion utilization level includes a first-level utilization level and a second-level utilization level. By dividing the data into two levels using a single threshold, the NIfTI file can be classified into two levels of quality, which can quickly filter out high-quality data that can be directly used for AI review. This is a simplified implementation solution for the quality assessment process.

[0159] Determining the conversion and utilization level of NIfTI file information based on actual quality scores includes the following steps:

[0160] S704 compares the actual quality score with a third preset threshold.

[0161] S705, when the actual quality score is not less than the third preset threshold, the utilization level is determined to be Level 1. Level 1 utilization level indicates that the NIfTI file information can be directly used for subsequent AI review.

[0162] S706, when the actual quality score is less than the third preset threshold, the utilization level is determined to be level two. Level two utilization level indicates that the NIfTI file information cannot be directly used for subsequent AI review.

[0163] In S704, the actual quality score is compared with the third preset threshold to determine the third preset threshold, which is usually set to 80 points. This score corresponds to the lower limit of the pass level in the document. The threshold can be adjusted according to actual business needs, and the quality inspection rule document must be updated synchronously when adjusting it.

[0164] Perform a score comparison to obtain the actual quality score calculated in step S702. Compare the actual quality score with a third preset threshold to obtain one of two results: less than or not less than.

[0165] In S705, it is determined to be a Class 1 utilization level, when the actual quality fraction... When the third preset threshold is reached, the conversion utilization level is determined to be Level 1. At this level, the NIfTI file meets the standards for geometric consistency, strength reasonableness, and artifact control, and can be directly used for subsequent AI model training or image review.

[0166] In S706, it is determined to be a level 2 utilization grade, when the actual quality fraction... When the third preset threshold is reached, the conversion utilization level is determined to be Level 2. NIfTI files at this level have issues such as geometric anomalies, excessive strength, or artifacts, and cannot be directly used for AI review. Manual review is required to determine whether to re-convert.

[0167] In one embodiment, the DICOM file information includes an input root directory and a specified output root directory, and the following steps are included before obtaining the list of DICOM files:

[0168] S801 sequentially scans all files to be processed in the input root directory. Each file to be processed has a unique identifier.

[0169] S802 groups all pending files based on unique identifiers to determine the DICOM file list.

[0170] By using the SeriesInstanceUID tag, all files belonging to the same series are filtered out. The core of this step is to automate the grouping and classification of DICOM files based on unique identifiers. It is a crucial preliminary step in the batch conversion process, ensuring that slices of the same series are correctly aggregated and avoiding cross-series confusion.

[0171] Based on standard unique identifiers, the grouping is accurate and unambiguous. The unique identifier corresponds to the DICOM standard label SeriesInstanceUID, which is automatically generated during device scanning and can ensure that all slice identifiers in the same sequence are completely consistent.

[0172] Specifically, S801 scans the files to be processed in the input root directory. Starting from the specified input root directory, it recursively traverses all subdirectories, selecting files with the .dcm extension. During the scan, the complete path of each file is recorded, forming an initial list of files to be processed.

[0173] Extract the unique identifier, and for each DICOM file to be processed, use the pydicom library to quickly read the file header (stop_before_pixels=True), without loading the complete pixel data, thus improving the scanning speed.

[0174] Extract the SeriesInstanceUID tag value from the file header as the unique identifier of the file.

[0175] In S802, a list of DICOM files is generated based on unique identifiers. A grouping dictionary is constructed, and an empty dictionary is initialized. The key of the dictionary is SeriesInstanceUID, and the value is a list of DICOM file paths for the corresponding sequence. All files to be processed are traversed, and the path of each file is added to the corresponding list in the dictionary according to its SeriesInstanceUID.

[0176] The intelligent conversion system generates a list of DICOM files. After grouping, each key-value pair in the dictionary corresponds to an independent scan sequence. The intelligent conversion system extracts all values ​​from the dictionary to form the final set of DICOM file lists. Each sublist contains the paths to all slice files in the same sequence, which can be directly used in subsequent conversion processes.

[0177] This application also discloses an intelligent conversion system for medical image formats.

[0178] like Figure 5 As shown, an intelligent conversion system for medical image formats executes an intelligent conversion method for medical image formats, including a slice acquisition module, a DICOM parsing module, a slice processing module, an NIfTI conversion module, a metadata embedding module, and a conversion and compression module.

[0179] The slice acquisition module retrieves a list of DICOM files, which is an ordered collection of DICOM slices. The DICOM parsing module extracts the corresponding tag information from the DICOM file list and constructs a metadata dictionary, including linear transformation tags. The slice processing module iterates through all DICOM slices, reads the corresponding pixel arrays, and performs linear transformations on the pixel values ​​using the linear transformation tags to obtain the actual physical value matrix. The NIfTI conversion module stacks the actual physical value matrix along a preset third dimension to form a three-dimensional NumPy array, calculates the affine matrix of the DICOM slices, and combines the three-dimensional NumPy array and the affine matrix into an NIfTI image object. The metadata embedding module converts the metadata dictionary into a string and writes it to the header file of the NIfTI image object to obtain NIfTI header information; the NIfTI data in the NIfTI header information maps to the metadata information. The conversion and compression module compresses the NIfTI image object and the NIfTI header information to obtain the NIfTI file information corresponding to the DICOM file information.

[0180] The other functions performed in the slice acquisition module, DICOM parsing module, slice processing module, NIfTI conversion module, metadata embedding module, and conversion compression module, as well as the technical details of each function, are the same as or similar to the corresponding features in the intelligent conversion method for medical image formats described above, and therefore will not be repeated here.

[0181] This application also discloses an electronic device.

[0182] Reference Figure 6 Electronic devices include a processor and a memory that are coupled to each other, and the memory stores computer programs that can run on the processor.

[0183] A computer program, when executed by a processor, implements an intelligent conversion method for medical image formats.

[0184] The memory 12 may be a ROM or other type of static storage device capable of storing static information and instructions, a random access memory, or other type of dynamic storage device capable of storing information and instructions. It may also be an electrically erasable programmable read-only memory, a read-only optical disc or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), a magnetic disk storage medium, or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto. In some embodiments, the memory 12 may be an internal storage unit.

[0185] Processor 11 can be a central processing unit, a general-purpose processor, a data signal processor, an application-specific integrated circuit, a field-programmable gate array, or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It is used to run program code stored in memory 12 or process data.

[0186] Processor 11 and memory 12 are connected via a bus. The bus may include a pathway for transmitting information between the components. The bus may be a peripheral interconnect standard bus or an extended industry standard structure bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0187] Figure 6 Only an electronic device with memory 12, processor 11, and bus is shown. It will be understood by those skilled in the art that... Figure 6The structures shown do not constitute a limitation on the electronic device. It can be a bus topology or a star topology. The electronic device may also include more or fewer components than shown, or combine certain components, or deploy different components. Other existing or future electronic devices are applicable and should be included within the scope of protection, and are incorporated herein by reference.

[0188] The implementation principle is as follows:

[0189] Through a modular pipeline architecture, it solves problems such as DICOM format fragmentation, difficulty in metadata parsing, and inconsistent coordinate systems, outputting NIfTI files and accompanying metadata that conform to the BIDS standard, providing standardized data for AI training and scientific research analysis. The overall process is executed in a closed loop of four steps: data input, intelligent processing, quality inspection, and standardized output. Each module works together to achieve automated and high-precision format conversion.

[0190] Based on four dimensions—patient, examination, sequence, and collection—standard tags such as PatientID, StudyDate, Modality, and SliceThickness are extracted. Intelligent metadata parsing and retention are performed, and multi-dimensional metadata extraction is carried out: the device manufacturer is identified, including GE, Siemens, and Philips, and the corresponding parsing logic is called to extract private tags and supplement them to the metadata dictionary.

[0191] The metadata dictionary is converted into a JSON format file and output along with the final NIfTI file. Simultaneously, the metadata is embedded into extended fields of the NIfTI file to enable data traceability.

[0192] Robust coordinate system transformation and affine matrix calculation are crucial for ensuring spatial accuracy. This process involves five steps to generate a 4×4 affine matrix conforming to the NIfTI specification. Row and column direction vectors are extracted from the Image Orientation Patient label. These vectors are then calculated using a cross product, and normalized to ensure a length of 1.

[0193] The spatial distance is calculated first using the Image Position Patient labels of adjacent slices to obtain the actual interlayer spacing. If the number of slices is less than 2, the nominal value of SliceThickness is used.

[0194] The normalized row, column, and layer direction vectors are multiplied by the row spacing, column spacing, and layer spacing, respectively, and then combined by column to generate a 3×3 scaling matrix. The matrix contains both direction and physical size information.

[0195] Calculate the determinant of the scaling matrix and check if its absolute value is close to 1; the error range is configurable. If it does not meet the requirement, correct the vectors using Gram-Schmidt orthogonalization and regenerate the matrix.

[0196] Fill the scaling matrix into the first three rows and first three columns of the 4×4 matrix, and fill the first layer slice Image Position Patient coordinates as translation vectors into the first three rows and fourth column. The fourth row is fixed as [0,0,0,1], forming the final affine matrix.

[0197] The slices are sorted according to their spatial location based on the Image Position Patient label to ensure correct data dimensions. Pixel data for each slice is read, and Rescale Slope and Rescale Intercept calibrations are applied to convert the raw pixel values ​​into true physical values, such as the HU value of a CT scan.

[0198] The sorted slices are stacked according to layer dimensions to form 3D volumetric data (rows, columns, layers). The entire transformation process described above is automatically executed, iterating through all grouped DICOM sequences and generating a batch transformation report. The report includes the transformation status, quality score, and output path for each sequence.

[0199] The output standardized NIfTI data can be directly connected to downstream patented modules such as sequence normalization, phase recognition, and organ segmentation to form a complete medical image processing pipeline.

[0200] It should be understood that although the steps in the flowcharts in the accompanying drawings are shown sequentially as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise expressly stated herein, there is no strict order in which these steps are performed, and they may be performed in other orders.

[0201] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.

Claims

1. A method for intelligent conversion of medical image formats, characterized in that, Includes the following steps: Obtain a list of DICOM files, wherein the list of DICOM files is an ordered collection of DICOM slices; Based on the DICOM file list, extract the corresponding tag information and construct a metadata dictionary from the tag information. The metadata dictionary includes metadata information and linear transformation tags. Traverse all DICOM slices and read the corresponding pixel arrays. Perform linear transformation on the pixel values ​​in the pixel arrays using the linear transformation label to obtain the actual physical value matrix. The actual physical value matrix is ​​stacked along a preset third dimension to form a three-dimensional NumPy array, and the affine matrix of the DICOM slice is calculated. The three-dimensional NumPy array and the affine matrix are then combined to form an NIfTI image object. The metadata dictionary is converted into a string and written into the header file of the NIfTI image object to obtain NIfTI header file information. The NIfTI data in the NIfTI header file information is mapped to the metadata information. The NIfTI image object and the NIfTI header information are compressed to obtain the NIfTI file information corresponding to the DICOM file information.

2. The intelligent conversion method for medical image formats according to claim 1, characterized in that, The metadata dictionary includes spatial orientation labels and position coordinate labels. The spatial orientation labels are used to determine the slice orientation, while the position coordinate labels are used to determine the slice absolute position. Calculating the affine matrix of the DICOM slice includes the following steps: Based on the spatial orientation label, generate the row direction vector and column direction vector corresponding to the DICOM slice, and perform a cross product of the row direction vector and the column direction vector to obtain the third dimension vector corresponding to the preset third dimension. A local orthogonal basis is constructed based on the row direction vector, column direction vector and unit vector. The local orthogonal basis is rotated or scaled to obtain a scaling matrix. The spatial origin is determined based on the location coordinate labels, and a translation vector is generated based on the location coordinate labels. The scaling matrix and the translation vector are combined to determine the affine matrix.

3. The intelligent conversion method for medical image formats according to claim 2, characterized in that, The metadata dictionary includes slice thickness labels, and the scaling matrix is ​​a 3×3 matrix. Generating the scaling matrix based on the direction vector includes the following steps: The row spacing is obtained based on the DICOM slice, and the row direction vector is multiplied by the row spacing to obtain the value of the first column of the scaling matrix; The column spacing is obtained based on the DICOM slice, and the column direction is multiplied by the column spacing to obtain the second column value of the scaling matrix; The interlayer spacing is obtained based on the updated slice thickness label, and the unit vector is multiplied by the interlayer spacing to obtain the value of the third column of the scaling matrix.

4. The intelligent conversion method for medical image formats according to claim 3, characterized in that, The interlayer spacing is obtained based on the updated slice thickness label, wherein the updating method of the slice thickness label includes the following steps: The number of DICOM slices is determined based on the DICOM file list, and it is determined whether the number of DICOM slices is greater than a preset threshold. If so, read the position coordinates of adjacent DICOM slices in the DICOM file list and calculate the vector difference between adjacent DICOM slices; The corresponding layer direction is obtained based on the third-dimensional vector of the DICOM file list. The vector difference is projected onto the layer direction to obtain the actual layer spacing, and the slice thickness label is updated based on the actual layer spacing.

5. The intelligent conversion method for medical image formats according to claim 2, characterized in that, Before combining the scaling matrix and the translation vector to determine the affine matrix, the following steps are also included: Calculate the determinant of the scaling matrix and determine whether the determinant is close to a second preset threshold; If yes, then the column direction vector and the row direction vector are orthogonal; if not, then a detection alarm signal is generated, and the scaling matrix is ​​updated based on the detection alarm signal.

6. The intelligent conversion method for medical image formats according to claim 1, characterized in that, The NIfTI file information includes the NIfTI file path. After compressing the NIfTI image object and the NIfTI header information to obtain the NIfTI file information corresponding to the DICOM file information, the following steps are also included: Set up multi-dimensional quality assessment rules, input the NIfTI file path into the multi-dimensional quality assessment rules, review them sequentially and obtain a set of review results, wherein the set of review results includes at least one review result; The quality adjustment parameters are determined based on the audit result set, and the quality adjustment parameters are summed with the initial quality score to obtain the actual quality score; The conversion and utilization level of the NIfTI file information is determined by the actual quality score, and the conversion and utilization level characterizes the credibility of the NIfTI file information for subsequent AI training.

7. The intelligent conversion method for medical image formats according to claim 6, characterized in that, The conversion utilization level includes a first-level utilization level and a second-level utilization level. The conversion utilization level of the NIfTI file information is determined by the actual quality score, including the following steps: Compare the actual quality score with a third preset threshold; When the actual quality score is not less than the third preset threshold, the conversion utilization level is determined to be the first-level utilization level. The first-level utilization level indicates that the NIfTI file information can be directly used for subsequent AI review. When the actual quality score is less than the third preset threshold, the conversion utilization level is determined to be a level 2 utilization level. The level 2 utilization level indicates that the NIfTI file information cannot be directly used for subsequent AI review.

8. The intelligent conversion method for medical image formats according to claim 1, characterized in that, The DICOM file information includes the input root directory and the specified output root directory. Before obtaining the list of DICOM files, the following steps are also included: The system sequentially scans all files to be processed in the input root directory, each file having a unique identifier. All files to be processed are grouped based on the unique identifier to determine the DICOM file list.

9. An intelligent conversion system for medical image formats, characterized in that, The method for intelligent conversion of medical image formats according to any one of claims 1-8 includes: A slice acquisition module is used to acquire a list of DICOM files, wherein the list of DICOM files is an ordered set of DICOM slices; The DICOM parsing module extracts corresponding tag information based on the DICOM file list and constructs a metadata dictionary from the tag information. The metadata dictionary includes metadata information and linear transformation tags. The slicing processing module traverses all DICOM slices and reads the corresponding pixel arrays. It then performs a linear transformation on the pixel values ​​using the linear transformation tag to obtain the actual physical value matrix. The NIfTI conversion module is used to stack the actual physical value matrix along a preset third dimension to form a three-dimensional NumPy array, calculate the affine matrix of the DICOM slice, and combine the three-dimensional NumPy array and the affine matrix into an NIfTI image object. Metadata embedding module, which is used to convert the metadata dictionary into a string and write it into the header file of the NIfTI image object to obtain NIfTI header file information, wherein the NIfTI data in the NIfTI header file information is mapped to the metadata information; A conversion and compression module is used to compress the NIfTI image object and the NIfTI header information to obtain the NIfTI file information corresponding to the DICOM file information.

10. An electronic device, characterized in that, The electronic device includes a processor and a memory coupled to each other, wherein the memory stores a computer program that can run on the processor. When the computer program is executed by the processor, it implements the intelligent conversion method for medical image formats as described in any one of claims 1-8.