original_docstring: 
      This function leverages nilearn's new javascript based brain viewer functions to create interactive plotting functionality.
  
      Args:
          brain (nltools.Brain_Data): a Brain_Data instance of 1d or 2d shape (i.e. 3d or 4d volume)
          threshold (float/str): threshold to initialize the visualization, maybe be a percentile string; default 0
          surface (bool): whether to create a surface-based plot; default False
          percentile_threshold (bool): whether to interpret threshold values as percentiles
          kwargs: optional arguments to nilearn.view_img or nilearn.view_img_on_surf
  
      Returns:
          interactive brain viewer widget
      
docstring: This function leverages nilearn's new javascript based brain viewer functions to create interactive plotting functionality.
docstring_tokens: This function leverages nilearn ' s new javascript based brain viewer functions to create interactive plotting functionality .
code: def plot_interactive_brain(
      brain,
      threshold=1e-6,
      surface=False,
      percentile_threshold=False,
      anatomical=None,
      **kwargs,
  ):
      """
      This function leverages nilearn's new javascript based brain viewer functions to create interactive plotting functionality.
  
      Args:
          brain (nltools.Brain_Data): a Brain_Data instance of 1d or 2d shape (i.e. 3d or 4d volume)
          threshold (float/str): threshold to initialize the visualization, maybe be a percentile string; default 0
          surface (bool): whether to create a surface-based plot; default False
          percentile_threshold (bool): whether to interpret threshold values as percentiles
          kwargs: optional arguments to nilearn.view_img or nilearn.view_img_on_surf
  
      Returns:
          interactive brain viewer widget
      """
  
      if ipywidgets is None:
          raise ImportError(
              "ipywidgets>=5.2.2 is required for interactive plotting. Please install this package manually or install nltools with optional arguments: pip install 'nltools[interactive_plots]'"
          )
  
      if isinstance(threshold, str):
          if threshold[-1] != "%":
              raise ValueError("Starting threshold provided as string must end in '%'")
          percentile_threshold = True
          warnings.warn(
              "Percentile thresholding ignores brain mask. Results are likely more liberal than you expect (e.g. with non-interactive plotting)!"
          )
          threshold = int(threshold[:-1])
  
      if len(brain.shape()) == 2:
          time_slider = True
          max_idx = brain.shape()[0] - 1
      elif len(brain.shape()) == 1:
          time_slider = False
      else:
          raise ValueError("Brain_Data object is not 1d or 2d")
  
      thresh_box = ipywidgets.widgets.FloatText(value=threshold, description="Threshold")
  
      if time_slider:
          idx = ipywidgets.widgets.IntSlider(
              min=0,
              max=max_idx,
              step=1,
              value=0,
              orientation="horizontal",
              continuous_update=False,
              description="Volume",
              readout_format="d",
          )
      else:
          idx = ipywidgets.widgets.HTML(
              value="Image is 3D", description="Volume", placeholder=""
          )
      ipywidgets.interact(
          _viewer,
          brain=ipywidgets.fixed(brain),
          thresh=thresh_box,
          idx=idx,
          percentile_threshold=percentile_threshold,
          surface=surface,
          anatomical=ipywidgets.fixed(anatomical),
          **kwargs,
      )
code_tokens: def plot_interactive_brain ( brain , threshold = 1e-6 , surface = False , percentile_threshold = False , anatomical = None , ** kwargs , ) : if ipywidgets is None : raise ImportError ( "ipywidgets>=5.2.2 is required for interactive plotting. Please install this package manually or install nltools with optional arguments: pip install 'nltools[interactive_plots]'" ) if isinstance ( threshold , str ) : if threshold [ - 1 ] != "%" : raise ValueError ( "Starting threshold provided as string must end in '%'" ) percentile_threshold = True warnings . warn ( "Percentile thresholding ignores brain mask. Results are likely more liberal than you expect (e.g. with non-interactive plotting)!" ) threshold = int ( threshold [ : - 1 ] ) if len ( brain . shape ( ) ) == 2 : time_slider = True max_idx = brain . shape ( ) [ 0 ] - 1 elif len ( brain . shape ( ) ) == 1 : time_slider = False else : raise ValueError ( "Brain_Data object is not 1d or 2d" ) thresh_box = ipywidgets . widgets . FloatText ( value = threshold , description = "Threshold" ) if time_slider : idx = ipywidgets . widgets . IntSlider ( min = 0 , max = max_idx , step = 1 , value = 0 , orientation = "horizontal" , continuous_update = False , description = "Volume" , readout_format = "d" , ) else : idx = ipywidgets . widgets . HTML ( value = "Image is 3D" , description = "Volume" , placeholder = "" ) ipywidgets . interact ( _viewer , brain = ipywidgets . fixed ( brain ) , thresh = thresh_box , idx = idx , percentile_threshold = percentile_threshold , surface = surface , anatomical = ipywidgets . fixed ( anatomical ) , ** kwargs , )
short_docstring: This function leverages nilearn's new javascript based brain viewer functions to create interactive plotting functionality.
short_docstring_tokens: This function leverages nilearn ' s new javascript based brain viewer functions to create interactive plotting functionality .
comment: """
      This function leverages nilearn's new javascript based brain viewer functions to create interactive plotting functionality.
  
      Args:
          brain (nltools.Brain_Data): a Brain_Data instance of 1d or 2d shape (i.e. 3d or 4d volume)
          threshold (float/str): threshold to initialize the visualization, maybe be a percentile string; default 0
          surface (bool): whether to create a surface-based plot; default False
          percentile_threshold (bool): whether to interpret threshold values as percentiles
          kwargs: optional arguments to nilearn.view_img or nilearn.view_img_on_surf
  
      Returns:
          interactive brain viewer widget
      """