smoothed_fc.py 850 B

1234567891011121314151617181920212223242526
  1. """Provide custom marker for FC on smoothed images."""
  2. from junifer.api.decorators import register_marker
  3. from junifer.markers import FunctionalConnectivityParcels
  4. from nilearn.image import smooth_img
  5. from junifer.utils import logger
  6. @register_marker
  7. class SmoothedFC(FunctionalConnectivityParcels):
  8. """Calculate FC after smoothing fMRI image."""
  9. def __init__(self, fwhm, name=None, *args, **kwargs):
  10. """Initialise class."""
  11. super().__init__(name=name, *args, **kwargs)
  12. print("=" * 80)
  13. print(fwhm)
  14. print("=" * 80)
  15. self._fwhm = fwhm
  16. logger.info(f"FWHM IS {fwhm}")
  17. def compute(self, input, extra_input=None):
  18. """Implement compute."""
  19. input["data"] = smooth_img(input["data"], fwhm=self._fwhm)
  20. return super().compute(input=input, extra_input=extra_input)