In order to make life easier since the early development days, it was decided to use the same basic object names in the .NET version as had been used in the older COM version version, but this does make life difficult if anyone wishes to use both in the same project. In general, we would not recommend this, but recognise that it might occasionally be necessary. This then is a short guide to the steps needed if you do wish to use the COM & .NET versions of DicomObjects in the same project.

Use C#

  • Unfortunately, VB .NET seems to lack the aliasing feature mentioned below.

Add both sets of references

  • Using normal mechanisms
  • either explicit adding of the references, or dragging a DicomViewer (COM or .NET) onto a form

Give DicomObjects.NET version an alias

  1. Go to solution explorer
  2. Click on the DicomObjects.NET.x reference (not the COM ones) and view its properties
  3. Changes the Aliases property from global to something else - e.g. DicomObjectsNET

Create an extern reference

Add an extern alias line at the top of your source file (above existing using statements) referencing the alias you gave in the previous step.

 extern alias DicomObjectsNET;

Use the fully qualified name when referencing .NET objects

You need the form alias.DicomObjects.class

 // create a .NET DicomImage object
 DicomObjectsNET.DicomObjects.DicomImage net_image = new DicomObjectsNET.DicomObjects.DicomImage();
 // create a COM DicomImage object
 DicomObjects8.DicomImage com_image = new DicomObjects8.DicomImage();

Or make things simpler with a ‘using’ alias, this makes the above less of a typing ordeal.

extern alias DicomObjectsNET;
using DoNET = DicomObjectsNET.DicomObjects;
...
 // create a .NET DicomImage object
 DoNET.DicomImage net_image = new DoNET.DicomImage();
 // create a COM DicomImage object
 DicomObjects8.DicomImage com_image = new DicomObjects8.DicomImage();

Finally, please note that although this mechanism allows both forms of DicomObjects to be used in the same project, they are not programmatically equivalent, and you cannot for instance cast from one to the other, as the underlying representations are fundamentally different.