Handle HSI images (to be tested)
This commit is contained in:
parent
fe2bba27e2
commit
dbb0a2ef30
@ -5,6 +5,7 @@ class ManifestMetadata {
|
|||||||
title = '';
|
title = '';
|
||||||
edition = '';
|
edition = '';
|
||||||
technique = '';
|
technique = '';
|
||||||
|
pca = null;
|
||||||
date = '';
|
date = '';
|
||||||
imageAuthor = '';
|
imageAuthor = '';
|
||||||
license = 'CC BY-NC-ND 4.0';
|
license = 'CC BY-NC-ND 4.0';
|
||||||
@ -18,6 +19,7 @@ class ManifestMetadata {
|
|||||||
* title,
|
* title,
|
||||||
* edition,
|
* edition,
|
||||||
* technique,
|
* technique,
|
||||||
|
* pca,
|
||||||
* date,
|
* date,
|
||||||
* imageAuthor,
|
* imageAuthor,
|
||||||
* license,
|
* license,
|
||||||
@ -32,6 +34,7 @@ class ManifestMetadata {
|
|||||||
// There should always be a technique value
|
// There should always be a technique value
|
||||||
// in the metadata param
|
// in the metadata param
|
||||||
this.technique = metadata.technique;
|
this.technique = metadata.technique;
|
||||||
|
this.pca = metadata.pca ?? this.pca;
|
||||||
this.date = metadata.date ?? this.date;
|
this.date = metadata.date ?? this.date;
|
||||||
this.imageAuthor = metadata.imageAuthor ?? this.imageAuthor
|
this.imageAuthor = metadata.imageAuthor ?? this.imageAuthor
|
||||||
this.license = metadata.license ?? this.license;
|
this.license = metadata.license ?? this.license;
|
||||||
@ -44,17 +47,26 @@ class ManifestMetadata {
|
|||||||
* @returns {Array<{label, value}>}
|
* @returns {Array<{label, value}>}
|
||||||
*/
|
*/
|
||||||
toObject() {
|
toObject() {
|
||||||
return [
|
let metadataObj = [
|
||||||
{label: "Papyrus", value: this.papyrus},
|
{label:"Papyrus", value: this.papyrus},
|
||||||
{label:"Author", value: this.author},
|
{label:"Author", value: this.author},
|
||||||
{label:"Title", value: this.title},
|
{label:"Title", value: this.title},
|
||||||
{label:"Reference edition", value: this.edition},
|
{label:"Reference edition", value: this.edition},
|
||||||
{label:"Technique", value: this.technique},
|
{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:"Date (Year)", value: this.date},
|
||||||
{label:"Image Author", value: this.imageAuthor},
|
{label:"Image Author", value: this.imageAuthor},
|
||||||
{label:"License", value: this.license},
|
{label:"License", value: this.license},
|
||||||
{label:"Copyright", value: this.copyright},
|
{label:"Copyright", value: this.copyright},
|
||||||
]
|
]);
|
||||||
|
|
||||||
|
return metadataObj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ const TECH_NAMES = {
|
|||||||
}
|
}
|
||||||
const authors = {
|
const authors = {
|
||||||
DAN: 'Danilo P. Pavone',
|
DAN: 'Danilo P. Pavone',
|
||||||
|
AUR: 'Aurélie Tournié',
|
||||||
|
SAB: 'Sabrina Samelo',
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* @param {string} imgFilename
|
* @param {string} imgFilename
|
||||||
@ -30,6 +32,16 @@ function extractNIRMetadata(imgFilename) {
|
|||||||
date: imgFilename.split('-')[0].match(/\d{4}/)[0],
|
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
|
* @param {string} imgFilename
|
||||||
* @returns {{papyrus:string,imageAuthor:string,date:string,copyright:string}}
|
* @returns {{papyrus:string,imageAuthor:string,date:string,copyright:string}}
|
||||||
@ -219,6 +231,7 @@ Common.getMetadataFromImgName = function (imgFilename, technique) {
|
|||||||
nir: extractNIRMetadata,
|
nir: extractNIRMetadata,
|
||||||
dn: extractDNMetadata,
|
dn: extractDNMetadata,
|
||||||
do: extractDOMetadata,
|
do: extractDOMetadata,
|
||||||
|
his: extractHSIMetadata,
|
||||||
}
|
}
|
||||||
|
|
||||||
return extractor[technique](imgFilename);
|
return extractor[technique](imgFilename);
|
||||||
|
Loading…
Reference in New Issue
Block a user