MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / setLut

Method setLut

ij/src/main/java/ij/macro/Functions.java:2138–2164  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2136 }
2137
2138 void setLut() {
2139 double[] reds = getFirstArray();
2140 double[] greens = getNextArray();
2141 double[] blues = getLastArray();
2142 int length = reds.length;
2143 if (greens.length!=length || blues.length!=length)
2144 interp.error("Arrays are not the same length");
2145 ImagePlus imp = getImage();
2146 if (imp.getBitDepth()==24)
2147 interp.error("Non-RGB image expected");
2148 ImageProcessor ip = getProcessor();
2149 byte[] r = new byte[length];
2150 byte[] g = new byte[length];
2151 byte[] b = new byte[length];
2152 for (int i=0; i<length; i++) {
2153 r[i] = (byte)reds[i];
2154 g[i] = (byte)greens[i];
2155 b[i] = (byte)blues[i];
2156 }
2157 LUT lut = new LUT(8, length, r, g, b);
2158 if (imp.isComposite())
2159 ((CompositeImage)imp).setChannelLut(lut);
2160 else
2161 ip.setColorModel(lut);
2162 imp.updateAndDraw();
2163 updateNeeded = false;
2164 }
2165
2166 void getThreshold() {
2167 Variable lower = getFirstVariable();

Callers 2

doFunctionMethod · 0.95
doColorMethod · 0.95

Calls 11

getFirstArrayMethod · 0.95
getNextArrayMethod · 0.95
getLastArrayMethod · 0.95
getImageMethod · 0.95
getBitDepthMethod · 0.95
getProcessorMethod · 0.95
isCompositeMethod · 0.95
setColorModelMethod · 0.95
updateAndDrawMethod · 0.95
setChannelLutMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected