14 internal const string VersionKey =
"Version";
15 internal const string EnabledKey =
"Enabled";
20 public int Version {
get;
protected set; } = 1;
33 public abstract string TypeId {
get; }
72 var version = archive.
GetInt64(VersionKey);
73 ValidateVersion(version,
TypeId);
78 public virtual object Process(
object input)
80 if (input is not
Image image)
83 $
"Casting from {input.GetType().Name} to the given type {typeof(Image).Name} is not supported!");
99 internal void ValidateVersion(
long version,
string moduleName)
104 $
"The 'Version' entry {version} int the archive for " +
105 $
"module {moduleName} is invalid! Must be at least 1.");
Occurs when a requested operation is not implemented or supported (e.g., exporting to an unsupported ...
Base class for all pipeline modules.
string TypeId
Gets the module type identifier used for serialization.
virtual void ResetToDefault()
Resets the module to its default state.The enabled state is not reset.
virtual object Process(object input)
Processes input data and returns the result.This function is called by the pipeline to process a unit...
Image Process(Image inputImage)
Processes the image.
virtual void Deserialize(IArchive archive)
Restores the object's state from the provided archive.
int Version
The module version.
virtual void Serialize(IArchive archive)
Serializes the object's internal state into the provided archive.
virtual bool IsEnabled
Get whether this module is enabled.
Constructs an Image from an IImageView Instance.
Interface for a module used within a pipeline.
Represents a hierarchical, strongly-typed key-value archive.
void SetBool(string key, bool value)
Stores a boolean value under the specified key.
long GetInt64(string key)
Retrieves a 64-bit integer value by key.
void SetInt64(string key, long value)
Stores a 64-bit integer value under the specified key.
bool GetBool(string key)
Retrieves a boolean value by key.