pydicom.fileset.generate_filename

pydicom.fileset.generate_filename(prefix: str = '', start: int = 0, alphanumeric: bool = False) Iterator[str][source]

Yield File IDs for a File-set.

Maximum number of File IDs is:

  • Numeric: (10 ** (8 - prefix)) - start

  • Alphanumeric: (36 ** (8 - prefix)) - start

Parameters:
  • prefix (str, optional) – The prefix to use for all filenames, default ("").

  • start (int, optional) – The starting index to use for the suffixes, (default 0). i.e. if you want to start at '00010' then start should be 10.

  • alphanumeric (bool, optional) – If False (default) then only generate suffixes using the characters [0-9], otherwise use [0-9][A-Z].

Yields:

str – A unique filename with 8 characters, with each incremented by 1 from the previous one (i.e. '00000000', '00000001', '00000002', and so on).