harpy.im.tiling_correction#
- harpy.im.tiling_correction(sdata, image_name=None, tile_size=2144, crd=None, to_coordinate_system='global', scale_factors=None, output_image_name='tiling_correction', overwrite=False)#
Function corrects for the tiling effect that occurs in some image data (e.g. resolve data).
The illumination within the tiles is adjusted, afterwards the tiles are connected as a whole image by inpainting the lines between the tiles.
- Parameters:
sdata (
SpatialData) – The SpatialData object containing the image data to correct.image_name (
str|None(default:None)) – The image element insdatato be corrected for tiling effects. If not provided, the last image element insdatais used.tile_size (
int(default:2144)) – The size of the tiles in the image.crd (
tuple[int,int,int,int] |None(default:None)) – Coordinates defining the region of the image to correct. It defines the bounds (x_min, x_max, y_min, y_max).to_coordinate_system (
str(default:'global')) – The coordinate system to which thecrdis specified. Ignored ifcrdis None. If acrdis specified, only the coordinate system defined here will be kept inoutput_image_name.scale_factors (
Sequence[dict[str,int] |int] |None(default:None)) – Scale factors to apply for multiscale.output_image_name (
str(default:'tiling_correction')) – Name of the image element where the corrected image will be stored in thesdataobject.overwrite (
bool(default:False)) – If True overwrites the element if it already exists.
- Return type:
tuple[SpatialData,list[ndarray]]- Returns:
: Updated
sdataobject containing the corrected image and a list of flatfield arrays with length equal to the number of channels.- Raises:
ValueError – If the image element does not contain exactly 2 spatial dimensions.
ValueError – If the dimensions of the image element are not multiples of the given tile size.
Notes
The function integrates the BaSiC algorithm for illumination correction and uses OpenCV’s inpainting to stitch tiles together. It manages the pre- and post-processing of data, translation of coordinates, and addition of corrected image results back to the
sdataobject.