JPEG2000压缩DICOM文件的解压(一)

JPEG2000压缩DICOM文件的解压(一)

    这几天写了一个JPEG2000压缩DICOM解压的下程序

    DICOM文件中如果标签如下:

     0002,0010里的值为    1.2.840.10008.1.2.4.90  或 1.2.840.10008.1.2.4.91  则该文件是 jpeg 2000 编码

    开源的DICOM软件包中,DCMTK是非常优秀的软件包,但该软件包关于JPEG2000解压或压缩的部分是收费的,

     所以就想自己写一个关JPEG2000解压的小程序。

     一下是采用DCMTK,将JPEG2000压缩的DICOM文件转换为XML文件的截图,可以看到所有的标签。

 

---------------------------------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="ISO-8859-1"?>

- < file-format >
- < meta-header xfer =" 1.2.840.10008.1.2.1 " name =" Little Endian Explicit ">
  < element tag =" 0002,0000 " vr =" UL " vm =" 1 " len =" 4 " name =" FileMetaInformationGroupLength "> 190 </ element >
  < element tag =" 0002,0001 " vr =" OB " vm =" 1 " len =" 2 " name =" FileMetaInformationVersion " binary =" hidden " />
  < element tag =" 0002,0002 " vr =" UI " vm =" 1 " len =" 26 " name =" MediaStorageSOPClassUID "> 1.2.840.10008.5.1.4.1.1.2 </ element >
  < element tag =" 0002,0003 " vr =" UI " vm =" 1 " len =" 42 " name =" MediaStorageSOPInstanceUID "> 1.2.840.113704.1.111.3352.1107859701.1308 </ element >
  < element tag =" 0002,0010 " vr =" UI " vm =" 1 " len =" 22 " name =" TransferSyntaxUID "> 1.2.840.10008.1.2.4.91 </ element >
  < element tag =" 0002,0012 " vr =" UI " vm =" 1 " len =" 22 " name =" ImplementationClassUID "> 1.3.6.1.4.1.19291.2.1 </ element >
  < element tag =" 0002,0013 " vr =" SH " vm =" 1 " len =" 10 " name =" ImplementationVersionName "> OSIRIX001 </ element >
  < element tag =" 0002,0016 " vr =" AE " vm =" 1 " len =" 6 " name =" SourceApplicationEntityTitle "> OsiriX </ element >
  </ meta-header >
- < data-set xfer =" 1.2.840.10008.1.2.4.91 " name =" JPEG 2000 (Lossless or Lossy) ">
  < element tag =" 0008,0005 " vr =" CS " vm =" 1 " len =" 10 " name =" SpecificCharacterSet "> ISO_IR 100 </ element >
  < element tag =" 0008,0008 " vr =" CS " vm =" 4 " len =" 28 " name =" ImageType "> ORIGINAL\PRIMARY\AXIAL\HELIX </ element >
  < element tag =" 0008,0012 " vr =" DA " vm =" 1 " len =" 8 " name =" InstanceCreationDate "> 20050201 </ element >
  < element tag =" 0008,0013 " vr =" TM " vm =" 1 " len =" 14 " name =" InstanceCreationTime "> 120000.000000 </ element >
  < element tag =" 0008,0016 " vr =" UI " vm =" 1 " len =" 26 " name =" SOPClassUID "> 1.2.840.10008.5.1.4.1.1.2 </ element >
  < element tag =" 0008,0018 " vr =" UI " vm =" 1 " len =" 42 " name =" SOPInstanceUID "> 1.2.840.113704.1.111.3352.1107859701.1308 </ element >
  < element tag =" 0008,0020 " vr =" DA " vm =" 1 " len =" 8 " name =" StudyDate "> 20050201 </ element >
  < element tag =" 0008,0022 " vr =" DA " vm =" 1 " len =" 8 " name =" AcquisitionDate "> 20050208 </ element >
  < element tag =" 0008,0023 " vr =" DA " vm =" 1 " len =" 8 " name =" ContentDate "> 20050208 </ element >
  < element tag =" 0008,0030 " vr =" TM " vm =" 1 " len =" 14 " name =" StudyTime "> 120000.000000 </ element >
  < element tag =" 0008,0032 " vr =" TM " vm =" 1 " len =" 14 " name =" AcquisitionTime "> 114308.000000 </ element >
  < element tag =" 0008,0033 " vr =" TM " vm =" 1 " len =" 14 " name =" ContentTime "> 114311.483000 </ element >
  < element tag =" 0008,0050 " vr =" SH " vm =" 1 " len =" 8 " name =" AccessionNumber "> 1963943 </ element >
  < element tag =" 0008,0060 " vr =" CS " vm =" 1 " len =" 2 " name =" Modality "> CT </ element >
  < element tag =" 0008,0070 " vr =" LO " vm =" 1 " len =" 8 " name =" Manufacturer "> Philips </ element >
  < element tag =" 0008,0080 " vr =" LO " vm =" 1 " len =" 4 " name =" InstitutionName "> dPJ </ element >
  < element tag =" 0008,0081 " vr =" ST " vm =" 1 " len =" 6 " name =" InstitutionAddress "> GENEVA </ element >
  < element tag =" 0008,0090 " vr =" PN " vm =" 1 " len =" 12 " name =" ReferringPhysicianName "> NULL^DUMCOB </ element >
  < element tag =" 0008,1010 " vr =" SH " vm =" 1 " len =" 6 " name =" StationName "> ctdumc </ element >
  < element tag =" 0008,1030 " vr =" LO " vm =" 1 " len =" 6 " name =" StudyDescription "> CER/CT </ element >
