()
| 180 | |
| 181 | // Conversion Options |
| 182 | void conversions() { |
| 183 | double[] weights = ColorProcessor.getWeightingFactors(); |
| 184 | boolean weighted = !(weights[0]==1d/3d && weights[1]==1d/3d && weights[2]==1d/3d); |
| 185 | //boolean weighted = !(Math.abs(weights[0]-1d/3d)<0.0001 && Math.abs(weights[1]-1d/3d)<0.0001 && Math.abs(weights[2]-1d/3d)<0.0001); |
| 186 | GenericDialog gd = new GenericDialog("Conversion Options"); |
| 187 | gd.addCheckbox("Scale when converting", ImageConverter.getDoScaling()); |
| 188 | gd.setInsets(0,40,0); |
| 189 | gd.addCheckbox("Calibrate", Prefs.calibrateConversions); |
| 190 | String prompt = "Weighted RGB conversions"; |
| 191 | if (weighted) |
| 192 | prompt += " (" + IJ.d2s(weights[0]) + "," + IJ.d2s(weights[1]) + ","+ IJ.d2s(weights[2]) + ")"; |
| 193 | gd.addCheckbox(prompt, weighted); |
| 194 | gd.addCheckbox("Full range 16-bit inversions", Prefs.fullRange16bitInversions); |
| 195 | gd.addHelp(IJ.URL2+"/docs/menus/edit.html#conversions"); |
| 196 | gd.showDialog(); |
| 197 | if (gd.wasCanceled()) |
| 198 | return; |
| 199 | ImageConverter.setDoScaling(gd.getNextBoolean()); |
| 200 | Prefs.calibrateConversions = gd.getNextBoolean(); |
| 201 | Prefs.weightedColor = gd.getNextBoolean(); |
| 202 | Prefs.fullRange16bitInversions = gd.getNextBoolean(); |
| 203 | if (Prefs.calibrateConversions) |
| 204 | ImageConverter.setDoScaling(true); |
| 205 | if (!Prefs.weightedColor) |
| 206 | ColorProcessor.setWeightingFactors(1d/3d, 1d/3d, 1d/3d); |
| 207 | else if (Prefs.weightedColor && !weighted) |
| 208 | ColorProcessor.setWeightingFactors(0.299, 0.587, 0.114); |
| 209 | return; |
| 210 | } |
| 211 | |
| 212 | // replaced by AppearanceOptions class |
| 213 | void appearance() { |
no test coverage detected