All other questions regarding DCMTK
Moderator: Moderator Team
gzhang
Posts: 50 Joined: Wed, 2015-09-02, 09:24
#1
Post
by gzhang » Wed, 2017-09-27, 14:04
Hi,
I have a single-frame dicom file in originally in 'LittleEndianImplicit'. It says
E: can't convert input pixel data, probably unsupported compression
when I try to read it with
Code: Select all
DcmFileFormat * format = new DcmFileFormat;
OFCondition cond = format->loadFile(/*path*/);
if(cond.good() && format->chooseRepresentation(EXS_LittleEndianExplicit, NULL).good())
{
DicomImage * image = new DicomImage(format, EXS_LittleEndianExplicit);
}
where the codecs have been registered in advance.
Apparently, chooseRepresentation() didn't help, nor is it relevant. If I first convert the file with 'dcmconv' into 'LittleEndianExplicit', then everything works fine as expected.
I wonder how to properly convert from 'LittleEndianImplicit' to 'LittleEndianExplicit'?
J. Riesmeier
DCMTK Developer
Posts: 2501 Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:
#2
Post
by J. Riesmeier » Wed, 2017-09-27, 19:59
Why do you call chooseRepresentation() at all?
gzhang
Posts: 50 Joined: Wed, 2015-09-02, 09:24
#3
Post
by gzhang » Thu, 2017-09-28, 12:09
My bad.. It seems to be specific to the file, because many other files in little endian implicit seem to work without a problem.
For this file with a problem, I took off the 'chooseRepresentation()':
Code: Select all
DcmFileFormat * format = new DcmFileFormat;
OFCondition cond = format->loadFile(/*path*/);
if(cond.good() && format->getDataset()->tagExistsWithValue(DCM_PixelData))
{
DicomImage * image = new DicomImage(format, EXS_Unknown); /* or EXS_LittleEndianImplicit */
}
it says the same
E: can't convert input pixel data, probably unsupported compression
I wonder why the 'conversion' is still called? Dcmdump shows everything normal in the output, where else should I look for the problem?
Thanks!
J. Riesmeier
DCMTK Developer
Posts: 2501 Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:
#4
Post
by J. Riesmeier » Thu, 2017-09-28, 12:13
If the
required decompression codec (decoder) is registered, the DicomImage class is able to access decompressed pixel data (internally, it is decompressed for further processing).
Dcmdump shows everything normal in the output, where else should I look for the problem?
What is the transfer syntax of this particular DICOM image?
gzhang
Posts: 50 Joined: Wed, 2015-09-02, 09:24
#5
Post
by gzhang » Thu, 2017-09-28, 12:15
well, here is the first few lines of dcmdump:
# Dicom-Meta-Information-Header
# Used TransferSyntax: Little Endian Explicit
(0002,0000) UL 224 # 4, 1 FileMetaInformationGroupLength
(0002,0001) OB 00\01 # 2, 1 FileMetaInformationVersion
(0002,0002) UI =XRayAngiographicImageStorage # 28, 1 MediaStorageSOPClassUID
(0002,0003) UI [1.3.12.2.1107.5.4.5.158073.30000017092706023131200000194.4] # 58, 1 MediaStorageSOPInstanceUID
(0002,0010) UI =LittleEndianImplicit # 18, 1 TransferSyntaxUID
(0002,0012) UI [1.2.276.0.7230010.3.0.3.6.2] # 28, 1 ImplementationClassUID
(0002,0013) SH [OFFIS_DCMTK_362] # 16, 1 ImplementationVersionName
(0002,0016) AE [PACSWFM6AZUUR] # 14, 1 SourceApplicationEntityTitle
# Dicom-Data-Set
# Used TransferSyntax: Little Endian Implicit
(0008,0005) CS [ISO_IR 100] # 10, 1 SpecificCharacterSet
(0008,0008) CS [DERIVED\PRIMARY\SINGLE PLANE\SINGLE A\STORE FLUORO] # 50, 5 ImageType
(0008,0016) UI =XRayAngiographicImageStorage # 28, 1 SOPClassUID
J. Riesmeier
DCMTK Developer
Posts: 2501 Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:
#6
Post
by J. Riesmeier » Thu, 2017-09-28, 12:17
So, the image is uncompressed (according to the transfer syntax given in the file meta information header).
Are you able to process the image (pixel data) with "dcm2pnm"?
gzhang
Posts: 50 Joined: Wed, 2015-09-02, 09:24
#7
Post
by gzhang » Thu, 2017-09-28, 12:21
Just tried. It worked with dcm2pnm. The resulting image 'test.pgm' opens fine in ImageJ. So it must be something I did wrong...
gzhang
Posts: 50 Joined: Wed, 2015-09-02, 09:24
#8
Post
by gzhang » Thu, 2017-09-28, 14:09
I was confused with a few different files earlier and now it seems clear:
1) problem has nothing to do with 'LittleEndianImplicit', nor is it related to DcmFileFormat::chooseRepresentation()
2) it goes wrong only with large files which are multi-frame. The error
E: can't convert input pixel data, probably unsupported compression
comes with insufficient memory.
3) solution
Code: Select all
DicomImage * dicom = new DicomImage(format, EXS_Unknown, CIF_MayDetachPixelData | CIF_UsePartialAccessToPixelData, (unsigned long) 0, (unsigned long) 1);
Thank you for helping!
Users browsing this forum: Ahrefs [Bot] , Bing [Bot] , Google [Bot] and 1 guest