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

Method loadLut

ij/src/main/java/ij/Executer.java:216–243  ·  view source on GitHub ↗

Opens a .lut file from the ImageJ/luts directory and returns 'true' if successful.

(String name)

Source from the content-addressed store, hash-verified

214
215 /** Opens a .lut file from the ImageJ/luts directory and returns 'true' if successful. */
216 public static boolean loadLut(String name) {
217 String path = IJ.getDirectory("luts")+name.replace(" ","_")+".lut";
218 File f = new File(path);
219 if (!f.exists()) {
220 path = IJ.getDirectory("luts")+name+".lut";
221 f = new File(path);
222 }
223 if (!f.exists()) {
224 path = IJ.getDirectory("luts")+name.toLowerCase().replace(" ","_")+".lut";
225 f = new File(path);
226 }
227 if (!f.exists() && Character.isLowerCase(name.charAt(0))) {
228 String name2 = name.substring(0,1).toUpperCase()+name.substring(1);
229 path = IJ.getDirectory("luts")+name2+".lut";
230 f = new File(path);
231 }
232 if (!f.exists() && name.toLowerCase().equals("viridis")) {
233 path = IJ.getDirectory("luts")+"mpl-viridis.lut"; //Fiji version
234 f = new File(path);
235 }
236 if (f.exists()) {
237 String dir = OpenDialog.getLastDirectory();
238 IJ.open(path);
239 OpenDialog.setLastDirectory(dir);
240 return true;
241 }
242 return false;
243 }
244
245 /** Opens a file from the File/Open Recent menu
246 and returns 'true' if successful. */

Callers 1

runCommandMethod · 0.95

Calls 9

getDirectoryMethod · 0.95
getLastDirectoryMethod · 0.95
openMethod · 0.95
setLastDirectoryMethod · 0.95
charAtMethod · 0.80
substringMethod · 0.80
replaceMethod · 0.45
existsMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected