MONAI icon indicating copy to clipboard operation
MONAI copied to clipboard

Adding transforms for signal (ECG, EEG for instance)

Open doursand opened this issue 2 years ago • 8 comments

Fixes # .

Description

This changes introduces the following transforms for 1d signal (example ECG , EEC, etc)

"SignalRandDrop", "SignalRandScale", "SignalRandShift", "SignalResample", "SignalRandAddSine", "SignalRandAddSquarePulse", "SignalRandAddGaussianNoise", "SignalRandAddSinePartial", "SignalRandAddSquarePulsePartial", "SignalNormalize", "SignalStandardize", "SignalZeroPad", "SignalFillEmpty", "SignalRemoveFrequency", "SignalShortTimeFourier", "SignalContinousWavelet",

Status

Work in progress

Types of changes

  • [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).
  • [x] New tests added to cover the changes.
  • [ ] Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • [x] Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • [x] In-line docstrings updated.
  • [x] Documentation updated, tested make html command in the docs/ folder.

doursand avatar Jun 20 '22 16:06 doursand

/build

wyli avatar Jun 28 '22 11:06 wyli

@wyli

I made some corrections and went thru a new run for the checks, however it is now failing on a file which is not part of my PR

notation for "outputs"? Suggestion: "List[Union[ndarray[Any, Any], Tensor]]" monai/networks/blocks/feature_pyramid_network.py:196:42: error: Argument 1 to "kaiming_uniform_" has incompatible type "Union[Tensor, Module]"; expected "Tensor" [arg-type]

what is the strategy to remediate that ?

doursand avatar Jun 29 '22 08:06 doursand

that's from torch 1.12 update, i'm working on a fix https://github.com/Project-MONAI/MONAI/issues/4606

wyli avatar Jun 29 '22 08:06 wyli

Thanks @doursand ! I can't see where best_metric_model.pth or the two nii.gz files are used. Are they used? If so, would it be possible to minimise the size of the files added? Perhaps generate the model on the fly (doesn't need to be good quality), and use test images that we already have present?

rijobro avatar Jun 29 '22 08:06 rijobro

@rijobro you are absolutely right , these 2 files are not used at all. I believe that this is because I did a full test locally and it may have downloaded those files in my local repo. I will remove them and resubmit

doursand avatar Jun 29 '22 09:06 doursand

@wyli @rijobro I m done with this first release, could you review and share feedback ?

doursand avatar Jul 05 '22 16:07 doursand

Looks great, thanks for all the hard work. A few points:

  1. There are a few classes here that already exist in a more general form in our code base. I think the current MONAI transforms should be used in favour (e.g., ScaleIntensity instead of SignalNormalize), so some of these transforms can be deleted.
  2. There is repetition of methods such as _paste_slices. This implies to me that there should be more class inheritance.
  3. By default you've used TransformBackends.NUMPY, which makes sense when scikit is used. But when the transforms is doing simple maths, I think they could be ambivalent to numpy/torch input. I'd then love to see CPU and GPU tensors tested.
  4. It would be great if you could create visualisations for these so that they can be rendered in our documentation. See SpatialPad for example. Images are stored in another github repository: https://github.com/Project-MONAI/DocImages.

Once these are done, we'll have to do equivalent dictionary transforms, though they should be trivial.

rijobro avatar Jul 06 '22 09:07 rijobro

Thanks a lot for the review ,I'll try to allocate time in the coming weeks to progress on this. It should be faster as I get a (little) bit more familiar with monai in general. Again thanks for your time and valuable inputs!

doursand avatar Jul 06 '22 09:07 doursand

/black

wyli avatar Aug 30 '22 15:08 wyli

/build

wyli avatar Aug 30 '22 15:08 wyli

@wyli : the remaining errors are not related to my PR (tests.test_slice_inferer.TestSliceInferer) ...

doursand avatar Aug 30 '22 16:08 doursand

Hello guys! I loved this contribution. Are there any plans to do a transformation to EEG reading?

bruAristimunha avatar Aug 31 '22 21:08 bruAristimunha