So far, we’ve looked at the PhysicalWorkspace and LogicalWorkspace, as well as the StudyTree. In this section, we see how they’re all related by examining how a study is actually loaded and displayed.

The ImageViewerComponent class knows how to load studies, but doesn’t know how to lay out the images on the PhysicalWorkspace, or how to organize Sops in the LogicalWorkspace. That responsibility is left to its ILayoutManager. To understand what ILayoutManager does, we must first understand the sequence of events that occurs when a study is loaded (see figure below).
When a user opens a study from the study browser, the OpenStudyTool calls OpenStudyHelper.OpenStudies(), which in turn calls ImageViewerComponent.Load(). That loads the images belonging to a particular study by using an implementation of IStudyLoader. Each loaded Sop is then added to the StudyTree. After all Sops have been loaded, control is then returned to OpenStudyHelper, which then calls ImageViewerComponent.Launch(). That calls ImageViewerComponent.Layout(), which involves:
| 1. | Building the LogicalWorkspace, which means: |
| Creating new ImageSets and adding them to the LogicalWorkspace |
| Creating new DisplaySets and adding them to the appropriate ImageSets |
| Taking the ImageSops in the StudyTree and creating new PresentationImages and adding them to the appropriate DisplaySets |
| 2. | Laying out the PhysicalWorkspace, which means: |
| Creating new ImageBoxes and adding them to the PhysicalWorkspace |
| Creating new Tiles and adding them to the appropriate ImageBoxes |
| 3. | Filling the PhysicalWorkspace by placing the DisplaySets from the LogicalWorkspace in the appropriate ImageBoxes |
Note that it is completely up to the implementation of ILayoutManager to determine how the logical and physical workspaces are filled, thereby allowing you to create your own hanging protocol engine.
