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

Create transform images #3039

Merged
merged 15 commits into from
Sep 30, 2021
Merged

Create transform images #3039

merged 15 commits into from
Sep 30, 2021

Conversation

rijobro
Copy link
Contributor

@rijobro rijobro commented Sep 28, 2021

Partly addresses #2721.

Description

Automatic generation of transform example image and add to the docstring.

image

Status

Ready

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro rijobro requested review from wyli, ericspod and Nic-Ma September 28, 2021 12:57
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@wyli
Copy link
Contributor

wyli commented Sep 28, 2021

looks great! the only concern is the image files, could we host the images elsewhere, so that we keep the primary codebase small?

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro
Copy link
Contributor Author

rijobro commented Sep 28, 2021

Could do but it would mean that we can't automate it (easily) as we can this way. Current images are 250kB, if we have 100 transforms to visualise that's 25MB. Is that too much? We could downsample by factor 2 to reduce to 6MB, and I'm sure we could play with data types to further reduce. What do you think?

@wyli
Copy link
Contributor

wyli commented Sep 28, 2021

I think every time we modify the images it'll create another copy in the git history and increase the size of the .git folder, this might not scale...

@ericspod
Copy link
Member

I think it's best we store this data elsewhere, we've used gdrive and other sources before, we can do that for now at least.

@rijobro
Copy link
Contributor Author

rijobro commented Sep 28, 2021

Do we have an official MONAI gdrive (or similar)? I wouldn't want to have it on my personal and then accidentally delete it.

@wyli
Copy link
Contributor

wyli commented Sep 29, 2021

Do we have an official MONAI gdrive (or similar)? I wouldn't want to have it on my personal and then accidentally delete it.

Thanks, I was looking for some other options but couldn't get an idea. Creating a new GitHub repo as you did looks good to me. Further in this direction, perhaps we need a way to dynamically inject the URLs with a global variable? https://stackoverflow.com/questions/57417808/standardizing-a-link-using-a-global-variable-in-sphinx-documentation

@rijobro
Copy link
Contributor Author

rijobro commented Sep 29, 2021

Hi @ericspod @wyli
I created a new repository and will store the images there. I won't use it as a git submodule as these can get messy. Instead I'll use an environment variable pointing to that repository. Using git is advantageous in that (a) we can all add to it and (b) the URLs that get created are consistent (unlike gdrive that contains some random characters).

@ericspod
Copy link
Member

Another repository makes sense. We should keep an eye on how large its .git directory gets over time to see if it's really an issue, Github's LFS is a thing as well that's meant to help manage large files and prevent that kind of issue. We keep talking about it and never trying it.

@rijobro
Copy link
Contributor Author

rijobro commented Sep 29, 2021

I used git LFS for another test base and although it's fine, I think it might be overkill for this use case.

Would someone be able to review, and when happy, update the branch and enable auto-merge?

@wyli
Copy link
Contributor

wyli commented Sep 29, 2021

I hope there's some sphinx plugin to handle the URLs, something like https://github.com/Project-MONAI/DocImages/raw/[version]/transforms/RandFlip.png where [version] could be the tag from the main repo such as main, 0.7.0, 1.0 so that each code release has the corresponding version of images... or is this functionality just too much for now for the transforms?

@rijobro rijobro enabled auto-merge (squash) September 29, 2021 15:14
@rijobro rijobro merged commit a589c82 into dev Sep 30, 2021
@rijobro rijobro deleted the create_transform_images branch September 30, 2021 18:36
plt.close(fig)


def create_transform_im(transform, data, ndim, update_doc=True, out_dir=None, seed=0):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SachidanandAlle mentioned that providing this utility to the users so that they can visualise the effects of the transforms for any input images. Looks like a nice feature to have cc @rijobro @Nic-Ma @ericspod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants