Simple DICOM Extensions to Read or Write Dataset Tags

The following tutorial illustrates how to use the DICOM Data Set get/set extensions to easily pull data from one data set and insert it into another. The classes written here show how to customize which tags are to be pulled from or written to a data set.  

Download a sample DICOM DE template here! (Unzip the downloaded file before using it.)

The following steps will create a project that can populate a DICOM DE template data set.

  1. Start Visual Studio .NET.

  2. Choose File->New->Project from the menu.

  3. In the New Project dialog box, choose "Visual C# Projects" in the Projects Type List, and select "Windows Forms Application" in the Templates List.

  4. Type the project name as DicomExtensions in the Project Name field, and then click OK. If desired, type a new location for your project or select a directory using the Browse button, and then click OK.

    Note: Make sure the project targets a full .NET Framework rather than just a client profile.

  5. In the Solution Explorer window right-click the References folder, and select Add Reference... from the context menu. In the Add Reference dialog box, select the Browse tab and browse to LEADTOOLS for .NET C:\LEADTOOLS 19\Bin\DotNet4\Win32 folder and select the following DLLS:

    Leadtools.dll 
    Leadtools.Codecs 
    Leadtools.Dicom.dll  
    Leadtools.Dicom.Common.dll 
    Leadtools.Dicom.Tables.dll  
    Leadtools.WinForms.CommonDialogs.File.dll 
    Click the OK button to add the above DLLs to the application.

  6. Make sure Form1 is in design view. Go to the toolbox (View->Toolbox) and drag three TextBox controls onto the form. Set them up as follows:

    Property

    Value

    Name

    txtSrcFile

    Anchor

    Top, Bottom, Left, Right

    TabStop

    True

    TabIndex

    0

                     

    Property

    Value

    Name

    txtTemplateFile

    Anchor

    Top, Bottom, Left, Right

    TabStop

    True

    TabIndex

    2

           

    Property

    Value

    Name

    txtTargetFile

    Anchor

    Top, Bottom, Left, Right

    TabStop

    True

    TabIndex

    4

  7. Now add three Label controls to accompany the text boxes. Set them up as follows:

    Property

    Value

    Name

    lblSrcFile

    Text

    Source File

           

    Property

    Value

    Name

    lblTemplateFile

    Text

    Template File:

           

    Property

    Value

    Name

    lblTargetFile

    Text

    Target File:

           

  8. Now add three Button controls for selecting file names to populate the text boxes. Set them up as follows:   

    Property

    Value

    Name

    butSetSrcFile

    Anchor

    Top, Right

    Text

    Set source dataset

    TabStop

    True

    TabIndex

    1

           

    Property

    Value

    Name

    butTemplateFile

    Anchor

    Top, Right

    Text

    Set template dataset

    TabStop

    True

    TabIndex

    3

           

    Property

    Value

    Name

    butSetTargetFile

    Anchor

    Top, Right

    Text

    Set output file

    TabStop

    True

    TabIndex

    5

  9. Add a Button for creating the DICOM DE file. Set it up as follows:

    Property

    Value

    Name

    butCreateFile

    Text

    Create Dicom File

    TabStop

    True

    TabIndex

    6

  10. Open the Form1.cs file and add the following using statements:

    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. Declare the following private variables to the 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. In the Form() constructor, paste the following code:

    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. Add a method for initializing the file dialogs and code it as follows:

    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. Add a button handler for selecting files using the file dialogs and code it as follows:

    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. Add a button handler for creating the DICOM DE file and code it as follows:

    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. Add a worker method to generate the DICOM DE file and code it as follows:

    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. Add a class to specify the General Study Module tags to copy from the source to the target file and code it as follows:

    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. Add a class to specify the group 14 tags to copy from the source DICOM file to target file and code it as follows:

    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. Add helper classes to specify the tags to copy within sequences and code it as follows:
    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. Build, and Run the program to test it.
Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Imaging, Medical, and Document