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

CodeCamp #141 [Feature] Add BioMedical3DRandomFlip. #2404

Merged
merged 4 commits into from
Jan 20, 2023

Conversation

Leeinsn
Copy link
Contributor

@Leeinsn Leeinsn commented Dec 12, 2022

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Support for biomedical 3d images augmentation.

Modification

Add BioMedical3DRandomFlip in mmseg/datasets/transforms/transforms.py.

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

Add the function to support the flipping for biomedical 3d images and segmentation maps.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMDet3D.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@CLAassistant
Copy link

CLAassistant commented Dec 12, 2022

CLA assistant check
All committers have signed the CLA.

@Leeinsn
Copy link
Contributor Author

Leeinsn commented Dec 14, 2022

Yes, I check the information about errors, but I cannot find the reason for the bug of my code.

@MeowZheng MeowZheng force-pushed the dev-1.x branch 3 times, most recently from 4c28e1e to 115552d Compare December 30, 2022 14:56
@MeowZheng MeowZheng added 1.x Related issue of 1.x version High Priority from Community This issue/pr needs more attention and higher priority than default developing plan labels Jan 3, 2023
@MeowZheng
Copy link
Collaborator

Yes, I check the information about errors, but I cannot find the reason for the bug of my code.

we are figuring out the bug of the ci test


def __init__(self,
prob: float,
axes: Optional[Tuple[int, ...]] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
axes: Optional[Tuple[int, ...]] = None,
axes: Tuple[int, ...],

I think the axes cannot be None in this transform, and could you give an example about axes in docstring, like the order of axes is ZYX or ZXY?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, the order 'ZXY' is given in docstring.

Comment on lines 1812 to 2042
"""Flip biomedical 3D images and segmentations. Modified from
https://github.com/MIC-DKFZ/batchgenerators/blob/master/batchgenerators/tra
nsforms/spatial_transforms.py # noqa:E501 Copyright 2021 Division of
Medical Image Computing, German Cancer Research Center (DKFZ) and Applied
Computer Vision Lab, Helmholtz Imaging Platform. Licensed under the
Apache-2.0 License Required Keys:

- img
- gt_seg_map (optional)
Modified Keys:
- img
- gt_seg_map (optional))
Added Keys:
- do_flip
- flip_axes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please other Bio3D transform and refine the docstring

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have refined docstring.

@codecov
Copy link

codecov bot commented Jan 3, 2023

Codecov Report

Base: 83.41% // Head: 83.40% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (031ccb1) compared to base (8dae946).
Patch coverage: 83.01% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           dev-1.x    #2404      +/-   ##
===========================================
- Coverage    83.41%   83.40%   -0.01%     
===========================================
  Files          145      145              
  Lines         8451     8503      +52     
  Branches      1259     1272      +13     
===========================================
+ Hits          7049     7092      +43     
- Misses        1194     1197       +3     
- Partials       208      214       +6     
Flag Coverage Δ
unittests 83.40% <83.01%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmseg/datasets/__init__.py 100.00% <ø> (ø)
mmseg/datasets/transforms/__init__.py 100.00% <ø> (ø)
mmseg/datasets/transforms/transforms.py 90.40% <83.01%> (-0.56%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@MeowZheng MeowZheng left a comment

Choose a reason for hiding this comment

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

why add a README file

Comment on lines 2031 to 2032
- img
- gt_seg_map (optional)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- img
- gt_seg_map (optional)
Required Keys:
- img (np.ndarry): Biomedical image with shape (N, Z, Y, X) by default,
N is the number of modalities.
- gt_seg_map (np.ndarray, optional): Biomedical seg map with shape
(Z, Y, X) by default.

Comment on lines 2036 to 2037
- img
- gt_seg_map (optional)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- img
- gt_seg_map (optional)
Required Keys:
- img (np.ndarry): Biomedical image with shape (N, Z, Y, X) by default,
N is the number of modalities.
- gt_seg_map (np.ndarray, optional): Biomedical seg map with shape
(Z, Y, X) by default.

Comment on lines 2022 to 2027
"""Flip biomedical 3D images and segmentations. Modified from
https://github.com/MIC-DKFZ/batchgenerators/blob/master/batchgenerators/tra
nsforms/spatial_transforms.py # noqa:E501 Copyright 2021 Division of
Medical Image Computing, German Cancer Research Center (DKFZ) and Applied
Computer Vision Lab, Helmholtz Imaging Platform. Licensed under the
Apache-2.0 License.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
"""Flip biomedical 3D images and segmentations. Modified from
https://github.com/MIC-DKFZ/batchgenerators/blob/master/batchgenerators/tra
nsforms/spatial_transforms.py # noqa:E501 Copyright 2021 Division of
Medical Image Computing, German Cancer Research Center (DKFZ) and Applied
Computer Vision Lab, Helmholtz Imaging Platform. Licensed under the
Apache-2.0 License.
"""Flip biomedical 3D images and segmentations.
Modified from
https://github.com/MIC-DKFZ/batchgenerators/blob/master/batchgenerators/transforms/spatial_transforms.py # noqa:E501
Copyright 2021 Division of
Medical Image Computing, German Cancer Research Center (DKFZ) and Applied
Computer Vision Lab, Helmholtz Imaging Platform.
Licensed under the Apache-2.0 License.

@MeowZheng MeowZheng merged commit 7fc8ca0 into open-mmlab:dev-1.x Jan 20, 2023
aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this pull request Mar 27, 2023
Fix typo in AttnProcessor2_0 symbol.
nahidnazifi87 pushed a commit to nahidnazifi87/mmsegmentation_playground that referenced this pull request Apr 5, 2024
…mlab#2404)

## Motivation

Support for biomedical 3d images augmentation.

## Modification

Add BioMedical3DRandomFlip in mmseg/datasets/transforms/transforms.py.

Co-authored-by: MeowZheng <meowzheng@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x Related issue of 1.x version High Priority from Community This issue/pr needs more attention and higher priority than default developing plan medical
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants