Simple Slice Sampler applied on Axis (mb with labelmap probability) #873
Replies: 2 comments 1 reply
-
Hi, @avKostanov.
I think the error message suggests padding your images. Have you tried that? |
Beta Was this translation helpful? Give feedback.
-
Hello I think this is a very often and general issue, (several issues have been open ) If I correctly understand the issue, the problem comes because the LabelSampler, try to find patch where the center is within the mask. but the patch center must be half the patch size away from the image border. That is why you need to add a padding of size half the patch size, then you allow the patch center to be at all image locations. @avKostanov did you tried this and you still have an error ? if yes I do not see why ? This is the easiest test to be sure than some label are present in the patch, but it is very conservative. If we were testing for a given patch if it contains some mask value (even if the patch center is not in the mask) it will avoid the need of the padding ... An other solution could then be to sample the patch center from the given mask, and then shift the patch at image border if need, (so by construction you are sure to have some mask in your sample, and you have the same efficiency for the generation process) |
Beta Was this translation helpful? Give feedback.
-
Hello everyone. I'm definitely sure that I'm facing this task very often, and maybe I'm doing something wrong, or it will be very handy feature.
I have 3d CT images and need to train 2d net for several tasks on 2d slices (ex.1x1x512x512x64 tensor sliced to 1x1x512x512 images to timm backbone etc). Uniform Sampler rocks, but I often need balanced sampling when masks area are very small.
LabelSampler supposed to solve this issue, but it fails when masks area are near border. Making label_probabilities = {0:1, 1:every number} even "hides" this problem, because sampler, not be able to sample mask due to border issue, samples randomly).
Is It only my issue? If not, it would be really cool to have Slice/AxisSampler, extracting full slices along axis (sometimes it's useful to patch axial, coronal or sagittal view), with desired distribution.
Looking for meaningful discussion, and thank you for this framework
Beta Was this translation helpful? Give feedback.
All reactions