主要代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Leadtools;
using Leadtools.MedicalViewer;
using Leadtools.Codecs;
using Leadtools.Dicom;
namespace ViewerControl
{
public partial class Viewer:UserControl
{
MedicalViewer _viewer = new MedicalViewer(2,2);
public Viewer()
{
InitializeComponent();
DicomEngine.Startup();
_viewer.Dock = DockStyle.Fill;
this.Controls.Add(_viewer);
using (RasterCodecs codecs = new RasterCodecs())
{
using(DicomDataSet ds = new DicomDataSet())
{
ds.Load(@"E:\ExportedImages\2\8600033_000002_02_01.dcm",DicomDataSetLoadFlags.None);
DicomElement element = ds.FindFirstElement(null, DicomTag.PixelData, true);
if (element != null)
{
//这句话报错
RasterImage image = ds.GetImage(element, 0, 0, RasterByteOrder.Gray,
DicomGetImageFlags.AutoApplyModalityLut | DicomGetImageFlags.AutoApplyVoiLut);
//end
_viewer.Cells.Add(new MedicalViewerCell(image));
}
}
}
}
}
}
|
|