Thursday, February 09, 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: VMCCNY
New Today New Today: 18
New Yesterday New Yesterday: 26
User Count Overall: 20581

People Online People Online:
Visitors Visitors: 10
Members Members: 2
Total Total: 12

Online Now Online Now:
01: lecalos
02: larrywiding

ClearCanvas Community Forums

Is the DICOM Toolkit the right pick for me?
Last Post 1900-01-01 12:00 AM by . 10 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
stiank81
Advanced Member
Advanced Member
Posts:33

--
2009-09-04 09:14 AM  

Hi,

I'm looking for a library to handle DICOM files. What I need to do is basically: 

  • load DICOM file
  • fetch header data and images from it
  • add graphics and text annotations
  • store modified DICOM files
  • Create DICOM files from skratch using my own images + header info.

I've come across clearcanvas, and it seems like this might be just what I'm looking for. I'm creating a WPF application in which I need to display data from DICOM files. What I'd like the library to do is only the mentioned parts surrounding the file handling. I'd like to handle the view part myself, e.g. showing the images by fetching them from the loaded DICOM files.

Does it sound like I'm on the right track by choosing clearcanvas?

Thx in advance for any help or comments.

Cheers!

dblanchard
Senior Member
Senior Member
Posts:185

--
2009-09-04 11:52 AM  
Hello,
We have done similar things with CC and WPF apps. Yes CC is the right tool, altough if you want to use the image viewer part, it would be difficult to use in WPF app, the CC code for that is WinForms strongly intertwined with their plugin model. It would be possible to use their plugin model w/ WPF, you would have to use WinForms interop and design your app from the get-go to use their plugin model.

One note about WPF apps and DICOM images - we use 12-16 bit grayscale DX images. They look nice in WPF, but unfortunately it is difficult if not impossible to do real-time window leveling with the WPF image control. You can do it with 8 bit grayscale but not 12-16 bit grayscale cos you cannot modify the pixel data real-time with the WPF image control. We use a 3rd party winForms viewer by Dicom Objects to do all this for us.

HTH,

dan
stiank81
Advanced Member
Advanced Member
Posts:33

--
2009-09-04 04:20 PM  

Thanks for your reply!.

Sounds like we should stay clear of the ImageViewer then. I would assume this means that we shouldn't touch anything under the ClearCanvas.ImageViewer namespace? But this seems to be where the annotations (text and graphics) is placed too. I'm new to DICOM, but as far as I've understood annotations can be stored within the DICOM-file. I would expect to be able to fetch information about this too from the loaded DICOM-file. Can I? 

The ClearCanvas.Dicom namespace and dll sounds like where I should find the core DICOM file handling parts (is it?), but this doesn't seem to be covered in the Framework reference guide. Do you know if there is documentation on this elsewhere? What dll's should I focus on for the dicom file handling only? cc.Dicom.dll and cc.Common.dll? 

About the problems with real-time window leveling in Wpf; is this not a problem with WinForms? You think this is not possible to handle at all - or just not at all using only Wpf? I've heard about posibilities doing such things by writing a shader directly in HSDL for DirectX, but this isn't something I've looked into myself yet..

Cheers,

Stian

steve
Senior Member
Senior Member
Posts:1885

--
2009-09-05 12:50 AM  
Stian,

The SDK download is basically focused on allowing a user to write plugins that can be run against a specific version of the ImageViewer. Most of this is focused on writing tools and other related plugins. The DICOM assembly is included, but since the focus has been on the GUI, we've put limited effort into documenting the DICOM assembly. At some point we'll attempt to document it better, but for now there's not much available.

Your best bet to get started would be to access our repository directly. In the Trunk\Dicom directory, there's a solution for the DICOM library which includes a Samples project. This has some good examples for doing some basic DICOM actions.

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

--
2009-09-05 12:26 PM  

As the focus for the SDK is on the ImageViewer - would you still say the library is suitable for only the DICOM file handling part? Is all I need to fetch and modify data from DICOM files isolated in the cc.Dicom.dll? 

I have checked out the repository, so I'll digg into the code and see if I can figure it out.

Thanks for your attention! 

Best regards,

Stian

jasper.yeh
Senior Member
Senior Member
Posts:521
Avatar

--
2009-09-09 10:47 AM  
Hi Stian,

Our DICOM library contains classes for reading, writing and parsing DICOM files and DICOM messages. In a sense, it is like System.IO combined System.Net in the context of DICOM. What it doesn't provide is code on how to interpret the DICOM data beyond IODs and attributes - which is to say that you can read/write (0028,0100) Bits Allocated at an unsigned short, and (7FE0,0010) Pixel Data as a byte array, but it doesn't know how to use Bits Allocated to extract single samples from the Pixel Data.

Now, even if you don't want to go so far in your own code as to write all the pixel interpretation code yourself for your view layer, you can look at the code in our CC.ImageViewer which is where we do our interpretation and rendering.

Just one final note (two actually). 1. You'll also need ClearCanvas.Common.dll, which contains a number of helper classes that everything else uses, including the basis for the plugin system. The plugin system may be of interest to you because: 2. the codecs for compressed transfer syntaxes are implemented as plugins: ClearCanvas.Dicom.Codec.Rle.dll, ClearCanvas.Dicom.Codec.Jpeg.dll.

Hope this helps!
// Jasper
stiank81
Advanced Member
Advanced Member
Posts:33

