I successfully compiled DCMTK and used in the Xcode project on macOS 10.15. I can read/decompress JPEG images, but I am not able to read some DICOM files.
Using DicomImage *di = new DicomImage(dfile, xfer , CIF_UsePartialAccessToPixelData, 0,1);
returns nil image. Reading dataset->findAndGetUint16(DCM_Rows, rows)
returns 0 (for rows or columns), reading pixel data returns 0....
Checking file with dcmdump
returns correct data:
# Dicom-File-Format
# Dicom-Meta-Information-Header
# Used TransferSyntax: Unknown Transfer Syntax
# Dicom-Data-Set
# Used TransferSyntax: Little Endian Implicit
(0008,0008) CS [DERIVED\PRIMARY\OTHER] # 22, 3 ImageType
(0008,0014) UI [1.2.840.113701.4.1.6653] # 24, 1 InstanceCreatorUID
(0008,0016) UI =MRImageStorage # 26, 1 SOPClassUID
(0008,0018) UI [1.2.840.113701.4.1.6653.3.264.4.9.6.0] # 38, 1 SOPInstanceUID
---
(0008,0070) LO [Toshiba] # 8, 1 Manufacturer
(0008,0080) LO [TOSHIBA Nasu Works. Bay-6653.] # 30, 1 CompanyName
(0008,1010) SH [FLEXART] # 8, 1 StationName
---
(0008,1090) LO [MRT150] # 6, 1 ManufacturerModelName
(0010,0010) PN [GGGGGG^WWWWW] # 12, 1 ComponentName
(0010,0020) LO [TMS04] # 6, 1 ComponentIDNumber
(0010,0030) DA [19000100] # 8, 1 ComponentManufacturingDate
(0010,0032) TM [000000] # 6, 1 PatientBirthTime
(0010,0040) CS [F] # 2, 1 PatientSex
(0010,1030) DS [79.000000] # 10, 1 PatientWeight
---
(0020,0052) UI [1.2.840.113701.4.1.1.1] # 22, 1 FrameOfReferenceUID
(0020,4000) LT (no value available) # 0, 0 ImageComments
(0028,0002) US 1 # 2, 1 SamplesPerPixel
(0028,0004) CS [MONOCHROME2] # 12, 1 PhotometricInterpretation
(0028,0010) US 512 # 2, 1 Rows
(0028,0011) US 512 # 2, 1 Columns
(0028,0030) DS [0.000312\0.000312] # 18, 2 PixelSpacing
(0028,0100) US 16 # 2, 1 BitsAllocated
(0028,0101) US 16 # 2, 1 BitsStored
(0028,0102) US 15 # 2, 1 HighBit
(0028,0103) US 0 # 2, 1 PixelRepresentation
(0028,0106) US 3 # 2, 1 SmallestImagePixelValue
(0028,0107) US 1030 # 2, 1 LargestImagePixelValue
(7fe0,0010) OW 8064\8064\8064\8064\8064\8064\8064\8064\8064\8064\8064\8064\8064... # 524288, 1 PixelData
I tried to force dataset to use EXS_LittleEndianExplicit
as dataset->chooseRepresentation(EXS_LittleEndianExplicit, NULL).bad()
but it returns true
(unsuccessful).
I have no idea what could be wrong. All DCMTK libraries and apps seem to be compiled correctly, my code is written in Objective-C++ so I can call DCMTK functions without problems. I hope I don't need to write a custom parser. I tried to open the file in Osiri, Miele, Horos.. all imported and displayed image correctly.
I really appreciate any idea... thank you.
Typical mistakes with DCMTK if compression handling does not work:
Initializing the codecs simpily works by
...but have a look at the parameters of these methods which you might set differently from the defaults.