code: def viz_displacement_mag(bundle, offsets, fname, interactive=False):
      """Render and plot displacement magnitude over the bundle.
  
      Parameters
      ----------
      bundle : Streamlines,
          Bundle to be rendered.
      offsets : List
          List containing displacement magnitdues per point on the bundle.
      fname: str
          Rendered scene is stored in a png file with that name.
      interactive : boolean, optional
          If True a 3D interactive rendering is created. Default is True.
  
      """
      scene = window.Scene()
      hue = (0.1, 0.9)
      hue = (0.9, 0.3)
      saturation = (0.5, 1)
      scene.background((1, 1, 1))
      lut_cmap = actor.colormap_lookup_table(
          scale_range=(offsets.min(), offsets.max()),
          hue_range=hue,
          saturation_range=saturation,
      )
  
      stream_actor = actor.line(
          bundle, offsets, linewidth=7, lookup_colormap=lut_cmap
      )
  
      stream_actor.RotateX(-70)
      stream_actor.RotateZ(90)
  
      scene.add(stream_actor)
      bar = actor.scalar_bar(lut_cmap)
  
      scene.add(bar)
  
      if interactive:
          window.show(scene)
  
      window.record(
          scene, n_frames=1, out_path=fname, size=(2000, 1500)
      )
      if interactive:
          im = plt.imread(fname)
          plt.figure(figsize=(10, 10))
          plt.imshow(im)
  
imports: from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 4 for calling a global function with example usage: viz_displacement_mag(bundle, offsets, fname, interactive) without return types