Using DicomObjects in Python

DicomObjects can be used in Python with the help of various API's and interface generators available. We have tested 2 of those modules (1 for .NET version and 1 for COM version) but please do not limit yourself to these examples as you may find other easier tools to use in conjunction with DicomObjects.

COM version: (The instructions in this section below has been tested using pywin32 interface generator for DicomObjects COM interfaces)

  1. Download and install appropriate pywin32 tool from here: http://sourceforge.net/projects/pywin32
  2. Run the makepy.py script from "\Lib\site-packages\win32com\client\makepy.py"
  3. Select DicomObjects8 from the list of registered COM/ActiveX components on your system
  4. A module is generated under "<python_install_path>\Lib\site-packages\win32com\gen_py\"
  5. Download our python sample script from here and run it using the command : python DicomObjects_COM.py

 

.NET version: (The instructions in this section below has been tested using IronPython that references our DicomObjects .NET assembly)

  1. Download and Install IronPython from here: http://ironpython.net/
  2. Open IronPython Console
  3. Run the following commands:
    1. import clr
    2. clr.AddReferenceToFileAndPath(Full_Path_To_DicomObjects.NET_DLL)
    3. import DicomObjects
  4. Test to see if it works:
    1. print DicomObjects.DicomGlobal.FileVersion
    2. print DicomObjects.DicomGlobal.Echo("DicomServer.co.uk", 104, "PySCU","DicomServer")
Relevance: