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: (35 ** (8 - prefix)) - start

Changed in version 3.0: The characters used when alphanumeric is True have been reduced to [0-9][A-I,K-Z]

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-I,K-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).