This module defines event types used for broadcasting and subscribing to selections of channels within a specific Region of Interest (ROI) in a Prism-based application. Specifically, it enables decoupled communication where a consumer (e.g., a view model or service) signals that a set of channels has been selected for a given ROI, identified by a suffix. The event is published using Prism’s CompositePresentationEvent, supporting both synchronous and asynchronous subscription patterns across modules or layers.
2. Public Interface
RegionOfInterestChannelsSelectedEvent Type:class (inherits from CompositePresentationEvent<RegionOfInterestChannelsSelectedEventArgs>) Behavior: A Prism event used to publish and subscribe to ROI channel selection changes. Subscribers receive an instance of RegionOfInterestChannelsSelectedEventArgs containing the selected channels and metadata.
RegionOfInterestChannelsSelectedEventArgs Type:class Behavior: Encapsulates the data payload for the RegionOfInterestChannelsSelectedEvent.
roiSuffix: A string identifying the ROI (e.g., "Brain", "Lesion"), used to scope the channel selection.
selectedChannelNames: An array of channel names (e.g., ["Red", "Green"]) selected for the ROI.
o: The consumer object triggering the event (e.g., a view model instance).
Properties:
RegionOfInterestSuffix: string — read-only; identifies the ROI context.
ChannelNames: string[] — read-only; the list of selected channel names.
Consumer: object — read-only; the object responsible for raising the event.
3. Invariants
RegionOfInterestSuffix and ChannelNames are non-null (enforced by constructor; no null checks are present in the source, implying callers must supply valid values).
ChannelNames is expected to be a non-empty array in typical usage (though not enforced by this class—consumers must validate).
The Consumer property is non-null in practice (as it is passed directly from the constructor argument o), but the class does not enforce this.
The event is publish-only—no built-in mechanism for acknowledgment or cancellation.
Microsoft.Practices.Prism.Regions (imported but not used in this file—likely a legacy or placeholder import)
System (implicitly via string, object, string[])
Used by:
Other modules in the DTS.Common.Events.RegionOfInterest.RegionOfInterestChannels namespace (inferred from namespace structure).
Any Prism module that needs to publish or subscribe to ROI channel selection events (e.g., UI components, analysis services).
5. Gotchas
No validation in constructor: The class does not validate roiSuffix, selectedChannelNames, or o for null or emptiness, risking NullReferenceException or invalid state at runtime if callers are not disciplined.
Prism.Regions import is unused: The using Microsoft.Practices.Prism.Regions; statement is present but irrelevant—suggests possible copy-paste artifact or incomplete refactoring.
Consumer is untyped: Using object for Consumer makes it unclear what contract the consumer is expected to adhere to (e.g., interface requirements), increasing coupling risk.
No immutability guarantee for ChannelNames: While the property is read-only, the underlying array reference is mutable—subscribers could observe side effects if the caller retains and mutates the array after construction.
No documentation on ROI suffix semantics: The meaning of RegionOfInterestSuffix (e.g., allowed values, naming conventions) is not defined here—consumers must infer from context or external documentation.