CN111243712B - File processing method and device - Google Patents

File processing method and device Download PDF

Info

Publication number
CN111243712B
CN111243712B CN201911295197.5A CN201911295197A CN111243712B CN 111243712 B CN111243712 B CN 111243712B CN 201911295197 A CN201911295197 A CN 201911295197A CN 111243712 B CN111243712 B CN 111243712B
Authority
CN
China
Prior art keywords
file
original
image file
dicom image
dicom
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911295197.5A
Other languages
Chinese (zh)
Other versions
CN111243712A (en
Inventor
冯海泉
韩玲娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Pioneering Huikang Technology Co ltd
Original Assignee
Pioneering Huikang Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Pioneering Huikang Technology Co ltd filed Critical Pioneering Huikang Technology Co ltd
Priority to CN201911295197.5A priority Critical patent/CN111243712B/en
Publication of CN111243712A publication Critical patent/CN111243712A/en
Application granted granted Critical
Publication of CN111243712B publication Critical patent/CN111243712B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16HHEALTHCARE INFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR THE HANDLING OR PROCESSING OF MEDICAL OR HEALTHCARE DATA
    • G16H30/00ICT specially adapted for the handling or processing of medical images
    • G16H30/20ICT specially adapted for the handling or processing of medical images for handling medical images, e.g. DICOM, HL7 or PACS
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16HHEALTHCARE INFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR THE HANDLING OR PROCESSING OF MEDICAL OR HEALTHCARE DATA
    • G16H30/00ICT specially adapted for the handling or processing of medical images
    • G16H30/40ICT specially adapted for the handling or processing of medical images for processing medical images, e.g. editing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention provides a file processing method and device. The method is applied to a server, and comprises the following steps: acquiring an original medical digital imaging and communication DICOM image file, and extracting key data set information in the original DICOM image file and image information of each frame of original image; wherein the key data set comprises key data in the original DICOM image file; converting the original image into a JPEG file according to the image information; sequentially writing the JPEG file and the key data set into a DICOM image file to obtain a target DICOM image file; and storing the target DICOM image file, and deleting the JPEG file and the cache data of the key data set in the server. The embodiment of the invention solves the problem that in the prior art, the integrity of data is difficult to ensure on the basis of reducing the storage space occupied by the DICOM image file.

Description

File processing method and device
Technical Field
The present invention relates to the field of internet technologies, and in particular, to a method and an apparatus for processing a file.
Background
In recent years, as digital imaging diagnostic apparatuses typified by electronic computed tomography (Computed Tomography, CT) are widely used in clinic, digital imaging and communication (Digital Imaging Communications in Medicine, DICOM) imaging in medicine is also widely used in radiology, cardiovascular imaging, and radiodiagnosis diagnostic apparatuses. When a DICOM client accesses a DICOM image file, the DICOM client generally acquires images of each examination (Study) one by one, and since an examination usually has a plurality of sequences (Series), each sequence (Series) further includes a plurality of instances (instances), and usually one Instance is stored as a DICOM image file; therefore, in the practical application process, a large number of DICOM image files need to be downloaded and cached in the web page, and the number is usually about several thousands; in addition, the resolution of DICOM image files is higher, for example, the resolution of 512 x 512 of image files generated by equipment such as CT is about 530k of each file, so that the total capacity of one checked file can reach several GB; if these original image files are downloaded and cached in the web page, it is difficult to directly cache in the script file (e.g. Javascript) of the browser due to the large data size, and the efficiency of image reading.
In order to solve the problem, a scheme of compressing and storing the DICOM image file is presented, but during the compression process, data loss is easy to cause, and the integrity of the data is affected.
Therefore, in the prior art, it is difficult to ensure the integrity of data on the basis of reducing the storage space occupied by the DICOM image file.
Disclosure of Invention
The embodiment of the invention provides a file processing method and device, which are used for solving the problem that in the prior art, the data integrity is difficult to be ensured on the basis of reducing the storage space occupied by DICOM image files.
In one aspect, an embodiment of the present invention provides a file processing method, applied to a server, where the method includes:
acquiring an original medical digital imaging and communication DICOM image file, and extracting key data set information in the original DICOM image file and image information of each frame of original image; wherein the key data set comprises key data in the original DICOM image file; the image information includes image size and pixel information;
converting the original image into a JPEG file according to the image information;
sequentially writing the JPEG file and the key data set into a DICOM image file to obtain a target DICOM image file;
and storing the target DICOM image file, and deleting the JPEG file and the cache data of the key data set in the server.
Optionally, the pixel information includes an original pixel matrix of the original image of each frame, and an element in the original pixel matrix is an RGB pixel value of each pixel point.
Optionally, the step of converting the original image into a JPEG file according to the pixel information includes:
for each frame of the original image in question,
converting the RGB pixel values into gray values according to a preset conversion formula to obtain a gray value matrix of the original pixel matrix;
writing the gray value matrix into a JPEG pixel matrix;
creating an original JPEG file with the same image size as the original image according to the image size;
and writing the JPEG pixel matrix into the original JPEG file to obtain the JPEG file.
Optionally, the step of writing the JPEG file and the key dataset into a DICOM image file in sequence to obtain the target DICOM image file includes:
creating a first DICOM image file;
writing the JPEG file into the first DICOM image file to obtain a second DICOM image file;
and writing the key data set into the second DICOM image file to obtain a target DICOM image file.
Optionally, the step of writing the key data set into the second DICOM image file to obtain a target DICOM image file includes:
packaging the key data set into a data set structure object in a target format; the target format is a protocol version format supported by the second DICOM image file;
and writing the data set structure object into the second DICOM image file to obtain a target DICOM image file.
Optionally, the key data set comprises a first data subset and/or a second data subset;
wherein the first data subset is a universal data set of the original DICOM image file;
the second subset of data is a specific set of data of the original image.
Optionally, the original image has a unique identification number;
the second subset of data is marked with the same unique identification number as the corresponding original image.
On the other hand, the embodiment of the invention also provides a file processing device, which is applied to a server and comprises:
the acquisition module is used for acquiring an original medical digital imaging and communication DICOM image file, and extracting key data set information in the original DICOM image file and image information of each frame of original image; wherein the key data set comprises key data in the original DICOM image file; the image information includes image size and pixel information;
the conversion module is used for converting the original image into a JPEG file according to the image information;
the processing module is used for writing the JPEG file and the key data set into a DICOM image file in sequence to obtain a target DICOM image file;
and the storage module is used for storing the target DICOM image file, deleting the JPEG file and the cache data of the key data set in the server.
Optionally, the pixel information includes an original pixel matrix of the original image of each frame, and an element in the original pixel matrix is an RGB pixel value of each pixel point.
Optionally, the conversion module is configured to:
for each frame of the original image in question,
converting the RGB pixel values into gray values according to a preset conversion formula to obtain a gray value matrix of the original pixel matrix;
writing the gray value matrix into a JPEG pixel matrix;
creating an original JPEG file with the same size as the original image according to the image size;
and writing the JPEG pixel matrix into the original JPEG file to obtain the JPEG file.
Optionally, the processing module includes:
the creation sub-module is used for creating a first DICOM image file;
the first processing submodule is used for writing the JPEG file into the first DICOM image file to obtain a second DICOM image file;
and the second processing sub-module is used for writing the key data set into the second DICOM image file to obtain a target DICOM image file.
Optionally, the processing module includes:
the packaging submodule is used for packaging the key data set into a data set structure object in a target format; the target format is a protocol version format supported by the second DICOM image file;
and the writing sub-module is used for writing the data set structure object into the second DICOM image file to obtain a target DICOM image file.
Optionally, the key data set comprises a first data subset and/or a second data subset;
wherein the first data subset is a universal data set of the original DICOM image file;
the second subset of data is a dataset of the original image.
Optionally, the original image has a unique identification number;
the second subset of data is marked with the same unique identification number as the corresponding original image.
In yet another aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and where the processor implements the steps in the file processing method as described above when the processor executes the computer program.
In yet another aspect, embodiments of the present invention also provide a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the file processing method as described above.
In the embodiment of the invention, an original medical digital imaging and communication DICOM image file is obtained, and key data set information and image information of each frame of original image in the original DICOM image file are extracted; converting the original image into a JPEG file according to the image information; sequentially writing the JPEG file and the key data set into a DICOM image file to obtain a target DICOM image file; storing the target DICOM image file, deleting the JPEG file and the buffer data of the key data set in the server, firstly compressing an original image into a JPEG file, then writing the JPEG file and the key data set into a new DICOM image file, reducing the storage space occupied by the DICOM image file, realizing JPEG lossy compression and then storing; meanwhile, a key data set in the original DICOM image file is reserved in the processing process, and the integrity of the original image data is maintained.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart illustrating steps of a method for processing a file according to an embodiment of the present invention;
FIG. 2 is a second flowchart illustrating steps of a document processing method according to an embodiment of the present invention;
FIG. 3 is a flow chart of steps of an example of an embodiment of the present invention;
FIG. 4 is a block diagram of a document processing apparatus according to an embodiment of the present invention;
fig. 5 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
In various embodiments of the present invention, it should be understood that the sequence numbers of the following processes do not mean the order of execution, and the order of execution of the processes should be determined by the functions and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
Referring to fig. 1, an embodiment of the present invention provides a file processing method, applied to a server, where the method includes:
step 101, acquiring an original medical digital imaging and communication DICOM image file, and extracting key data set information in the original DICOM image file and image information of each frame of original image; wherein the key data set comprises key data in the original DICOM image file; the image information includes image size and pixel information.
Wherein DICOM provides a way to encapsulate a service object pair (Service Object Pair, SOP) instance of a DICOM information object definition (Information Object Definition, IOD) in a file in the form of a dataset. The DICOM file consists of a DICOM header and a DICOM data set, the byte stream of the data set being located after the DICOM header information.
In this step, an original DICOM image file, i.e., an uncompressed DICOM image file, is obtained, which may be a DICOM image file from a medical imaging device; the server extracts key data set information and image information of each frame of original image.
In one aspect, the original DICOM image file includes a single SOP instance and one or more key data sets; each instance contains one or more frames of original images, each frame of image being represented by an Item, each Item being identified by (FFFE, E000); the key data set includes key data in the original DICOM image file, and each key data is a group of data elements, for example, a medical image, and the data elements include patient information, examination information, sequence information, image information, and the like, which are main parts of the DICOM image file.
Optionally, the key dataset is composed of DICOM data elements arranged in a pre-specified order, such as in the order: patient name, gender, age, image size, etc.; the critical data consists of data elements, each of which may consist of 4 parts, for example: tag, value representation type (VR Value Representation), value Length (Value Length), value Field (Value Field).
As an example, the Tag (Tag) indicates a specific storage location of the value range of the data element, and the Tag (Tag) of a partial data element is as follows:
(1) Patient level information: patient name (0010 ), patient ID (0010, 0020), age Tag (0010, 1010), etc.; taking the name of the patient as an example, (0010 ) as a label, and setting the value range position as (0010 ); again, taking patient ID as an example, (0010, 0020) indicates its value range location.
(2) Checking level information: check date (0008, 0020), check ID (0020, 0010), check instance number (0020, 000D), and the like;
(3) Sequence level information: sequence instance number (0020, 000E), sequence number (0020, 0011), inspection pattern (0008, 0060), etc.;
(4) Example (Instance) grade information: SOP instance UID (0008, 0018), pixel pitch (0028, 0030), and the like.
On the other hand, the image information includes image size, i.e., height and width of each frame of image, image storage bit number, etc., and pixel information; the pixel information, that is, the pixel value of each pixel point on the image, is usually RGB pixel values, that is, three primary colors of RGB (Red), green (Green), and Blue (Blue).
Step 102, converting the original image into a JPEG file according to the image information.
The JPEG is an image format, redundant images and color data are removed in a lossy compression mode, and therefore less disk space can be occupied, and better picture quality can be obtained; in the step, for each frame of original image, a new JPEG file is constructed according to the size information of the original image, the compression ratio is set to be 1, and the height and the width of the new JPEG file are the same as those of the original image; and writing the pixel information into the constructed JPEG file to convert the original image into the JPEG file.
Step 103, writing the JPEG file and the key data set into a DICOM image file in sequence, thereby obtaining a target DICOM image file.
In this step, an empty DICOM image file is created, and header information is written, and the value of the transmission syntax Tag (0002,0010) is modified as follows: 1.2.840.10008.1.2.4.50 (JPEG Baseline (Process 1)), then writing the JPEG file into the constructed DICOM image file, and finally writing the key data set into the DICOM image file to obtain the target DICOM image file.
Compared with the original DICOM image file, the target DICOM image file realizes JPEG lossy compression and reduces the occupied storage space; meanwhile, the target DICOM image file is written into the key data set, so that the data integrity of the original DICOM image file is ensured.
Step 104, storing the target DICOM image file, and deleting the JPEG file and the cached data of the key data set in the server.
In this step, the target DICOM image file is stored, and the JPEG file and the cached data of the key data set in the server are deleted, thereby reducing the temporary storage space of the DICOM image file.
In the embodiment of the invention, an original medical digital imaging and communication DICOM image file is obtained, and key data set information and image information of each frame of original image in the original DICOM image file are extracted; converting the original image into a JPEG file according to the image information; sequentially writing the JPEG file and the key data set into a DICOM image file to obtain a target DICOM image file; storing the target DICOM image file, deleting the JPEG file and the buffer data of the key data set in the server, firstly compressing an original image into a JPEG file, then writing the JPEG file and the key data set into a new DICOM image file, reducing the storage space occupied by the DICOM image file, realizing JPEG lossy compression and then storing; meanwhile, a key data set in the original DICOM image file is reserved in the processing process, and the integrity of the original image data is maintained. The embodiment of the invention solves the problem that in the prior art, the integrity of data is difficult to ensure on the basis of reducing the storage space occupied by the DICOM image file.
Optionally, in an embodiment of the present invention, the pixel information includes an original pixel matrix of the original image of each frame, and an element in the original pixel matrix is an RGB pixel value of each pixel point.
The original pixel matrix is a matrix formed by RGB pixel values of pixel points in an original image according to the positions of the pixel points to which the RGB pixel values belong.
In addition, since the number of bytes occupied by each line of the image must be a multiple of 4, error-free conversion can be ensured; therefore, if the number of row bytes of the pixel value is not an integer multiple of 4 in the pixel matrix, byte 0 padding is required.
Further, referring to fig. 2, in an embodiment of the present invention, the step of converting the original image into a JPEG file according to the pixel information includes:
step 201, for each frame, the original image is displayed.
In this step, the SOP instance of the original DICOM image file includes one or more frames of original images; the following steps are performed separately for each frame of the original image.
Step 202, converting the RGB pixel values into gray values according to a preset conversion formula, so as to obtain a gray value matrix of the original pixel matrix.
Converting the RGB pixel values into gray values, i.e. graying the color image, reduces the storage space occupied by the color image.
Alternatively, for a pixel, gray scale conversion may be implemented according to the following formula:
G=0.299R+0.578G+0.114B
wherein G is the converted gray value of the pixel, R is the R value of the pixel, G is the G value of the pixel, and B is the B value of the pixel.
And after the gray value of each pixel point is obtained, obtaining a gray value matrix according to the corresponding position.
Step 203, writing the gray value matrix into a JPEG pixel matrix.
Step 204, creating an original JPEG file with the same image size as the original image according to the image size.
Wherein an original JPEG file is created that is the same (width, height exactly identical) as the image size of the original image.
Step 205, writing the JPEG pixel matrix into the original JPEG file to obtain a JPEG file.
Writing a JPEG pixel matrix into the original JPEG file to obtain a JPEG file; since the JPEG pixel matrix stores gray values, the gray conversion of the original image is realized.
Optionally, in the embodiment of the present invention, the step of writing the JPEG file and the key dataset into a DICOM image file in sequence to obtain the target DICOM image file includes:
creating a first DICOM image file;
writing the JPEG file into the first DICOM image file to obtain a second DICOM image file;
and writing the key data set into the second DICOM image file to obtain a target DICOM image file.
Wherein, an empty DICOM image file, namely a first DICOM image file, is created; and writes header information including, for example: transmitting a syntax Tag (0002, 0010) having a value of 1.2.840.10008.1.2.4.50[JPEG Baseline (Process 1) ]; encoding format Tag (0008,0005), its value is set to iso_ir100;
then writing the file stream of the JPEG file into the newly constructed DICOM image file in sequence to obtain a second DICOM image file;
finally, the key data set is written into the second DICOM image file to obtain a target DICOM image file, so that compared with the original DICOM image file, the target DICOM image file realizes JPEG lossy compression and reduces the occupied storage space; meanwhile, the target DICOM image file is written into the key data set, so that the data integrity of the original DICOM image file is ensured.
Optionally, in the embodiment of the present invention, the step of writing the key dataset into the second DICOM image file to obtain the target DICOM image file includes:
packaging the key data set into a data set structure object in a target format; the target format is a protocol version format supported by the second DICOM image file;
and writing the data set structure object into the second DICOM image file to obtain a target DICOM image file.
Optionally, the target format may be a format of a data set structure object specified by the DICOM3.0 protocol, encapsulating the key data set into the data set structure object in the target format, and writing the data set structure object into the second DICOM image file, so as to complete encapsulation of the key data set.
Optionally, in an embodiment of the present invention, the key data set includes a first data subset and/or a second data subset;
wherein the first data subset is a general data set of the original DICOM image file, and includes a patient level, an examination level, and a sequence level data set of the original DICOM image file; patient-level datasets such as patient information and the like; a data set of inspection level, such as inspection information including inspection time, inspection description, inspection ID, and the like; sequence level data sets such as sequence information, sequence ID, sequence description, etc. data;
the second data subset is a specific data set of the original image, namely a data set of an image information level, and each frame of original image is respectively and uniquely identified.
Further, in the embodiment of the present invention, the original image has a unique identification number;
the second subset of data is marked with the same unique identification number as the corresponding original image.
Wherein the original image is identified by a unique identification number, and a second subset of data of the original image; and reserving each unique identification number and the unique identification number of the second data subset in the data set packaging process so as to record the corresponding relation between the original image and the second data subset.
In the prior art, JPEG lossy compression or JPEG lossless compression exists, and on the premise of effectively keeping an original data image undistorted, the conventional JPEG lossy compression or JPEG lossless compression can only compress to about one half to one third of the original image data at most, so that the compression effect is poor. In the file processing method provided by the embodiment of the invention, the original uncompressed DICOM image file is read, the pixel information in the original image file is extracted to form a JPEG picture, then the JPEG picture stream is written into the DICOM image file to form a new DICOM image file, finally the key DICOM image data set (kos) in the original image file is written into the newly generated DICOM file, and the size of the finally generated image file is about one fifth to one tenth of the size of the original uncompressed image file.
As an example, referring to fig. 3, fig. 3 shows an example of an embodiment of the present invention, mainly comprising the following steps:
in step 301, an uncompressed DICOM original image file is received and read.
And receiving and reading the uncompressed original image file under the designated directory, and analyzing the key DICOM data set information and pixel information of the DICOM image file.
Step 302, the pixel information of each frame in the DICOM file is read and compressed to form a JPEG picture.
Each DICOM image file may have one or more images, and each piece of pixel information is parsed, sequentially compressed and constructed into a JPEG image, and the compression ratio is set to 1, and the height and width of the compression ratio are the same as those of the original DICOM image file.
Step 303, writing the JPEG picture into the DICOM video file to construct a new DICOM video file.
Creating an empty DICOM image file, namely a first DICOM image file; and writes header information including, for example: transmitting a syntax Tag (0002, 0010) having a value of 1.2.840.10008.1.2.4.50[JPEG Baseline (Process 1) ]; encoding format Tag (0008,0005), its value is set to iso_ir100; the generated JPEG file stream in step 302 is sequentially written into the newly constructed DICOM image file.
Step 304, the parsed DICOM key data set in the original image file is written into the new DICOM image file for storage.
And (3) writing all the key data sets in the original image file into the newly constructed image file in the step (3) for storage. The image key dataset information here generally includes:
(1) Patient level information: patient name [ Tag label (0010 ) ], patient ID [ Tag label (0010, 0020) ], age [ Tag label (0010, 1010) ] and the like;
(2) Checking level information: check date [ Tag label (0008, 0020) ], check ID [ Tag label (0020, 0010) ], check instance number [ Tag label (0020, 000D) ], and the like;
(3) Sequence level information: sequence example number [ Tag (0020, 000E) ], sequence number [ Tag (0020, 0011) ], examination pattern [ Tag (0008, 0060) ] and the like;
(4) Example (Instance) grade information: SOP instance UID [ Tag (0008, 0018) ], pixel pitch [ Tag (0028, 0030) ], and the like.
The configuration can be carried out according to different service requirements, and only data required by the service is reserved. And finally deleting all the temporarily generated jpeg pictures and temporary catalogues.
In the embodiment of the invention, an original medical digital imaging and communication DICOM image file is obtained, and key data set information and image information of each frame of original image in the original DICOM image file are extracted; converting the original image into a JPEG file according to the image information; sequentially writing the JPEG file and the key data set into a DICOM image file to obtain a target DICOM image file; storing the target DICOM image file, deleting the JPEG file and the buffer data of the key data set in the server, firstly compressing an original image into a JPEG file, then writing the JPEG file and the key data set into a new DICOM image file, reducing the storage space occupied by the DICOM image file, realizing JPEG lossy compression and then storing; meanwhile, a key data set in the original DICOM image file is reserved in the processing process, and the integrity of the original image data is maintained.
Having described the file processing method provided by the embodiment of the present invention, the file processing device provided by the embodiment of the present invention will be described with reference to the accompanying drawings.
Referring to fig. 4, the embodiment of the invention further provides a file processing device, which is applied to a server, and the device comprises:
the acquiring module 401 is configured to acquire an original digital imaging and communication DICOM image file, and extract key data set information in the original DICOM image file and image information of each frame of original image; wherein the key data set comprises key data in the original DICOM image file; the image information includes image size and pixel information.
In one aspect, the original DICOM image file includes a single SOP instance and one or more key data sets; each instance contains one or more frames of original images, each frame of image being represented by an Item, each Item being identified by (FFFE, E000); the key data set includes key data in the original DICOM image file, and each key data is a group of data elements, for example, a medical image, and the data elements include patient information, examination information, sequence information, image information, and the like, which are main parts of the DICOM image file.
Optionally, the key dataset is composed of DICOM data elements arranged in a pre-specified order, such as in the order: patient name, gender, age, image size, etc.; the critical data consists of data elements, each of which may consist of 4 parts, for example: tag, value representation type (VR Value Representation), value Length (Value Length), value Field (Value Field).
As an example, the Tag (Tag) indicates a specific storage location of the value range of the data element, and the Tag (Tag) of a partial data element is as follows:
(1) Patient level information: patient name (0010 ), patient ID (0010, 0020), age Tag (0010, 1010), etc.; taking the name of the patient as an example, (0010 ) as a label, and setting the value range position as (0010 ); again, taking patient ID as an example, (0010, 0020) indicates its value range location.
(2) Checking level information: check date (0008, 0020), check ID (0020, 0010), check instance number (0020, 000D), and the like;
(3) Sequence level information: sequence instance number (0020, 000E), sequence number (0020, 0011), inspection pattern (0008, 0060), etc.;
(4) Example (Instance) grade information: SOP instance UID (0008, 0018), pixel pitch (0028, 0030), and the like.
On the other hand, the image information includes image size, i.e., height and width of each frame of image, image storage bit number, etc., and pixel information; the pixel information, that is, the pixel value of each pixel point on the image, is usually RGB pixel values, that is, three primary colors of RGB (Red), green (Green), and Blue (Blue).
The conversion module 402 is configured to convert the original image into a JPEG file according to the image information.
The JPEG is an image format, redundant images and color data are removed in a lossy compression mode, and therefore less disk space can be occupied, and better picture quality can be obtained; in the step, for each frame of original image, a new JPEG file is constructed according to the image size of the original image, the compression ratio is set to be 1, and the height and the width of the new JPEG file are the same as those of the original image; and writing the pixel information into the constructed JPEG file to convert the original image into the JPEG file.
The processing module 403 is configured to sequentially write the JPEG file and the key dataset into a DICOM image file, thereby obtaining a target DICOM image file.
Creating an empty DICOM image file and writing file header information; and writing the JPEG file into the constructed DICOM image file, and finally writing the key data set into the DICOM image file to obtain the target DICOM image file.
Compared with the original DICOM image file, the target DICOM image file realizes JPEG lossy compression and reduces the occupied storage space; meanwhile, the target DICOM image file is written into the key data set, so that the data integrity of the original DICOM image file is ensured.
And the storage module 404 is used for storing the target DICOM image file and deleting the JPEG file and the cache data of the key data set in the server.
And storing the target DICOM image file, deleting the JPEG file and the buffer data of the key data set in the server, and reducing the temporary storage space of the DICOM image file.
Optionally, in an embodiment of the present invention, the pixel information includes an original pixel matrix of the original image of each frame, and an element in the original pixel matrix is an RGB pixel value of each pixel point.
Optionally, in an embodiment of the present invention, the conversion module 402 is configured to:
for each frame of the original image in question,
converting the RGB pixel values into gray values according to a preset conversion formula to obtain a gray value matrix of the original pixel matrix;
writing the gray value matrix into a JPEG pixel matrix;
creating an original JPEG file with the same image size as the original image according to the image size;
and writing the JPEG pixel matrix into the original JPEG file to obtain the JPEG file.
Optionally, in an embodiment of the present invention, the processing module 403 includes:
the creation sub-module is used for creating a first DICOM image file;
the first processing submodule is used for writing the JPEG file into the first DICOM image file to obtain a second DICOM image file;
and the second processing sub-module is used for writing the key data set into the second DICOM image file to obtain a target DICOM image file.
Optionally, in an embodiment of the present invention, the processing module 403 includes:
the packaging submodule is used for packaging the key data set into a data set structure object in a target format; the target format is a protocol version format supported by the second DICOM image file;
and the writing sub-module is used for writing the data set structure object into the second DICOM image file to obtain a target DICOM image file.
Optionally, in an embodiment of the present invention, the key data set includes a first data subset and/or a second data subset;
wherein the first data subset is a universal data set of the original DICOM image file;
the second subset of data is a specific set of data of the original image.
Optionally, in an embodiment of the present invention, the original image has a unique identification number;
the second subset of data is marked with the same unique identification number as the corresponding original image.
The file processing device provided in the embodiment of the present invention can implement each process implemented by the file processing device in the method embodiment of fig. 1 to 3, and in order to avoid repetition, a description is omitted here.
In the embodiment of the invention, the acquisition module 401 acquires an original medical digital imaging and communication DICOM image file, and extracts key data set information in the original DICOM image file and image information of each frame of original image; the conversion module 402 converts the original image into a JPEG file according to the image information; the processing module 403 sequentially writes the JPEG file and the key dataset into a DICOM image file to obtain a target DICOM image file; the storage module 404 stores the target DICOM image file, deletes the JPEG file and the cached data of the key data set in the server, compresses the original image into the JPEG file first, writes the JPEG file and the key data set into a new DICOM image file, reduces the storage space occupied by the DICOM image file, and realizes the lossy compression of JPEG for storing; meanwhile, a key data set in the original DICOM image file is reserved in the processing process, and the integrity of the original image data is maintained. The embodiment of the invention solves the problem that in the prior art, the integrity of data is difficult to ensure on the basis of reducing the storage space occupied by the DICOM image file.
In another aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, a bus, and a computer program stored in the memory and capable of running on the processor, where the processor implements the steps in the file processing method described above when executing the program.
For example, fig. 5 shows a schematic physical structure of an electronic device.
As shown in fig. 5, the electronic device may include: processor 510, communication interface (Communications Interface) 520, memory 530, and communication bus 540, wherein processor 510, communication interface 520, memory 530 complete communication with each other through communication bus 540. Processor 510 may invoke logic instructions in memory 530 to perform the following method:
acquiring an original medical digital imaging and communication DICOM image file, and extracting key data set information in the original DICOM image file and image information of each frame of original image; wherein the key data set comprises key data in the original DICOM image file; the image information includes image size and pixel information;
converting the original image into a JPEG file according to the image information;
sequentially writing the JPEG file and the key data set into a DICOM image file to obtain a target DICOM image file;
and storing the target DICOM image file, and deleting the JPEG file and the cache data of the key data set in the server.
Further, the logic instructions in the memory 530 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In still another aspect, an embodiment of the present invention further provides a computer readable storage medium having stored thereon a computer program, which when executed by a processor is implemented to perform the file processing method provided in the above embodiments, for example, including:
acquiring an original medical digital imaging and communication DICOM image file, and extracting key data set information in the original DICOM image file and image information of each frame of original image; wherein the key data set comprises key data in the original DICOM image file; the image information includes image size and pixel information;
converting the original image into a JPEG file according to the image information;
sequentially writing the JPEG file and the key data set into a DICOM image file to obtain a target DICOM image file;
and storing the target DICOM image file, and deleting the JPEG file and the cache data of the key data set in the server.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A file processing method applied to a server, the method comprising:
acquiring an original medical digital imaging and communication DICOM image file, and extracting key data set information in the original DICOM image file and image information of each frame of original image; wherein the key data set comprises key data in the original DICOM image file; the image information includes image size and pixel information;
converting the original image into a JPEG file according to the image information;
sequentially writing the JPEG file and the key data set into a DICOM image file to obtain a target DICOM image file, wherein the DICOM image file consists of a DICOM image file header and a DICOM image data set, and the DICOM image data set comprises one or more key data sets;
and storing the target DICOM image file, and deleting the JPEG file and the cache data of the key data set in the server.
2. The method according to claim 1, wherein the pixel information includes an original pixel matrix of the original image for each frame, and an element in the original pixel matrix is an RGB pixel value of each pixel point.
3. The file processing method according to claim 2, wherein the step of converting the original image into a JPEG file based on the pixel information, comprises:
for each frame of the original image in question,
converting the RGB pixel values into gray values according to a preset conversion formula to obtain a gray value matrix of the original pixel matrix;
writing the gray value matrix into a JPEG pixel matrix;
creating an original JPEG file with the same image size as the original image according to the image size;
and writing the JPEG pixel matrix into the original JPEG file to obtain the JPEG file.
4. The method of claim 1, wherein the step of sequentially writing the JPEG file and the key dataset into a DICOM image file to obtain the target DICOM image file comprises:
creating a first DICOM image file;
writing the JPEG file into the first DICOM image file to obtain a second DICOM image file;
and writing the key data set into the second DICOM image file to obtain a target DICOM image file.
5. The method of claim 4, wherein the step of writing the key dataset into the second DICOM image file to obtain a target DICOM image file comprises:
packaging the key data set into a data set structure object in a target format; the target format is a protocol version format supported by the second DICOM image file;
and writing the data set structure object into the second DICOM image file to obtain a target DICOM image file.
6. The file processing method according to claim 1, wherein the key dataset comprises a first subset of data and/or a second subset of data;
wherein the first data subset is a universal data set of the original DICOM image file;
the second subset of data is a specific set of data of the original image.
7. The file processing method according to claim 6, wherein the original image has a unique identification number;
the second subset of data is marked with the same unique identification number as the corresponding original image.
8. A document processing apparatus for use with a server, the apparatus comprising:
the acquisition module is used for acquiring an original medical digital imaging and communication DICOM image file, and extracting key data set information in the original DICOM image file and image information of each frame of original image; wherein the key data set comprises key data in the original DICOM image file; the image information includes image size and pixel information;
the conversion module is used for converting the original image into a JPEG file according to the image information;
the processing module is used for writing the JPEG file and the key data set into a DICOM image file in sequence to obtain a target DICOM image file, wherein the DICOM image file consists of a DICOM image file header and a DICOM image data set, and the DICOM image data set comprises one or more key data sets;
and the storage module is used for storing the target DICOM image file, deleting the JPEG file and the cache data of the key data set in the server.
9. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, wherein the computer program when executed by the processor implements the steps of the file processing method according to any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the file processing method according to any of claims 1 to 7.
CN201911295197.5A 2019-12-16 2019-12-16 File processing method and device Active CN111243712B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911295197.5A CN111243712B (en) 2019-12-16 2019-12-16 File processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911295197.5A CN111243712B (en) 2019-12-16 2019-12-16 File processing method and device

Publications (2)

Publication Number Publication Date
CN111243712A CN111243712A (en) 2020-06-05
CN111243712B true CN111243712B (en) 2023-09-08

Family

ID=70869190

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911295197.5A Active CN111243712B (en) 2019-12-16 2019-12-16 File processing method and device

Country Status (1)

Country Link
CN (1) CN111243712B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112071403B (en) * 2020-09-09 2023-09-12 周兴祥 DICOMDIR file generation method and system containing icon images
CN113096776A (en) * 2021-04-30 2021-07-09 平安好医投资管理有限公司 DICOM image file storage method, DICOM image file storage device, electronic equipment and DICOM image file storage medium
CN113676536A (en) * 2021-08-18 2021-11-19 上海医影数联医疗科技有限公司 Accelerated transmission control method and system based on medical image file

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609540A (en) * 2012-02-17 2012-07-25 深圳市理邦精密仪器股份有限公司 Ultrasound image storage method and system
CN103414904A (en) * 2013-09-05 2013-11-27 苏州皓琪信息科技有限公司 Data compression storage method for medical high-capacity digital imaging and communications in medicine (DICOM) dynamic images
CN104077588A (en) * 2014-07-10 2014-10-01 苏州皓琪信息科技有限公司 Method for automatically interposing frame offsets into medical DICOM dynamic images compressed by JPEG
WO2016061415A2 (en) * 2014-10-15 2016-04-21 Trice Imaging, Inc. Systems and methods for encrypting, converting and interacting with medical images
CN106650211A (en) * 2016-10-10 2017-05-10 重庆市中迪医疗信息科技股份有限公司 Storage server
CN107480299A (en) * 2017-08-30 2017-12-15 上海联影医疗科技有限公司 A kind of method and device of information processing

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8417043B2 (en) * 2011-03-30 2013-04-09 Mckesson Financial Holdings Method, apparatus and computer program product for normalizing and processing medical images

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609540A (en) * 2012-02-17 2012-07-25 深圳市理邦精密仪器股份有限公司 Ultrasound image storage method and system
CN103414904A (en) * 2013-09-05 2013-11-27 苏州皓琪信息科技有限公司 Data compression storage method for medical high-capacity digital imaging and communications in medicine (DICOM) dynamic images
CN104077588A (en) * 2014-07-10 2014-10-01 苏州皓琪信息科技有限公司 Method for automatically interposing frame offsets into medical DICOM dynamic images compressed by JPEG
WO2016061415A2 (en) * 2014-10-15 2016-04-21 Trice Imaging, Inc. Systems and methods for encrypting, converting and interacting with medical images
CN106650211A (en) * 2016-10-10 2017-05-10 重庆市中迪医疗信息科技股份有限公司 Storage server
CN107480299A (en) * 2017-08-30 2017-12-15 上海联影医疗科技有限公司 A kind of method and device of information processing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
(美)Larry L.Peterson,(美)Bruce S.Davie著;叶新铭等译.计算机网络.机械工业出版社,2001,第355-358页. *

Also Published As

Publication number Publication date
CN111243712A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
CN111243712B (en) File processing method and device
CN102523367B (en) Real time imaging based on many palettes compresses and method of reducing
Bidgood Jr et al. Introduction to the ACR-NEMA DICOM standard.
Wiggins et al. Image file formats: past, present, and future
Yee et al. Medical image compression based on region of interest using better portable graphics (BPG)
US20070076009A1 (en) Bitstream format and reading and writing methods and apparatus therefor
JP2015509294A (en) Encode high quality (medical) images using standard low quality (web) image formats
CN107145730A (en) DICOM medical images file reads adaption system
Liang et al. Lossless compression of medical images using Hilbert space-filling curves
WO2022017085A1 (en) Dicom file processing method, device and system
Sriramakrishnan et al. An medical image file formats and digital image conversion
KR100573527B1 (en) How to compress and restore graphic images
US20130230242A1 (en) Presentation and manipulation of high depth images in low depth image display systems
Punitha et al. Analysis of file formats and lossless compression techniques for medical images
CN116193136B (en) Nuclear magnetic resonance image network communication method and system
CN113538253B (en) Medical image processing method, medium and CT device
Rusev A module for visualisation and analysis of digital images in DICOM file format.
Smith et al. Acceptable levels of digital image compression in chest radiology
Gillespy et al. Radiological images on personal computers: Introduction and fundamental principles of digital images
CN109788292A (en) A kind of logical image compression method suitable for display panel detection
JP4739443B2 (en) Method and apparatus for processing digital images
CN109996077A (en) A kind of logical image decompressing method suitable for display panel detection
CN114283212A (en) Medical image lossless compression data structure, computer and storage medium
CN112599223A (en) Compression method, device, equipment and storage medium for browser film reading data
Koval et al. A lossless image compression algorithm based on group encoding

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant