class_docstr: A utility class to create organized filenames within ``output_dir``. The
  ``filename`` method could be used to create a filename following the folder structure.
  
  Example:
  
  .. code-block:: python
  
      from monai.data import FolderLayout
  
      layout = FolderLayout(
          output_dir="/test_run_1/",
          postfix="seg",
          extension="nii",
          makedirs=False)
      layout.filename(subject="Sub-A", idx="00", modality="T1")
      # return value: "/test_run_1/Sub-A_seg_00_modality-T1.nii"
  
  The output filename is a string starting with a ``subject`` ID, and
  includes additional information about a customized index and image
  modality.  This utility class doesn't alter the underlying image data, but
  provides a convenient way to create filenames.
class_docstr_tok: ["A","utility","class","to","create","organized","filenames","within","``","output_dir","``",".","The","``","filename","``","method","could","be","used","to","create","a","filename","following","the","folder","structure",".","Example",":","..","code-block",":",":","python","from","monai.data","import","FolderLayout","layout","=","FolderLayout","(","output_dir=","''","\/test_run_1\/","''",",","postfix=","''","seg","''",",","extension=","''","nii","''",",","makedirs=False",")","layout.filename","(","subject=","''","Sub-A","''",",","idx=","''","00","''",",","modality=","''","T1","''",")","#","return","value",":","``","\/test_run_1\/Sub-A_seg_00_modality-T1.nii","''","The","output","filename","is","a","string","starting","with","a","``","subject","``","ID",",","and","includes","additional","information","about","a","customized","index","and","image","modality",".","This","utility","class","does","n't","alter","the","underlying","image","data",",","but","provides","a","convenient","way","to","create","filenames","."]
docstr: Create a filename based on the input ``subject`` and ``idx``.
  
  The output filename is formed as:
  
      ``output_dir/[subject/]subject[_postfix][_idx][_key-value][ext]``
  
  Args:
      subject: subject name, used as the primary id of the output filename.
          When a `PathLike` object is provided, the base filename will be used as the subject name,
          the extension name of `subject` will be ignored, in favor of ``extension``
          from this class's constructor.
      idx: additional index name of the image.
      kwargs: additional keyword arguments to be used to form the output filename.
          The key-value pairs will be appended to the output filename as ``f"_{k}-{v}"``.
docstr_tok: ["Create","a","filename","based","on","the","input","``","subject","``","and","``","idx","``",".","The","output","filename","is","formed","as",":","``","output_dir\/","[","subject\/","]","subject","[","_postfix","]","[","_idx","]","[","_key-value","]","[","ext","]","``","Args",":","subject",":","subject","name",",","used","as","the","primary","id","of","the","output","filename",".","When","a","`","PathLike","`","object","is","provided",",","the","base","filename","will","be","used","as","the","subject","name",",","the","extension","name","of","`","subject","`","will","be","ignored",",","in","favor","of","``","extension","``","from","this","class","'s","constructor",".","idx",":","additional","index","name","of","the","image",".","kwargs",":","additional","keyword","arguments","to","be","used","to","form","the","output","filename",".","The","key-value","pairs","will","be","appended","to","the","output","filename","as","``","f","''","_","{","k","}","-","{","v","}","''","``","."]
code: def filename(
      self, subject: PathLike = "subject", idx=None, **kwargs
  ) -> PathLike:
      """
      Create a filename based on the input ``subject`` and ``idx``.
  
      The output filename is formed as:
  
          ``output_dir/[subject/]subject[_postfix][_idx][_key-value][ext]``
  
      Args:
          subject: subject name, used as the primary id of the output filename.
              When a `PathLike` object is provided, the base filename will be used as the subject name,
              the extension name of `subject` will be ignored, in favor of ``extension``
              from this class's constructor.
          idx: additional index name of the image.
          kwargs: additional keyword arguments to be used to form the output filename.
              The key-value pairs will be appended to the output filename as ``f"_{k}-{v}"``.
      """
      full_name = create_file_basename(
          postfix=self.postfix,
          input_file_name=subject,
          folder_path=self.output_dir,
          data_root_dir=self.data_root_dir,
          separate_folder=self.parent,
          patch_index=idx,
          makedirs=self.makedirs,
      )
      for k, v in kwargs.items():
          full_name += f"_{k}-{v}"
      if self.ext is not None:
          ext = f"{self.ext}"
          full_name += (
              f".{ext}" if ext and not ext.startswith(".") else f"{ext}"
          )
      return full_name
  
file_path: MONAI/monai/data/folder_layout.py
imports: from __future__ import annotations
  from abc import ABC, abstractmethod
  import monai
  from monai.config import PathLike
  from monai.data.utils import create_file_basename
label_desc: Use image node_id 2 for calling the FolderLayout obj's underlying member method code with example usage: obj.filename(subject, idx) and returns: full_name