Showing posts with label DICOM. Show all posts
Showing posts with label DICOM. Show all posts

Thursday, May 22, 2014

BioSuite and DICOM

A few years ago Dr. Julian Uzan together with Professor Alan Nahum developed a comprehensive research tool for radiobiological evaluation and optimization, called BioSuite. The tool has continuously evolved and has been made available at no extra cost for the participants of the Clatterbridge Radiobiological Modeling course that is being held (more or less) annually.

BioSuite uses input from treatment planning systems in the form of differential dose-volume histograms (DVHs). More specifically, the tool supports DVHs exported from Philips Pinnacle³ and Varian Eclipse. One format BioSuite does not support though, is DICOM!

To overcome this limitation, I have developed a simple preprocessing tool called the BioSuite Exporter. This tool allows the user to import DICOM RT Plans, RT Structure Sets and RT Doses,


and based on this data the tool computes the resulting dose volume-histograms associated with each RT Plan for the regions of interest in the RT Structure Set. The user can view the dose-volume histograms and select a subset of the DVHs for export.


Upon export, BioSuite Exporter writes absolute volume, differential dose-volume histograms for each of the selected regions-of-interest in a comma-separated value (CSV) format that can be imported by BioSuite.

For BioSuite users and others interested in obtaining a free copy of this tool, please contact me at biosuite@cureos.com.

Sunday, October 30, 2011

Silverlight mdcm merged into Colby Dillion's main fork!


Yesterday, I was excited to see that my Silverlight and WPF fork of mdcm was merged, in its entirety, into Colby Dillion's main mdcm fork.

Since my efforts have now become more "official", I think it could be worth recalling some of the specific issues that are currently applicable in particular to the Silverlight library of mdcm:

  • The Silverlight class library is currently using Silverlight version 5 Release Candidate. It should be fairly straightforward to revert to Silverlight 4, but there may be some incompatibilities especially with respect to network access.
  • I have tried to implement managed support for JPEG codecs in the Silverlight project, but I have so far stumbled on 12 (and 16) bit support. The available open source JPEG codec libraries (FluxJpeg.Core and LibJpeg.Net) only support 8 bit images, and I have not yet been able to extend either of the libraries to 12 bit support. Furthermore, these libraries only support lossy compression.
  • Silverlight 5 will open up new possibilities for the mdcm Silverlight library, since P/Invoke is now supported when running in so called "elevated trust" mode. In particular, it should be possible to implement network server and full image codec support through calls to native libraries. So far, I have not implemented any of these ideas.
  • I have not made any extensive efforts with the MonoTouch project yet; in particular, no image support is implemented. Basic functionality is there though, DICOM file parsing and network client for example works out-of-the-box.



Monday, September 5, 2011

DICOM on the phone!

I received an e-mail the other day from Pantelis Georgiadis. He wrote that he had forked my mdcm fork and that he is now developing a Windows Phone 7.1 ("Mango") class library based on my Silverlight mdcm efforts.

It is really great to see that Colby Dillion's, and more recently my, work on this C# DICOM library is now proliferating into the phone. It will be very interesting to follow Pantelis's work and see what kind of applications will come out of his efforts.

Thursday, August 18, 2011

Finally! WPF support in mdcm!

As I have mentioned in several recent blog posts, I have forked Colby Dillion's excellent C# DICOM class library mdcm and implemented a Silverlight DICOM class library largely based on the original mdcm code.

When dealing with Silverlight imaging support, it was apparent that it would be very easy to also make a WPF port of the mdcm class library.

Well, consider it done!

As of today, I have uploaded an update of mdcm to the Github repository, containing a complete .NET 4 class library Wpf.Dicom where DICOM images are rendered using WPF rather than Windows Forms.

Apart from imaging, the Wpf.Dicom project provides the same functionality as the original Dicom and Dicom.Linq projects combined. There are parts of the implemented imaging code for WPF that still remains untested, more specifically image rotation and flipping as well as multilayered images. I plan to test this specific functionality as soon as possible to verify that the WPF implementation is indeed fully functional.

The Dicom.Codec and Dicom.Codec64 projects have previously referenced the original Dicom project. To enable full codec support in WPF, I have updated the codec projects to instead reference Wpf.Dicom, and at the same time I have excluded the Windows Forms-based project Dicom and associated applications from the Visual Studio solution. This is of course an easy thing to change back, if anyone so wishes.

Please feel free to download and use the source code from Github. Comments and improvement suggestions are more than welcome. Do not hesitate to report issues under the Issues tab in the Github repository.

Wednesday, April 13, 2011

