TemplateList fromGallery(const File &gallery)

Create a TemplateList from a gallery File.

  • function definition:

    static TemplateList fromGallery(const File &gallery)
    
  • parameters:

    Parameter Type Description
    gallery const File & Gallery file to be enrolled.
  • output: (TemplateList) Returns a TemplateList created by enrolling the gallery.

TemplateList fromBuffer(const QByteArray &buffer)

Create a template from a memory buffer of individual templates. This is compatible with .gal galleries.

  • function definition:

    static TemplateList fromBuffer(const QByteArray &buffer)
    
  • parameters:

    Parameter Type Description
    buffer const QByteArray & Raw data buffer to be enrolled
  • output: (TemplateList) Returns a TemplateList created by enrolling the buffer

TemplateList relabel(const TemplateList &tl, const QString &propName, bool preserveIntegers)

Relabel the values associated with a given key in the metadata of a provided TemplateList. The values are relabeled to be between [0, numClasses-1]. If preserveIntegers is true and the metadata can be converted to integers then numClasses equals the maximum value in the values. Otherwise, numClasses equals the number of unique values. The relabeled values are stored in the "Label" field of the returned TemplateList.

  • function definition:

    static TemplateList relabel(const TemplateList &tl, const QString &propName, bool preserveIntegers)
    
  • parameters:

    Parameter Type Description
    tl const TemplateList & TemplateList to be relabeled
    propName const QString & Metadata key
    preserveIntegers bool If true attempt to use the metadata values as the relabeled values. Otherwise use the number of unique values.
  • output: (TemplateList) Returns a TemplateList identical to the input TemplateList but with the new labels appended to the metadata using the "Label" key.

  • example:
    Template t1, t2, t3;
    
    t1.file.set("Class", QString("1"));
    t2.file.set("Class", QString("10"));
    t3.file.set("Class", QString("100"));
    TemplateList tList(QList<Template>() << t1 << t2 << t3);
    
    TemplateList relabeled = TemplateList::relabel(tList, "Class", true);
    relabeled.files(); // returns [[Class=1, Label=1], [Class=10, Label=10], [Class=100, Label=100]]
    
    relabeled = TemplateList::relabel(tList, "Class", false);
    relabeled.files(); // returns [[Class=1, Label=0], [Class=10, Label=1], [Class=100, Label=2]]