Extension of RandCropByPosNegLabeld to extract patches with positive voxels anywhere in the patch
See original GitHub issueIs your feature request related to a problem? Please describe.
I would like to make sure I compose my batch with both positive and negative examples. However, I do have a patch size corresponding to the whole 2D slice from a 3D volume, and the labelled object might not necessarily be at the centre of it. I understand that the RandCropByPosNegLabeld
transform goes towards the direction of balancing samples, but selects the patch as positive/negative based on the patch centre voxel only.
Describe the solution you’d like
Would it be possible to extend the RandCropByPosNegLabeld
transform so as to consider a patch positive based on the presence of foreground label anywhere in the patch?
Additional context I have noticed there is only a dict implementation of this transform and not an array one. Is there a particular reason for it?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (6 by maintainers)
Top GitHub Comments
Hi @martaranzini ,
I think you mean to do 3 steps: (1) randomly select a
point
(based on pos/neg ratio), (2) select a randomdistance
(0, crop_size/2), (3) usepoint
+distance
as the patch center to crop patch. Is it right?BTW, I will add Array level PosNegCrop soon in https://github.com/Project-MONAI/MONAI/issues/583.
Thanks.
Hi @martaranzini ,
Mark: I added Array version PosNeg crop in PR: https://github.com/Project-MONAI/MONAI/pull/628. Thanks.