Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.03.09
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 "Visual Basic" 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 choose OK.
  5. In the "Solution Explorer" window right-click on 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 "\LEAD Technologies\LEADTOOLS 16\Bin\DotNet\Win32" folder and select the following DLLS:

    [Showing a C# code example]

    
    Leadtools.Dicom.dll
    Leadtools.Dicom.AddIn.dll		
    
    Press the OK button to add the above DLLs to the application.
  6. 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.
  7. Open the Module.cs file and add the following using statements:
    
    using Leadtools.Dicom.AddIn;
    using System.IO;
    using System.Diagnostics;				
    
  8. Define the module class as listed below:
    
    public class Module : ModuleInit
    {
        public override void Load(string ServiceDirectory, string DisplayName)
        {
            //
            // Do any AddIn initialization here. For instance, set up
            // the logging infrastructure.
            //
        }
    }
    
  9. In the "Solution Explorer" window right-click Class1.cs and select Rename from the context menu. Type ReceiveNotify.cs and press enter.
  10. Open the ReceiveNotify.cs file and add the following using statements:
    
    using Leadtools.Dicom.AddIn;
    using Leadtools.Dicom.AddIn.Interfaces;
    using System.Diagnostics;
    
  11. Add NotifyReceiveMessageBase to the ReceiveNotify class derivation list. Your class should look like the following:
    
    public class ReceiveNotify : NotifyReceiveMessageBase
    {
    }
    
  12. 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.
    
    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");
        }
    }	
    
    
  13. 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.
  14. Open the SendNotify.cs file and add the following using statements:
    
    using Leadtools.Dicom;
    using Leadtools.Dicom.AddIn;
    using Leadtools.Dicom.AddIn.Interfaces;
    using System.Diagnostics;
    
  15. Add NotifySendMessageBase to the ReceiveNotify class derivation list. Your class should look like the following:
    
    public class SendNotify : NotifySendMessageBase
    {
    }
    
  16. 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.
    
    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);
        }
    }
    
  17. Build the class library and take the output and put it in the AddIn directory of your previously created server.
  18. If the server is running stop it. Start the server.
  19. Connect to the server and perform an association and make a C-ECHO request.

Leadtools.Dicom.Scu requires a Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features