Skip to content

Commit

Permalink
Fix Meta modules and add inputs to ndvi-colormap (#1432)
Browse files Browse the repository at this point in the history
* 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 <jeff@unterbahn.com>
  • Loading branch information
3 people committed Jan 8, 2020
1 parent 448848b commit c453bbb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
20 changes: 19 additions & 1 deletion src/modules/NdviColormap/info.json
Original file line number Diff line number Diff line change
@@ -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"
}
13 changes: 7 additions & 6 deletions src/util/createMetaModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit c453bbb

Please sign in to comment.