Skip to content

Commit

Permalink
Signalfillempty set track_meta to True (#7089)
Browse files Browse the repository at this point in the history
Related to #7011. I was using the `Signalfillemptyd` (based on
`Signalfillempty`) transform in monailabel and found out, it currently
allows no inversion.
When digging deeper I realized that SignalFillEmpty just throws away the
meta information.
With the simple addition of `track_meta=True` it works as expected.
I hope it has no other impact, but I honestly don't know.

@wyli would be cool if we can add this to MONAI 1.3.0, thanks! I can
also rework `Signalfillempty` to just accept any datatype, if that would
the more appropriate approach.

### 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.
- [ ] Documentation updated, tested `make html` command in the `docs/`
folder.
- [ ] 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.

Signed-off-by: Matthias Hadlich <matthiashadlich@posteo.de>
  • Loading branch information
matt3o authored Oct 5, 2023
1 parent 4cb7bb2 commit 100db27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion monai/transforms/signal/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def __call__(self, signal: NdarrayOrTensor) -> NdarrayOrTensor:
Args:
signal: signal to be filled
"""
signal = torch.nan_to_num(convert_to_tensor(signal), nan=self.replacement)
signal = torch.nan_to_num(convert_to_tensor(signal, track_meta=True), nan=self.replacement)
return signal


Expand Down

0 comments on commit 100db27

Please sign in to comment.