code: def _separate_talairach_levels(
      atlas_img, labels, output_dir, verbose
  ):
      """Separate the multiple annotation levels in talairach raw atlas.
  
      The Talairach atlas has five levels of annotation: hemisphere, lobe, gyrus,
      tissue, brodmann area. They are mixed up in the original atlas: each label
      in the atlas corresponds to a 5-tuple containing, for each of these levels,
      a value or the string '*' (meaning undefined, background).
  
      This function disentangles the levels, and stores each in a separate image.
  
      The label '*' is replaced by 'Background' for clarity.
  
      """
      if verbose:
          print(
              f"Separating talairach atlas levels: {_TALAIRACH_LEVELS}"
          )
      for level_name, old_level_labels in zip(
          _TALAIRACH_LEVELS, np.asarray(labels).T
      ):
          if verbose:
              print(level_name)
          # level with most regions, ba, has 72 regions
          level_data = np.zeros(atlas_img.shape, dtype="uint8")
          level_labels = {"*": 0}
          for region_nb, region_name in enumerate(old_level_labels):
              level_labels.setdefault(region_name, len(level_labels))
              level_data[
                  get_data(atlas_img) == region_nb
              ] = level_labels[region_name]
          new_img_like(atlas_img, level_data).to_filename(
              str(output_dir.joinpath(f"{level_name}.nii.gz"))
          )
          level_labels = list(level_labels.keys())
          # rename '*' -> 'Background'
          level_labels[0] = "Background"
          output_dir.joinpath(f"{level_name}-labels.json").write_text(
              json.dumps(level_labels), "utf-8"
          )
  
imports: import json
  import os
  import re
  import shutil
  import warnings
  import xml.etree.ElementTree
  from pathlib import Path
  from tempfile import mkdtemp
  import nibabel
  import numpy
  import pandas
  from sklearn.utils import Bunch
  from .._utils import check_niimg, fill_doc
  from ..image import get_data, new_img_like, reorder_img
  from ._utils import fetch_files, get_dataset_descr, get_dataset_dir
label_desc: Use image node_id 20 for calling a global function with example usage: _separate_talairach_levels(atlas_img, labels, output_dir, verbose) without return types