Using DicomObjects in Python

DicomObjects can be used in python by the help of various api's and interface generators

COM version: (This instructions below is using pywin32 interface generator for COM objects)

  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 DicomObjects6 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: In this article, we used IronPython to call the .NET version of DicomObjects:

  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") this should print 0 on console screen
Relevance: