major restructuring, ui code separation and sequential processing

This commit is contained in:
jywarren
2017-01-06 01:39:03 -05:00
parent 55743961e3
commit 9e3f6b9aff
13 changed files with 3763 additions and 2355 deletions

View File

@@ -1,71 +1,12 @@
/*
* Core modules; externalized these wrapper modules with:
* 'image-select': require('./modules/ImageSelect.js'),
* Core modules
*/
module.exports = {
// How much of this wrapper is necessary?
// Could it be for UI, and the actual module is for functionality?
// But 'image-select' is not set up that way; it's UI. But it's special.
'image-select': function ImageSelect() {
'image-select': require('./modules/ImageSelect'),
'green-channel': require('./modules/GreenChannel'),
'ndvi-red': require('./modules/NdviRed'),
'plot': require('./modules/Plot'),
'image-threshold': require('./modules/ImageThreshold')
var imageselect;
function setup(onComplete) {
imageselect = require('./modules/ImageSelect.js')({
output: onComplete,
selector: '#drop'
});
}
function run(image, onComplete) {
if (onComplete) onComplete(get());
}
function get() {
return imageselect.getImage();
}
return {
title: "Select image",
run: run,
setup: setup,
get: get
}
},
'green-channel': require('./modules/GreenChannel.js'),
'ndvi-red': require('./modules/NdviRed.js'),
'plot': require('./modules/Plot.js'),
/*
'image-threshold': {
name: "Threshold image",
run: function imageThreshold(image, onComplete, options) {
options = options || {};
options.threshold = options.threshold || 30;
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
context.drawImage(image, 0, 0 );
var imageData = context.getImageData(0, 0, element.width, element.height);
var imageThreshold = require('../node_modules/image-filter-threshold/src/index.js');
var result = imageThreshold({
data: imageData,
threshold: options.threshold
}).then(function (result) {
var image = new Image();
image.onload = function onLoad() {
onComplete(image);
}
image.src = result;
});
}
}
*/
}