使用LEADTOOLS 创建简单的DICOM扩展读取/写入数据集标签

发布时间:2017/03/24 00:03 发布者:Richard.Ma

返回博客中心

 

以下教程介绍如何使用DICOM数据集get / set扩展来轻松地从一个数据集中提取数据并将其插入另一个数据集。 课程展示如何自定义要从数据集中提取或写入哪些标签。

Download a sample DICOM DE template here! (使用前解压下载的文件.)

以下步骤将创建一个可以填充DICOM DE模板数据集的项目。

 

1.打开Visual Studio .NET

 

2.选择File->New->Project from the menu.

 

3.在New Project 对话框中, 选择"Visual C# Projects" 类型, 然后选择"Windows Forms Application" 模板.

 

4.键入项目名称为DicomExtensionsProject Name 字段, 点击 OK. 如果需要,键入项目的新位置或使用浏览按钮选择目录,然后单击 OK.

   注意: 确保项目的目标是完整的.NET Framework,而不仅仅是一个客户端配置文件。

 

5.在 解决方案浏览器 窗口 右击 引用 菜单, 选择添加引用... .在新对话框中, 选择浏览器标签然后选择 LEADTOOLS dll文件夹C:\LEADTOOLS 19\Bin\DotNet4\Win32,选择如下的 DLLS:

Leadtools.dll
Leadtools.Codecs
Leadtools.Dicom.dll
Leadtools.Dicom.Common.dll
Leadtools.Dicom.Tables.dll
Leadtools.WinForms.CommonDialogs.File.dll

单击确定按钮将上述DLL添加到应用程序。

 

6.确保Form1处于设计视图。 转到工具箱(View-> Toolbox),然后将三个TextBox控件拖到窗体上。 设置如下:

image

 

7.现在添加三个Label控件来搭配文本框。 设置如下:

image

 

8.现在添加三个Button控件来选择文件名来填充文本框。 设置如下:  

image

 

9.添加一个用于创建DICOM DE文件的按钮。 设置如下:

image

 

10.打开Form1.cs 文件并添加以下using语句:

C#

using Leadtools;
using Leadtools.Codecs;
using Leadtools.Dicom; 
using Leadtools.Dicom.Common; 
using Leadtools.Dicom.Common.DataTypes; 
using Leadtools.Dicom.Common.Extensions;
using Leadtools.WinForms.CommonDialogs.File;

 

11.声明如下私有变量到 Form1 class:

C#

private string DEVELOPER_LICENSE_FILE = @"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC";
private string DEVELOPER_KEY = System.IO.File.ReadAllText(@"C:\LEADTOOLS 19\Common\License\LEADTOOLS.LIC.KEY");
private RasterCodecs codecs;
private RasterOpenDialog openDlg;
private RasterSaveDialog saveDlg;

 

12.在 Form() 构造函数中, 粘贴如下代码:

C#

this.butSetSrcFile.Click += new System.EventHandler(this.butSelectFile_Click);
this.butSetTargetFile.Click += new System.EventHandler(this.butSelectFile_Click);
this.butTemplateFile.Click += new System.EventHandler(this.butSelectFile_Click);
this.butCreateFile.Click += new System.EventHandler(this.butCreateFile_Click);

try
{
   RasterSupport.SetLicense(DEVELOPER_LICENSE_FILE, DEVELOPER_KEY);
}
catch
{
   goto LicenseError;
}

if (RasterSupport.KernelExpired ||   RasterSupport.IsLocked(RasterSupportType.Medical))
   goto LicenseError;

SetupFileDialogs();

return;

LicenseError:
MessageBox.Show("There are insufficient permissions to run this application. Your license is either missing, expired or does not unlock support for the features that follow. Please check your license file.", "LEADTOOLS license not set", MessageBoxButtons.OK, MessageBoxIcon.Information);

System.Environment.Exit(1);

 

13.添加一个初始化文件对话框的方法,如下所示:

C#

