Opens a .lut file from the ImageJ/luts directory and returns 'true' if successful.
(String name)
| 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. */ |
no test coverage detected