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
|
// 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;
|
||||||
@ -53,18 +52,11 @@ class ManifestMetadata {
|
|||||||
{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 = 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;
|
return metadataObj;
|
||||||
}
|
}
|
||||||
|
@ -32,16 +32,6 @@ 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('_')[3].replace(/\..*$/,'');
|
|
||||||
|
|
||||||
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}}
|
||||||
@ -160,10 +150,16 @@ Common.createCanvas = async function (manifest, filename) {
|
|||||||
const canvasName = filename.split('_')[namePos[manifest.technique]]
|
const canvasName = filename.split('_')[namePos[manifest.technique]]
|
||||||
.replace(/\.\w{1,3}$/, '');
|
.replace(/\.\w{1,3}$/, '');
|
||||||
canvas.generateID(manifest.resourceId, canvasName);
|
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) {
|
.replace(/c(\w{1,2})0+(\d+).*(\.\w{2,3})?$/i, function (str, c, number) {
|
||||||
return `C${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);
|
let image = new Image(canvas.id);
|
||||||
image.generateID(process.env.IMAGE_SERVER_URL, filename);
|
image.generateID(process.env.IMAGE_SERVER_URL, filename);
|
||||||
@ -232,7 +228,7 @@ Common.getMetadataFromImgName = function (imgFilename, technique) {
|
|||||||
nir: extractNIRMetadata,
|
nir: extractNIRMetadata,
|
||||||
dn: extractDNMetadata,
|
dn: extractDNMetadata,
|
||||||
do: extractDOMetadata,
|
do: extractDOMetadata,
|
||||||
hsi: extractHSIMetadata,
|
hsi: extractNIRMetadata,
|
||||||
}
|
}
|
||||||
|
|
||||||
return extractor[technique](imgFilename);
|
return extractor[technique](imgFilename);
|
||||||
|
Loading…
Reference in New Issue
Block a user