private void SetupFileDialogs()
{
   codecs = new RasterCodecs();
   openDlg = new RasterOpenDialog(codecs);

   openDlg.Filter = new RasterOpenDialogLoadFormat[]
      {
          new RasterOpenDialogLoadFormat ( "All Files", "*.*" ),
          new RasterOpenDialogLoadFormat ( "DICOM", "*.dcm;*.dic" )
      };

   openDlg.CheckFileExists = true;
   openDlg.CheckPathExists = true;
   openDlg.DefaultExt = "dcm";
   openDlg.DereferenceLinks = true;
   openDlg.EnableSizing = true;
   openDlg.FileName = "";
   openDlg.FilterIndex = 2;
   openDlg.GenerateThumbnail = false;
   openDlg.InitialDirectory = @"C:\Users\Public\Documents\LEADTOOLS Images";
   openDlg.InitialView = FileDialogInitialView.List;
   openDlg.LoadCompressed = false;
   openDlg.LoadFileImage = false;
   openDlg.LoadOptions = false;
   openDlg.LoadRotated = false;
   openDlg.Multiselect = false;
   openDlg.PreviewWindowVisible = false;
   openDlg.ShowDeletePage = false;
   openDlg.ShowFileInformation = true;
   openDlg.ShowGeneralOptions = true;
   openDlg.ShowHelp = false;
   openDlg.ShowLoadCompressed = false;
   openDlg.ShowLoadOptions = false;
   openDlg.ShowLoadRotated = false;
   openDlg.ShowMultipage = false;
   openDlg.ShowPdfOptions = false;
   openDlg.ShowXpsOptions = false;
   openDlg.ShowPreview = false;
   openDlg.ShowProgressive = false;
   openDlg.ShowRasterOptions = false;
   openDlg.ShowTotalPages = true;
   openDlg.Title = "Open DataSet Dialog";
   openDlg.UseFileStamptoPreview = false;


   //Save dialog
   saveDlg = new RasterSaveDialog(codecs);

   RasterSaveDialogFileFormatsList saveDlgFormatList = new RasterSaveDialogFileFormatsList(RasterDialogFileFormatDataContent.User);

   // Adding DicomColor format 
   saveDlgFormatList.Add(RasterDialogFileTypesIndex.DicomColor, RasterDialogBitsPerPixelDataContent.Default);
   saveDlgFormatList[0].Name = "DicomColor";

   // Adding DicomGray format 
   saveDlgFormatList.Add(RasterDialogFileTypesIndex.DicomGray, RasterDialogBitsPerPixelDataContent.Default);
   saveDlgFormatList[1].Name = "DicomGray";

   saveDlg.AutoProcess = false;
   saveDlg.DefaultExt = "dcm";
   saveDlg.EnableSizing = true;
   saveDlg.FileFormatsList = saveDlgFormatList;
   saveDlg.FileTypeIndex = RasterDialogFileTypesIndex.DicomGray;
   saveDlg.InitialDirectory = @"C:\Users\Public\Documents\LEADTOOLS Images";
   saveDlg.InitialView = FileDialogInitialView.List;
   saveDlg.PromptOverwrite = true;
   saveDlg.QualityFactor = 2;
   saveDlg.Title = "Save Dialog";
   saveDlg.WithStamp = false;

   // Replace "Cancel" string with "Cancel Save" 
   RasterSaveDialog.SetDialogString(new RasterDialogStrings("Cancel Save", RasterDialogStringsId.SaveCancel));
}

 

14.添加一个按钮处理程序,使用文件对话框选择文件,并编写代码如下:

C#

private void butSelectFile_Click(object sender, EventArgs e)
{
   switch(((Button)sender).Name)
   {
      case "butSetSrcFile":
         if(openDlg.ShowDialog(this) == DialogResult.OK)
            txtSrcFile.Text = openDlg.FileName;
         break;
      case "butTemplateFile":
         if (openDlg.ShowDialog(this) == DialogResult.OK)
            txtTemplateFile.Text = openDlg.FileName;
         break;
      case "butSetTargetFile":
         if (saveDlg.ShowDialog(this) == DialogResult.OK)
            txtTargetFile.Text = saveDlg.FileName;
         break;
      default:
         break;
   }
}

 

15.添加一个用于创建DICOM DE文件的按钮处理程序,并编写代码如下:

C#

private void butCreateFile_Click(object sender, EventArgs e)
{
   DicomEngine.Startup();

   DicomDataSet srcDS = new DicomDataSet(),
                tmpDS = new DicomDataSet();
   srcDS.Load(txtSrcFile.Text, DicomDataSetLoadFlags.LoadAndClose);
   tmpDS.Load(txtTemplateFile.Text, DicomDataSetLoadFlags.LoadAndClose);

   try
   {
      GenerateDicomDEFile(srcDS, tmpDS, txtTargetFile.Text);
      MessageBox.Show("Dicom file created:\n" + txtTargetFile.Text, "Success", MessageBoxButtons.OK, MessageBoxIcon.None);
   }
   catch (Exception ex)
   {
      MessageBox.Show("The following exception occurred in generating the DICOM DE file:\n" + ex.Message, "Error creating file",
                      MessageBoxButtons.OK, MessageBoxIcon.Error);
   }
}

 

16.添加一个worker方法来生成DICOM DE文件,并按如下所示进行编码:

C#

private void GenerateDicomDEFile(DicomDataSet srcDataSet, DicomDataSet targetDataSet, string outputFileName)
{
   //Get the information from the source file and move it to its destination
   try
   {
      PatientBase patientBase = srcDataSet.Get<PatientBase>();
      patientBase.PatientName = new PersonName("Smith^John");
      patientBase.PatientID = "1234567890";
      targetDataSet.Set(patientBase);

      PatientModule patientModule = srcDataSet.Get<PatientModule>();
      patientModule.OtherPatientNames = new List<string>() { "Doe^John", "Doe^Jon" };
      targetDataSet.Set(patientModule);

      GeneralStudyBase gsBase = srcDataSet.Get<GeneralStudyBase>();
      targetDataSet.Set(gsBase);

      GeneralStudyModule gsModule = srcDataSet.Get<GeneralStudyModule>();
      targetDataSet.Set(gsModule);

      GeneralEquipmentModule geModule = srcDataSet.Get<GeneralEquipmentModule>();
      targetDataSet.Set(geModule);

      Group14ElementsBase g14EBase = srcDataSet.Get<Group14ElementsBase>();
      targetDataSet.Set(g14EBase);
   }
   catch (Exception ex)
   {
      throw new Exception("Exception moving DICOM information", ex);
   }

   //Write the new output file
   try
   {
      targetDataSet.Save(outputFileName, DicomDataSetSaveFlags.LittleEndian |   DicomDataSetSaveFlags.ExplicitVR);
   }
   catch (Exception ex)
   {
      throw new Exception("Exception saving resulting DICOM file", ex);
   }
}

 

17.添加一个类以指定从源程序复制到目标文件的General Study Module标签,并按如下所示进行编码:

C#

public class GeneralStudyBase
{
   private DateTime? _studyDate;
   [Element(DicomTag.StudyDate)]
   public DateTime? StudyDate
   {
      get { return _studyDate; }
set { _studyDate = value; }
   }

   private DicomTimeValue _studyTime;
   [Element(DicomTag.StudyTime)]
   public DicomTimeValue StudyTime
   {
      get { return _studyTime; }
      set { _studyTime = value; }
   }

   private string _accessionNumber;
[Element(DicomTag.AccessionNumber)]
   public string AccessionNumber
   {
      get { return _accessionNumber; }
set { _accessionNumber = value; }
   }

   private string _referringPhysicianName;
   [Element(DicomTag.ReferringPhysicianName)]
   public string ReferringPhysicianName
   {
      get { return _referringPhysicianName; }
set { _referringPhysicianName = value; }
   }

   private string _studyDescription;
   [Element(DicomTag.StudyDescription)]
   public string StudyDescription
   {
      get { return _studyDescription; }
      set { _studyDescription = value; }
   }

   private List<string> _physicicanOfRecord;
   [Element(DicomTag.PhysicianOfRecord)]
   public List<string> PhysicianOfRecord
   {
      get { return _physicicanOfRecord; }
      set { _physicicanOfRecord = value; }
   }

   private List<string> _nameOfPhysicianReadingStudy;
   [Element(DicomTag.NameOfPhysicianReadingStudy)]
   public List<string> NameOfPhysicianReadingStudy
   {
      get { return _nameOfPhysicianReadingStudy; }
      set { _nameOfPhysicianReadingStudy = value; }
   }

   private string _studyInstanceUID;
   [Element(DicomTag.StudyInstanceUID)]
   public string StudyInstanceUID
   {
      get { return _studyInstanceUID; }
      set { _studyInstanceUID = value; }
   }

   private string _studyID;
   [Element(DicomTag.StudyID)]
   public string StudyID
   {
      get { return _studyID; }
      set { _studyID = value; }
   }
}

 

18.添加一个类以指定要从源DICOM文件复制到目标文件的组14标签,并按如下所示进行编码:

C#

public class Group14ElementsBase
{
   private string _componentManufacturingProcedure;
   [Element(DicomTag.ComponentManufacturingProcedure)]
   public string ComponentManufacturingProcedure
   {
      get { return _componentManufacturingProcedure; }
set { _componentManufacturingProcedure = value; }
   }

   private string _componentManufacturer;
   [Element(DicomTag.ComponentManufacturer)]
   public string ComponentManufacturer
   {
      get { return _componentManufacturer; }
      set { _componentManufacturer = value; }
   }

   private string _materialGrade;
   [Element(DicomTag.MaterialGrade)]
   public string MaterialGrade
   {
      get { return _materialGrade; }
      set { _materialGrade = value; }
   }

   private string _materialNotes;
   [Element(DicomTag.MaterialNotes)]
   public string MaterialNotes
   {
      get { return _materialNotes; }
      set { _materialNotes = value; }
   }

   private DateTime? _expiryDate;
   [Element(DicomTag.ExpiryDate)]
   public DateTime? ExpiryDate
   {
      get { return _expiryDate; }
      set { _expiryDate = value; }
   }

   private List<Evaluator> _evaluatorSequence;
   [Element(DicomTag.EvaluatorSequence)]
   public List<Evaluator> EvaluatorSequence
   {
      get { return _evaluatorSequence; }
      set { _evaluatorSequence = value; }
   }

   private string _coordinateSystemNumberOfAxes;
   [Element(DicomTag.CoordinateSystemNumberOfAxes)]
   public string CoordinateSystemNumberOfAxes
   {
      get { return _coordinateSystemNumberOfAxes; }
      set { _coordinateSystemNumberOfAxes = value; }
   }

   private List<CoordinateSystemAxes> _coordinateSystemAxesSequence;
   [Element(DicomTag.CoordinateSystemAxesSequence)]
   public List<CoordinateSystemAxes> CoordinateSystemAxesSequence
   {
      get { return _coordinateSystemAxesSequence; }
      set { _coordinateSystemAxesSequence = value; }
   }

   private string _internalDetectorFrameTime;
   [Element(DicomTag.InternalDetectorFrameTime)]
   public string InternalDetectorFrameTime
   {
      get { return _internalDetectorFrameTime; }
      set { _internalDetectorFrameTime = value; }
   }

   private string _numberOfFramesIntegrated;
   [Element(DicomTag.NumberOfFramesIntegrated)]
   public string NumberOfFramesIntegrated
   {
      get { return _numberOfFramesIntegrated; }
      set { _numberOfFramesIntegrated = value; }
   }

   private List<DetectorTemporature> _detectorTemperatureSequence;
   [Element(DicomTag.DetectorTemperatureSequence)]
   public List<DetectorTemporature> DetectorTemperatureSequence
   {
      get { return _detectorTemperatureSequence; }
      set { _detectorTemperatureSequence = value; }
   }

   private List<DarkCurrentSequence> _darkCurrentSequence;
   [Element(DicomTag.DarkCurrentSequence)]
   public List<DarkCurrentSequence> DarkCurrentSequence
   {
      get { return _darkCurrentSequence; }
      set { _darkCurrentSequence = value; }
   }

   private List<GainCorrectionReference> _gainCorrectionReferenceSequence;
   [Element(DicomTag.GainCorrectionReferenceSequence)]
   public List<GainCorrectionReference> GainCorrectionReferenceSequence
   {
      get { return _gainCorrectionReferenceSequence; }
      set { _gainCorrectionReferenceSequence = value; }
   }

   private string _badPixelImage;
   [Element(DicomTag.BadPixelImage)]
   public string BadPixelImage
   {
      get { return _badPixelImage; }
      set { _badPixelImage = value; }
   }

   private string _calibrationNotes;
   [Element(DicomTag.CalibrationNotes)]
   public string CalibrationNotes
   {
      get { return _calibrationNotes; }
      set { _calibrationNotes = value; }
   }

   private string _imageQualityIndicatorType;
   [Element(DicomTag.ImageQualityIndicatorType)]
   public string ImageQualityIndicatorType
   {
      get { return _imageQualityIndicatorType; }
      set { _imageQualityIndicatorType = value; }
   }

   private string _imageQualityIndicatorMaterial;
   [Element(DicomTag.ImageQualityIndicatorMaterial)]
   public string ImageQualityIndicatorMaterial
   {
      get { return _imageQualityIndicatorMaterial; }
      set { _imageQualityIndicatorMaterial = value; }
   }

   private string _imageQualityIndicatorSize;
   [Element(DicomTag.ImageQualityIndicatorSize)]
   public string ImageQualityIndicatorSize
   {
      get { return _imageQualityIndicatorSize; }
      set { _imageQualityIndicatorSize = value; }
   }
}

 

