Skip to content

Conversation

@rijobro
Copy link
Contributor

@rijobro rijobro commented Feb 23, 2021

decollate a batch of data

#1515

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
Copy link
Contributor Author

rijobro commented Feb 23, 2021

this requires #1625

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>
Copy link
Contributor

@wyli wyli left a comment

Choose a reason for hiding this comment

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

thanks! this could also be packaged as a post-processing transform? https://github.com/Project-MONAI/MONAI/blob/master/monai/transforms/post/dictionary.py#L33

@rijobro
Copy link
Contributor Author

rijobro commented Feb 24, 2021

I've added the Decollated as a post transform, good idea.

@rijobro rijobro enabled auto-merge (squash) February 24, 2021 17:55
Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@Nic-Ma
Copy link
Contributor

Nic-Ma commented Feb 25, 2021

Hi @rijobro ,

Thanks for developing this new feature, may I know what's the typical use cases?

@rijobro
Copy link
Contributor Author

rijobro commented Feb 25, 2021

Hi @Nic-Ma of course. After the data loader, the data are collated. Images that were C,H,W,[D] become B,C,H,W,[D]. Similarly metadata are merged (e.g., a list of the transforms applied to each image).

To perform the inverse transforms on images, I want to convert them back from B,C,H,W,[D] and collated metadata to a list containing B elements, each element containing C,H,W,[D] images, and only the metadata associated with that image.

My particular use case is for inverse transforms of a batch of images, but I'm sure this isn't the only use case for this functionality (for example, NiftiSaver.save_batch could be rewritten to use it).

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Feb 25, 2021

OK, I see, thanks for your explanation.

Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com>
@rijobro rijobro merged commit 69d9fcc into Project-MONAI:master Feb 25, 2021
@rijobro rijobro deleted the decollate_batch branch February 25, 2021 09:41
@wyli
Copy link
Contributor

wyli commented Feb 25, 2021

not sure why it gives a circular import error in the container https://github.com/Project-MONAI/MONAI/runs/1977893666?check_suite_focus=true#step:3:32 I couldn't replicate the issue locally

@rijobro
Copy link
Contributor Author

rijobro commented Feb 25, 2021

Hm, so all the different CI builds were OK, but the docker one is causing a problem? Is this using master branch (since it's already merged)?

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