nifreeze.estimator module¶
Orchestrates model and registration in volume-to-volume artifact estimation.
- class nifreeze.estimator.Estimator(self, model: 'BaseModel | str', strategy: 'str' = 'random', prev: 'Estimator | Filter | None' = None, model_kwargs: 'dict | None' = None, single_fit: 'bool' = False, start_index: 'int' = 0, stop_index: 'int | None' = None, **kwargs)[source]¶
Bases:
objectOrchestrates components for a single estimation step.
The estimator traverses the 4D sequence with a Leave-One-Volume-Out (LOVO) strategy: for each target volume it fits the model on the remaining volumes, predicts the held-out volume, and registers the observed volume to that prediction. Held-out independence is what makes the estimated transform valid (see
fit_predict()).- Parameters:
model (
BaseModelorstr) – The model (or model name) used to generate the registration target.strategy (
str, optional) – Name of the iterator used to traverse the 4D sequence.prev (
Estimator,Filter, optional) – A previous estimator/filter whose output initializes this one (cascade).model_kwargs (
dict, optional) – Extra keyword arguments passed through to the model at construction.single_fit (
bool, optional) – Run the model in single-fit mode: fit once on all volumes up front (viamodel.fit_predict(None)) and lock that fit instead of refitting per held-out volume. Prediction is no longer unbiased.start_index (
int, optional) – First volume index to process.stop_index (
int, optional) – One-past-last volume index to process (None= to the end).
- run(dataset: DatasetT, **kwargs) Self[source]¶
Trigger execution of the workflow this estimator belongs.
- Parameters:
dataset (
BaseDataset) – The input dataset this estimator operates on.- Returns:
The estimator, after fitting.
- Return type:
- class nifreeze.estimator.Filter(self, /, *args, **kwargs)[source]¶
Bases:
objectAlters an input data object (e.g., downsampling).
- run(dataset: DatasetT, **kwargs) DatasetT[source]¶
Trigger execution of the designated filter.
- Parameters:
dataset (
BaseDataset) – The input dataset this estimator operates on.- Returns:
dataset – The dataset, after filtering.
- Return type: