DICOM @ OFFIS

Discussion Forum for OFFIS DICOM Tools - For registration, send email with desired user name to the OFFIS DICOM team
It is currently Sun, 2017-07-23, 01:56

All times are UTC + 1 hour




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Thu, 2011-07-07, 17:18 
Offline

Joined: Fri, 2008-03-28, 11:07
Posts: 38
Hi,

I need to convert from JPEG2000 to JPEG-LS.
The operation fails because "canWriteXfer" return "false".
Debugging the code I see this is because both the tx syntax are encapsulated.
What's the best way to perform this conversion?
Does is exist something to decompress original file (JPEG2000) "on the fly" before translating to JPEG-LS?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Thu, 2011-07-07, 17:39 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1831
Location: Oldenburg, Germany
Quote:
Does is exist something to decompress original file (JPEG2000) "on the fly" before translating to JPEG-LS?

JPEG 2000 decompression is not part of the freely available DCMTK but has to be licensed separately.


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 09:42 
Offline

Joined: Fri, 2008-03-28, 11:07
Posts: 38
Hi Joerg,

I purchased the license you are speaking.
I'm able to compress/decompress JPEG2000 tx syntax.
The problem arise when I try to convert between 2 encapsulated tx syntaxes. Also JPEG (not 2000) to JPEG-LS.


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 10:12 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1831
Location: Oldenburg, Germany
There is currently no way for a direct conversion between these two compression schemes (see source code of class D2JPEG2000Decoder).
That means, you have to decompress the image first and then compress it again with the desired codec / transfer syntax.


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 11:11 
Offline

Joined: Fri, 2008-03-28, 11:07
Posts: 38
Thank you.

Is it possible to decompress in memory (EVRLE) than compress again to JPEG?
If yes what's the code to use?


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 11:16 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1831
Location: Oldenburg, Germany
You can find sample code in the documentation. The compression/decompression is performed by the call to chooseRepresentation(). There's no need to save the DICOM object to a file.


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 11:59 
Offline

Joined: Fri, 2008-03-28, 11:07
Posts: 38
I use the following code:

// Temporary decompress original file
eTxSyntax = EXS_LittleEndianExplicit;
pDataset->chooseRepresentation(eTxSyntax, NULL);
if (!pDataset->canWriteXfer(eTxSyntax)) // Decompression failed?
{
return FALSE;
}

Debugging the application the pDataset tx syntax remains EXS_JPEG2000LosslessOnly before and after "chooseRepresentation" call.

What I'm missing?


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 12:01 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1831
Location: Oldenburg, Germany
Did you register the JPEG 2000 decoders? In a previous posting you wrote:

Quote:
I'm able to compress/decompress JPEG2000 tx syntax.


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 12:16 
Offline

Joined: Fri, 2008-03-28, 11:07
Posts: 38
Yes all registered correctly.
I'm able to compress/decompress from non-encapsulated to encapsulated and vice-versa.
I'm looking for a workaround to convert from encapsulated to encapsulated by decompressing to EVRLE on the fly.

Adding my previous piece of code I think the decompression in memory succeded (the memory grows) but the next step to compress again fails.


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 12:19 
Offline

Joined: Fri, 2008-03-28, 11:07
Posts: 38
I add that the second chooseRep. compressing to JPEG-LS again return the following:

"Unsupported pixel representation for near-lossless JPEG-LS compression"


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 13:05 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 14:38
Posts: 1831
Location: Oldenburg, Germany
Did you also register the JPEG-LS compression codec?


Top
 Profile  
 
 Post subject:
PostPosted: Fri, 2011-07-08, 14:18 
Offline

Joined: Fri, 2008-03-28, 11:07
Posts: 38
The problem was the PixelRepresentation=1 (not codec) incompatible with JPEG-LS near lossless.
I tryed to convert from JPEG2000 to JPEG-LS lossless and it's working.
Also other conversion from JPEG to JPEG2000 and viceversa works.

Thank you


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group