PCA number in label, not metadata
This commit is contained in:
parent
18217ad89e
commit
0cf0df54af
@ -34,7 +34,6 @@ 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;
|
||||
@ -53,18 +52,11 @@ class ManifestMetadata {
|
||||
{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 = 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;
|
||||
}
|
||||
|
@ -32,16 +32,6 @@ 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('_')[3].replace(/\..*$/,'');
|
||||
|
||||
return hsi;
|
||||
}
|
||||
/**
|
||||
* @param {string} imgFilename
|
||||
* @returns {{papyrus:string,imageAuthor:string,date:string,copyright:string}}
|
||||
@ -160,10 +150,16 @@ Common.createCanvas = async function (manifest, filename) {
|
||||
const canvasName = filename.split('_')[namePos[manifest.technique]]
|
||||
.replace(/\.\w{1,3}$/, '');
|
||||
canvas.generateID(manifest.resourceId, canvasName);
|
||||
canvas.label = canvasName
|
||||
let label = canvasName
|
||||
.replace(/c(\w{1,2})0+(\d+).*(\.\w{2,3})?$/i, function (str, c, number) {
|
||||
return `C${c}. ${number}`;
|
||||
});
|
||||
// Add PCA to canvas label for HSI images
|
||||
if (manifest.technique === 'hsi') {
|
||||
label += ` ${filename.split('_')[3].replace(/\..*$/,'')}`;
|
||||
}
|
||||
|
||||
canvas.label = label;
|
||||
|
||||
let image = new Image(canvas.id);
|
||||
image.generateID(process.env.IMAGE_SERVER_URL, filename);
|
||||
@ -232,7 +228,7 @@ Common.getMetadataFromImgName = function (imgFilename, technique) {
|
||||
nir: extractNIRMetadata,
|
||||
dn: extractDNMetadata,
|
||||
do: extractDOMetadata,
|
||||
hsi: extractHSIMetadata,
|
||||
hsi: extractNIRMetadata,
|
||||
}
|
||||
|
||||
return extractor[technique](imgFilename);
|
||||
|
Loading…
Reference in New Issue
Block a user