About Displaying a DICOM image in C# -
i'm trying display dicom image in c#. steve, i've been able read in dicom file. however, want display dicom image, have code seem attempt display image, has single error. code posted below. error being displayed follows.
error 1
the name 'image1' not exist in current context c:\users\don jar\documents\visual studio 2010\projects\dicomca\dicomca\form1.cs 52 13 dicomca
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); image1.source = bitmapsource;
it seems image1 not defined anywhere in source compiler can't make sense of image1.source = bitmapsource;.
Comments
Post a Comment