ess.imaging.tools.analysis.resize#
- ess.imaging.tools.analysis.resize(image, sizes, method='sum')[source]#
Resize an image by folding it into blocks of specified sizes and applying a reduction method. The sizes should be provided as a dictionary where the keys are dimension names and the values are the sizes of the blocks. The shape of the input image must be divisible by the block sizes.
- Parameters:
sizes (
dict[str,int]) – A dictionary specifying the desired size of the output image for each dimension. The original sizes should be divisible by the specified sizes. For example,{'x': 128, 'y': 128}will create an output image of size 128x128.method (
str|Callable, default:'sum') – The reduction method to apply to the blocks. This can be a string referring to any valid Scipp reduction method, such as ‘sum’, ‘mean’, ‘max’, etc. Alternatively, a custom reduction function can be provided. The function signature should accept ascipp.Variableorscipp.DataArrayas first argument and a set of dimensions to reduce over as second argument. The function should return ascipp.Variableorscipp.DataArray.
- Return type: