From 030f43d3b38ce3138a626f3946b9749cae721abb Mon Sep 17 00:00:00 2001 From: Chinmay Pandhare Date: Thu, 13 Jul 2017 02:23:51 +0530 Subject: [PATCH] Added Custom Colormap Support --- src/modules/SegmentedColormap.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/SegmentedColormap.js b/src/modules/SegmentedColormap.js index 005a3cd2..66145410 100644 --- a/src/modules/SegmentedColormap.js +++ b/src/modules/SegmentedColormap.js @@ -3,6 +3,9 @@ module.exports = function SegmentedColormap(options) { options = options || {}; options.title = "Segmented Colormap"; options.colormap = options.colormap || "default"; + if(typeof(options.colormap) == "object") + options.colormap = segmented_colormap(options.colormap); + else options.colormap = colormaps[options.colormap]; var output; function draw(input,callback) { @@ -10,7 +13,7 @@ module.exports = function SegmentedColormap(options) { function changePixel(r, g, b, a) { var ndvi = (b - r) / (r + b); var normalized = (ndvi + 1) / 2; - var res = colormaps[options.colormap](normalized); + var res = options.colormap(normalized); return [res[0], res[1], res[2], 255]; } function output(image,datauri,mimetype){