"""Provide custom marker for FC on smoothed images."""


from junifer.api.decorators import register_marker
from junifer.markers import FunctionalConnectivityParcels
from nilearn.image import smooth_img
from junifer.utils import logger


@register_marker
class SmoothedFC(FunctionalConnectivityParcels):
    """Calculate FC after smoothing fMRI image."""

    def __init__(self, fwhm, name=None, *args, **kwargs):
        """Initialise class."""
        super().__init__(name=name, *args, **kwargs)
        print("=" * 80)
        print(fwhm)
        print("=" * 80)
        self._fwhm = fwhm
        logger.info(f"FWHM IS {fwhm}")

    def compute(self, input, extra_input=None):
        """Implement compute."""
        input["data"] = smooth_img(input["data"], fwhm=self._fwhm)
        return super().compute(input=input, extra_input=extra_input)