- < sequence tag =" 0008,1032 " vr =" SQ " card =" 1 " len =" 36 " name =" ProcedureCodeSequence ">
- < item card =" 2 " len =" 28 ">
  < element tag =" 0008,0102 " vr =" SH " vm =" 1 " len =" 6 " name =" CodingSchemeDesignator "> BROKER </ element >
  < element tag =" 0008,0104 " vr =" LO " vm =" 1 " len =" 6 " name =" CodeMeaning "> CER/CT </ element >
  </ item >
  </ sequence >
  < element tag =" 0008,103e " vr =" LO " vm =" 1 " len =" 8 " name =" SeriesDescription "> ANGIO CT </ element >
  < element tag =" 0008,1040 " vr =" LO " vm =" 1 " len =" 4 " name =" InstitutionalDepartmentName "> CAU </ element >
  < element tag =" 0008,1070 " vr =" PN " vm =" 2 " len =" 16 " name =" OperatorsName "> CTDUMC\mxservice </ element >
  < element tag =" 0008,1090 " vr =" LO " vm =" 1 " len =" 10 " name =" ManufacturerModelName "> Mx8000 IDT </ element >
- < sequence tag =" 0008,1110 " vr =" SQ " card =" 1 " len =" 100 " name =" ReferencedStudySequence ">
- < item card =" 2 " len =" 92 ">
  < element tag =" 0008,1150 " vr =" UI " vm =" 1 " len =" 24 " name =" ReferencedSOPClassUID "> 1.2.840.10008.3.1.2.3.1 </ element >
  < element tag =" 0008,1155 " vr =" UI " vm =" 1 " len =" 52 " name =" ReferencedSOPInstanceUID "> 1.2.124.113532.129.195.3.60.20050208.112149.1708074 </ element >
  </ item >
  </ sequence >
- < sequence tag =" 0008,1120 " vr =" SQ " card =" 1 " len =" 100 " name =" ReferencedPatientSequence ">
- < item card =" 2 " len =" 92 ">
  < element tag =" 0008,1150 " vr =" UI " vm =" 1 " len =" 24 " name =" ReferencedSOPClassUID "> 1.2.840.10008.3.1.2.1.1 </ element >
  < element tag =" 0008,1155 " vr =" UI " vm =" 1 " len =" 52 " name =" ReferencedSOPInstanceUID "> 1.2.124.113532.129.195.3.60.20030224.174643.1093514 </ element >
  </ item >
  </ sequence >