--
2009-09-09 03:28 PM  
Thanks for the feedback. Actually I haven't had the opportunity to do any further testing with your Toolkit as I got stuck with some other things. Will get back to it any time soon...

I'm new to DICOM, so I just learned that DICOM is both a file format and a communication protocol. This is correct, right? If I understood you correctly - mentioning "DICOM messages" - your toolkit supports the communication protocol too?

Actually I'm not sure what you mean by the description of what isn't supported in your library - probably due to my lack of DICOM experience.. Is this something that is likely to have any practical affection in a typical DICOM usage? I mean; the library supports modifying all essential parts of the header - cause that's what you mean by "attributes", right? And you are able to fetch all frames of the image data, and possibly remove some frames etc - is this what you mean by "IODs"? If this is fully supported; what more than images and attributes might be relevant?

Thanks for your help!
jasper.yeh
Senior Member
Senior Member
Posts:521
Avatar

--
2009-09-09 06:08 PM  

Hi Stian,

Yes, the toolkit library handles DICOM network communications too.

A short primer on DICOM messages:
A DICOM message (either in-memory like in network communications, or stored on a file system as a file) is really a collection of "attributes". Each "attribute" is essentially a pairing of a "tag" and a "value" - the tag describing the contents of the value in a standard way. Tags are 32-bit unsigned numbers, and they are usually represented in hexadecimal as something like (0010,002F). The standard prescribes, among other things, what kinds of tags can be used in what kinds of messages, what those values contain, what format the values are in, and so on. "IOD"s are the standardized "templates" of what tags may/must/cannot be used and how their contents relate to other tags. (Individual frames of an image are stored, concatenated, in a single pixel data sequence. Since the number of frames is stored separately in another attribute under another tag, you can compute the exact byte offset at which to find a given frame, and the frame length is precisely pixel data byte length divided by number of frames).

Now, the pixel data in any given DICOM message/file uses the tag Pixel Data (7FE0,0010), but its format is governed by other tags. For one thing, the pixel data may or may not be compressed - but the toolkit will handle this, provided you have the appropriate decompressor plugin. When uncompressed, all the pixel data is is simply a byte array - the format of which is determined by other attributes. This is where the toolkit stops handling things because what you do from here can be very implementation specific. Pixel data can be colour or greyscale, and, if greyscale, can additionally be palette-based, 8-bit, 9-bit (or up to 16-bit!)... And what often happens is that some devices have special more efficient ways of handling certain formats (for example, a pure grayscale display adapter may be able to show more than the 256 gray levels that a standard 32-bit ARGB colour display adapter can). A default handling of these display concepts is included in the CC.ImageViewer library, where we translate all the myriad of pixel data formats into a 32-bit ARGB bitmap and render it using GDI+.

What does this all mean for you? Well, it depends on how far you are willing to go in writing your own image handling code. Some people have special hardware of which they wish to take advantage, some have special software, and others will doubtless have their own reasons. But if you're just looking to create a simple, custom viewer (and perhaps especially if you're new to DICOM), all you would need to do is add a few more libraries or include code extracted from CC.ImageViewer to achieve this. There's some "glue" code you'll have to put in to make it work together, as the current ImageViewer assembly was written to favour a GUI (it is our intention to remedy this eventually, possibly by splitting the ImageViewer assembly into two). We've had other people on these forums make viewers using CC.Common+Dicom (our DICOM toolkit) in addition to some extra code from the ImageViewer to achieve a web viewer using Silverlight. You may find the tips on those forum threads very useful if you decide to go this route - just search for "web viewer", "simple viewer", "integrating viewer" using The Power of Google at the very top of this page.

Hope this helps!

// Jasper
stewart
Senior Member
Senior Member
Posts:2032

--
2009-09-13 11:31 PM  
Hi Stian, I just wanted to add that there are others on the forums who have successfully used the viewer directly when all they are looking to do is render an image to a bitmap and display it in a UI control (like the WPF Image control). Although the viewer is quite plugin-heavy at the moment, and it's intended use is as a GUI component, it can also be used as a library. Before reinventing the wheel, I suggest that you at least try using the viewer. Search the forums for the keyword "DrawToBitmap" and you'll get an example of how to load a DICOM image and draw it to a bitmap, which you could then show directly in your Image control.

Also, with regards to storing annotations, they can't be stored in the image header, but rather as part of a separate DICOM object called a presentation state. There is support for creating these in the ImageViewer project also. The code can be found in ImageViewer.PresentationStates and is used in Reporting.KeyImages if you want to see an example of how to use it.

Hope this helps,
Stewart
Real-time support available to Clinical Edition and Team Edition customers
noemata
New Member
New Member
Posts:2

--
2009-09-16 05:02 PM  

Have you made any further progress with your WPF viewer?

I'm embarking on a similar task.

stiank81
Advanced Member
Advanced Member
Posts:33

--
2009-10-29 06:10 AM  
Hi guys,
Thanks for your further feedback on this, and I'm sorry that I haven't replied before. I have been busy with other things and it seems like I haven't got mail notifications about new posts.

We're starting today digging into the Dicom part, attempting to use ClearCanvas to help us on our way. Will get back to you with an update on my success or further questions soon..

Thanks for all good help this far..!
You are not authorized to post a reply.

Active Forums 4.1
Copyright 2011 ClearCanvas Inc.