Implementing a DICOM Log AddIn

  1. Start Visual Studio 2005.

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

  3. In the New Project dialog box, choose either "Visual C#" or "VB" in the Projects Type List, and choose "Class Library" in the Templates List.

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

  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:\LEADTOOLS23\Bin\DotNet4\Win32" folder and select the following DLLS:

    • Leadtools.Dicom.dll
    • Leadtools.Dicom.AddIn.dll
  6. Click OK to add the above DLLs to the application.

  7. In the "Solution Explorer" window right-click "LogAddIn" and select Add->Class from the context menu. In the "Add New Item" dialog, type Module.cs in the "Name" field. Click "Add" to add the class to the project.

  8. Open the Module.cs file and add the following using statements:

    C#
    using Leadtools.Dicom.AddIn; 
    using System.IO; 
    using System.Diagnostics; 

  9. Define the module class as listed below:

    C#
    public class Module : ModuleInit 
    { 
       public override void Load(string ServiceDirectory, string DisplayName) 
       { 
          // Do any add-in initialization here. For instance, set up 
          // the logging infrastructure. 
          // 
       } 
    } 

  10. In the "Solution Explorer" window right-click Class1.cs and select Rename from the context menu. Type ReceiveNotify.cs and press Enter.

  11. Open the ReceiveNotify.cs file and add the following using statements:

    C#
    using Leadtools.Dicom.AddIn; 
    using Leadtools.Dicom.AddIn.Interfaces; 
    using System.Diagnostics; 

  12. Add NotifyReceiveMessageBase to the ReceiveNotify class derivation list. The class should look like the following:

    C#
    public class ReceiveNotify : NotifyReceiveMessageBase 
    { 
    } 

  13. Override the messages you are interested in logging. This tutorial only overrides two methods to show what is possible. For a more detailed implementation of logging refer to the Leadtools.AddIn.DicomLog example.

    C#
    public class ReceiveNotify : NotifyReceiveMessageBase 
    { 
       public override void OnReceiveAssociateAccept(DicomClient Client, Leadtools.Dicom.DicomAssociate association) 
       { 
          Debug.WriteLine("Receive Associate Accept"); 
       } 
                     
       public override void OnReceiveCEchoRequest(DicomClient Client, byte presentationID, int messageID, string affectedClass) 
       { 
          Debug.WriteLine("Receive Echo Request"); 
       } 
    }        

  14. In the "Solution Explorer" window right-click "LogAddIn" and select Add->Class from the context menu. In the "Add New Item" dialog, type SendNotify.cs in the "Name" field. Click "Add" to add the class to the project.

  15. Open the SendNotify.cs file and add the following using statements:

    C#
    using Leadtools.Dicom; 
    using Leadtools.Dicom.AddIn; 
    using Leadtools.Dicom.AddIn.Interfaces; 
    using System.Diagnostics; 

  16. Add NotifySendMessageBase to the ReceiveNotify class derivation list. The class should look like the following:

    C#
    public class SendNotify : NotifySendMessageBase 
    { 
    } 

  17. Override the messages you are interested in logging. This tutorial only overrides two methods to show what is possible. For a more detailed implementation of logging refer to the Leadtools.AddIn.DicomLog example.

    C#
    public class SendNotify : NotifySendMessageBase 
    { 
       public override void OnSendAssociateAccept(DicomClient Client, DicomAssociate associate) 
       { 
          base.OnSendAssociateAccept(Client, associate); 
       } 
                         
       public override void OnSendCEchoRequest(DicomClient Client, byte presentationID, int messageID, string affectedClass) 
       { 
          base.OnSendCEchoRequest(Client, presentationID, messageID, affectedClass); 
       } 
    } 

  18. Build the class library and take the output and put it in the AddIn directory of your previously created server.

  19. If the server is running, stop it. Then start the server.

  20. Connect to the server and perform an association and make a C-ECHO request.

Help Version 23.0.2024.8.27
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Imaging, Medical, and Document
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.