- < sequence tag =" 0008,1140 " vr =" SQ " card =" 1 " len =" 92 " name =" ReferencedImageSequence ">
- < item card =" 2 " len =" 84 ">
  < element tag =" 0008,1150 " vr =" UI " vm =" 1 " len =" 26 " name =" ReferencedSOPClassUID "> 1.2.840.10008.5.1.4.1.1.2 </ element >
  < element tag =" 0008,1155 " vr =" UI " vm =" 1 " len =" 42 " name =" ReferencedSOPInstanceUID "> 1.2.840.113704.1.111.3352.1107859195.1185 </ element >
  </ item >
  </ sequence >
  < element tag =" 0010,0010 " vr =" PN " vm =" 1 " len =" 6 " name =" PatientName "> MANIX </ element >
  < element tag =" 0010,0020 " vr =" LO " vm =" 1 " len =" 8 " name =" PatientID "> 7Thjq7g </ element >
  < element tag =" 0010,1010 " vr =" AS " vm =" 1 " len =" 4 " name =" PatientAge "> 000Y </ element >
  < element tag =" 0018,0010 " vr =" LO " vm =" 1 " len =" 8 " name =" ContrastBolusAgent "> CONTRAST </ element >
  < element tag =" 0018,0022 " vr =" CS " vm =" 1 " len =" 6 " name =" ScanOptions "> HELIX </ element >
  < element tag =" 0018,0050 " vr =" DS " vm =" 1 " len =" 4 " name =" SliceThickness "> 1.5 </ element >
  < element tag =" 0018,0060 " vr =" DS " vm =" 1 " len =" 4 " name =" KVP "> 120 </ element >
  < element tag =" 0018,0088 " vr =" DS " vm =" 1 " len =" 4 " name =" SpacingBetweenSlices "> 0.7 </ element >
  < element tag =" 0018,0090 " vr =" DS " vm =" 1 " len =" 4 " name =" DataCollectionDiameter "> 250 </ element >
  < element tag =" 0018,1020 " vr =" LO " vm =" 1 " len =" 4 " name =" SoftwareVersions "> 2.5 </ element >
  < element tag =" 0018,1030 " vr =" LO " vm =" 1 " len =" 22 " name =" ProtocolName "> ANGIO CT BPU 4/Head/Hx </ element >
  < element tag =" 0018,1040 " vr =" LO " vm =" 1 " len =" 2 " name =" ContrastBolusRoute "> IV </ element >
  < element tag =" 0018,1100 " vr =" DS " vm =" 1 " len =" 4 " name =" ReconstructionDiameter "> 250 </ element >
  < element tag =" 0018,1120 " vr =" DS " vm =" 1 " len =" 2 " name =" GantryDetectorTilt "> 0 </ element >
  < element tag =" 0018,1130 " vr =" DS " vm =" 1 " len =" 4 " name =" TableHeight "> 172 </ element >
  < element tag =" 0018,1140 " vr =" CS " vm =" 1 " len =" 2 " name =" RotationDirection "> CW </ element >
  < element tag =" 0018,1151 " vr =" IS " vm =" 1 " len =" 4 " name =" XRayTubeCurrent "> 221 </ element >
  < element tag =" 0018,1152 " vr =" IS " vm =" 1 " len =" 4 " name =" Exposure "> 250 </ element >
  < element tag =" 0018,1160 " vr =" SH " vm =" 1 " len =" 2 " name =" FilterType "> UB </ element >
  < element tag =" 0018,1210 " vr =" SH " vm =" 1 " len =" 2 " name =" ConvolutionKernel "> UB </ element >
  < element tag =" 0018,5100 " vr =" CS " vm =" 1 " len =" 4 " name =" PatientPosition "> HFS </ element >
  < element tag =" 0020,000d " vr =" UI " vm =" 1 " len =" 38 " name =" StudyInstanceUID "> 1.2.840.113704.1.111.5600.1107858801.1 </ element >
  < element tag =" 0020,000e " vr =" UI " vm =" 1 " len =" 40 " name =" SeriesInstanceUID "> 1.2.840.113704.1.111.5600.1107859570.17 </ element >
  < element tag =" 0020,0010 " vr =" SH " vm =" 1 " len =" 8 " name =" StudyID "> 1963943 </ element >
  < element tag =" 0020,0011 " vr =" IS " vm =" 1 " len =" 4 " name =" SeriesNumber "> 9712 </ element >
  < element tag =" 0020,0013 " vr =" IS " vm =" 1 " len =" 2 " name =" InstanceNumber "> 40 </ element >
  < element tag =" 0020,0032 " vr =" DS " vm =" 3 " len =" 20 " name =" ImagePositionPatient "> -125\-63\-830.700012 </ element >
  < element tag =" 0020,0037 " vr =" DS " vm =" 6 " len =" 12 " name =" ImageOrientationPatient "> 1\0\0\0\1\0 </ element >
  < element tag =" 0020,0052 " vr =" UI " vm =" 1 " len =" 38 " name =" FrameOfReferenceUID "> 1.2.840.113704.1.111.5600.1107859163.4 </ element >
  < element tag =" 0020,1041 " vr =" DS " vm =" 1 " len =" 8 " name =" SliceLocation "> -352.20 </ element >
  < element tag =" 0020,4000 " vr =" LT " vm =" 1 " len =" 8 " name =" ImageComments "> ANGIO CT </ element >
  < element tag =" 0028,0002 " vr =" US " vm =" 1 " len =" 2 " name =" SamplesPerPixel "> 1 </ element >
  < element tag =" 0028,0004 " vr =" CS " vm =" 1 " len =" 12 " name =" PhotometricInterpretation "> MONOCHROME2 </ element >
  < element tag =" 0028,0010 " vr =" US " vm =" 1 " len =" 2 " name =" Rows "> 512 </ element >
  < element tag =" 0028,0011 " vr =" US " vm =" 1 " len =" 2 " name =" Columns "> 512 </ element >
  < element tag =" 0028,0030 " vr =" DS " vm =" 2 " len =" 22 " name =" PixelSpacing "> 0.48828125\0.48828125 </ element >
  < element tag =" 0028,0100 " vr =" US " vm =" 1 " len =" 2 " name =" BitsAllocated "> 16 </ element >
  < element tag =" 0028,0101 " vr =" US " vm =" 1 " len =" 2 " name =" BitsStored "> 12 </ element >
  < element tag =" 0028,0102 " vr =" US " vm =" 1 " len =" 2 " name =" HighBit "> 11 </ element >
  < element tag =" 0028,0103 " vr =" US " vm =" 1 " len =" 2 " name =" PixelRepresentation "> 0 </ element >
  < element tag =" 0028,1050 " vr =" DS " vm =" 2 " len =" 12 " name =" WindowCenter "> 00100\00100 </ element >
  < element tag =" 0028,1051 " vr =" DS " vm =" 2 " len =" 12 " name =" WindowWidth "> 00500\00500 </ element >
  < element tag =" 0028,1052 " vr =" DS " vm =" 1 " len =" 6 " name =" RescaleIntercept "> -1000 </ element >
  < element tag =" 0028,1053 " vr =" DS " vm =" 1 " len =" 2 " name =" RescaleSlope "> 1 </ element >
  < element tag =" 0028,2110 " vr =" CS " vm =" 1 " len =" 2 " name =" LossyImageCompression "> 01 </ element >
  < element tag =" 0028,2112 " vr =" DS " vm =" 1 " len =" 8 " name =" LossyImageCompressionRatio "> 6.214594 </ element >
  < element tag =" 0032,1032 " vr =" PN " vm =" 1 " len =" 12 " name =" RequestingPhysician "> NULL DUMCOB </ element >
  < element tag =" 0032,1060 " vr =" LO " vm =" 1 " len =" 6 " name =" RequestedProcedureDescription "> CER/CT </ element >
  < element tag =" 0038,0010 " vr =" LO " vm =" 1 " len =" 10 " name =" AdmissionID "> 00.9650912 </ element >
  < element tag =" 0040,0007 " vr =" LO " vm =" 1 " len =" 6 " name =" ScheduledProcedureStepDescription "> CER/CT </ element >
  < element tag =" 0040,0254 " vr =" LO " vm =" 1 " len =" 6 " name =" PerformedProcedureStepDescription "> CER/CT </ element >
  < element tag =" 0040,1001 " vr =" SH " vm =" 1 " len =" 8 " name =" RequestedProcedureID "> 1963943 </ element >
- < sequence tag =" 7fe0,0010 " vr =" OB " card =" 2 " name =" PixelData ">
  < pixel-item len =" 4 " binary =" hidden " />
  < pixel-item len =" 84364 " loaded =" no " binary =" hidden " />
  </ sequence >
  </ data-set >
  </ file-format >
--------------------------------------------------------------------------------------------------------------------------------------------------------------

 

你可能感兴趣的:(UI,xml,encoding)