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

Allow different input types for DataStats transform by default #6844

Closed
surajpaib opened this issue Aug 8, 2023 · 0 comments · Fixed by #7082
Closed

Allow different input types for DataStats transform by default #6844

surajpaib opened this issue Aug 8, 2023 · 0 comments · Fixed by #7082

Comments

@surajpaib
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently DataStats supports Ndarray or Tensor and breaks by default for any other data type if the shape attribute is not available.

There are four items for DataStats and in the default behavior,

  1. data_type: Works irrespective of the provided type.
  2. data_shape: Breaks when shape attribute is missing
  3. value_range: Works irrespective of provided type as there is a conditional check for type
  4. data_value: Off by default

Describe the solution you'd like
Could we streamline 2 and 3 so that there is a conditional check for the data_shape similar to type checks for value_range?

if self.value_range if value_range is None else value_range:

It makes sense that they would work the same and either both break by default or handle arbitrary types by default.

Describe alternatives you've considered
Setting data_shape to False explicitly works for arbitrary types.

vgrau98 added a commit to vgrau98/MONAI that referenced this issue Oct 3, 2023
Fixes: Project-MONAI#6844

DataStats was breaking for arbitrary types (other than tensor or array).

Signed-off-by: vgrau98 <[email protected]>
@wyli wyli closed this as completed in #7082 Oct 3, 2023
wyli pushed a commit that referenced this issue Oct 3, 2023
Fixes #6844.

### Description

DataStats was breaking for arbitrary types (other than tensor or array)
because of shape attribute. Changes are made in order to be consistent
with other DataStats attributes management like `data_type`.

### Types of changes
<!--- Put an `x` in all the boxes that apply, and remove the not
applicable items -->
- [x] 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 --disttests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.

---------

Signed-off-by: vgrau98 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants