【发布时间】:2016-06-27 18:50:16
【问题描述】:
我在R 中使用readDICOMFile 读取DICOM 文件如下:
dcmImages <- readDICOMFile("/home/darshil/Downloads/BREBIX/CT10 ponction foie/DEF. VEINEUX - 107205/IM-0001-0001.dcm",debug = TRUE, pixelData = FALSE)
但是,我收到以下错误:
parsePixelData(fraw[(bstart + dcm$data.seek):fsize], hdr, endian, :
未指定 PixelData 中的字节数;猜测 = 1
如果我输入pixelData=FALSE,则仅读取标题是成功的。但我也想要图像部分。我正在使用来自here 的标准 dicom 文件。 (我现在正在尝试“BREBIX”数据库,但其他数据库给出了同样的错误。)
有什么问题?我找不到此错误的任何参考。
debug=TRUE 的完整输出:
# First 128 bytes of DICOM header =
[1] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[27] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[53] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[79] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[105] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
# DICM = TRUE
# 0002 0000 GroupLength UL UL 4 190
# 0002 0001 FileMetaInformationVersion OB OB 2
# 0002 0002 MediaStorageSOPClassUID UI UI 26 1.2.840.10008.5.1.4.1.1.2
# 0002 0003 MediaStorageSOPInstanceUID UI UI 42 1.2.840.113704.1.111.2864.1161868417.2891
# 0002 0010 TransferSyntaxUID UI UI 22 1.2.840.10008.1.2.4.91
# 0002 0012 ImplementationClassUID UI UI 22 1.3.6.1.4.1.19291.2.1
# 0002 0013 ImplementationVersionName SH SH 10 OSIRIX001
# 0002 0016 SourceApplicationEntityTitle AE AE 6 OsiriX
# 0008 0005 SpecificCharacterSet CS CS 10 ISO_IR 100
# 0008 0008 ImageType CS CS 28 ORIGINAL PRIMARY AXIAL HELIX
# 0008 0012 InstanceCreationDate DA DA 8 20061026
# 0008 0013 InstanceCreationTime TM TM 14 151337.000000
# 0008 0016 SOPClassUID UI UI 26 1.2.840.10008.5.1.4.1.1.2
# 0008 0018 SOPInstanceUID UI UI 42 1.2.840.113704.1.111.2864.1161868417.2891
# 0008 0020 StudyDate DA DA 8 20061026
# 0008 0022 AcquisitionDate DA DA 8 20061026
# 0008 0023 ContentDate DA DA 8 20061026
# 0008 0030 StudyTime TM TM 14 141819.000000
# 0008 0032 AcquisitionTime TM TM 14 140519.000000
# 0008 0033 ContentTime TM TM 14 140519.583000
# 0008 0050 AccessionNumber SH SH 2 0
# 0008 0060 Modality CS CS 2 CT
# 0008 0070 Manufacturer LO LO 8 Philips
# 0008 0080 InstitutionName LO LO 4 hY9
# 0008 0090 ReferringPhysiciansName PN PN 10 9D2n76uYj
# 0008 1010 StationName SH SH 6 ctrad
# 0008 1030 StudyDescription LO LO 18 CT10 ponction foie
# 0008 1032 ProcedureCodeSequence SQ SQ 64 Sequence
# FFFE E000 Item UN UN 0 (0008,1032)
# 0008 0100 CodeValue SH SH 8 CTPFOIE (0008,1032)
# 0008 0102 CodingSchemeDesignator SH SH 6 XPLORE (0008,1032)
# 0008 0104 CodeMeaning LO LO 18 CT10 ponction foie (0008,1032)
# 0008 103E SeriesDescription LO LO 12 DEF. VEINEUX
# 0008 1040 InstitutionalDepartmentName LO LO 10 Radiologie
# 0008 1090 ManufacturersModelName LO LO 14 Mx8000 IDT 16
# 0008 1111 ReferencedPerformedProcedureStepSequence SQ SQ 88 Sequence
# FFFE E000 Item UN UN 0 (0008,1111)
# 0008 1150 ReferencedSOPClassUID UI UI 24 1.2.840.10008.3.1.2.3.3 (0008,1111)
# 0008 1155 ReferencedSOPInstanceUID UI UI 40 1.2.840.113704.1.111.2656.1161865075.16 (0008,1111)
# 0010 0010 PatientsName PN PN 6 BREBIX
# 0010 0020 PatientID LO LO 6 XsaDYa
# 0010 1010 PatientsAge AS AS 4 000Y
# 0018 0010 ContrastBolusAgent LO LO 8 CONTRAST
# 0018 0022 ScanOptions CS CS 6 HELIX
# 0018 0050 SliceThickness DS DS 4 2.0
# 0018 0060 kVp DS DS 4 120
# 0018 0088 SpacingBetweenSlices DS DS 4 1.0
# 0018 0090 DataCollectionDiameter DS DS 4 340
# 0018 1020 SoftwareVersions LO LO 6 3.2.0
# 0018 1030 ProtocolName LO LO 24 THORAX-ABD 3 4 Thorax Hx
# 0018 1100 ReconstructionDiameter DS DS 4 340
# 0018 1120 GantryDetectorTilt DS DS 2 0
# 0018 1130 TableHeight DS DS 4 137
# 0018 1140 RotationDirection CS CS 2 CW
# 0018 1151 XrayTubeCurrent IS IS 4 360
# 0018 1152 Exposure IS IS 4 200
# 0018 1160 FilterType SH SH 2 B
# 0018 1210 ConvolutionKernel SH SH 2 B
# 0018 5100 PatientPosition CS CS 4 FFS
# 0020 000D StudyInstanceUID UI UI 42 2.16.840.1.113669.632.20.1211.10000330985
# 0020 000E SeriesInstanceUID UI UI 38 1.2.840.113704.1.111.4848.1161868385.1
# 0020 0010 StudyID SH SH 4 8369
# 0020 0011 SeriesNumber IS IS 6 107205
# 0020 0013 InstanceNumber IS IS 2 1
# 0020 0032 ImagePositionPatient DS DS 14 -180 -52 1479
# 0020 0037 ImageOrientationPatient DS DS 12 1 0 0 0 1 0
# 0020 0052 FrameOfReferenceUID UI UI 38 1.2.840.113704.1.111.4492.1161865106.3
# 0020 1041 SliceLocation DS DS 8 -493.50
# 0020 4000 ImageComments LT LT 58 JPEG 2000 lossless - Version 4.0.2 (c) Image Devices GmbH
# 0028 0002 SamplesperPixel US US 2 1
# 0028 0004 PhotometricInterpretation CS CS 12 MONOCHROME2
# 0028 0010 Rows US US 2 512
# 0028 0011 Columns US US 2 512
# 0028 0030 PixelSpacing DS DS 20 0.6640625 0.6640625
# 0028 0100 BitsAllocated US US 2 16
# 0028 0101 BitsStored US US 2 12
# 0028 0102 HighBit US US 2 11
# 0028 0103 PixelRepresentation US US 2 0
# 0028 1050 WindowCenter DS DS 12 00050 00050
# 0028 1051 WindowWidth DS DS 12 00350 00350
# 0028 1052 RescaleIntercept DS DS 6 -1000
# 0028 1053 RescaleSlope DS DS 2 1
# 0028 2110 LossyImageCompression CS CS 2 01
# 0028 2112 LossyImageCompressionRatio DS DS 8 5.896176
# 0032 1032 RequestingPhysician PN PN 16 MOSIMANN Pascal
# 0032 1060 RequestedProcedureDescription LO LO 18 CT10 ponction foie
# 0040 0007 ScheduledProcedureStepDescription LO LO 18 CT10 ponction foie
# 0040 0008 ScheduledProtocolCodeSequence SQ SQ 64 Sequence
# FFFE E000 Item UN UN 0 (0040,0008)
# 0008 0100 CodeValue SH SH 8 CTPFOIE (0040,0008)
# 0008 0102 CodingSchemeDesignator SH SH 6 XPLORE (0040,0008)
# 0008 0104 CodeMeaning LO LO 18 CT10 ponction foie (0040,0008)
# 0040 0009 ScheduledProcedureStepID SH SH 12 A10026674234
# 0040 0254 PerformedProcedureStepDescription LO LO 18 CT10 ponction foie
# 0040 0260 PerformedProtocolCodeSequence SQ SQ 64 Sequence
# FFFE E000 Item UN UN 0 (0040,0260)
# 0008 0100 CodeValue SH SH 8 CTPFOIE (0040,0260)
# 0008 0102 CodingSchemeDesignator SH SH 6 XPLORE (0040,0260)
# 0008 0104 CodeMeaning LO LO 18 CT10 ponction foie (0040,0260)
# 0040 0275 RequestAttributesSequence SQ SQ 150 Sequence
# FFFE E000 Item UN UN 0 (0040,0275)
# 0040 0007 ScheduledProcedureStepDescription LO LO 18 CT10 ponction foie (0040,0275)
# 0040 0008 ScheduledProtocolCodeSequence SQ SQ 64 Sequence (0040,0275)
# FFFE E000 Item UN UN 0 (0040,0275) (0040,0008)
# 0008 0100 CodeValue SH SH 8 CTPFOIE (0040,0275) (0040,0008)
# 0008 0102 CodingSchemeDesignator SH SH 6 XPLORE (0040,0275) (0040,0008)
# 0008 0104 CodeMeaning LO LO 18 CT10 ponction foie (0040,0275) (0040,0008)
# 0040 0009 ScheduledProcedureStepID SH SH 12 A10026674234 (0040,0275)
# 0040 1001 RequestedProcedureID SH SH 12 A10026674233 (0040,0275)
# 0040 1001 RequestedProcedureID SH SH 12 A10026674233
# 7FE0 0010 PixelData OB OW -1 PixelData
##### Reading PixelData (7FE0,0010) #####
Error in parsePixelData(fraw[(bstart + dcm$data.seek):fsize], hdr, endian, :
Number of bytes in PixelData not specified; guess = 1
编辑:
我查看了源代码。结果发现错误来自readDICOMFile 使用的函数parsePixelData。错误是由于以下几行:
length <- as.numeric(with(hdr, length[name == "PixelData" &
sequence == ""]))
if (length <= 0) {
guess <- 1
stop(paste("Number of bytes in PixelData not specified; guess =",
guess))
}
具体来说,以下结果给出了“-1”作为答案,这是导致问题的原因:
> with(dcmImages$hdr, length[name == "PixelData"])
[1] "-1"
现在,我该如何处理?由于我使用的是标准文件(上面给出的链接),它应该不会导致问题,对吧?
【问题讨论】: