Postprocessing¶
Smoothing and outlier removal are methods on ROI.
simnibs_reader.nifti.roi.ROI.postprocess(smooth_fwhm=2.0, outlier_method='iqr', portion=None)
¶
Smooth and/or remove outliers.
Returns a new ROI — the original is never mutated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
smooth_fwhm
|
float or None
|
FWHM (mm) for Gaussian smoothing applied before masking.
|
2.0
|
outlier_method
|
('iqr', 'z')
|
Outlier removal strategy. |
"iqr"
|
portion
|
float or None
|
Central portion to keep (e.g. |
None
|
Source code in simnibs_reader/nifti/roi.py
simnibs_reader.nifti.roi.ROI.remove_outliers(values, method='iqr', z_thresh=3.5, iqr_factor=1.5, portion=None)
staticmethod
¶
Filter outliers on a 1-D vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
ndarray
|
Input values. |
required |
method
|
('iqr', 'z')
|
|
"iqr"
|
z_thresh
|
float
|
Threshold for the robust z-score method (default 3.5). |
3.5
|
iqr_factor
|
float
|
Multiplier for IQR fences (default 1.5). |
1.5
|
portion
|
float or None
|
If set, additionally trim to the central portion
(e.g. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
filtered |
ndarray
|
Copy of values with outliers set to |
keep |
ndarray
|
Boolean mask of retained values. |