darsia.presets.workflows.rig.Rig#
- class Rig[source]#
Bases:
objectRig object for CO2 analysis.
Methods
import_from_csv(path, *[, delimiter, date, ...])Import scalar result data from CSV.
load(folder[, corrections_config])Load rig object from file.
load_corrections(folder[, corrections_config])Load persisted corrections from disk.
load_experiment(experiment)Load experiment and associated protocols.
mass_analysis(img)Mass analysis of the image.
read_image(path)Read image from file and apply corrections.
save(folder)Save rig object to file.
setup(experiment, baseline_path, ...[, ...])Fast setup.
setup_boolean_image_porosity([threshold, ...])Setup boolean porosity based on the defined threshold.
setup_color_corrections([...])Setup label-dependent color corrections after labels/porosity are available.
setup_depth(path[, log])Setup depth map for the rig object.
setup_facies(path[, apply_corrections, log, ...])Setup facies.
setup_facies_props([props_path, porosity, ...])Define facies properties like porosity.
Setup geometry for volumetric integration of images.
setup_illumination_correction(config[, log, ...])Setup and return illumination correction.
setup_image_porosity([path, log, config, ...])Setup image porosity based on the baseline image.
setup_inner_labels([log])Define boolean mask which excludes the label boundaries.
setup_labels(path[, apply_corrections, log])Setup labels for the rig object.
setup_mass_analysis(atmospheric_pressure, ...)Setup and return patchwise illumination correction.
setup_reading(baseline_path, experiment[, ...])setup_shape_corrections(pre_baseline[, ...])Setup shape corrections that do not depend on labels/porosity.
threshold_analysis(mass_analysis_result)Threshold analysis of the mass analysis result.
update(path)Update the state of the rig based on the image path.
Attributes
Combined correction workflow in execution order.
- classmethod load(folder, corrections_config=None)[source]#
Load rig object from file.
Mimick the save method.
- Parameters:
- folder
Path Path to the folder where the rig object is saved.
- folder
- import_from_csv(path, *, delimiter=',', date=None, reference_date=None, time=None, name=None, is_extensive=False)[source]#
Import scalar result data from CSV.
- load_corrections(folder, corrections_config=None)[source]#
Load persisted corrections from disk.
Supports both split-format files (shape_correction_*, color_correction_*) and legacy mixed-format files (correction_*).
- load_experiment(experiment)[source]#
Load experiment and associated protocols.
This is required to read images and compute the injected mass correctly.
- Parameters:
- experiment
darsia.ProtocolledExperiment Experiment object containing imaging, injection, and pressure/temperature protocols.
- experiment
- read_image(path)[source]#
Read image from file and apply corrections.
The respective date is extracted from the path using the imaging protocol.
- Parameters:
- path
Path Path to the image file.
- path
- Returns:
darsia.ImageImage object with applied corrections.
- setup(experiment, baseline_path, depth_map_path, labels_path, facies_path=None, facies_props_path=None, corrections_config=None, image_porosity_config=None, log=None, show_plot=False)[source]#
Fast setup.
- setup_boolean_image_porosity(threshold=None, log=None, config=None, show_plot=False)[source]#
Setup boolean porosity based on the defined threshold.
In
mode="full"the boolean mask is always all-True(full image domain), regardless of threshold / tol. Inmode="from_image"the mask is derived by thresholdingself.image_porositywith the effective tolerance.The effective tolerance is resolved in order of precedence:
threshold argument (when explicitly passed).
config.tol(when config is given).self._image_porosity_config.tol(stored bysetup_image_porosity()).0.9(hard-coded default).
- Parameters:
- threshold
float|None Override tolerance value. Deprecated in favour of
config.tol; kept for backward compatibility.- log
Path|None Folder for diagnostic output. When given, a JPG illustration is stored to
log/image_porosity/boolean_porosity.jpg.- config
ImagePorosityConfig|None Porosity configuration. Falls back to the config stored by the last call to
setup_image_porosity(), and finally toImagePorosityConfig()(mode="full").- show_plotbool
When
Truethe boolean porosity is displayed interactively. PassTruewhen calling from a GUI or user-interface workflow.
- threshold
- setup_color_corrections(corrections_config=None, log=None, show_plot=False)[source]#
Setup label-dependent color corrections after labels/porosity are available.
Execution order is fixed: 1) illumination, 2) relative color, 3) color correction. Relative color can either be loaded from a precomputed correction file or calibrated from configured images (interactive mode only).
- setup_facies(path, apply_corrections=False, log=None, show_plot=False)[source]#
Setup facies.
This method loads facies from a specified path and applies corrections if needed.
- setup_facies_props(props_path=None, porosity=None, permeability=None)[source]#
Define facies properties like porosity.
- setup_illumination_correction(config, log=None, show_plot=False)[source]#
Setup and return illumination correction.
- Parameters:
- config
IlluminationCorrectionConfig|None Configuration for the illumination correction. If provided, it will set up the illumination correction based on this configuration.
- log
Path|None Path to the log folder where diagnostic plots will be saved.
- show_plotbool
Whether to show diagnostic plots during setup (default: False).
- config
Notes
Illumination calibration in Rig intentionally uses the shape-corrected baseline as setup input.
- setup_image_porosity(path=None, log=None, config=None, show_plot=False)[source]#
Setup image porosity based on the baseline image.
Behaviour is controlled by config:
mode="full"(default): constant porosity of1over the full domain.mode="from_image": porosity derived from the baseline image viapatched_porosity_analysis()using the parameters stored in config (patches,num_clusters,sample_width,tol_color_distance,tol_color_gradient).
When path is provided the image is always loaded from disk regardless of config, which is useful for restoring a previously saved rig.
- Parameters:
- path
Path|None Path to a previously saved porosity
.npzfile. When given, the file is loaded and config is not used.- log
Path|None Folder for diagnostic output. When given, a JPG illustration is stored to
log/image_porosity/image_porosity.jpg.- config
ImagePorosityConfig|None Porosity configuration. Defaults to
ImagePorosityConfig()(i.e.mode="full") when not provided.- show_plotbool
When
Truethe image porosity is displayed interactively. PassTruewhen calling from a GUI or user-interface workflow.
- path
- setup_labels(path, apply_corrections=False, log=None)[source]#
Setup labels for the rig object.
This method loads labels from a specified path and applies corrections if needed.
- setup_patchwise_illumination_correction(config, show_plot=False)[source]#
Setup and return patchwise illumination correction.
- Parameters:
- config
PatchwiseIlluminationCorrectionConfig|None Configuration for the patchwise illumination correction. If provided, it will set up the correction based on this configuration.
- config
Notes
Patchwise illumination calibration uses the labels image to enable per-label reference color computation within each patch, ensuring heterogeneous regions contribute equally by material.
- setup_shape_corrections(pre_baseline, corrections_config=None)[source]#
Setup shape corrections that do not depend on labels/porosity.
- update(path)[source]#
Update the state of the rig based on the image path.
This method updates the current date, time, pressure, and temperature of the rig object based on the provided image path.
- Parameters:
- path
Path Path to the image file.
- path
- property corrections#
Combined correction workflow in execution order.