From 2c02c27770b7382ddfbdef5d244308de3baaff6c Mon Sep 17 00:00:00 2001 From: Firela Date: Mon, 6 Jan 2020 14:00:08 +0530 Subject: [PATCH 1/2] fix meta module bug --- src/util/createMetaModule.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/createMetaModule.js b/src/util/createMetaModule.js index 2cb6dbcaf9..d22c26cef0 100644 --- a/src/util/createMetaModule.js +++ b/src/util/createMetaModule.js @@ -36,12 +36,12 @@ module.exports = function createMetaModule(mapFunction, moduleOptions) { */ // ui: false prevents internal logs - var internalSequencer = ImageSequencer({ inBrowser: false, ui: false }); function draw(input, callback) { var step = this; - + + var internalSequencer = ImageSequencer({ inBrowser: false, ui: false }); internalSequencer.loadImage(input.src, function onAddImage() { internalSequencer.importJSON(steps); internalSequencer.run(function onCallback(internalOutput) { From 8c6486a32afca03cd56ceef364c883a294707f37 Mon Sep 17 00:00:00 2001 From: Firela Date: Tue, 7 Jan 2020 03:17:50 +0530 Subject: [PATCH 2/2] fix create meta module and add inputs to ndvi-colormap --- src/modules/NdviColormap/info.json | 20 +++++++++++++++++++- src/util/createMetaModule.js | 14 ++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/modules/NdviColormap/info.json b/src/modules/NdviColormap/info.json index 7b52106535..0e25cb7c5e 100644 --- a/src/modules/NdviColormap/info.json +++ b/src/modules/NdviColormap/info.json @@ -1,6 +1,24 @@ { "name": "ndvi-colormap", "description": "Sequentially Applies NDVI and Colormap steps", - "inputs": {}, + "inputs": { + "filter": { + "type": "select", + "desc": "Filter color", + "default": "red", + "values": ["red", "blue"] + }, + "colormap": { + "type": "select", + "desc": "Name of the Colormap", + "default": "default", + "values": [ + "default", + "greyscale", + "stretched", + "fastie" + ] + } + }, "docs-link": "https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md#ndvi-colormap-module" } diff --git a/src/util/createMetaModule.js b/src/util/createMetaModule.js index d22c26cef0..3323198d81 100644 --- a/src/util/createMetaModule.js +++ b/src/util/createMetaModule.js @@ -16,11 +16,6 @@ module.exports = function createMetaModule(mapFunction, moduleOptions) { } } - // map inputs to internal step options; - // use this to set defaults for internal steps - // and to expose internal settings as external meta-module parameters; - // it must return a steps object - var steps = mapFunction(options); /* example: function mapFunction(opt, _defaults) { @@ -40,7 +35,14 @@ module.exports = function createMetaModule(mapFunction, moduleOptions) { function draw(input, callback) { var step = this; - + + + // map inputs to internal step options; + // use this to set defaults for internal steps + // and to expose internal settings as external meta-module parameters; + // it must return a steps object + var steps = mapFunction(options); + var internalSequencer = ImageSequencer({ inBrowser: false, ui: false }); internalSequencer.loadImage(input.src, function onAddImage() { internalSequencer.importJSON(steps);