Closed TaekyungKi closed 3 years ago
Thanks! Which interpolation order are you using for the mask? By default, the function uses 3rd order spline interpolation, which works for floating point images but not for binary masks. You can specify the order when you call deform_grid
or deform_random_grid
. For binary masks, you should use 0 instead of 3.
Looking at your toy example, you probably want to use the same deformation for the image and the label. You can do that with a single call to deform_grid
. You can specify a different interpolation order for each input:
[image_deform, label_deform] = elasticdeform.deform_random_grid([image, label], order=[3, 0])
There's something on this in the README, but I should probably add something about the interpolation order as well.
Oh, I used order 3 for interpolation. With your advice, I made the right one. Thank you! You save my time :) I will close this issue.
Hi, thank for providing nice package. When i use the elastic distortion to binary image, i.e. label image which has value of 0 or 1, the binarization is broken. Thresholding also produces poor result. Is there any way to maintain the binarization ? Below is a toy example that I made. Thanks.