IntensityCorrection#
- class pulserver.recon.IntensityCorrection[source]#
Bases:
objectDivision of the magnitude images of a unit by the receive field N4 estimates from them.
The field is
bartorch.tools.bias_field_correct()’s (SimpleITK’s N4) over Otsu’s mask of the magnitude image, divided by its mean inside the mask and clipped to the range it takes there, so the image keeps its mean over the object and the background is not amplified beyond the object’s worst voxel. Real, imaginary and phase images are not divided, so the phase of a complex image is sent as reconstructed.One field is estimated for each slice and set, from the first unit that closes with a magnitude image, and divides every later contrast, repetition and cardiac phase of it: echoes and time points keep their intensity ratios, so a T2* fit or a time series is not changed by the correction. Each slice of a 2D multi-slice series has a field of its own, of mean 1 inside its own mask, so ratios between slices are not kept. Make one instance per stream.
A magnitude image that is not 2D or 3D once its axes of one point are dropped, or whose mask holds fewer than 64 pixels or 128 voxels or less than
N4_MIN_MASK_FRACTIONof the image, or that falls apart into separate compartments (N4_MIN_CONNECTED_FRACTION), is sent uncorrected, as are all images when SimpleITK is not installed or the estimate fails; the reason is logged.- Parameters:
levels (int, default=None) – Fitting levels of the field;
N4_FITTING_LEVELSwhenNone.