diff --git a/src/Metadata.js b/src/Metadata.js index c11e4a4..889d289 100644 --- a/src/Metadata.js +++ b/src/Metadata.js @@ -5,6 +5,7 @@ class ManifestMetadata { title = ''; edition = ''; technique = ''; + pca = null; date = ''; imageAuthor = ''; license = 'CC BY-NC-ND 4.0'; @@ -18,6 +19,7 @@ class ManifestMetadata { * title, * edition, * technique, + * pca, * date, * imageAuthor, * license, @@ -32,6 +34,7 @@ class ManifestMetadata { // There should always be a technique value // in the metadata param this.technique = metadata.technique; + this.pca = metadata.pca ?? this.pca; this.date = metadata.date ?? this.date; this.imageAuthor = metadata.imageAuthor ?? this.imageAuthor this.license = metadata.license ?? this.license; @@ -44,17 +47,26 @@ class ManifestMetadata { * @returns {Array<{label, value}>} */ toObject() { - return [ - {label: "Papyrus", value: this.papyrus}, + let metadataObj = [ + {label:"Papyrus", value: this.papyrus}, {label:"Author", value: this.author}, {label:"Title", value: this.title}, {label:"Reference edition", value: this.edition}, {label:"Technique", value: this.technique}, + ]; + + if (this.pca) { + metadataObj.push({label:"Principal Component Analysis",value: this.pca}); + } + + metadataObj.concat([ {label:"Date (Year)", value: this.date}, {label:"Image Author", value: this.imageAuthor}, {label:"License", value: this.license}, {label:"Copyright", value: this.copyright}, - ] + ]); + + return metadataObj; } } diff --git a/src/common.js b/src/common.js index 3f7f8da..fb1dd99 100644 --- a/src/common.js +++ b/src/common.js @@ -18,6 +18,8 @@ const TECH_NAMES = { } const authors = { DAN: 'Danilo P. Pavone', + AUR: 'Aurélie Tournié', + SAB: 'Sabrina Samelo', }; /** * @param {string} imgFilename @@ -30,6 +32,16 @@ function extractNIRMetadata(imgFilename) { date: imgFilename.split('-')[0].match(/\d{4}/)[0], } } +/** + * @param {string} imgFilename + * @returns {{papyrus:string,imageAuthor:string,pca:string,date:string}} + */ +function extractHSIMetadata(imgFilename) { + let hsi = extractNIRMetadata(imgFilename); + hsi.pca = imgFilename.split('_')[1].split('_')[2]; + + return hsi; +} /** * @param {string} imgFilename * @returns {{papyrus:string,imageAuthor:string,date:string,copyright:string}} @@ -219,6 +231,7 @@ Common.getMetadataFromImgName = function (imgFilename, technique) { nir: extractNIRMetadata, dn: extractDNMetadata, do: extractDOMetadata, + his: extractHSIMetadata, } return extractor[technique](imgFilename);