Stock DICOM file compression method based on Java platform
By developing the existing DICOM file compression method on the Java platform, and using the lossless compression algorithm of the distributed task scheduling platform and the Dcm4che tool library, the problem of low compression efficiency in the existing technology is solved, and high-efficiency compression and image quality are guaranteed.
Patent Information
- Application Number
- CN202411791929.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-21
AI Technical Summary
The prior art is difficult to efficiently compress stock DICOM files while ensuring image quality, resulting in insufficiency of storage and transmission.
The existing DICOM file compression method based on the Java platform is adopted, and the distributed task scheduling platform is used to trigger the Java program to query the DICOM source file path regularly, and the DICOM source file is backed up and compressed. Lossless or near lossless compression algorithms provided by Dcm4che, a third-party DICOM tool library, such as JPEG-LS and JPEG 2000.
It realizes efficient compression of DICOM files, reduces file size, improves storage and data transmission efficiency, and ensures image quality and meets the needs of clinical diagnosis.
Smart Images

Figure CN119673390A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to image compression, and in particular to a Java platform-based storage DICOM file compression method. Background Art
[0002] DICOM (Digital Imaging and Communications in Medicine) is an international standard format for storing, exchanging, transmitting and displaying image information in the field of medical imaging. Since DICOM files usually contain high-quality image data to accurately reflect the patient's pathological conditions, they often occupy a large space.
[0003] In modern medical practice, especially in image-intensive fields such as radiology, cardiovascular imaging, and pathology, a large number of DICOM files are generated every day. These huge stock of DICOM files poses a huge challenge to the storage facilities of medical institutions, which not only require expensive hardware equipment to store these files, but also require effective data management strategies to ensure the integrity, security, and accessibility of the files. In addition, large DICOM files will also encounter problems when transmitted over the network, especially in bandwidth-constrained environments, where transmission delays may affect the timeliness of diagnosis and treatment.
[0004] In order to solve the above problems, it is necessary to adopt an efficient compression method for existing DICOM files to reduce the space occupied by DICOM files, while ensuring the image quality so that the accuracy of clinical diagnosis is not affected. An efficient compression method for existing DICOM files can not only save storage costs, but also improve data transmission efficiency, thereby shortening the clinical diagnosis and treatment cycle, which is particularly important for the treatment of patients in emergency situations. Summary of the invention
[0005] 1. Technical issues to be solved
[0006] In view of the above shortcomings of the prior art, the present invention provides a method for compressing existing DICOM files based on the Java platform, which can effectively overcome the defect of the prior art that the existing DICOM files cannot be efficiently compressed while ensuring the image quality.
[0007] (II) Technical solution
[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0009] A Java-based DICOM file compression method uses a distributed task scheduling platform to periodically trigger a Java program to query the DICOM source file path, back up and compress the DICOM source file to obtain a DICOM compressed file.
[0010] The distributed task scheduling platform is used to periodically read the DICOM compressed file to confirm whether the DICOM compressed file is normal, and the backup file corresponding to the normal DICOM compressed file is deleted.
[0011] Preferably, the distributed task scheduling platform is used to periodically trigger the Java program to query the DICOM source file path, and back up and compress the DICOM source file to obtain a DICOM compressed file, including:
[0012] S11, using XXL-JOB to trigger the Java program regularly to traverse all DICOM source files in the specified directory in the database in a time-lapse manner;
[0013] S12, creating a backup file of the DICOM source file, and copying the DICOM source file to a backup directory;
[0014] S13, compressing the DICOM source file using the selected compression algorithm, and converting the DICOM source file into a DICOM compressed file of a corresponding compression format;
[0015] S14, confirm whether the DICOM compressed file is valid, if the DICOM compressed file is invalid, return to S13;
[0016] Among them, all the above steps have detailed log records, and the log records use the Slf4j log interface + Logback log implementation to write the log information into the log file.
[0017] Preferably, in S11, XXL-JOB is used to periodically trigger a Java program to traverse all DICOM source files in a specified directory in the database in a time-lapse manner, including:
[0018] Log in to the XXL-JOB management platform, create a new task, set the execution frequency of the task, and select, adjust or create an executor with access to the storage location of the DICOM source file according to actual needs.
[0019] Preferably, in S13, the DICOM source file is compressed using a selected compression algorithm, and the DICOM source file is converted into a DICOM compressed file of a corresponding compression format, including:
[0020] Compress the DICOM source file using the selected compression algorithm, and convert the DICOM source file into a DICOM compressed file of the corresponding compression format according to the input Transfer SyntaxUID;
[0021] The compression algorithm uses the lossless or near-lossless compression algorithm provided by the Java third-party DICOM tool library Dcm4che, including JPEG-LS and JPEG 2000.
[0022] Preferably, confirming whether the DICOM compressed file is valid in S14 includes:
[0023] Through the metadata verification of DICOM standard, use the DICOM input stream DicomInputStream provided by the DICOM tool library Dcm4che to read the File Metadata Info of the DICOM compressed file;
[0024] If it can be read normally and the Tag value is normal, the DICOM compressed file is valid.
[0025] Preferably, the method of using the distributed task scheduling platform to periodically read the DICOM compressed file, confirm whether the DICOM compressed file is normal, and delete the backup file corresponding to the normal DICOM compressed file includes:
[0026] S21, using XXL-JOB to trigger the Java program regularly, traversing all DICOM compressed files in the directory;
[0027] S22, confirm whether the DICOM compressed file is normal, and delete the backup file corresponding to the normal DICOM compressed file;
[0028] Among them, all the above steps have detailed log records, and the log records use the Slf4j log interface + Logback log implementation to write the log information into the log file.
[0029] Preferably, in S21, XXL-JOB is used to periodically trigger a Java program to traverse all DICOM compressed files in the directory, including:
[0030] Log in to the XXL-JOB management platform, create a new task, set the execution frequency of the task, and select, adjust or create an executor with access to the storage location of the DICOM compressed file according to actual needs.
[0031] Preferably, confirming whether the DICOM compressed file is normal in S22 includes:
[0032] Verify by trying to decompress and check key DICOM tags, and use the DICOM input stream DicomInputStream provided by the DICOM tool library Dcm4che to read the File MetadataInfo of the DICOM compressed file;
[0033] If it can be read normally and the Tag value is normal, the DICOM compressed file passes the verification.
[0034] Preferably, confirming whether the DICOM compressed file is normal in S22 includes:
[0035] Verify by decompressing the DICOM compressed file and converting the DICOM compressed file into a DICOM file with common uncompressed transfer syntax using the TransferSyntaxUID provided by the DICOM tool library Dcm4che;
[0036] If it can be decompressed normally, and the DICOM input stream DicomInputStream provided by the DICOM tool library Dcm4che can be used to read the File Metadata Info of the decompressed DICOM file normally, and there is no abnormality in obtaining the Tag value, the DICOM compressed file passes the verification.
[0037] Preferably, deleting the backup file corresponding to the normal DICOM compressed file in S22 includes:
[0038] If the DICOM compressed file passes the verification, the backup file corresponding to the DICOM compressed file is deleted;
[0039] If the DICOM compressed file fails the verification, the DICOM compressed file is replaced with the backup file corresponding to the DICOM compressed file, and the DICOM compressed file is deleted.
[0040] (III) Beneficial effects
[0041] Compared with the prior art, the Java platform-based DICOM file compression method provided by the present invention has the following beneficial effects:
[0042] 1) Efficient compression: The compression algorithm uses the lossless or near-lossless compression algorithm provided by the Java third-party DICOM tool library Dcm4che, such as JPEG-LS, JPEG 2000, etc., and adopts advanced compression technology to reduce the size of DICOM files and effectively improve storage efficiency and data transmission efficiency;
[0043] 2) Ensure image quality: The compression algorithm uses the lossless or near-lossless compression algorithm provided by the Java third-party DICOM tool library Dcm4che, such as JPEG-LS, JPEG 2000, etc., which can ensure image quality so that the compressed DICOM file can still meet the needs of clinical diagnosis;
[0044] 3) Cross-platform compatibility: Since the solution is developed in Java, it has good cross-platform compatibility and can run on different operating systems. The solution can be integrated into the existing medical image processing system as a library or service, providing a simple API interface for calling and controlling;
[0045] 4) User-friendly interface: The intuitive user interface simplifies the compression configuration process and can be easily operated by non-professional users;
[0046] 5) Performance optimization: Targeted tuning is performed based on the performance characteristics of the Java virtual machine to ensure that the compression algorithm runs efficiently in the Java environment, reduce the consumption of computing resources, and improve response speed;
[0047] 6) Standardization and versatility: Strictly follow the DICOM standard to ensure that the compressed DICOM files still meet industry standards and can be recognized and processed by various medical imaging software;
[0048] 7) Data security protection: Strengthen data security measures to protect the privacy of patient data and prevent data leakage during the compression process;
[0049] 8) Scalability and adaptability: Ability to adjust compression parameters according to the specific needs of different medical institutions and provide the possibility of subsequent upgrades to adapt to future technological developments;
[0050] 9) Comprehensive testing and verification: Conduct comprehensive testing, including unit testing, integration testing, and performance testing, to ensure the stability and reliability of this solution, and verify its effectiveness through actual clinical data. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0052] Figure 1 It is a schematic diagram of the process of the present invention. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0054] A Java-based DICOM file compression method Figure 1 As shown, the distributed task scheduling platform is used to periodically trigger the Java program to query the DICOM source file path, and to back up and compress the DICOM source file to obtain a DICOM compressed file;
[0055] The distributed task scheduling platform is used to periodically read the DICOM compressed file to confirm whether the DICOM compressed file is normal, and the backup file corresponding to the normal DICOM compressed file is deleted.
[0056] ① Use the distributed task scheduling platform to periodically trigger the Java program to query the DICOM source file path, and back up and compress the DICOM source file to obtain the DICOM compressed file, including:
[0057] S11, using XXL-JOB to trigger the Java program regularly to traverse all DICOM source files in the specified directory in the database in a time-lapse manner;
[0058] S12, creating a backup file of the DICOM source file, and copying the DICOM source file to a backup directory;
[0059] S13, compressing the DICOM source file using the selected compression algorithm, and converting the DICOM source file into a DICOM compressed file of a corresponding compression format;
[0060] S14, confirm whether the DICOM compressed file is valid, if the DICOM compressed file is invalid, return to S13;
[0061] Among them, all the above steps have detailed log records, and the log records use the Slf4j log interface + Logback log implementation to write the log information into the log file.
[0062] In addition, if any error occurs during the above process, there are corresponding abnormal situation handling mechanisms, such as retry, skip or send alarm notification, etc. The log file can save the log information of the specified level according to the configuration, and the log file generation location (supports creating folders according to date), log file size, retention days, etc. can be specified.
[0063] Specifically, S11 uses XXL-JOB to periodically trigger a Java program to traverse all DICOM source files in a specified directory in the database in a time-lapse manner, including:
[0064] Log in to the XXL-JOB management platform, create a new task, set the execution frequency of the task, and select, adjust or create an executor with access to the storage location of the DICOM source file according to actual needs.
[0065] Specifically, S13 uses the selected compression algorithm to compress the DICOM source file and converts the DICOM source file into a DICOM compressed file of a corresponding compression format, including:
[0066] Compress the DICOM source file using the selected compression algorithm, and convert the DICOM source file into a DICOM compressed file of the corresponding compression format according to the input Transfer SyntaxUID;
[0067] The compression algorithm uses the lossless or near-lossless compression algorithm provided by the Java third-party DICOM tool library Dcm4che, including JPEG-LS and JPEG 2000.
[0068] For example, if the input Transfer Syntax UID is 1.2.840.10008.1.2.4.70, the DICOM source file can be converted into a file with the transfer syntax of JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1]). The Transfer Syntax UID and its meaning are specifically described in the DICOM international standard. For more information, please refer to the latest current version of DICOM, Part 5.
[0069] Specifically, S14 confirms whether the DICOM compressed file is valid, including:
[0070] Through the metadata verification of DICOM standard, use the DICOM input stream DicomInputStream provided by the DICOM tool library Dcm4che to read the File Metadata Info of the DICOM compressed file;
[0071] If it can be read normally and the Tag value is normal, the DICOM compressed file is valid.
[0072] ② Use the distributed task scheduling platform to periodically read the DICOM compressed file to confirm whether the DICOM compressed file is normal, and delete the backup file corresponding to the normal DICOM compressed file, including:
[0073] S21, using XXL-JOB to trigger the Java program regularly, traversing all DICOM compressed files in the directory;
[0074] S22, confirm whether the DICOM compressed file is normal, and delete the backup file corresponding to the normal DICOM compressed file;
[0075] Among them, all the above steps have detailed log records, and the log records use the Slf4j log interface + Logback log implementation to write the log information into the log file.
[0076] In addition, if any error occurs during the above process, there are corresponding abnormal situation handling mechanisms, such as retry, skip or send alarm notification, etc. The log file can save the log information of the specified level according to the configuration, and the log file generation location (supports creating folders according to date), log file size, retention days, etc. can be specified.
[0077] Specifically, S21 uses XXL-JOB to periodically trigger the Java program to traverse all DICOM compressed files in the directory, including:
[0078] Log in to the XXL-JOB management platform, create a new task, set the execution frequency of the task, and select, adjust or create an executor with access to the storage location of the DICOM compressed file according to actual needs.
[0079] Specifically, S22 confirms whether the DICOM compressed file is normal, including:
[0080] Verify by trying to decompress and check key DICOM tags, and use the DICOM input stream DicomInputStream provided by the DICOM tool library Dcm4che to read the File MetadataInfo of the DICOM compressed file;
[0081] If it can be read normally and the Tag value is normal, the DICOM compressed file passes the verification.
[0082] Specifically, S22 confirms whether the DICOM compressed file is normal, including:
[0083] Verify by decompressing the DICOM compressed file and converting the DICOM compressed file into a DICOM file with common uncompressed transfer syntax using the TransferSyntaxUID provided by the DICOM tool library Dcm4che;
[0084] If it can be decompressed normally, and the DICOM input stream DicomInputStream provided by the DICOM tool library Dcm4che can be used to read the File Metadata Info of the decompressed DICOM file normally, and there is no abnormality in obtaining the Tag value, the DICOM compressed file passes the verification.
[0085] For example, the input Transfer Syntax UID is 1.2.840.10008.1.2, and the corresponding transfer syntax means ImplicitVR Little Endian, which can convert the DICOM compressed file into a DICOM file with common uncompressed transfer syntax.
[0086] Specifically, in S22, the backup file corresponding to the normal DICOM compressed file is deleted, including:
[0087] If the DICOM compressed file passes the verification, the backup file corresponding to the DICOM compressed file is deleted;
[0088] If the DICOM compressed file fails the verification, the DICOM compressed file is replaced with the backup file corresponding to the DICOM compressed file, and the DICOM compressed file is deleted.
[0089] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements will not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for compressing stock DICOM files based on Java platform, characterized by: The distributed task scheduling platform is used to periodically trigger the Java program to query the DICOM source file path, and to back up and compress the DICOM source file to obtain the DICOM compressed file; The distributed task scheduling platform is used to periodically read the DICOM compressed file to confirm whether the DICOM compressed file is normal, and the backup file corresponding to the normal DICOM compressed file is deleted.
2. The Java platform-based DICOM file compression method according to claim 1, characterized in that: The distributed task scheduling platform is used to periodically trigger the Java program to query the DICOM source file path, and to back up and compress the DICOM source file to obtain a DICOM compressed file, including: S11, using XXL-JOB to trigger the Java program regularly to traverse all DICOM source files in the specified directory in the database in a time-lapse manner; S12, creating a backup file of the DICOM source file, and copying the DICOM source file to a backup directory; S13, compressing the DICOM source file using the selected compression algorithm, and converting the DICOM source file into a DICOM compressed file of a corresponding compression format; S14, confirm whether the DICOM compressed file is valid, if the DICOM compressed file is invalid, return to S13; Among them, all the above steps have detailed log records, and the log records use the Slf4j log interface + Logback log implementation to write the log information into the log file.
3. The method for compressing existing DICOM files based on the Java platform according to claim 2, characterized in that: In S11, XXL-JOB is used to trigger the Java program to traverse all DICOM source files in the specified directory in the database in a time-lapse manner, including: Log in to the XXL-JOB management platform, create a new task, set the execution frequency of the task, and select, adjust or create an executor with access to the storage location of the DICOM source file according to actual needs.
4. The method for compressing existing DICOM files based on the Java platform according to claim 2, characterized in that: S13 compresses the DICOM source file using the selected compression algorithm and converts the DICOM source file into a DICOM compressed file of a corresponding compression format, including: Compress the DICOM source file using the selected compression algorithm, and convert the DICOM source file into a DICOM compressed file of the corresponding compression format according to the input Transfer Syntax UID; The compression algorithm uses the lossless or near-lossless compression algorithm provided by the Java third-party DICOM tool library Dcm4che, including JPEG-LS and JPEG 2000.
5. The method for compressing existing DICOM files based on the Java platform according to claim 2, characterized in that: S14 confirms whether the DICOM compressed file is valid, including: Through the metadata verification of DICOM standard, use the DICOM input stream DicomInputStream provided by the DICOM tool library Dcm4che to read the File Metadata Info of the DICOM compressed file; If it can be read normally and the Tag value is normal, the DICOM compressed file is valid.
6. The Java platform-based existing DICOM file compression method according to claim 1, characterized in that: The method of using the distributed task scheduling platform to periodically read the DICOM compressed file, confirm whether the DICOM compressed file is normal, and delete the backup file corresponding to the normal DICOM compressed file includes: S21, using XXL-JOB to trigger the Java program regularly, traversing all DICOM compressed files in the directory; S22, confirm whether the DICOM compressed file is normal, and delete the backup file corresponding to the normal DICOM compressed file; Among them, all the above steps have detailed log records, and the log records use the Slf4j log interface + Logback log implementation to write the log information into the log file.
7. The Java platform-based method for compressing stock DICOM files according to claim 6, characterized in that: In S21, XXL-JOB is used to trigger the Java program regularly to traverse all DICOM compressed files in the directory, including: Log in to the XXL-JOB management platform, create a new task, set the execution frequency of the task, and select, adjust or create an executor with access to the storage location of the DICOM compressed file according to actual needs.
8. The method for compressing existing DICOM files based on the Java platform according to claim 6, characterized in that: S22 confirms whether the DICOM compressed file is normal, including: Verify by trying to decompress and check key DICOM tags, and use the DICOM input stream DicomInputStream provided by the DICOM tool library Dcm4che to read the File MetadataInfo of the DICOM compressed file; If it can be read normally and the Tag value is normal, the DICOM compressed file passes the verification.
9. The Java platform-based existing DICOM file compression method according to claim 6, characterized in that: S22 confirms whether the DICOM compressed file is normal, including: Verify by decompressing the DICOM compressed file and converting the DICOM compressed file into a DICOM file with common uncompressed transfer syntax using the TransferSyntaxUID provided by the DICOM tool library Dcm4che; If it can be decompressed normally, and the DICOM input stream DicomInputStream provided by the DICOM tool library Dcm4che can be used to read the File Metadata Info of the decompressed DICOM file normally, and there is no abnormality in obtaining the Tag value, the DICOM compressed file passes the verification.
10. The Java platform-based method for compressing stock DICOM files according to claim 8 or 9, characterized in that: In S22, the backup files corresponding to the normal DICOM compressed files are deleted, including: If the DICOM compressed file passes the verification, the backup file corresponding to the DICOM compressed file is deleted; If the DICOM compressed file fails the verification, the DICOM compressed file is replaced with the backup file corresponding to the DICOM compressed file, and the DICOM compressed file is deleted.
Citation Information
Patent Citations
Implementation method of C-PACS (China-Picture Archiving and Communication System) distributed medical image platform
CN104778034A
Method and system for realizing medical examination big data management
CN118039085A
Image compression method and system
US20150215625A1