From c453bbbd922e3c7d1b026b57d77c80a53a3c4e8e Mon Sep 17 00:00:00 2001 From: Rishabh Shukla <42492389+blurry-x-face@users.noreply.github.com> Date: Thu, 9 Jan 2020 02:44:50 +0530 Subject: [PATCH] Fix Meta modules and add inputs to ndvi-colormap (#1432) * fix meta module bug * fix create meta module and add inputs to ndvi-colormap Co-authored-by: Harsh Khandeparkar <34770591+HarshKhandeparkar@users.noreply.github.com> Co-authored-by: Jeffrey Warren --- src/modules/NdviColormap/info.json | 20 +++++++++++++++++++- src/util/createMetaModule.js | 13 +++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/modules/NdviColormap/info.json b/src/modules/NdviColormap/info.json index 7b521065..0e25cb7c 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 d22c26ce..a20e2e9b 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,13 @@ 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);