Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label image sampler #50

Closed
tobiashepp opened this issue Jan 16, 2020 · 2 comments · Fixed by #175
Closed

Label image sampler #50

tobiashepp opened this issue Jan 16, 2020 · 2 comments · Fixed by #175
Labels
bug Something isn't working enhancement New feature or request

Comments

@tobiashepp
Copy link

Hi fernando,

I recently switched from tf to pytorch and I was really happy to find your library.
Great work! Thanks.

  • I added a more efficient image sampler to sample random patches which should contain
    at least one point of a specific label.
    https://github.com/lab-midas/midas-torchio/blob/dev_tobias/torchio/data/sampler/label.py
    (code and examples are still a bit messy, I will work on this the next days).
    But maybe you can use (parts of) it ;)

  • There was also a minor issue if the patch size is equal to the image size in a dimension
    (missing +1, rand numbers low=a high=b -> sample from [a,b) so b can be the max_size). I corrected this.
    This is very helpful to use the patch sampler as a slice sampler (for instance slicing 512x512 from 512x512x156 volumes).

Cheers
Tobias

@fepegar
Copy link
Owner

fepegar commented Jan 16, 2020

Hi @tobiashepp

That's great! I'm glad you're finding it useful. Please don't hesitate to post more feedback or issues here.

It would be amazing to include your sampler here if you think it's worth it. You can create a PR whenever you're ready and I'll review it.

Someone told me about that bug when the patch size is the same as the image. I'll create an issue. Thanks for reporting!

@fepegar
Copy link
Owner

fepegar commented May 29, 2020

FYI I've started working on more efficient samplers in #175.

@fepegar fepegar linked a pull request May 31, 2020 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants