Пример #1
0
    def generate_report(self, displayed_maps=10):
        """Generate an HTML report for the current ``NiftiMapsMasker`` object.

        .. note::
            This functionality requires to have ``Matplotlib`` installed.

        Parameters
        ----------
        displayed_maps : :obj:`int`, or :obj:`list`,\
        or :class:`~numpy.ndarray`, or "all", optional
            Indicates which maps will be displayed in the HTML report.

                - If "all": All maps will be displayed in the report.

                .. code-block:: python

                    masker.generate_report("all")

                .. warning:
                    If there are too many maps, this might be time and
                    memory consuming, and will result in very heavy
                    reports.

                - If a :obj:`list` or :class:`~numpy.ndarray`: This indicates
                  the indices of the maps to be displayed in the report. For
                  example, the following code will generate a report with maps
                  6, 3, and 12, displayed in this specific order:

                .. code-block:: python

                    masker.generate_report([6, 3, 12])

                - If an :obj:`int`: This will only display the first n maps,
                  n being the value of the parameter. By default, the report
                  will only contain the first 10 maps. Example to display the
                  first 16 maps:

                .. code-block:: python

                    masker.generate_report(16)

            Default=10.

        Returns
        -------
        report : `nilearn.reporting.html_report.HTMLReport`
            HTML report for the masker.
        """
        from nilearn.reporting.html_report import generate_report
        if (displayed_maps != "all"
                and not isinstance(displayed_maps, (list, np.ndarray, int))):
            raise TypeError("Parameter ``displayed_maps`` of "
                            "``generate_report()`` should be either 'all' or "
                            "an int, or a list/array of ints. You provided a "
                            f"{type(displayed_maps)}")
        self.displayed_maps = displayed_maps
        self.report_id += 1
        return generate_report(self)
Пример #2
0
 def generate_report(self):
     from nilearn.reporting.html_report import generate_report
     return generate_report(self)