Preblem with DJDecoderRegistration

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
poong4444
Posts: 8
Joined: Mon, 2020-03-23, 10:42

Preblem with DJDecoderRegistration

#1 Post by poong4444 » Tue, 2020-03-24, 03:02

Hello, I have a problem with decompression(JPEG Lossless to LittleEndianExplicit).
I referred to the following site.
https://support.dcmtk.org/docs/mod_dcmjpeg.html
When I checked OFCondition of chooseRepresentation function, the Status is 'OF_error' and the error text is 'Pixel representation cannot be changed'
How can I solve this problem?
The part of code is below.

Code: Select all

E_TransferSyntax xfer = m_pdcmfile->getDataset()->getOriginalXfer();
if(xfer !=EXS_LittleEndianExplicit)
{
	DJDecoderRegistration::registerCodecs();
	DcmDataset *dataset = m_pdcmfile->getDataset();
	if (dataset->chooseRepresentation(EXS_LittleEndianExplicit, NULL).good() &&
		dataset->canWriteXfer(EXS_LittleEndianExplicit))
	{
		fileformat->saveFile(fileName, EXS_LittleEndianExplicit);
	}
	DJDecoderRegistration::cleanup();
}
'fileformat' is a pointer of DcmFileFormat and 'fileName' is OFString of file name

Thank you in advance
Best regards,
Yonah

Markus Sabin
Posts: 88
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

Re: Preblem with DJDecoderRegistration

#2 Post by Markus Sabin » Tue, 2020-03-24, 13:53

Are you linking to the dcmjpeg and to the IJG libraries?

poong4444
Posts: 8
Joined: Mon, 2020-03-23, 10:42

Re: Preblem with DJDecoderRegistration

#3 Post by poong4444 » Wed, 2020-03-25, 01:12

Thank you for reply.
I am linking to the dcmjpeg but I didn't link IJG library.
How can I link it?

Markus Sabin
Posts: 88
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

Re: Preblem with DJDecoderRegistration

#4 Post by Markus Sabin » Wed, 2020-03-25, 08:48

The IJG libraries are shipped with DCMTK, so you just compile jpg8, jpg12 and jpg16 and then link to them like you link to other DCMTK libraries as well.

poong4444
Posts: 8
Joined: Mon, 2020-03-23, 10:42

Re: Preblem with DJDecoderRegistration

#5 Post by poong4444 » Thu, 2020-03-26, 02:00

Thanks for your help, Markus!
I could find the header file of IJG libraries.
I added code as below but I still faced same error message.

Code: Select all

#include "dcmtk/dcmjpeg/djdijg8.h"
#include "dcmtk/dcmjpeg/djdijg12.h"
#include "dcmtk/dcmjpeg/djdijg16.h"
#include "dcmtk/dcmjpeg/djdecode.h"
I need your help

Markus Sabin
Posts: 88
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

Re: Preblem with DJDecoderRegistration

#6 Post by Markus Sabin » Thu, 2020-03-26, 09:40

Including the header is not the same as linking to the libraries. You need to have the libraries built as ".lib" and potentially ".dll" or ".so" files, and you have to instruct your linker to add them to your project.

poong4444
Posts: 8
Joined: Mon, 2020-03-23, 10:42

Re: Preblem with DJDecoderRegistration

#7 Post by poong4444 » Fri, 2020-03-27, 08:26

Thank you for reply!

But I only have dcmtk.lib file and some _obj.lib file(e.g. dcmimgle_obj.lib, dcmnet_obj.lib, etc).
And also I only have dcmtk.dll.

Do I have to compile dcmtk project again?

poong4444
Posts: 8
Joined: Mon, 2020-03-23, 10:42

Re: Preblem with DJDecoderRegistration

#8 Post by poong4444 » Mon, 2020-03-30, 08:17

I made library files(dcmjpeg.lib, ijg8.lib, ijg12.lib, ijg16.lib) and link it.
But It didn't work..

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1257
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Preblem with DJDecoderRegistration

#9 Post by Marco Eichelberg » Tue, 2020-04-07, 18:09

Other than I would recommend the codec registration and cleanup to happen at the startup/end of your application,
and not somewhere in the middle of the DICOM parsing logic, I see no problem with your code. Are you certain that the
image you are trying to decode is really encoded in a JPEG transfer syntax, and not JPEG-LS or JPEG 2000?

poong4444
Posts: 8
Joined: Mon, 2020-03-23, 10:42

Re: Preblem with DJDecoderRegistration

#10 Post by poong4444 » Thu, 2020-04-09, 01:24

Thanks for reply.
I'm trying to decode JPEG-LS file. Do I have to use DJLSDecoderRegistration?

poong4444
Posts: 8
Joined: Mon, 2020-03-23, 10:42

Re: Preblem with DJDecoderRegistration

#11 Post by poong4444 » Mon, 2020-04-13, 10:09

I've been using integrated library file(dcmtk.lib) so far, can this be the cause of the problem?

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest