Thursday, May 17, 2012
Google Custom Search

ClearCanvas Highlights

Download our Open Source software
Watch some Videos
Get the Source
Check out our Licensing
Join our  Forums
Some Research: OICR IPP-Trials

Our Community

Membership Membership:
Latest New User Latest: JBauza
New Today New Today: 19
New Yesterday New Yesterday: 33
User Count Overall: 22559

People Online People Online:
Visitors Visitors: 9
Members Members: 2
Total Total: 11

Online Now Online Now:
01: radialheadfx
02: JBauza

ClearCanvas Community Forums

Compression?
Last Post 2011-03-20 05:21 PM by nibuen. 34 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Page 1 of 212 > >>
Author Messages
jfc
New Member
New Member
Posts:2

--
2007-10-30 01:51 PM  
Does clearcanvas support jpeg-lossless or other compression algorithms? I see in the old forums there was a plan to do so, about a year ago. Thanks, John
norman
Senior Member
Senior Member
Posts:813

--
2007-11-01 04:49 PM  
Hi John,

At this point, no. The plan is to do so, of course, but because of other priorities, we've had to bump that down in importance.

Are you interested specifically in compression support in the DICOM toolkit, or in the viewer as well?

Norman
jfc
New Member
New Member
Posts:2

--
2007-11-01 06:05 PM  
Well, we're wondering how to use the viewer to look at images that are compressed, in particular with JPEG lossless. Perhaps the easiest way to do this is to pre-process the images prior to import and expand them. We also are looking at adding this functionality ourselves, but would depend on how complex that would be. I assume the easiest path for the time being would be to make a pre-processor to run prior to import, but our programmers will take a look at this.


stewart
Senior Member
Senior Member
Posts:2128

--
2007-11-02 08:32 PM  
Hi John, you can do the decompression on the fly in the viewer by writing an extension of ImageCodecExtensionPoint (that implements IImageCodec). The viewer automatically loads all the image codec extensions (which are implemented per-transfer syntax) and if an appropriate one is available, it will use it to decompress the image. This is probably the easiest solution in terms of getting the images to open in the viewer.

Hope this helps,
Stewart
Real-time support available to Clinical Edition and Team Edition customers
DM
Advanced Member
Advanced Member
Posts:44

--
2007-12-15 08:05 PM  
jfc,

Did you successfully implement the codec for JPEG lossless?

DM
DM
Advanced Member
Advanced Member
Posts:44

--
2008-01-27 08:11 AM  
i recreated an image codec extension for JPEG 2000 lossless and when i load the image, i get a black screen with no images.  I'm using OPENJPEG for decoding JPEG2000.

After reading the log file, i see this:

System.ArgumentNullException: Value cannot be null.
Parameter name: source
   at System.Runtime.InteropServices.Marshal.CopyToManaged(IntPtr source, Object destination, Int32 startIndex, Int32 length)
   at System.Runtime.InteropServices.Marshal.Copy(IntPtr source, Byte[] destination, Int32 startIndex, Int32 length)
   at ClearCanvas.Codecs.OpenJPEGNet.OpenJPEG.Decode(Byte[] encoded, Int32& width, Int32& height, Int32& components)
   at ClearCanvas.Codecs.JPEG2000ImageCompressionLosslessOnlyCodec.Decode(Byte[] compressedPixelData, Int32 rows, Int32 columns, Int32 bitsAllocated, Int32 bitsStored, Int32 pixelRepresentation, String photometricInterpretation, Int32 samplesPerPixel, Int32 planarConfiguration, CodecPerformanceInfo info)
   at ClearCanvas.Codecs.ImageCodecMap.DecompressPixelData(Byte[] compressedPixelData, String transferSyntaxUid, Int32 rows, Int32 columns, Int32 bitsAllocated, Int32 bitsStored, Int32 pixelRepresentation, String photometricInterpretation, Int32 SamplesPerPixel, Int32 PlanarConfiguration, CodecPerformanceInfo info)
stewart
Senior Member
Senior Member
Posts:2128

--
2008-01-28 09:26 AM  
Hi DM, I'm afraid I can't determine much from the log. Can you set a breakpoint at the very beginning of your codec's DecompressPixelData method. Is compressedPixelData null? If so, then our Dicom toolkit may not be able to parse the file for some reason. If it is null, would you be able to provide us an anonymized sample image?

If it is not null, then there is likely a problem either in your extension or in the OpenJPEG library.

Best regards,
Stewart
Real-time support available to Clinical Edition and Team Edition customers
DM
Advanced Member
Advanced Member
Posts:44

--
2008-01-28 06:29 PM  
Hi Stewart,

After setting a breakpoint, i noticed that the compressedPixelData byte is empty. Therefore when it is passed to the OpenJPEGnet class, there was no pixel data to be decompressed.

Can i get your email so that i can send you the compressed image?

DM
norman
Senior Member
Senior Member
Posts:813

--
2008-01-28 06:34 PM  
Hi DM,

If the image isn't too big, you can upload it here on the forum. Just ensure that it has been properly anonymized.

Just so you know, the image codec related APIs are not yet stable, as we're trying consolidate our approach to compression/decompression between our viewer and server products. Be prepared for some possible changes in the future. (Hopefully they won't be too big.)

Norman
DM
Advanced Member
Advanced Member
Posts:44

--
2008-01-28 06:58 PM  
I realised that the mximum attachment size is 32KB, however the image is 149KB.

DM
superuser
Basic Member
Basic Member
Posts:15

--
2008-01-28 11:52 PM  
Hmmm...that's odd. The max upload has been set at 32MB, so you shouldn't have a problem uploading. If you want, just send it to Stewart (stewart AT clearcanvas DOT ca) and he can take a look.

Norman
steve
Senior Member
Senior Member
Posts:1932

--
2008-01-29 01:12 PM  
DM,

Upon further review, our advice was misleading. The problem arises from the fact that for compressed images, the actual pixel data for compressed transfer syntaxes is being stored right now in the value DicomAttributeOB.Fragments, and for uncompressed code the pixel data is stored in DicomAttributeOB.Values. The current viewer code is not differentiating between this data, and is always assuming pixel data is stored int he DicomAttributeOB.Values field.

We do plan on starting work in February on supporting compression better in the DICOM library, and subsequently in the viewer. So, we'll be working on the "glue" code to make this all work together. With the current code base, however, reading compressed images is impossible because of the above issues.javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("dnn$ctr425$NTForums$AF_TopicView$amQuickReply$lnkPost", "", true, "", "", false, true))
QuickReplyButtonSubmit

Steve
Real-time support available to Clinical Edition and Team Edition customers
DM
Advanced Member
Advanced Member
Posts:44

--
2008-01-29 08:48 PM  
Thanks Steve.
dblanchard
Senior Member
Senior Member
Posts:185

--
2008-02-19 05:17 PM  
Hi Steve,

I am curious on the status of having compression images in the library?  We may have a need to use jpeg lossless compression (.70)...

thanks

Dan

steve
Senior Member
Senior Member
Posts:1932

--
2008-02-20 01:26 PM  
Hi Dan,

I just got done yesterday with some changes related to loading individual frames of pixel data from a file one at a time, I'm next going to be working on getting the codec and compressed image infrastructure in place over the next week or two, then focusing in on implementing the actual codecs. We're probably going to use FreeImage as a reference implementation to support the various compressed formats, including JPEG lossless.

You should start seeing some progress in the repository over the next few weeks.

Steve
Real-time support available to Clinical Edition and Team Edition customers
dblanchard
Senior Member
Senior Member
Posts:185

--
2008-02-20 06:43 PM  
thanks Steve, I look forward to it.

regards,

dan
dcsst29
New Member
New Member
Posts:2

--
2008-04-06 12:37 PM  
Hello Steve,
I would really appreciate if you could post code snippet of how to do these things specifically

1.  Register the new codec ( specifically for jpeg decompression )
2.  Build the dll / library  for jpeg  lossless decompression .

Looking forward for your reply.

Regards

Deepak
steve
Senior Member
Senior Member
Posts:1932

--
2008-04-07 12:30 AM  
Hi Deepak,

First some background:  The codecs uses are OpenJPEG for JPEG2000 support, and the IJG code for standard JPEG compression.  The basic code was taken from the mDCM library (which was the original basis of our entire DICOM library).  This is partially the reason for our recent change in licensing of the code.  We did make some modifications to interfaces from the mDCM codec code.  Specifically, the interfaces were changed to allow greater flexibility and the potential for a plugin type interface for setting compression/decompression parameters.

As for how to build the library, the OpenJPEG and IJG code are compiled within managed C++ code.  If you load the solution Trunk\Dicom\ClearCanvas.Dicom.sln, the projects for building the codecs are included in this solution.  The compiled versions of the codec assemblies are also checked into Trunk\ReferencedAssemblies.  

Codecs are registered via the static DicomCodecRegistry class.  Here is some sample code to register the current codecs:

DicomCodecRegistry.RegisterCodec(TransferSyntax.JpegBaselineProcess1,
                                 new DicomJpegProcess1CodecFactory());

DicomCodecRegistry.RegisterCodec(TransferSyntax.JpegExtendedProcess24,
                                 new DicomJpegProcess24CodecFactory());

DicomCodecRegistry.RegisterCodec(TransferSyntax.JpegLosslessNonHierarchicalProcess14,
                                 new DicomJpegLossless14CodecFactory());

DicomCodecRegistry.RegisterCodec(               TransferSyntax.JpegLosslessNonHierarchicalFirstOrderPredictionProcess14SelectionValue1,
                                 new DicomJpegLossless14SV1CodecFactory());

DicomCodecRegistry.RegisterCodec(TransferSyntax.Jpeg2000ImageCompressionLosslessOnly,
                                 new DicomJpeg2000LosslessCodecFactory());

DicomCodecRegistry.RegisterCodec(TransferSyntax.Jpeg2000ImageCompression,
                                 new DicomJpeg2000LossyCodecFactory());

DicomCodecRegistry.RegisterCodec(TransferSyntax.RleLossless,
                                 new DicomRleCodecFactory());

The above use of the DicomCodecRegistry can be done with just the ClearCanvas.Dicom assembly and the correct assembly containing the codec being registered.  We've also added an extension point for codecs, and a DicomCodecHelper class in the ClearCanvas.DicomServices assembly to help loading the extensions.  The ImageServer code base has implemented the plugin mechanism.  You can look at the ClearCanvas.ImageServer.Codec.* assemblies to see how this is done.

Finally, the DICOM library itself has a few ways to do conversions.  The DicomMessageBase class has a ChangeTransferSyntax() method that can be used to do conversions of DICOM files or messages between supported transfer syntaxes.  Also, the SendCStoreRequest method of DicomClient has been modified to do a single conversion of an object, if necessary, when sending over the network.  (Ie, it can decompress or compress an object to match w/ the negotiated transfer syntax for the object.)

There's also been some mods with the library for accessing frames, and the ability to leave pixel data on disk when reading a file, and then read the data frame by frame from a compressed file on disk.  (The viewer is now doing this.)    

Overall, the codec code hasn't been extensively tested yet.  We have done a bit more testing of decompression than compression with this code.  The API, however, is fairly stable, and I wouldn't expect many changes with it at this time.

regards,
Steve
Real-time support available to Clinical Edition and Team Edition customers
dcsst29
New Member
New Member
Posts:2

--
2008-04-07 12:07 PM  
Hi Steve,
Thanks a ton for the super quick reply.
I think i got a good idea looking at your detailed reply but what i am still not able to figure out is how to add the plugin to the viewer code. ( How to add a new decoder ? )

If you could point me to the exact way these assemblies are used in image server for getting it exactly that would be great .


Regards

Deepak
norman
Senior Member
Senior Member
Posts:813

--
2008-04-14 02:08 AM  
Hi Deepak,

Sorry for the delay. We wanted to figure out the best way of doing this before replying. We're actually going to commit codec plugins for JPEG, JPEG2000 and RLE in the next few days. Once we do that, you'll have a concrete example of how to do it. We'll let you know.

N.
You are not authorized to post a reply.
Page 1 of 212 > >>


Active Forums 4.1
Copyright 2012 ClearCanvas Inc.