code: def _get_data_and_json_view(black_bg, cbar):
      # simple simulated data for stat_img and background
      bg_img, data = _simulate_img()
      stat_map_img, data = _simulate_img()
  
      # make a mask
      mask_img = new_img_like(
          stat_map_img, data > 0, stat_map_img.affine
      )
  
      # Get color bar and data ranges
      colors = colorscale(
          "cold_hot",
          data.ravel(),
          threshold=0,
          symmetric_cmap=True,
          vmax=1,
      )
  
      # Build a sprite
      json_view = html_stat_map._json_view_data(
          bg_img,
          stat_map_img,
          mask_img,
          bg_min=0,
          bg_max=1,
          black_bg=black_bg,
          colors=colors,
          cmap="cold_hot",
          colorbar=cbar,
      )
      return data, json_view
  
imports: import base64
  import warnings
  from io import BytesIO
  import numpy
  import pytest
  from matplotlib import pyplot
  from nibabel import Nifti1Image
  from nilearn import datasets, image
  from nilearn.image import get_data, new_img_like
  from nilearn.plotting import html_stat_map
  from ..js_plotting_utils import colorscale
label_desc: Use image node_id 14 for calling a global function with example usage: _get_data_and_json_view(black_bg, cbar) and returns: data,  json_view