superdsm.preprocess
- class superdsm.preprocess.Preprocessing
Bases:
StageImplements the computation of the intensity offsets (see Convex energy minimization).
This stage requires
g_rawfor input (the input image) and producesyfor output (the offset image intensities). Refer to Inputs and outputs for more information on the available inputs and outputs.Hyperparameters
The following hyperparameters can be used to control this pipeline stage:
preprocess/sigma1The scale of the Gaussian filter used for denoising. Defaults to \(\sqrt{2}\).
preprocess/sigma2The scale of the Gaussian filter \(\mathcal G_\sigma\), which is used to determine the intensity offsets \(\tau_x\) (see Convex energy minimization). Defaults to \(40\), or to
AF_sigma2 × scaleif configured automatically (andAF_sigma2defaults to 1).preprocess/offset_clipCorresponds to \(\tau_\text{max}\) in Supplemental Material 1. Defaults to \(3\).
preprocess/lower_clip_meanIf True, intensity offsets \(\tau_x\) smaller than the mean image intensity are set to the mean image intensity. Defaults to False.
- configure(pipeline, input_id, *args, scale, **kwargs)
Returns the rules to adopt hyperparameters based on the input data.
Sometimes it can be necessary to automatically adopt hyperparameters based on the input data. For those cases where linear adoptation is suitable, this method can be overridden to return the rules which specify how to adopt the hyperparameters. The rules are then applied by the
repype.pipeline.Pipeline.configure()method.The rules must be specified by the following structure:
{ 'key': [ factor, default_user_factor, ], }
The rules are resolved by mapping the above structure to the arguments of the
repype.pipeline.create_config_entry()function. In this example, two new hyperparameters are created:The hyperparameter
AF_keyis created and defaults to the value ofdefault_user_factor.The hyperparameter
keyis created and defaults to the value of the hyperparameterAF_keytimes the value offactor.
In addition, a third element can be added to the list to further constrain the resulting values:
{ 'key': [ factor, default_user_factor, { type: 'float', min: 0.0, max: 1.0, }, ], }
- Parameters:
pipeline – The pipeline object that this stage is a part of.
input_id – The identifier of the input data to adopt the hyperparameters for.
*args – Sequential arguments passed to
Pipeline.configure.**kwargs – Keyword arguments passed to
Pipeline.configure.
- process(g_raw, pipeline, config, status=None)
Processes the input fields of this stage of the pipeline.
This method implements a stage of the pipeline with the provided inputs and configuration parameters. It then returns the outputs produced by the stage.
- Parameters:
pipeline – The pipeline object that this stage is a part of.
config – The hyperparameters to be used for this stage.
status – A status object to report the progress of the computations.
**inputs – The fields of the pipeline read by this stage. Each key-value pair represents an input field and the corresponding value.
- Returns:
A dictionary containing the outputs of this stage. Each key-value pair in the dictionary represents an output field and the corresponding value.
- Raises:
NotImplementedError – If the method is not implemented by the subclass.