19.添加辅助类以指定要在序列中复制的标记,并按如下所示进行编码:

C#

public class Evaluator
{
   private string _evaluatorNumber;
   [Element(DicomTag.EvaluatorNumber)]
   public string EvaluatorNumber
   {
      get { return _evaluatorNumber; }
set { _evaluatorNumber = value; }
   }

   private string _evaluationAttempt;
[Element(DicomTag.EvaluationAttempt)]
   public string EvaluationAttempt
   {
      get { return _evaluationAttempt; }
set { _evaluationAttempt = value; }
   }

   private EvaluatorIndicationSequence _indicationSequence;
   [Element(DicomTag.IndicationSequence)]
   public EvaluatorIndicationSequence IndicationSequence
   {
      get { return _indicationSequence; }
      set { _indicationSequence = value; }
   }

}

public class EvaluatorIndicationSequence
{
   private string _sopClassUID;
   [Element(DicomTag.SOPClassUID)]
   public string SOPClassUID
   {
      get { return _sopClassUID; }
      set { _sopClassUID = value; }
   }

   private string _indicationNumber;
   [Element(DicomTag.IndicationNumber)]
   public string IndicationNumber
   {
      get { return _indicationNumber; }
      set { _indicationNumber = value; }
   }

   private string _indicationDescription;
   [Element(DicomTag.IndicationDescription)]
   public string IndicationDescription
   {
      get { return _indicationDescription; }
      set { _indicationDescription = value; }
   }

   private string _indicationType;
   [Element(DicomTag.IndicationType)]
   public string IndicationType
   {
      get { return _indicationType; }
      set { _indicationType = value; }
   }

   private string _indicationDisposition;
   [Element(DicomTag.IndicationDisposition)]
   public string IndicationDisposition
   {
      get { return _indicationDisposition; }
      set { _indicationDisposition = value; }
   }
}

public class CoordinateSystemAxes
{
   private string _coordinateSystemAxisDescription;
   [Element(DicomTag.CoordinateSystemAxisDescription)]
   public string CoordinateSystemAxisDescription
   {
      get { return _coordinateSystemAxisDescription; }
      set { _coordinateSystemAxisDescription = value; }
   }

   private string _coordinateSystemDataSetMapping;
   [Element(DicomTag.CoordinateSystemDataSetMapping)]
   public string CoordinateSystemDataSetMapping
   {
      get { return _coordinateSystemDataSetMapping; }
      set { _coordinateSystemDataSetMapping = value; }
   }

   private int _coordinateSystemAxisNumber;
   [Element(DicomTag.CoordinateSystemAxisNumber)]
   public int CoordinateSystemAxisNumber
   {
      get { return _coordinateSystemAxisNumber; }
      set { _coordinateSystemAxisNumber = value; }
   }

   private string _coordinateSystemAxisType;
   [Element(DicomTag.CoordinateSystemAxisType)]
   public string CoordinateSystemAxisType
   {
      get { return _coordinateSystemAxisType; }
      set { _coordinateSystemAxisType = value; }
   }


   private string _coordinateSystemAxisUnits;
   [Element(DicomTag.CoordinateSystemAxisUnits)]
   public string CoordinateSystemAxisUnits
   {
      get { return _coordinateSystemAxisUnits; }
      set { _coordinateSystemAxisUnits = value; }
   }

   private string _coordinateSystemAxisValues;
   [Element(DicomTag.CoordinateSystemAxisValues)]
   public string CoordinateSystemAxisValues
   {
      get { return _coordinateSystemAxisValues; }
      set { _coordinateSystemAxisValues = value; }
   }
}

public class DetectorTemporature
{
   private string _sensorName;
   [Element(DicomTag.SensorName)]
   public string SensorName
   {
      get { return _sensorName; }
      set { _sensorName = value; }
   }

   private string _horizontalOffsetOfSensor;
   [Element(DicomTag.HorizontalOffsetOfSensor)]
   public string HorizontalOffsetOfSensor
   {
      get { return _horizontalOffsetOfSensor; }
      set { _horizontalOffsetOfSensor = value; }
   }

   private string _verticalOffsetOfSensor;
   [Element(DicomTag.VerticalOffsetOfSensor)]
   public string VerticalOffsetOfSensor
   {
      get { return _verticalOffsetOfSensor; }
      set { _verticalOffsetOfSensor = value; }
   }

