Created
August 13, 2015 09:01
-
-
Save mutterer/97dafaf6bb2988945f6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// grab the Viridis (option-d) colormap from Berkeley Institute for Data Science GitHub repo | |
// and parse it to an ImageJ LUT | |
// Viridis colormap presented @ SciPy 2015 by Nathaniel Smith and Stéfan van der Walt | |
s=File.openUrlAsString("https://raw.githubusercontent.com/BIDS/colormap/master/option_d.py"); | |
s=substring(s,indexOf(s,"[[")+1,indexOf(s,"]]")+1); | |
s=replace(s,'\n\n','\n'); | |
s=replace(s,' ',''); | |
s=split(s,'\n'); | |
length = s.length; | |
reds = newArray(length); | |
greens = newArray(length); | |
blues = newArray(length); | |
for (i=0;i<s.length;i++) { | |
l=split(substring (s[i],1,lengthOf(s[i])-2),','); | |
reds[i] = 255*l[0]; | |
greens[i] = 255*l[1]; | |
blues[i] = 255*l[2]; | |
} | |
run("Bridge (174K)"); | |
setLut(reds, greens, blues); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment