c# - Error displaying DICOM image with ClearCanvas -


i have been working in displaying dicom image in c# clearcanvas, developer steve aided me in reading in tags image. however, have been stuck 2 weeks working on project of , on trying display image. have tried , added code steve helped , yet unable display dicom image. maybe i'm doing incorrect, can take @ code , tell me wrong or alternative way display it. have been trying project work in c# being able convert visual basic. obtaining same error on again. code posted below.

enter         string filename = @"c:\users\don jar\pictures\xray pics\fluro.dcm";         dicomfile dicomfile = new dicomfile(filename);         dicomfile.load(dicomreadoptions.default);         foreach (dicomattribute attribute in dicomfile.dataset)         {             console.writeline("tag: {0}, value: {1}", attribute.tag.name, attribute.tostring());         }          int bitsperpixel = dicomfile.dataset.getattribute(dicomtags.bitsstored).getint32(0, 0);         int width = dicomfile.dataset.getattribute(dicomtags.columns).getint32(0, 0);         int height = dicomfile.dataset.getattribute(dicomtags.rows).getint32(0, 0);         int stride = width * 2;         byte[] bitmapbuffer = (byte[])dicomfile.dataset.getattribute(dicomtags.pixeldata).values;           bitmapsource bitmapsource = bitmapimage.create(width, height, 96, 96, system.windows.media.pixelformats.gray16, null, bitmapbuffer, stride);          picturebox1.image = bitmapsource; code here 

the error being displayed on last line picturebox1.image = bitmapsource; , the error is

error 1 'system.windows.forms.picturebox' not contain definition 'source' , no extension method 'source' accepting first argument of type 'system.windows.forms.picturebox' found (are missing using directive or assembly reference?) c:\users\don jar\documents\visual studio 2010\projects\dicomca\dicomca\form1.c

the second error error 2 cannot implicitly convert type 'system.windows.media.imaging.bitmapsource' 'system.drawing.image' c:\users\don jar\documents\visual studio 2010\projects\dicomca\dicomca\form1.cs 62 33 dicomca

bitmapsource is, error says, system.windows.media.imaging.bitmapsource image, i.e. it's wpf image.
picturebox1 object system.windows.forms.picturebox object.
2 things incompatible, cannot display wpf image in windows forms picturebox.

you'll need convert bitmapsource regular system.drawing.bitmap in order display, luckily there multiple ways this, although best option kind of depends on pixel format of image.
how convert bitmapsource bitmap
is there way convert between bitmapsource , bitmap?

the answer on second link faster way though.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -