I would like to resample the volume and mask to a fixed spacing using simpleitk in python, but after I do that, the mask of small regions disappears completely. Do you have any idea about this phenomenon?
I tried a smaller spacing, and different interpolator but the results still the same.
I suspect what you are experiencing is aliasing (is your new spacing larger than the original mask spacing?). For a concrete code example illustrating aliasing in SimpleITK take a look at the first couple of cells in this Jupyter notebook.
For the mask image you can try to use the sitkLabelGaussian interpolator instead of the sitkNearestNeighbor interpolator (see full list of interpolator options).
If that doesn’t improve the result you can convert the binary mask image to a distance map, resample the distance map using sitkLinear, or any other interpolator for continuous data, and convert the result back to a binary image (resampled_distance_map<=0).