class_docstr: Automatic detection and parsing of API docs to Sphinx-parsable reST format.
class_docstr_tok: ["Automatic","detection","and","parsing","of","API","docs","to","Sphinx-parsable","reST","format","."]
docstr: Make a reST API index file from the written files.
  
  Parameters
  ----------
  outdir : string
      Directory to which to write generated index file.
  froot : string, optional
      Root (filename without extension) of filename to write to
      Defaults to 'gen'. We add ``self.rst_extension``.
  relative_to : string
      Path to which written filenames are relative. This
      component of the written file path will be removed from
      outdir, in the generated index. Default is None, meaning,
      leave path as it is.
docstr_tok: ["Make","a","reST","API","index","file","from","the","written","files",".","Parameters","--","--","--","--","--","outdir",":","string","Directory","to","which","to","write","generated","index","file",".","froot",":","string",",","optional","Root","(","filename","without","extension",")","of","filename","to","write","to","Defaults","to","'gen","'",".","We","add","``","self.rst_extension","``",".","relative_to",":","string","Path","to","which","written","filenames","are","relative",".","This","component","of","the","written","file","path","will","be","removed","from","outdir",",","in","the","generated","index",".","Default","is","None",",","meaning",",","leave","path","as","it","is","."]
code: def write_index(self, outdir, froot="gen", relative_to=None):
      """Make a reST API index file from the written files.
  
      Parameters
      ----------
      outdir : string
          Directory to which to write generated index file.
      froot : string, optional
          Root (filename without extension) of filename to write to
          Defaults to 'gen'. We add ``self.rst_extension``.
      relative_to : string
          Path to which written filenames are relative. This
          component of the written file path will be removed from
          outdir, in the generated index. Default is None, meaning,
          leave path as it is.
      """
      if self.written_modules is None:
          raise ValueError("No modules written")
      # Get full filename path
      path = os.path.join(outdir, froot + self.rst_extension)
      # Path written into index is relative to rootpath
      if relative_to is not None:
          relpath = (outdir + os.path.sep).replace(
              relative_to + os.path.sep, ""
          )
      else:
          relpath = outdir
      print("outdir: ", relpath)
      with open(path, "w") as idx:
          w = idx.write
          w(".. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n")
  
          # We look at the module name.
          # If it is `skimage`, display,
          # if `skimage.submodule`, only show `submodule`,
          # if it is `skimage.submodule.subsubmodule`, ignore.
  
          title = "API reference"
          w(title + "\n")
          w("=" * len(title) + "\n\n")
  
          w(".. toctree::\n")
          w("   :maxdepth: 1\n\n")
          for f in self.written_modules:
              w(f"   {os.path.join(relpath, f)}\n\n")
  
          w("----------------------\n\n")
          w(".. toctree::\n")
          w("   :maxdepth: 1\n\n")
          w("   ../license\n")
  
file_path: scikit-image/doc/tools/apigen.py
imports: import os
  import re
  from types import BuiltinFunctionType, FunctionType, ModuleType
label_desc: Use image node_id 16 for calling the ApiDocWriter obj's underlying member method code with example usage: obj.write_index(outdir, froot, relative_to) without return types