Skip to content

Added Gibbs transform#2163

Merged
rijobro merged 80 commits intoProject-MONAI:devfrom
yanielc:Gibbs_transform
May 14, 2021
Merged

Added Gibbs transform#2163
rijobro merged 80 commits intoProject-MONAI:devfrom
yanielc:Gibbs_transform

Conversation

@yanielc
Copy link
Copy Markdown
Contributor

@yanielc yanielc commented May 9, 2021

Description

Added a Gibbs artifact transform to model Gibbs artifacts in 3D MRI data. The transform has the property to be applied randomly as a naturalistic data augmentation tool. Gibbs artifacts are one of the typical sources of noise in MRI data. I added both the transform to the intensity/array.py file and its dictionary partner to the intensity/dictionary.py.

For general information on Gibbs artifacts, please refer to:
https://pubs.rsna.org/doi/full/10.1148/rg.313105115
https://pubs.rsna.org/doi/full/10.1148/radiographics.22.4.g02jl14949

Status

Work in progress

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

@yanielc yanielc force-pushed the Gibbs_transform branch from 3d7c3b0 to 2aa8f06 Compare May 9, 2021 19:26
@rijobro
Copy link
Copy Markdown
Contributor

rijobro commented May 10, 2021

@yanielc thanks! Do you think you could tidy up the git diff? I'm not sure why, but the changes from this PR seem to be present. Perhaps simply clicking "Update branch" will solve it.

@rijobro
Copy link
Copy Markdown
Contributor

rijobro commented May 10, 2021

Would you also be able to attach a before and after photo in this thread so we can visually check the transform?

@yanielc
Copy link
Copy Markdown
Contributor Author

yanielc commented May 10, 2021

Would you also be able to attach a before and after photo in this thread so we can visually check the transform?

Hi @rijobro, here one can see the transform applied on a sample image from the BraTS dataset.
Gibbs_example

Leftmost is the original volume, then separate applications of the transform with different strengths.

@yanielc
Copy link
Copy Markdown
Contributor Author

yanielc commented May 10, 2021

@yanielc thanks! Do you think you could tidy up the git diff? I'm not sure why, but the changes from this PR seem to be present. Perhaps simply clicking "Update branch" will solve it.

Sure thing, I can try. I also noticed afterwards that my pull request had stuff from other PR you mentioned. I'll try your suggestion.

@yanielc yanielc force-pushed the Gibbs_transform branch from a57c783 to 4088fbf Compare May 10, 2021 15:04
@rijobro
Copy link
Copy Markdown
Contributor

rijobro commented May 11, 2021

@yanielc let me know when you want me to re-review this.

@yanielc
Copy link
Copy Markdown
Contributor Author

yanielc commented May 11, 2021

@yanielc let me know when you want me to re-review this.

@rijobro, I'm done with the commits, it's ready now. I tried to address all your suggestions.

Copy link
Copy Markdown
Contributor

@rijobro rijobro left a comment

Choose a reason for hiding this comment

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

Aside from the remaining comments, unit tests are needed for all 4 classes (random/deterministic and array/dictionary). Should use a variety of inputs (alpha as float vs. list) etc. Should also be tested on both 2d and 3d images with a variety of number of channels.

@yanielc
Copy link
Copy Markdown
Contributor Author

yanielc commented May 12, 2021

Aside from the remaining comments, unit tests are needed for all 4 classes (random/deterministic and array/dictionary). Should use a variety of inputs (alpha as float vs. list) etc. Should also be tested on both 2d and 3d images with a variety of number of channels.

Sounds good, I will commit the changes possibly tomorrow and I will include the unit tests.

@yanielc yanielc force-pushed the Gibbs_transform branch from b183c36 to 10872cf Compare May 13, 2021 09:26
@yanielc
Copy link
Copy Markdown
Contributor Author

yanielc commented May 13, 2021

Aside from the remaining comments, unit tests are needed for all 4 classes (random/deterministic and array/dictionary). Should use a variety of inputs (alpha as float vs. list) etc. Should also be tested on both 2d and 3d images with a variety of number of channels.

Hi Richard, the commit is ready for review. I added the unit tests as well.

@rijobro
Copy link
Copy Markdown
Contributor

rijobro commented May 14, 2021

Looks really good, just need to get all the checks green and then I think this is good to go. Thanks!

@rijobro
Copy link
Copy Markdown
Contributor

rijobro commented May 14, 2021

One thing I was assuming, perhaps unnecessarily, was that the number of leading dimensions was arbitrary, say (..., channel, H, W) for 2D and (..., channel, H, W, D) for 3D. Hence my mask method was a bit less direct.

I think all of our transforms assume (C, H, W, [D]) with no batch. I think this is a safe assumption here as otherwise all our other transforms would fall over.

@yanielc
Copy link
Copy Markdown
Contributor Author

yanielc commented May 14, 2021

Looks really good, just need to get all the checks green and then I think this is good to go. Thanks!

There are currently two tests failing. One is build-docs. The interesting thing is that when I run make html locally, I no longer see any warnings or errors. So I am a bit uncertain what to do about the error it shows on the repository:

/home/runner/work/MONAI/MONAI/monai/transforms/intensity/array.py:docstring of monai.transforms.intensity.array.GibbsNoise.shift_fourier:1: WARNING: duplicate object description of monai.transforms.GibbsNoise.shift_fourier, other instance in transforms, use :noindex: for one of them

The other error is simpler. It's flake8. When I run it locally it wants to reformat more files than the ones I have edited it. Can I let it do that?

Thank you for all guidance!

rijobro and others added 3 commits May 14, 2021 10:22
@yanielc yanielc force-pushed the Gibbs_transform branch from a7f06b4 to e14c031 Compare May 14, 2021 10:25
@rijobro
Copy link
Copy Markdown
Contributor

rijobro commented May 14, 2021

@wyli @Nic-Ma @ericspod – do you think we could revisit the use of DCO? I committed from a github suggestion, which apparently doesn't do the DCO (so not very useful), but I can't force push since it's not my branch...

@wyli
Copy link
Copy Markdown
Contributor

wyli commented May 14, 2021

@wyli @Nic-Ma @ericspod – do you think we could revisit the use of DCO? I committed from a github suggestion, which apparently doesn't do the DCO (so not very useful), but I can't force push since it's not my branch...

there is a discussion about the DCO here dcoapp/app#141

yanielc added 3 commits May 14, 2021 14:31
Signed-off-by: Yaniel Cabrera <[email protected]>
Signed-off-by: Yaniel Cabrera <[email protected]>
Signed-off-by: Yaniel Cabrera <[email protected]>
@yanielc
Copy link
Copy Markdown
Contributor Author

yanielc commented May 14, 2021

@rijobro, almost all green marks! I think you saw there is just one missing sign-off from a previous commit of yours.

By the way, I noticed that the docs are showing every method of the Gibbs transforms, for example inv_shift_fourier and apply_mask. I think I should rename them to private methods so that they don't show up in the docs.

@rijobro rijobro enabled auto-merge (squash) May 14, 2021 13:36
auto-merge was automatically disabled May 14, 2021 14:04

Head branch was pushed to by a user without write access

@rijobro
Copy link
Copy Markdown
Contributor

rijobro commented May 14, 2021

tell me when you're happy. I'll have to manually set the DCO check to pass, and then enable auto-merge.

@yanielc
Copy link
Copy Markdown
Contributor Author

yanielc commented May 14, 2021

tell me when you're happy. I'll have to manually set the DCO check to pass, and then enable auto-merge.

Ok, I think I am done with changes on my end.

@rijobro rijobro enabled auto-merge (squash) May 14, 2021 14:15
@rijobro rijobro merged commit 0e6f945 into Project-MONAI:dev May 14, 2021
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.

9 participants