-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLRGBAuto.js
More file actions
executable file
·150 lines (139 loc) · 3.91 KB
/
LRGBAuto.js
File metadata and controls
executable file
·150 lines (139 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
function linearFit(isSHO) {
var P = new LinearFit;
P.referenceViewId = isSHO ? "H": "L";
P.rejectLow = 0.000000;
P.rejectHigh = 0.920000;
if (isSHO) {
var ok = P.executeOn(ImageWindow.windowById("S").currentView, false);
ok = P.executeOn(ImageWindow.windowById("O").currentView, false);
} else {
var ok = P.executeOn(ImageWindow.windowById("R").currentView, false);
ok = P.executeOn(ImageWindow.windowById("G").currentView, false);
ok = P.executeOn(ImageWindow.windowById("B").currentView, false);
}
}
/*
function generateRGB(isSHO) {
var P = new LRGBCombination;
P.channels = isSHO? [ // enabled, id, k
[true, "S", 1.00000],
[true, "H", 1.00000],
[true, "O", 1.00000],
[false, "", 1.00000]
] : [ // enabled, id, k
[true, "R", 1.00000],
[true, "G", 1.00000],
[true, "B", 1.00000],
[false, "", 1.00000]
];
P.mL = 0.500;
P.mc = 0.500;
P.clipHighlights = true;
P.noiseReduction = false;
P.layersRemoved = 4;
P.layersProtected = 2;
let ok = P.executeGlobal();
}
*/
function generateRGB(isSHO) {
var P = new PixelMath;
P.expression = isSHO? "S" : "R";
P.expression1 = isSHO ? "H" : "G";
P.expression2 = isSHO ? "O": "B";
P.expression3 = "";
P.useSingleExpression = false;
P.symbols = "";
P.clearImageCacheAndExit = false;
P.cacheGeneratedImages = false;
P.generateOutput = true;
P.singleThreaded = false;
P.optimization = true;
P.use64BitWorkingImage = false;
P.rescale = false;
P.rescaleLower = 0;
P.rescaleUpper = 1;
P.truncate = true;
P.truncateLower = 0;
P.truncateUpper = 1;
P.createNewImage = true;
P.showNewImage = true;
P.newImageId = "Color";
P.newImageWidth = 0;
P.newImageHeight = 0;
P.newImageAlpha = false;
P.newImageColorSpace = PixelMath.prototype.RGB;
P.newImageSampleFormat = PixelMath.prototype.SameAsTarget;
let ok = P.executeOn(ImageWindow.windowById(isSHO ? "H": "L").currentView, false);
/*
* Read-only properties
*
P.outputData = [ // globalVariableId, globalVariableRK, globalVariableG, globalVariableB
];
*/
}
function generateL(isSHO) {
var P = new PixelMath;
P.expression = isSHO? "H*0.5+O*0.2+S*0.3" : "R*0.1+G*0.1+B*0.1+L*0.7";
P.expression1 = "";
P.expression2 = "";
P.expression3 = "";
P.useSingleExpression = true;
P.symbols = "";
P.clearImageCacheAndExit = false;
P.cacheGeneratedImages = false;
P.generateOutput = true;
P.singleThreaded = false;
P.optimization = true;
P.use64BitWorkingImage = false;
P.rescale = false;
P.rescaleLower = 0;
P.rescaleUpper = 1;
P.truncate = true;
P.truncateLower = 0;
P.truncateUpper = 1;
P.createNewImage = true;
P.showNewImage = true;
P.newImageId = "SynthL";
P.newImageWidth = 0;
P.newImageHeight = 0;
P.newImageAlpha = false;
P.newImageColorSpace = PixelMath.prototype.Gray;
P.newImageSampleFormat = PixelMath.prototype.SameAsTarget;
let ok = P.executeOn(ImageWindow.windowById(isSHO ? "H": "L").currentView, false);
/*
* Read-only properties
*
P.outputData = [ // globalVariableId, globalVariableRK, globalVariableG, globalVariableB
];
*/
}
function combineColorL(isSHO) {
var P = new LRGBCombination;
P.channels = [ // enabled, id, k
[false, "", 1.00000],
[false, "", 1.00000],
[false, "", 1.00000],
[true, "SynthL", 1.00000]
];
P.mL = 0.500;
P.mc = 0.500;
P.clipHighlights = true;
P.noiseReduction = false;
P.layersRemoved = 4;
P.layersProtected = 2;
let ok = P.executeOn(ImageWindow.windowById("Color").currentView, false);
}
function autoCombineLRGB() {
// First rename the views to L, R, G, B.
linearFit();
generateRGB();
generateL();
}
function autoCombineSHO() {
// First rename the views to L, R, G, B.
// linearFit(true);
generateRGB(true);
generateL(true);
combineColorL(true);
}
autoCombineSHO();