Networking with Silverlight mdcm

As recently announced, I am adapting the C# DICOM library mdcm to Silverlight. Due to the compactness and security limitations of Silverlight, I have had to make several workarounds. However, I have now reached a stage where a large degree of the original library's functionality is in place. The only large part missing now is codec handling, which is highly dependent upon native support libraries in the original mdcm library.

Most recently, I have included network support in the Silverlight library. The client functionality is definitely in place; with the latest commit in the Github repository there is a working example of a storage SCU (service class user).

There are a few restrictions: Silverlight only supports the TCP protocol; there is currently no support for TLS or SSL. The only available port range is 4502-4534, and the port access has to be granted through a separate policy access server. As far as I have been able to find out, the server that the Silverlight client application is communicating with also has to be located on the same system. The supported DNS name of the computer should be obtained as follows:

string DnsHostName = Application.Current.Host.Source.DnsSafeHost;

(I should state that I have not yet learned all the windings of the Silverlight network support, so there may be more flexibility to this than I yet know.)

To test the functionality, I created a new Silverlight hosting web application in my mdcm fork at Github, denoted SL.DicomToXml.Web. When running this web application via Visual Studio, it is possible to open DICOM files on the regular file system. The DICOM file dump is displayed on screen, together with the contained image if any.

In the background, the application is also trying to send the DICOM object to a storage SCP server on port 4502. For this to work, a storage SCP application has to be running on the same computer (I used the storescp application from the OFFIS DCMTK library).

Furthermore, an access policy server has to be running, granting the Silverlight application access to ports 4502 through 4534. Based on code that I obtained from Stackoverflow user luke here, I also included a very simple policy server application, SilverlightPolicyServer, in the mdcm tree. Before any DICOM object sending can take place, the policy server must also be running; double-click the executable or start it from the command prompt.

Getting this to work in Silverlight was a little bit of a challenge. In particular, the Socket class in Silverlight is extremely stripped compared to its vanilla .NET counterpart. The regular mdcm library also makes extensive use of the NetworkStream class for sending and receiving network data. NetworkStream is not included at all in the core Silverlight library. Fortunately Alexander Wieser has developed a replacement in his Crystalbyte Networking project at Codeplex, and this support class was easily included in the Silverlight mdcm library.

While discussing the workarounds I have had to take in the Silverlight mdcm library, I should also mention that file access has been limited to the isolated storage assigned per user and application. This means that DICOM file access is limited to this isolated storage, and it is only practically available when running the Silverlight application. To access files on the regular file system, the most efficient solution is probably to open the file stream directly through an open-file dialog, pretty much like it is done in the demo application.

Wednesday, April 6, 2011

DICOM and WPF

I have recently taken up the effort of adapting the C# DICOM class library mdcm to Silverlight, as can be seen on the forked project website at Github.

Initially, I excluded all imaging, codec, HL7 and network functionality in order to make the library build at all in Silverlight.

Just now I have begun looking at porting the mdcm image handling to Silverlight. The mdcm library uses the .NET System.Drawing library for image handling, which is not available in Silverlight. However, I have modified the source code so that when it compiles for Silverlight, it instead uses the BitmapSource and WriteableBitmap classes from the System.Windows.Media.Imaging namespace.

The added benefit of these modifications are that they are equally applicable to WPF, i.e. it would be a simple task to switch from Windows Forms (which the original mdcm library depends upon) to WPF, given these Silverlight motivated modifications.

I have not explicitly made any WPF adaptation yet, but this is clearly worth future exploration.

UPDATE AUG 21: WPF support is now implemented! Please have a look in the Github repository and this blog post.

Wednesday, March 30, 2011

DICOM and Silverlight

Since I would like to provide DICOM functionality in a Silverlight environment, I have examined whether there are any obvious libraries or tools available that would facilitate. Leadtools provide a DICOM Silverlight software development kit as a component in some of their commercial products, but so far I have not been able to identify any open source DICOM toolkit for Silverlight.

I have been using Colby Dillion's C# DICOM library mdcm for a while. This library provides all the DICOM functionality I have had the need for, but it has only been available for desktop applications until now.

However, I have started exploring whether the mdcm library can be sufficiently migrated to Silverlight. My continuous efforts can be followed here. At this stage I have made all shortcuts necessary to make the Silverlight class library build at all, and I have only included the most central parts of the original library. In due time I will fine tune the shortcuts to mimic the original library as much as possible, and I will try to add as many missing parts as I can.

It will be exciting to see if this effort can eventually result in a true open source alternative for DICOM functionality in Silverlight!