public interface ScopeDataUtils
ScopeData contains device properties in "DeviceLabel-PropertyName" format with String values. This class provides methods to validate that all properties exist in the current hardware configuration and to apply the properties to restore hardware state.
Access this utility via Studio.acquisitions().scopeData().
Example usage:
ScopeDataUtils utils = studio.acquisitions().scopeData();
PropertyMap scopeData = image.getMetadata().getScopeData();
// Validate first
ScopeDataUtils.ValidationResult validation = utils.validateScopeData(core, scopeData);
if (!validation.isFullyValid()) {
ReportingUtils.logMessage("Issues: " + validation.getSummary());
}
// Apply with default options
ScopeDataUtils.ApplyResult result = utils.applyScopeData(scopeData);
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ScopeDataUtils.ApplyOptions
Options for controlling how ScopeData is applied to hardware.
|
static interface |
ScopeDataUtils.ApplyResult
Result of applying ScopeData to hardware.
|
static interface |
ScopeDataUtils.PropertyChange
Represents a property change with both previous and new values.
|
static interface |
ScopeDataUtils.PropertyEntry
Represents a single property entry from ScopeData.
|
static interface |
ScopeDataUtils.PropertyError
Represents a property that failed to apply with error information.
|
static interface |
ScopeDataUtils.ValidationResult
Result of validating ScopeData against current hardware configuration.
|
| Modifier and Type | Method and Description |
|---|---|
ScopeDataUtils.ApplyResult |
applyScopeData(PropertyMap scopeData)
Applies ScopeData to hardware with default options.
|
ScopeDataUtils.ApplyResult |
applyScopeData(PropertyMap scopeData,
ScopeDataUtils.ApplyOptions options)
Applies ScopeData to hardware with configurable options.
|
PropertyMap |
configurationToPropertyMap(mmcorej.Configuration config)
Converts a Configuration (from core.getSystemStateCache()) to a PropertyMap
in the standard ScopeData format ("DeviceLabel-PropertyName" keys).
|
PropertyMap |
filterChangedProperties(mmcorej.CMMCore core,
PropertyMap scopeData)
Filters ScopeData to only include properties that exist in the current
hardware configuration and have different values from the current state.
|
PropertyMap |
filterReadOnlyProperties(mmcorej.CMMCore core,
PropertyMap scopeData)
Filters ScopeData to remove read-only properties.
|
PropertyMap |
filterStateProperties(PropertyMap scopeData)
Filters ScopeData to remove "State" properties when the device also has
a "Label" property.
|
java.util.List<ScopeDataUtils.PropertyChange> |
getChangedProperties(mmcorej.CMMCore core,
PropertyMap scopeData)
Filters ScopeData to only include properties that exist in the current
hardware configuration and have different values, returning detailed
information about each property difference.
|
java.lang.String[] |
parseKey(java.lang.String key)
Parses a ScopeData key into device and property name.
|
ScopeDataUtils.ValidationResult |
validateScopeData(mmcorej.CMMCore core,
PropertyMap scopeData)
Validates that all properties in ScopeData exist in current hardware configuration.
|
java.lang.String[] parseKey(java.lang.String key)
key - Key in "DeviceLabel-PropertyName" formatPropertyMap configurationToPropertyMap(mmcorej.Configuration config)
config - Configuration object from CMMCoreScopeDataUtils.ValidationResult validateScopeData(mmcorej.CMMCore core, PropertyMap scopeData)
core - The CMMCore instancescopeData - PropertyMap containing device propertiesPropertyMap filterChangedProperties(mmcorej.CMMCore core, PropertyMap scopeData)
This is useful for determining what would actually change if the ScopeData were applied, without actually applying it.
core - The CMMCore instancescopeData - PropertyMap containing device propertiesjava.util.List<ScopeDataUtils.PropertyChange> getChangedProperties(mmcorej.CMMCore core, PropertyMap scopeData)
core - The CMMCore instancescopeData - PropertyMap containing device propertiesPropertyMap filterReadOnlyProperties(mmcorej.CMMCore core, PropertyMap scopeData)
Returns a new PropertyMap containing only properties that are writable. Properties for devices that don't exist in the current configuration are also removed.
core - The CMMCore instancescopeData - PropertyMap containing device propertiesPropertyMap filterStateProperties(PropertyMap scopeData)
State devices (like filter wheels, objectives, etc.) typically have both a numeric "State" property and a human-readable "Label" property. When both are present in the ScopeData, it's preferable to use "Label" since it's more meaningful and less error-prone if the state device configuration has changed.
scopeData - PropertyMap containing device propertiesScopeDataUtils.ApplyResult applyScopeData(PropertyMap scopeData)
scopeData - PropertyMap containing device propertiesScopeDataUtils.ApplyResult applyScopeData(PropertyMap scopeData, ScopeDataUtils.ApplyOptions options)
scopeData - PropertyMap containing device propertiesoptions - Options controlling apply behavior