sopa.utils.image
sopa.utils.image.scale_dtype(arr, dtype)
Change the dtype of an array but keep the scale compared to the type maximum value.
Example
For an array of dtype uint8
being transformed to np.uint16
, the value 255
will become 65535
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arr |
ndarray
|
A |
required |
dtype |
dtype
|
Target |
required |
Returns:
Type | Description |
---|---|
ndarray
|
A scaled |
Source code in sopa/utils/image.py
sopa.utils.image.resize(xarr, scale_factor)
Resize a xarray image
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xarr |
DataArray
|
A |
required |
scale_factor |
float
|
Scale factor of resizing, e.g. |
required |
Returns:
Type | Description |
---|---|
Array
|
Resized dask array |
Source code in sopa/utils/image.py
sopa.utils.image.resize_numpy(arr, scale_factor, dims, output_shape)
Resize a numpy image
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arr |
ndarray
|
a |
required |
scale_factor |
float
|
Scale factor of resizing, e.g. |
required |
dims |
list[str]
|
List of dimension names. Only |
required |
output_shape |
list[int]
|
Size of the output array |
required |
Returns:
Type | Description |
---|---|
ndarray
|
Resized array |