Hello, we would like to use to_multiscale to generate downscaled pyramids of label arrays. Unfortunately, it looks like the ITK_LABEL_GAUSSIAN method only works for certain data types. Please see the snippet below:
import dask.array as da
import numpy as np
from multiscale_spatial_image import to_multiscale, Methods
from spatial_image import to_spatial_image, SpatialImage
def try_multiscale_label():
"""
types:
- int8 failed -> itk.support.extras.TemplateTypeError: itk.Image is not wrapped for input type `itk.SC, int`.
- int16 worked, but max val not big enough
- int32 failed -> itk.support.extras.TemplateTypeError: itk.BinShrinkImageFilter is not wrapped for input type `None`.
- int64 failed -> itk.support.extras.TemplateTypeError: itk.Image is not wrapped for input type `itk.SL, int`.
- uint8 worked, but max val not big enough
- uint16 worked, but max val not big enough
- uint32 failed -> itk.support.extras.TemplateTypeError: itk.BinShrinkImageFilter is not wrapped for input type `None`.
- uint64 failed -> itk.support.extras.TemplateTypeError: itk.BinShrinkImageFilter is not wrapped for input type `None`.
"""
labels_arr: da.Array = da.zeros(shape=(100, 100), dtype=np.uint64)
labels_arr[:50, :50] = 1
labels: SpatialImage = to_spatial_image(labels_arr, dims=("y", "x"))
to_multiscale(
labels,
scale_factors=[dict(y=2, x=2)],
method=Methods.ITK_LABEL_GAUSSIAN,
)
if __name__ == "__main__":
try_multiscale_label()
For int8, int32, int64, uint32, and uint64, there is an error thrown, and it seems like this will take me into the weeds a bit. If you have any suggestions on how to approach fixing this I am all ears.
Hello, we would like to use
to_multiscale
to generate downscaled pyramids of label arrays. Unfortunately, it looks like theITK_LABEL_GAUSSIAN
method only works for certain data types. Please see the snippet below:For int8, int32, int64, uint32, and uint64, there is an error thrown, and it seems like this will take me into the weeds a bit. If you have any suggestions on how to approach fixing this I am all ears.
Edit: the dependencies for the above snippet are:
Thank you, Seb