class_docstr: Implementation of ``ClientAlgoStats`` to allow federated learning with MONAI bundle configurations.
  
  Args:
      bundle_root: directory path of the bundle.
      config_train_filename: bundle training config path relative to bundle_root. Can be a list of files;
          defaults to "configs/train.json". only useful when `workflow` is None.
      config_filters_filename: filter configuration file. Can be a list of files; defaults to `None`.
      data_stats_transform_list: transforms to apply for the data stats result.
      histogram_only: whether to only compute histograms. Defaults to False.
      workflow: the bundle workflow to execute, usually it's training, evaluation or inference.
          if None, will create an `ConfigWorkflow` internally based on `config_train_filename`.
class_docstr_tok: ["Implementation","of","``","ClientAlgoStats","``","to","allow","federated","learning","with","MONAI","bundle","configurations",".","Args",":","bundle_root",":","directory","path","of","the","bundle",".","config_train_filename",":","bundle","training","config","path","relative","to","bundle_root",".","Can","be","a","list","of","files",";","defaults","to","``","configs\/train.json","''",".","only","useful","when","`","workflow","`","is","None",".","config_filters_filename",":","filter","configuration","file",".","Can","be","a","list","of","files",";","defaults","to","`","None","`",".","data_stats_transform_list",":","transforms","to","apply","for","the","data","stats","result",".","histogram_only",":","whether","to","only","compute","histograms",".","Defaults","to","False",".","workflow",":","the","bundle","workflow","to","execute",",","usually","it","'s","training",",","evaluation","or","inference",".","if","None",",","will","create","an","`","ConfigWorkflow","`","internally","based","on","`","config_train_filename","`","."]
docstr: Returns summary statistics about the local data.
  
  Args:
      extra: Dict with additional information that can be provided by the FL system.
              Both FlStatistics.HIST_BINS and FlStatistics.HIST_RANGE must be provided.
  
  Returns:
      stats: ExchangeObject with summary statistics.
docstr_tok: ["Returns","summary","statistics","about","the","local","data",".","Args",":","extra",":","Dict","with","additional","information","that","can","be","provided","by","the","FL","system",".","Both","FlStatistics.HIST_BINS","and","FlStatistics.HIST_RANGE","must","be","provided",".","Returns",":","stats",":","ExchangeObject","with","summary","statistics","."]
code: def get_data_stats(self, extra: dict | None = None) -> ExchangeObject:
      """
      Returns summary statistics about the local data.
  
      Args:
          extra: Dict with additional information that can be provided by the FL system.
                  Both FlStatistics.HIST_BINS and FlStatistics.HIST_RANGE must be provided.
  
      Returns:
          stats: ExchangeObject with summary statistics.
  
      """
      if extra is None:
          raise ValueError("`extra` has to be set")
  
      if self.workflow.dataset_dir:  # type: ignore
          self.phase = FlPhase.GET_DATA_STATS
          self.logger.info(f"Computing statistics on {self.workflow.dataset_dir}")  # type: ignore
  
          if FlStatistics.HIST_BINS not in extra:
              raise ValueError(
                  "FlStatistics.NUM_OF_BINS not specified in `extra`"
              )
          else:
              hist_bins = extra[FlStatistics.HIST_BINS]
          if FlStatistics.HIST_RANGE not in extra:
              raise ValueError(
                  "FlStatistics.HIST_RANGE not specified in `extra`"
              )
          else:
              hist_range = extra[FlStatistics.HIST_RANGE]
  
          stats_dict = {}
  
          # train data stats
          (
              train_summary_stats,
              train_case_stats,
          ) = self._get_data_key_stats(
              data=self.workflow.train_dataset_data,  # type: ignore
              data_key=self.train_data_key,
              hist_bins=hist_bins,
              hist_range=hist_range,
              output_path=os.path.join(
                  self.app_root, "train_data_stats.yaml"
              ),
          )
          if train_case_stats:
              # Only return summary statistics to FL server
              stats_dict.update(
                  {self.train_data_key: train_summary_stats}
              )
  
          # eval data stats
          eval_summary_stats = None
          eval_case_stats = None
          if self.workflow.val_dataset_data is not None:  # type: ignore
              (
                  eval_summary_stats,
                  eval_case_stats,
              ) = self._get_data_key_stats(
                  data=self.workflow.val_dataset_data,  # type: ignore
                  data_key=self.eval_data_key,
                  hist_bins=hist_bins,
                  hist_range=hist_range,
                  output_path=os.path.join(
                      self.app_root, "eval_data_stats.yaml"
                  ),
              )
          else:
              self.logger.warning(
                  "the datalist doesn't contain validation section."
              )
          if eval_summary_stats:
              # Only return summary statistics to FL server
              stats_dict.update(
                  {self.eval_data_key: eval_summary_stats}
              )
  
          # total stats
          if train_case_stats and eval_case_stats:
              # Compute total summary
              total_summary_stats = self._compute_total_stats(
                  [train_case_stats, eval_case_stats],
                  hist_bins,
                  hist_range,
              )
              stats_dict.update(
                  {FlStatistics.TOTAL_DATA: total_summary_stats}
              )
  
          # optional filter of data stats
          stats = ExchangeObject(statistics=stats_dict)
          if self.post_statistics_filters is not None:
              for _filter in self.post_statistics_filters:
                  stats = _filter(stats, extra)
  
          return stats
      else:
          raise ValueError("data_root not set!")
  
imports: from __future__ import annotations
  import os
  import time
  from collections.abc import Mapping, MutableMapping
  from typing import Any, cast
  import torch
  import torch.distributed
  from monai.apps.auto3dseg.data_analyzer import DataAnalyzer
  from monai.apps.utils import get_logger
  from monai.auto3dseg import SegSummarizer
  from monai.bundle import BundleWorkflow, ConfigComponent, ConfigItem, ConfigParser, ConfigWorkflow
  from monai.engines import SupervisedEvaluator, SupervisedTrainer, Trainer
  from monai.fl.client import ClientAlgo, ClientAlgoStats
  from monai.fl.utils.constants import ExtraItems, FiltersType, FlPhase, FlStatistics, ModelType, WeightType
  from monai.fl.utils.exchange_object import ExchangeObject
  from monai.networks.utils import copy_model_state, get_state_dict
  from monai.utils import min_version, require_pkg
  from monai.utils.enums import DataStatsKeys
label_desc: Use image node_id 3 for calling the MonaiAlgoStats obj's underlying member method code with example usage: obj.get_data_stats(extra) and returns: stats