This is a very narrow and specific question, but I know there are someone else out there using this, so I'll keep my fingers crossed and hope anyone of you pics this question up.
I'm working on a WPF application where one part of it is a Dicom viewer. We'd like to use a 3rd party component to handle the Dicom stuff, and ClearCanvas is the one we've got the best impression of this far. We're able to load a Dicom file and fetch the attributes, but we're having problems putting the image data on the Source property of an Image control to show it. Anyone with hints on how to make this happen?
Here's the code I use for extracting the image data:
var file = new DicomFile(dicomFilePath);
var patientName = file.DataSet.GetAttribute(DicomTags.PatientsName);
var imageData = file.DataSet.GetAttribute(DicomTags.PixelData);
Have also tried using the ImageViewer library, but it is still the same data..
var localSopDataSource = new LocalSopDataSource(new DicomFile(dicomFilePath));
var patientName = localSopDataSource.File.DataSet.GetAttribute(DicomTags.PatientsName);
var imageData = localSopDataSource.File.DataSet.GetAttribute(DicomTags.PixelData);
Also check Steve, as he works in ClearCanvas. I’ve seen his response (and confirmation about this) in this StackOverflow question.
Okay, I figured it out.. There might be some more ways of achieving this, but this is what I did. Now I have a Wpf Image bound to a property which provides the bitmap data. The following is the property used to provide the Bitmap data.
Note that this is a very straight forward solution. One might e.g. want to do stuff like preloading the pictures etc to avoid heavy load when scrolling multiframe images. But for the "howto display the image" question - this should answer it..
Ok, I've managed to show a DICOM image in a Picturebox using this code:
Here are the assemblies I used:
I also had to copy these dll into bin/debug:
BilinearInterpolation.dll (this one I could'nt reference it as assemblie so I just copied it into the bin/degug folder)
WindowsBase.dll (This one I was able to reference it as an assemblie)
Code (There's a button in my project that lets you select the dcm file and then show it in a picturebox)