Compressing palette color image to JPEG using dcmcjpeg code

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
yogendrarampuria
Posts: 5
Joined: Tue, 2006-01-17, 18:36
Location: Hyderabad (AP), India
Contact:

Compressing palette color image to JPEG using dcmcjpeg code

#1 Post by yogendrarampuria »

Hi,
I am trying to compress a palette color image to jpeg lossless. I am using the dcmcjpeg code as is. I am creating a dll instead of .exe, later using Runtime loading I am loading and running the compressing function.

the trouble is that its giving me a null pointer at
dataset->chooseRepresentation(opt_oxfer, rp);
i tried compress the same file using binaries, and it happened
the stack trace is as follows
DiOverlay::getCount() line 244 + 15 bytes
DiMonoImage::Init(DiMonoModality * 0x00807b30) line 653 + 26 bytes
DiMonoImage::DiMonoImage(const DiDocument * 0x00807d50, EI_Status EIS_Normal) line 104
DiMono2Image::DiMono2Image(const DiDocument * 0x00807d50, EI_Status EIS_Normal) line 49 + 23 bytes
DicomImage::Init() line 207 + 51 bytes
DicomImage::DicomImage(DcmObject * 0x00803310, E_TransferSyntax EXS_LittleEndianImplicit, const unsigned long 0, const unsigned long 0, const unsigned long 0) line 106
DJCodecEncoder::encodeColorImage(int 0, DcmItem * 0x00803310, const DcmRepresentationParameter * 0x0012fd9c, DcmPixelSequence * & 0x00000000, const DJCodecParameter * 0x008039a0, double & 0.00000000000000) line 274 + 54 bytes
DJCodecEncoder::encode(const unsigned short * 0x00880068, const unsigned short * 0x00880068, const DcmRepresentationParameter * 0x0012fd9c, DcmPixelSequence * & 0x00000000, const DcmCodecParameter * 0x008039a0, DcmStack & {...}) line 150 + 37 bytes
DcmCodecList::encode(E_TransferSyntax EXS_LittleEndianExplicit, const unsigned short * 0x00880068, const unsigned long 258000, E_TransferSyntax EXS_JPEGProcess14SV1TransferSyntax, const DcmRepresentationParameter * 0x0012fd9c, DcmPixelSequence * & 0x00000000, DcmStack & {...}) line 408 + 65 bytes
DcmPixelData::encode(const DcmXfer & {...}, const DcmRepresentationParameter * 0x00000000, DcmPixelSequence * 0x00000000, const DcmXfer & {...}, const DcmRepresentationParameter * 0x0012fd9c, DcmStack & {...}) line 412 + 47 bytes
DcmPixelData::chooseRepresentation(E_TransferSyntax EXS_JPEGProcess14SV1TransferSyntax, const DcmRepresentationParameter * 0x0012fd9c, DcmStack & {...}) line 322 + 49 bytes
DcmDataset::chooseRepresentation(E_TransferSyntax EXS_JPEGProcess14SV1TransferSyntax, const DcmRepresentationParameter * 0x0012fd9c) line 490 + 43 bytes
so can some one pt. out where is the trouble.
Yogendra Rampuria

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

Does that mean that dcmcjpeg crashes? If this is the case we would be interested to get this DICOM palette color image. Please send it by email to dicom/at/offis/dot/de.

yogendrarampuria
Posts: 5
Joined: Tue, 2006-01-17, 18:36
Location: Hyderabad (AP), India
Contact:

#3 Post by yogendrarampuria »

Jörg Riesmeier wrote:Does that mean that dcmcjpeg crashes? If this is the case we would be interested to get this DICOM palette color image. Please send it by email to dicom/at/offis/dot/de.
I must say that its partly correct. It does a gr8 job when i run the precompiled binary ... given by offis.but when i run it from the source debug it does crash. i am mailing you a copy too
Yogendra Rampuria

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

yogendrarampuria wrote:I must say that its partly correct. It does a gr8 job when i run the precompiled binary ... given by offis.but when i run it from the source debug it does crash.
In this case it should be pretty obvious that your program is (most probably) doing something wrong. You should use the debugger in order to determine the reason for the crash.

yogendrarampuria
Posts: 5
Joined: Tue, 2006-01-17, 18:36
Location: Hyderabad (AP), India
Contact:

#5 Post by yogendrarampuria »

Jörg Riesmeier wrote: In this case it should be pretty obvious that your program is (most probably) doing something wrong. You should use the debugger in order to determine the reason for the crash.
Ok, I have also tried bare bone thing. I created a new console application and just added your dcmcjpeg file to it and started debugging i still got the same problem. Its crashing in the some overlay function. could you pt. out the problem to me. whether its in dataset? i m using DCMTK 3.5.3 on windows if that matters.
also, i have mailed you the image.
Yogendra Rampuria

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

#6 Post by Marco Eichelberg »

The image you sent is fine, nothing wrong with that. Actually I suspect that there is something wrong with the registration (or linkage) of the classes for color images (the dcmimage library), because the stack trace shows that your tool crashes in the constructor for class DiMonoImage, which should never ever be called when loading a color image - the sample image you provided is a color image after all. Make sure your main application includes "dcmtk/dcmimage/diregist.h" (or just diregist.h for older DCMTK releases) and links against the dcmimgle and dcmimage libraries.

Post Reply

Who is online

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