Files
DP44/enriched-qwen3-coder-next/Common/DTS.CommonCore/Interface/RegionOfInterest/RegionOfInterestChannels.md
2026-04-17 14:55:32 -04:00

7.5 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Interface/RegionOfInterest/RegionOfInterestChannels/IRegionOfInterestChannelsView.cs
Common/DTS.CommonCore/Interface/RegionOfInterest/RegionOfInterestChannels/IRegionOfInterestChannelsViewModel.cs
2026-04-16T02:29:26.774100+00:00 Qwen/Qwen3-Coder-Next-FP8 1 3255d2bc1a28f8fd

RegionOfInterestChannels

Documentation: IRegionOfInterestChannelsViewModel and IRegionOfInterestChannelsView


1. Purpose

This module defines the contract for the view and view model layers responsible for managing and presenting a collection of regions of interest (ROIs) in the context of test setups, channel groupings, and hardware configurations. It serves as the data and interaction layer for UI components that display, filter, sort, and validate ROI channel data—typically used in test setup or configuration interfaces where users define or inspect specific channel subsets (ROIs) across hardware devices. The module sits between domain-level ROI definitions (IRegionOfInterest) and higher-level test setup logic (ITestSetup, IDASHardware), enabling dynamic UI-driven manipulation of ROI collections.


2. Public Interface

IRegionOfInterestChannelsView

  • Interface: IRegionOfInterestChannelsView : IBaseView
    A marker interface for the view layer (e.g., UI control or page) implementing the view contract for ROI channel presentation. Inherits from IBaseView, implying standard view lifecycle or binding support.

IRegionOfInterestChannelsViewModel

  • Interface: IRegionOfInterestChannelsViewModel : IBaseViewModel
    Core business logic interface for ROI channel management.

    • void SetParent(object o)
      Assigns a parent object (e.g., a parent view model or controller) for hierarchical navigation or context propagation.

    • IRegionOfInterestChannelsView View { get; set; }
      Gets or sets the associated view instance. Enables two-way binding or view-model-to-view coordination.

    • BindingList<IRegionOfInterest> RegionsOfInterest { get; set; }
      Gets or sets the mutable list of ROI objects currently managed. BindingList<T> implies change notifications (e.g., for UI data binding).

    • string[] AllChannelSSNs { get; }
      Read-only array of serial numbers (SSNs) for all channels known to the view model (e.g., from hardware or test setup). Used for validation or lookup.

    • void SetGroups(ITestSetup testSetup, Dictionary<string, IDASHardware> serialNumberToHardware, IsoViewMode viewMode)
      Initializes or updates the ROI list based on a given test setup, hardware lookup (by serial number), and view mode. Replaces or populates RegionsOfInterest.

    • void SetTest(string path, IsoViewMode viewMode)
      Loads ROI data from a test definition at path, applying the specified IsoViewMode. Likely used for loading saved or template-based configurations.

    • void Filter(object tag, string term)
      Filters ROIs (and possibly their channels) using a search term, with optional tag for context-specific filtering (e.g., by group or hardware type).

    • void Filter(string term)
      Overload of Filter that filters all channels/ROIs by term without additional context.

    • void Sort(object o, bool columnClick)
      Sorts the RegionsOfInterest list. o likely identifies the sort key (e.g., column header or property name); columnClick may indicate user-initiated sorting.

    • void SelectAll(int roiIndex, bool selection)
      Sets the selection state (true = selected, false = deselected) for all channels within the ROI at roiIndex.

    • bool Validate(ref List<string> errors)
      Validates the current ROI configuration (e.g., channel assignments, hardware compatibility). Returns false if errors exist; populates errors with human-readable messages.

    • IsoViewMode ISOViewMode { get; set; }
      Gets or sets the current view mode (e.g., IsoViewMode.Standard, IsoViewMode.Comparison), influencing how ROIs/channels are displayed or interpreted.


3. Invariants

  • RegionsOfInterest must be a BindingList<IRegionOfInterest>—not a plain List<T>—to support UI change notifications.
  • AllChannelSSNs must contain all channel serial numbers relevant to the current context (e.g., those in testSetup or loaded hardware), and must not include duplicates.
  • Validate(ref List<string> errors) must return false if any ROI or channel assignment is invalid (e.g., missing hardware, duplicate SSNs, out-of-range indices), and must populate errors with actionable details.
  • Filter and Sort operations must not mutate the underlying ROI data—only the view or displayed list (implied by BindingList usage and typical MVVM patterns).
  • SetGroups and SetTest must fully reinitialize RegionsOfInterest and related state (e.g., AllChannelSSNs, ISOViewMode) to reflect the new context.

4. Dependencies

Imports/Usings (Explicit Dependencies)

  • DTS.Common.Base → Base interfaces (IBaseViewModel, IBaseView).
  • System.Collections.Generic, System.Collections.ObjectModel, System.ComponentModel → Core .NET collections and data binding (BindingList<T>, ObservableCollection<T> implied via IBaseViewModel).
  • DTS.Common.Interface.DataRecordersIDASHardware.
  • DTS.Common.Interface.Groups, DTS.Common.Interface.GroupTemplateITestObject, ITestObjectTemplate (commented-out signature suggests legacy use).
  • DTS.Common.Interface.TestSetups.TestSetupsListITestSetup.
  • DTS.Common.EnumsIsoViewMode.

Inferred Dependencies

  • Consumers: Any UI layer or parent view model requiring ROI channel management (e.g., test configuration dialog, ROI editor).
  • Dependencies:
    • IRegionOfInterest (type of items in RegionsOfInterest)
    • ITestSetup (for SetGroups/SetTest)
    • IDASHardware (via serialNumberToHardware dictionary)
    • IsoViewMode enum (controls behavior of filtering/sorting/validation)

Notable Omission

  • The commented-out SetGroups signature suggests a prior design using ITestObject[] and ITestObjectTemplate[]; current implementation uses ITestSetup instead. This may indicate legacy compatibility concerns.

5. Gotchas

  • SetGroups vs. SetTest ambiguity: The distinction between SetGroups (hardware/test setup-driven) and SetTest (path-driven) is not clarified in the source. It is unclear whether SetTest internally calls SetGroups or loads data from disk (e.g., JSON/XML).
  • Filter(object tag, string term): The purpose of tag is undocumented. It may be used for multi-filter scenarios (e.g., filtering by group and term), but without implementation or usage context, its contract is ambiguous.
  • SelectAll(int roiIndex, bool selection): No bounds checking is declared. Passing an out-of-range roiIndex may cause runtime exceptions.
  • AllChannelSSNs scope: It is unclear whether this includes only channels in the current test setup or all channels in the system. This affects validation logic (e.g., rejecting SSNs not in AllChannelSSNs).
  • No thread-safety guarantees: BindingList<T> is not thread-safe; concurrent modifications (e.g., from background workers) may corrupt state.
  • IsoViewMode usage: The enum IsoViewMode is used in multiple methods, but its possible values and their behavioral impact are not defined here (must be checked in DTS.Common.Enums).

None identified from source alone.