question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extension of RandCropByPosNegLabeld to extract patches with positive voxels anywhere in the patch

See original GitHub issue

Is 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:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Nic-Macommented, Jun 17, 2020

Hi @martaranzini ,

I think you mean to do 3 steps: (1) randomly select a point(based on pos/neg ratio), (2) select a random distance(0, crop_size/2), (3) use point + 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.

0reactions
Nic-Macommented, Jun 26, 2020

Hi @martaranzini ,

Mark: I added Array version PosNeg crop in PR: https://github.com/Project-MONAI/MONAI/pull/628. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Patch samplers - Training - TorchIO
Extract random patches with labeled voxels at their center. This sampler yields patches whose center value is greater than 0 in the label_name...
Read more >
Patch-based MRI Analysis: From voxel to knowledge
have extended our patch-based segmentation framework to patch-based ... In the proposed PBS method, the search of good patches within the ...
Read more >
tf.image.extract_patches | TensorFlow v2.11.0
This is the input stride, specifying how far two consecutive patch samples are in the input. Equivalent to extracting patches with ...
Read more >
fiftyone.utils.patches - Voxel51
Extracts the patch from the image. Parses the patches from the given document. Class for iterating over the labeled/unlabeled image patches in a...
Read more >
Patch-Based Super-Resolution of MR Spectroscopic Images
PBSR methods are based on the principle of image redundancy (ability to find similar patches in an image) and aim at finding similar...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found