   private string _sensorTemperature;
   [Element(DicomTag.SensorTemperature)]
   public string SensorTemperature
   {
      get { return _sensorTemperature; }
      set { _sensorTemperature = value; }
   }
}

public class DarkCurrentSequence
{
   private int _photometricInterpretation;
   [Element(DicomTag.PhotometricInterpretation)]
   public int PhotometricInterpretation
   {
      get { return _photometricInterpretation; }
      set { _photometricInterpretation = value; }
   }

   private int _bitsAllocated;
   [Element(DicomTag.BitsAllocated)]
   public int BitsAllocated
   {
      get { return _bitsAllocated; }
      set { _bitsAllocated = value; }
   }

   private int _bitsStored;
   [Element(DicomTag.BitsStored)]
   public int BitsStored
   {
      get { return _bitsStored; }
      set { _bitsStored = value; }
   }

   private int _highBit;
   [Element(DicomTag.HighBit)]
   public int HighBit
   {
      get { return _highBit; }
      set { _highBit = value; }
   }

   private string _darkCurrentCounts;
   [Element(DicomTag.DarkCurrentCounts)]
   public string DarkCurrentCounts
   {
      get { return _darkCurrentCounts; }
      set { _darkCurrentCounts = value; }
   }
}

public class GainCorrectionReference
{
   private string _airCounts;
   [Element(DicomTag.AirCounts)]
   public string AirCounts
   {
      get { return _airCounts; }
      set { _airCounts = value; }
   }


   private string _kVUsedInGainCalibration;
   [Element(DicomTag.KVUsedInGainCalibration)]
   public string KVUsedInGainCalibration
   {
      get { return _kVUsedInGainCalibration; }
      set { _kVUsedInGainCalibration = value; }
   }

   private string _mAUsedInGainCalibration;
   [Element(DicomTag.MAUsedInGainCalibration)]
   public string MAUsedInGainCalibration
   {
      get { return _mAUsedInGainCalibration; }
      set { _mAUsedInGainCalibration = value; }
   }

   private string _numberOfFramesUsedForIntegration;
   [Element(DicomTag.NumberOfFramesUsedForIntegration)]
   public string NumberOfFramesUsedForIntegration
   {
      get { return _numberOfFramesUsedForIntegration; }
      set { _numberOfFramesUsedForIntegration = value; }
   }

   private string _filterMaterialUsedInGainCalibration;
   [Element(DicomTag.FilterMaterialUsedInGainCalibration)]
   public string FilterMaterialUsedInGainCalibration
   {
      get { return _filterMaterialUsedInGainCalibration; }
      set { _filterMaterialUsedInGainCalibration = value; }
   }

   private DateTime? _dateOfGainCalibration;
   [Element(DicomTag.DateOfGainCalibration)]
   public DateTime? DateOfGainCalibration
   {
      get { return _dateOfGainCalibration; }
      set { _dateOfGainCalibration = value; }
   }

   private DateTime? _timeOfGainCalibration;
   [Element(DicomTag.TimeOfGainCalibration)]
   public DateTime? TimeOfGainCalibration
   {
      get { return _timeOfGainCalibration; }
      set { _timeOfGainCalibration = value; }
   }

   private int _bitsAllocated;
   [Element(DicomTag.BitsAllocated)]
   public int BitsAllocated
   {
      get { return _bitsAllocated; }
      set { _bitsAllocated = value; }
   }


   private int _bitsStored;
   [Element(DicomTag.BitsStored)]
   public int BitsStored
   {
      get { return _bitsStored; }
      set { _bitsStored = value; }
   }

   private int _highBit;
   [Element(DicomTag.HighBit)]
   public int HighBit
   {
      get { return _highBit; }
      set { _highBit = value; }
   }

   private int _pixelRepresentation;
   [Element(DicomTag.PixelRepresentation)]
   public int PixelRepresentation
   {
      get { return _pixelRepresentation; }
      set { _pixelRepresentation = value; }
   }

}

 

20.编译并运行程序进行测试.


关于葡萄城

赋能开发者!葡萄城是专业的集开发工具、商业智能解决方案、低代码开发平台于一身的软件和服务提供商,为超过 75% 的全球财富 500 强企业提供服务。葡萄城专注控件软件领域30年,希望通过模块化的开发控件、灵活的低代码应用开发平台等一系列开发工具、解决方案和服务,帮助开发者快速响应复杂多变的业务需求,最大程度地发挥开发者的才智和潜能,让开发者的 IT 人生更从容更美好。

了解详情,请访问葡萄城官网