Navigation:  I Want To... > Basics >

Load a DICOM study

Previous pageReturn to chapter overviewNext page

Use Case

You want to load a DICOM study into an ImageViewerComponent.

Relevant Architecture

Physical and Logical Workspaces
Opening a study

Relevant Types

OpenStudyHelper

Sample Code

using System;

using System.Collections.Generic;

using ClearCanvas.Common;

using ClearCanvas.Desktop;

using ClearCanvas.Desktop.Actions;

using ClearCanvas.ImageViewer;

using ClearCanvas.ImageViewer.BaseTools;

using ClearCanvas.ImageViewer.Configuration;

using ClearCanvas.ImageViewer.StudyManagement;

 

// ... (other using namespace statements here)

 

namespace MyPlugin.Basics

{

   [ButtonAction("open""global-toolbars/ToolbarStandard/OpenStudies""Open")]

   [IconSet("open", IconScheme.Colour, "Icons.MyToolSmall.png""Icons.MyToolMedium.png""Icons.MyToolLarge.png")]

   // ... (other action attributes here)

   [ExtensionOf(typeof (ImageViewerToolExtensionPoint))]

   public class LoadDicomStudiesTool : ImageViewerTool

   {

      public void Open()

      {

         string[] studyInstanceUids = {"1.2.840.1234567890.1.1""1.2.840.1234567890.1.2""1.2.840.1234567890.1.3"};

 

         this.LoadStudies(studyInstanceUids);

      }

 

      public void LoadStudies(IEnumerable<string> studyInstanceUids)

      {

         try

         {

            OpenStudyHelper helper = new OpenStudyHelper();

            helper.WindowBehaviour = ViewerLaunchSettings.WindowBehaviour;

            foreach (string studyInstanceUid in studyInstanceUids)

            {

               helper.AddStudy(studyInstanceUid, null"DICOM_LOCAL");

            }

            helper.OpenStudies();

         }

         catch (Exception e)

         {

            ExceptionHandler.Report(e, this.Context.DesktopWindow);

         }

      }

   }

}

Remarks

If you are using ClearCanvas Workstation in its default configuration, it's unlikely you will ever have to load a study in this way, since all the study loading facilities are already provided for you.  However, if you want to alter the default study loading behaviour by say, writing your own version of OpenStudyTool (found in ClearCanvas.ImageViewer.Explorer.Dicom), this may be what you need.

Most of the time, you will want to load studies from the local data store (i.e., the combination of the local file system and database).  You may do this by specifying "DICOM_LOCAL" as the study loader when adding the UIDs of the studies to be opened; all the details of file system and database access are hidden from you.

If you want to load studies from another source, such as WADO (Web Accessible DICOM objects) or some other source using your own protocol, you can do that provided you have written your own IStudyLoader extension.  Just use the AddStudy(...) method in the same way as the sample above, except specify the name of the study loader that you have written.

Examples in Code Base

ClearCanvas.ImageViewer.Explorer.Dicom.OpenStudyTool