105 lines
6.7 KiB
Markdown
105 lines
6.7 KiB
Markdown
|
|
---
|
|||
|
|
source_files:
|
|||
|
|
- DataPRO/Modules/RegionOfInterest/RegionOfInterestChannels/RegionOfInterestChannelsModule.cs
|
|||
|
|
generated_at: "2026-04-16T04:33:45.724018+00:00"
|
|||
|
|
model: "Qwen/Qwen3-Coder-Next-FP8"
|
|||
|
|
schema_version: 1
|
|||
|
|
sha256: "50e1f1160782bccc"
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
# RegionOfInterestChannels
|
|||
|
|
|
|||
|
|
## Documentation: RegionOfInterestChannelsModule
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### 1. Purpose
|
|||
|
|
The `RegionOfInterestChannelsModule` is a Prism-based modular component responsible for registering the view and view model for the *Region of Interest Channels* UI section within the application. It integrates with the Unity dependency injection container to expose `IRegionOfInterestChannelsView` and `IRegionOfInterestChannelsViewModel` as singleton services, enabling their reuse and injection elsewhere in the UI. This module serves as the entry point for the ROI Channels functionality—likely a UI area where users configure or inspect channel-specific regions of interest in imaging or data analysis workflows.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### 2. Public Interface
|
|||
|
|
|
|||
|
|
#### `RegionOfInterestChannelsModule` class
|
|||
|
|
- **`RegionOfInterestChannelsModule(Unity.IUnityContainer unityContainer)`**
|
|||
|
|
Constructor. Accepts a Unity container via dependency injection and stores it for later use in type registration.
|
|||
|
|
- **`void Initialize()`**
|
|||
|
|
Registers two types as singletons in the Unity container:
|
|||
|
|
- `IRegionOfInterestChannelsView` → `RegionOfInterestChannelsView`
|
|||
|
|
- `IRegionOfInterestChannelsViewModel` → `RegionOfInterestChannelsViewModel`
|
|||
|
|
This method is called by both `OnInitialized` and `RegisterTypes`.
|
|||
|
|
- **`void OnInitialized(IContainerProvider containerProvider)`**
|
|||
|
|
Currently empty; no initialization logic beyond what `Initialize()` provides.
|
|||
|
|
- **`void RegisterTypes(IContainerRegistry containerRegistry)`**
|
|||
|
|
Delegates to `Initialize()`; used by Prism’s module initialization pipeline.
|
|||
|
|
|
|||
|
|
#### `RegionOfInterestChannelsModuleNameAttribute` class
|
|||
|
|
- **`RegionOfInterestChannelsModuleNameAttribute()` / `RegionOfInterestChannelsModuleNameAttribute(string)`**
|
|||
|
|
Constructor. Sets `AssemblyName` to `AssemblyNames.RegionOfInterestChannels.ToString()`.
|
|||
|
|
- **`override string AssemblyName { get; }`**
|
|||
|
|
Returns `"RegionOfInterestChannels"` (value of `AssemblyNames.RegionOfInterestChannels`).
|
|||
|
|
- **`override Type GetAttributeType()`**
|
|||
|
|
Returns `typeof(TextAttribute)`.
|
|||
|
|
- **`override string GetAssemblyName()`**
|
|||
|
|
Returns `AssemblyName`.
|
|||
|
|
|
|||
|
|
#### `RegionOfInterestChannelsModuleImageAttribute` class
|
|||
|
|
- **`RegionOfInterestChannelsModuleImageAttribute()` / `RegionOfInterestChannelsModuleImageAttribute(string)`**
|
|||
|
|
Constructor. Loads the assembly image via `AssemblyInfo.GetImage("RegionOfInterestChannels")`.
|
|||
|
|
- **`override BitmapImage AssemblyImage { get; }`**
|
|||
|
|
Returns the loaded image (cached in `_img`).
|
|||
|
|
- **`override string AssemblyName { get; }`**
|
|||
|
|
Returns `"RegionOfInterestChannels"`.
|
|||
|
|
- **`override string AssemblyGroup { get; }`**
|
|||
|
|
Returns `"Prepare"` (value of `eAssemblyGroups.Prepare`).
|
|||
|
|
- **`override eAssemblyRegion AssemblyRegion { get; }`**
|
|||
|
|
Returns `eAssemblyRegion.RegionOfInterestChannelsRegion`.
|
|||
|
|
- **`override Type GetAttributeType()`**
|
|||
|
|
Returns `typeof(ImageAttribute)`.
|
|||
|
|
- **`override BitmapImage GetAssemblyImage()`**
|
|||
|
|
Returns `AssemblyImage`.
|
|||
|
|
- **`override string GetAssemblyName()`**
|
|||
|
|
Returns `AssemblyName`.
|
|||
|
|
- **`override string GetAssemblyGroup()`**
|
|||
|
|
Returns `AssemblyGroup`.
|
|||
|
|
- **`override eAssemblyRegion GetAssemblyRegion()`**
|
|||
|
|
Returns `AssemblyRegion`.
|
|||
|
|
|
|||
|
|
> **Note**: The types `IRegionOfInterestChannelsView`, `IRegionOfInterestChannelsViewModel`, `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, and `eAssemblyRegion` are referenced but *not defined* in this file. Their definitions must be found in other modules or shared libraries (e.g., `DTS.Common`, `RegionOfInterestChannels` namespace).
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### 3. Invariants
|
|||
|
|
- The Unity container (`_unityContainer`) is non-null after construction (enforced by DI framework).
|
|||
|
|
- `IRegionOfInterestChannelsView` and `IRegionOfInterestChannelsViewModel` are registered exactly once as singletons per module load.
|
|||
|
|
- `AssemblyName` for both attributes is consistently `"RegionOfInterestChannels"`.
|
|||
|
|
- `AssemblyGroup` is always `"Prepare"`.
|
|||
|
|
- `AssemblyRegion` is always `eAssemblyRegion.RegionOfInterestChannelsRegion`.
|
|||
|
|
- Image loading via `AssemblyInfo.GetImage(...)` must succeed (or throw); no fallback or null-check is visible in this module.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### 4. Dependencies
|
|||
|
|
|
|||
|
|
#### This module depends on:
|
|||
|
|
- **Prism.Modularity** (`IModule`, `IContainerRegistry`, `IContainerProvider`)
|
|||
|
|
- **Unity** (`Unity.IUnityContainer`, `IContainerRegistry`)
|
|||
|
|
- **WPF** (`System.Windows.Media.Imaging.BitmapImage`)
|
|||
|
|
- **DTS.Common** (`AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, `eAssemblyRegion`)
|
|||
|
|
- **DTS.Common.Interface.RegionOfInterest.RegionOfInterestChannels** (`IRegionOfInterestChannelsView`, `IRegionOfInterestChannelsViewModel`)
|
|||
|
|
- **Prism.Ioc** (`IContainerProvider`, `IContainerRegistry`)
|
|||
|
|
|
|||
|
|
#### This module is depended upon by:
|
|||
|
|
- The Prism bootstrapper/module catalog system (via `[Export(typeof(IModule))]` and `[Module(...)]`).
|
|||
|
|
- UI components that resolve `IRegionOfInterestChannelsView` or `IRegionOfInterestChannelsViewModel` via Unity.
|
|||
|
|
- The main UI (likely `SummaryModule` or equivalent) that uses `RegionOfInterestChannelsModuleImageAttribute` to display the module’s icon and group in the assembly list.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### 5. Gotchas
|
|||
|
|
- **`OnInitialized` is empty**: Though Prism’s module lifecycle calls `OnInitialized` *after* `RegisterTypes`, this module performs all registration in `Initialize()` (called from `RegisterTypes`). This may be intentional but could confuse developers expecting initialization logic in `OnInitialized`.
|
|||
|
|
- **Redundant `Initialize()` calls**: `Initialize()` is invoked both directly and via `RegisterTypes`, but Unity’s singleton registration is idempotent—no harm, but potentially misleading.
|
|||
|
|
- **Image loading side effects**: `AssemblyInfo.GetImage(...)` is called in both constructors and property getters; if `GetImage` is expensive or has side effects (e.g., disk I/O), repeated access (e.g., via `AssemblyImage` getter) may be inefficient despite `_img` caching.
|
|||
|
|
- **Missing type definitions**: Core interfaces (`IRegionOfInterestChannelsView`, `IRegionOfInterestChannelsViewModel`) and enums (`eAssemblyRegion`, `eAssemblyGroups`) are not defined here. Their contracts and behavior are unknown from this file alone.
|
|||
|
|
- **No validation**: No checks ensure `AssemblyNames.RegionOfInterestChannels` is valid or that `AssemblyInfo.GetImage(...)` returns a non-null image. Failure here may cause runtime errors.
|
|||
|
|
- **Attribute reuse**: Both attributes are assembly-level and applied via `[assembly: ...]`, but their constructors accept unused `string s` parameters—likely legacy.
|