-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAutoIntegrateEnhancementsGUI.js
More file actions
1749 lines (1547 loc) · 103 KB
/
AutoIntegrateEnhancementsGUI.js
File metadata and controls
1749 lines (1547 loc) · 103 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
AutoIntegrate image enhancements module. Previously called extra processing.
Interface functions:
See end of the file.
Interface objects:
AutoIntegrateEnhancementsGUI
This product is based on software from the PixInsight project, developed
by Pleiades Astrophoto and its contributors (https://pixinsight.com/).
*/
#ifndef AUTOINTEGRATEENHANCEMENTSGUI_JS
#define AUTOINTEGRATEENHANCEMENTSGUI_JS
#include "AutoIntegrateSelectiveColor.js"
function AutoIntegrateSelectStarsImageDialog( util )
{
this.__base__ = Dialog;
this.__base__();
this.restyle();
this.labelWidth = this.font.width( "Object identifier:M" );
this.editWidth = this.font.width( 'M' )*40;
this.starsImageLabel = new Label( this );
this.starsImageLabel.text = "Select stars image:"
this.starsImageComboBox = new ComboBox( this );
this.starsImageComboBox.minItemCharWidth = 20;
this.window_list = util.getWindowListReverse();
if (this.window_list.length == 0) {
this.name = "";
} else {
this.name = this.window_list[0];
for (var i = 0; i < this.window_list.length; i++) {
this.starsImageComboBox.addItem( this.window_list[i] );
}
}
this.starsImageComboBox.onItemSelected = function( itemIndex )
{
this.dialog.name = this.dialog.window_list[itemIndex];
};
// Common Buttons
this.ok_Button = new PushButton( this );
this.ok_Button.text = "OK";
this.ok_Button.icon = this.scaledResource( ":/icons/ok.png" );
this.ok_Button.onClick = function()
{
this.dialog.ok();
};
this.cancel_Button = new PushButton( this );
this.cancel_Button.text = "Cancel";
this.cancel_Button.icon = this.scaledResource( ":/icons/cancel.png" );
this.cancel_Button.onClick = function()
{
this.dialog.cancel();
};
this.buttons_Sizer = new HorizontalSizer;
this.buttons_Sizer.spacing = 6;
this.buttons_Sizer.addStretch();
this.buttons_Sizer.add( this.ok_Button );
this.buttons_Sizer.add( this.cancel_Button );
this.sizer = new VerticalSizer;
this.sizer.margin = 6;
this.sizer.spacing = 4;
this.sizer.add( this.starsImageLabel );
this.sizer.add( this.starsImageComboBox );
this.sizer.add( this.buttons_Sizer );
this.windowTitle = "Select stars image";
this.ensureLayoutUpdated();
this.adjustToContents();
}
AutoIntegrateSelectStarsImageDialog.prototype = new Dialog;
function AutoIntegrateHueColors(par)
{
this.__base__ = Frame;
this.__base__();
this.hueColorsBitmap = new Bitmap( File.extractDrive( #__FILE__ ) + File.extractDirectory( #__FILE__ ) + "/hue.png" );
function drawHueLine(g, bmp_startpos, bmp_width, bmp_height, hue)
{
// console.writeln("drawHueLine " + hue + " " + bmp_startpos + " " + bmp_width + " " + bmp_height);
var line_x = bmp_startpos + hue * bmp_width;
g.drawLine(line_x, 0, line_x, bmp_height);
}
this.onPaint = function(x0, y0, x1, y1) {
// console.writeln("AutoIntegrateHueColors onPaint");
var width = this.width;
var height = this.height;
var pos = 23;
var bmp_width = (100 - pos) * width / 100;
var bmp_startpos = pos * width / 100;
var bmp = this.hueColorsBitmap.scaledTo(bmp_width, height);
var graphics = new Graphics(this);
graphics.drawBitmap(bmp_startpos, 0, bmp);
graphics.pen = new Pen(0xFFFFFFFF,0); // white
drawHueLine(graphics, bmp_startpos, bmp_width, height, par.narrowband_colorized_R_hue.val);
drawHueLine(graphics, bmp_startpos, bmp_width, height, par.narrowband_colorized_G_hue.val);
drawHueLine(graphics, bmp_startpos, bmp_width, height, par.narrowband_colorized_B_hue.val);
graphics.end();
}
}
AutoIntegrateHueColors.prototype = new Frame;
function AutoIntegrateEnhancementsGUI(parent, guitools, util, global, engine, preview)
{
this.__base__ = Object;
this.__base__();
if (global.debug) console.writeln("AutoIntegrateEnhancementsGUI: constructor");
var self = this;
var par = global.par;
var ppar = global.ppar;
this.apply_completed_callback = null;
this.target_image_selected_callback = null;
var Foraxx_palette_values = [ 'SHO', 'HOO' ];
var enhancements_gui_info = {
undo_images: [], // undo_images[0] == original image, { image: <Image>, keywords: <image keywords>, histogramInfo: <see getHistogramInfo>, enhancements_info: [] }, see add_undo_image
undo_images_pos: -1,
undo_button: null,
redo_button: null,
images_combobox: null,
save_button: null
};
var enhancements_target_image_window_list = [];
var preview_control = null;
var adjust_type_values = [ 'Lights', 'Darks', 'All' ];
var star_reduce_methods = [ 'None', 'Transfer', 'Halo', 'Star' ];
var normalize_channels_reference_values = [ 'R', 'G', 'B' ];
var rotate_degrees_values = [ '90', '180', '-90' ];
var colorized_narrowband_preset_values = [ 'Default', 'North America', 'Eagle' ];
var narrowband_colorized_mapping_values = [ 'RGB', 'GRB', 'GBR', 'BRG', 'BGR', 'RBG' ];
var narrowband_colorized_combine_values = [ 'Channels', 'Screen', 'Sum', 'Mean', 'Max', 'Median' ];
var narrowband_colorized_method_values = [ 'PixelMath' ];
var signature_positions_values = [ 'Top left', 'Top middle', 'Top right', 'Bottom left', 'Bottom middle', 'Bottom right' ];
var highpass_sharpen_values = [ 'Default', 'MLT', 'UnsharpMask', 'BlurXTerminator', 'None' ];
var enhancements_HDRMLT_color_values = [ 'None', 'Preserve hue', 'Color corrected' ];
function update_enhancements_target_image_window_list(current_item)
{
var combobox = enhancements_gui_info.images_combobox;
if (current_item == null && enhancements_target_image_window_list.length > 0) {
// use item from dialog
current_item = enhancements_target_image_window_list[combobox.currentItem];
}
enhancements_target_image_window_list = util.getWindowListReverse();
#ifndef AUTOINTEGRATE_STANDALONE
enhancements_target_image_window_list.unshift("Auto");
#endif
combobox.clear();
for (var i = 0; i < enhancements_target_image_window_list.length; i++) {
combobox.addItem( enhancements_target_image_window_list[i] );
}
// update dialog
if (current_item) {
combobox.currentItem = enhancements_target_image_window_list.indexOf(current_item);
if (!combobox.currentItem) {
combobox.currentItem = 0;
}
if (enhancements_target_image_window_list
&& enhancements_target_image_window_list.length > 0
&& enhancements_target_image_window_list[combobox.currentItem])
{
combobox.setItemText(combobox.currentItem, enhancements_target_image_window_list[combobox.currentItem]);
}
}
return enhancements_target_image_window_list;
}
function setPreviewControl(control)
{
preview_control = control;
guitools.preview_control = control;
}
function update_undo_buttons()
{
enhancements_gui_info.undo_button.enabled = enhancements_gui_info.undo_images.length > 0 && enhancements_gui_info.undo_images_pos > 0;
enhancements_gui_info.redo_button.enabled = enhancements_gui_info.undo_images.length > 0 && enhancements_gui_info.undo_images_pos < enhancements_gui_info.undo_images.length - 1;
}
function getNumberAfterUnderscore(str)
{
const match = /_(\d+)$/.exec(str);
return match ? parseInt(match[1], 10) : 0;
}
function removeUnderscoreNumber(str)
{
return str.replace(/_\d+$/, '');
}
function copy_new_edit_image(id)
{
var copy_id = null;
// Get edit count from file name
var id_editcount = getNumberAfterUnderscore(id);
if (global.debug) console.writeln("copy_new_edit_image:id_editcount " + id_editcount);
// Get edit count from image metadata
var win = ImageWindow.windowById(id);
id = util.getBaseWindowId(win);
var editcount = util.getKeywordValue(win, "AutoIntegrateEditCount");
if (editcount == null) {
editcount = 0;
} else {
editcount = parseInt(editcount);
}
if (global.debug) console.writeln("copy_new_edit_image:editcount " + editcount);
if (id_editcount > 0) {
// Check if next number is available
var basename = removeUnderscoreNumber(id);
if (global.debug) console.writeln("copy_new_edit_image:basename " + basename);
var next_id = basename + "_" + (id_editcount + 1).toString();
if (global.debug) console.writeln("copy_new_edit_image:next_id " + next_id);
if (util.findWindow(next_id) == null) {
// Next id is free, use it
copy_id = next_id;
}
}
if (copy_id == null) {
// Next number used, create a new subversion
// Try to find first free number
for (var id_editcount = 1; ; id_editcount++) {
var next_id = id + "_" + id_editcount.toString();
if (util.findWindow(next_id) == null) {
copy_id = next_id;
break;
}
}
}
var copy_win = util.copyWindowEx(win, copy_id, true);
if (global.debug) console.writeln("Copy image " + copy_win.mainView.id);
util.setFITSKeyword(
copy_win,
"AutoIntegrateEditCount",
(editcount + 1).toString(),
"AutoIntegrate image edit count");
return copy_win.mainView.id;
}
function print_enhancements_info(txt, info)
{
if (txt) {
console.noteln(txt);
}
if (info.length == 0) {
console.writeln("- No enhancements applied");
} else {
for (var i = 0; i < info.length; i++) {
console.writeln("- " + info[i]);
}
}
}
function create_undo_image(id)
{
var undo_win = ImageWindow.windowById(id);
return { image: new Image( undo_win.mainView.image ), keywords: util.copyKeywords(undo_win) };
}
function add_undo_image(undo_image, histogramInfo)
{
//console.writeln("add_undo_image");
while (enhancements_gui_info.undo_images.length > enhancements_gui_info.undo_images_pos + 1) {
enhancements_gui_info.undo_images.pop();
console.writeln("Remove undo image " + enhancements_gui_info.undo_images.length);
}
enhancements_gui_info.undo_images_pos++;
// console.writeln("undo_images_pos " + enhancements_gui_info.undo_images_pos);
enhancements_gui_info.undo_images[enhancements_gui_info.undo_images_pos] =
{
image: undo_image.image,
keywords: undo_image.keywords,
histogramInfo: histogramInfo,
enhancements_info: global.enhancements_info.concat()
};
update_undo_buttons();
print_enhancements_info("Applied enhancements:", global.enhancements_info);
}
function apply_undo()
{
console.writeln("apply_undo");
if (global.enhancements_target_image_id == null || global.enhancements_target_image_id == "Auto") {
console.criticalln("No target image!");
return;
}
if (enhancements_gui_info.undo_images_pos <= 0) {
console.noteln("Nothing to undo");
return;
}
console.noteln("Undo on image " + global.enhancements_target_image_id + " (" + enhancements_gui_info.undo_images_pos + "/" + enhancements_gui_info.undo_images.length + ")");
var target_win = ImageWindow.windowById(global.enhancements_target_image_id);
if (target_win == null) {
console.criticalln("Failed to find target image " + global.enhancements_target_image_id);
return;
}
let undo_pos = enhancements_gui_info.undo_images_pos - 1;
let source_image = enhancements_gui_info.undo_images[undo_pos].image;
let source_keywords = enhancements_gui_info.undo_images[undo_pos].keywords;
let source_histogramInfo = enhancements_gui_info.undo_images[undo_pos].histogramInfo;
let source_enhancements_info = enhancements_gui_info.undo_images[undo_pos].enhancements_info;
target_win.mainView.beginProcess(UndoFlag_NoSwapFile);
target_win.mainView.image.assign( source_image );
target_win.mainView.endProcess();
print_enhancements_info("Undo enhancements:", global.enhancements_info);
target_win.keywords = source_keywords;
global.enhancements_info = source_enhancements_info;
preview.updatePreviewIdReset(global.enhancements_target_image_id, true, source_histogramInfo);
enhancements_gui_info.undo_images_pos--;
console.writeln("undo_images_pos " + enhancements_gui_info.undo_images_pos);
update_undo_buttons();
}
function apply_redo()
{
console.writeln("apply_redo");
if (global.enhancements_target_image_id == null || global.enhancements_target_image_id == "Auto") {
console.criticalln("No target image!");
return;
}
if (enhancements_gui_info.undo_images_pos >= enhancements_gui_info.undo_images.length - 1) {
console.noteln("Nothing to redo");
return;
}
console.noteln("Redo on image " + global.enhancements_target_image_id + " (" + (enhancements_gui_info.undo_images_pos + 2) + "/" + enhancements_gui_info.undo_images.length + ")");
var target_win = ImageWindow.windowById(global.enhancements_target_image_id);
if (target_win == null) {
console.criticalln("Failed to find target image " + global.enhancements_target_image_id);
return;
}
let undo_pos = enhancements_gui_info.undo_images_pos + 1;
let source_image = enhancements_gui_info.undo_images[undo_pos].image;
let source_keywords = enhancements_gui_info.undo_images[undo_pos].keywords;
let source_histogramInfo = enhancements_gui_info.undo_images[undo_pos].histogramInfo;
let source_enhancements_info = enhancements_gui_info.undo_images[undo_pos].enhancements_info;
target_win.mainView.beginProcess(UndoFlag_NoSwapFile);
target_win.mainView.image.assign( source_image );
target_win.mainView.endProcess();
target_win.keywords = source_keywords;
global.enhancements_info = source_enhancements_info;
preview.updatePreviewIdReset(global.enhancements_target_image_id, true, source_histogramInfo);
enhancements_gui_info.undo_images_pos++;
console.writeln("undo_images_pos " + enhancements_gui_info.undo_images_pos);
update_undo_buttons();
print_enhancements_info("Redo enhancements:", global.enhancements_info);
}
function save_as_undo()
{
console.writeln("Save image as XISF and TIFF");
if (global.enhancements_target_image_id == null || global.enhancements_target_image_id == "Auto") {
console.criticalln("No target image!");
return;
}
let saveFileDialog = new SaveFileDialog();
saveFileDialog.caption = "Save As XISF and TIFF";
if (global.outputRootDir == "") {
var path = ppar.lastDir;
} else {
var path = global.outputRootDir;
}
if (path != "") {
path = util.ensurePathEndSlash(path);
}
saveFileDialog.initialPath = path + global.enhancements_target_image_id + ".xisf";
if (!saveFileDialog.execute()) {
console.noteln("Image " + global.enhancements_target_image_id + " not saved");
return;
}
var save_dir = File.extractDrive(saveFileDialog.fileName) + File.extractDirectory(saveFileDialog.fileName);
var save_id = File.extractName(saveFileDialog.fileName);
var save_win = ImageWindow.windowById(global.enhancements_target_image_id);
/* Save as 16 bit TIFF.
*/
var copy_win = util.copyWindow(save_win, util.ensure_win_prefix(save_win.mainView.id + "_savetmp"));
if (copy_win.bitsPerSample != 16) {
console.writeln("saveFinalImageWindow:set bits to 16");
copy_win.setSampleFormat(16, false);
}
var filename = util.ensurePathEndSlash(save_dir) + save_id + ".tif";
console.noteln("Save " + global.enhancements_target_image_id + " as " + filename);
// Save image. No format options, no warning messages,
// no strict mode, no overwrite checks.
if (!copy_win.saveAs(filename, false, false, false, false)) {
util.throwFatalError("Failed to save image: " + filename);
}
util.closeOneWindow(copy_win);
/* Save as XISF.
*/
var filename = util.ensurePathEndSlash(save_dir) + save_id + ".xisf";
console.noteln("Save " + global.enhancements_target_image_id + " as " + filename);
// Save image. No format options, no warning messages,
// no strict mode, no overwrite checks.
if (!save_win.saveAs(filename, false, false, false, false)) {
util.throwFatalError("Failed to save image: " + filename);
}
util.saveLastDir(save_dir);
update_undo_buttons();
if (save_id != global.enhancements_target_image_id) {
// Rename old image
save_win.mainView.id = save_id;
// Update preview name
preview.updatePreviewTxt(save_win);
// Update target list
update_enhancements_target_image_window_list(save_id);
}
}
function close_undo_images(at_exit = false)
{
if (enhancements_gui_info.undo_images.length > 0) {
console.writeln("Close undo images");
enhancements_gui_info.undo_images = [];
enhancements_gui_info.undo_images_pos = -1;
if (!at_exit) {
update_undo_buttons();
}
}
}
function createEnhancementsControls(parent)
{
// Foraxx mapping
self.narrowband_Foraxx_CheckBox = guitools.newCheckBox(parent, "Foraxx mapping", par.run_foraxx_mapping,
"<p>Use dynamic Foraxx palette on image.</p>" +
"<p>Foraxx mapping can be done on a SHO or HOO image. Channels are extracted from the SHO or HOO " +
"image and mapped again to create a dynamic Foraxx palette image.</p>" +
"<p>After Foraxx SHO mapping <i>Remove green cast</i> and <i>Orange/blue colors</i> are run for the image.</p>" +
"<p>To run basic Foraxx SHO mapping use <i>SHO mapping</i> and select <i>Dynamic SHO</i>.</p>" +
"<p>To run Foraxx palette during the normal processing you need to select Dynamic narrowband palette like Dynamic SHO and " +
"check the option <i>Narrowband mapping using non-linear data</i>.</p>" +
"<p>" + guitools.Foraxx_credit + "</p>" );
self.narrowband_Foraxx_palette_ComboBox = guitools.newComboBox(parent, par.foraxx_palette, Foraxx_palette_values, self.narrowband_Foraxx_CheckBox.toolTip);
self.ForaxxSizer = new HorizontalSizer;
self.ForaxxSizer.spacing = 4;
self.ForaxxSizer.add( self.narrowband_Foraxx_CheckBox );
self.ForaxxSizer.add( self.narrowband_Foraxx_palette_ComboBox );
self.ForaxxSizer.addStretch();
// SHO mapping
self.enhancements_SHO_mapping_values = [];
for (var i = 0; i < global.narrowBandPalettes.length; i++) {
if (global.narrowBandPalettes[i].sho_mappable) {
self.enhancements_SHO_mapping_values.push(global.narrowBandPalettes[i].name);
}
}
self.enhancements_narrowband_mapping_CheckBox = guitools.newCheckBox(parent, "Narrowband mapping", par.run_enhancements_narrowband_mapping,
"<p>Map source narrowband image to a new narrowband palette.</p>" +
"<p>Mapping can be done only on SHO or HOO images. Channels are extracted from the SHO or HOO " +
"image and mapped again to create a new palette image.</p>");
self.enhancements_narrowband_source_palette_ComboBox = guitools.newComboBox(parent, par.enhancements_narrowband_mapping_source_palette, Foraxx_palette_values, self.enhancements_narrowband_mapping_CheckBox.toolTip);
self.enhancements_narrowband_target_mapping_Label = guitools.newLabel(parent, "to", self.enhancements_narrowband_mapping_CheckBox.toolTip);
self.enhancements_narrowband_target_palette_ComboBox = guitools.newComboBox(parent, par.enhancements_narrowband_mapping_target_palette, self.enhancements_SHO_mapping_values, self.enhancements_narrowband_mapping_CheckBox.toolTip);
self.enhancementsSHOMappingSizer = new HorizontalSizer;
self.enhancementsSHOMappingSizer.spacing = 4;
self.enhancementsSHOMappingSizer.add( self.enhancements_narrowband_mapping_CheckBox );
self.enhancementsSHOMappingSizer.add( self.enhancements_narrowband_source_palette_ComboBox );
self.enhancementsSHOMappingSizer.add( self.enhancements_narrowband_target_mapping_Label );
self.enhancementsSHOMappingSizer.add( self.enhancements_narrowband_target_palette_ComboBox );
self.enhancementsSHOMappingSizer.addStretch();
self.narrowband_orangeblue_colors_CheckBox = guitools.newCheckBox(parent, "Orange/blue colors", par.run_orangeblue_colors,
"<p>Enhance image by shifting red colors more to orange and enhancing blues. Useful for example with Foraxx palette.</p>");
self.fix_narrowband_star_color_CheckBox = guitools.newCheckBox(parent, "Fix star colors", par.fix_narrowband_star_color,
"<p>Fix magenta color on stars typically seen with SHO color palette. If all green is not removed from the image then a mask use used to fix only stars.</p>" );
self.narrowband_orange_hue_shift_CheckBox = guitools.newCheckBox(parent, "Hue shift for more orange", par.run_orange_hue_shift,
"<p>Do hue shift to enhance orange color. Useful with SHO color palette.</p>" );
self.narrowband_hue_shift_CheckBox = guitools.newCheckBox(parent, "Hue shift for SHO", par.run_hue_shift,
"<p>Do hue shift to enhance HSO colors. Useful with SHO color palette.</p>" );
self.selectiveColor = new AutoIntegrateSelectiveColor(guitools, util, global, preview);
self.selectiveColorEngine = self.selectiveColor.createSelectiveColorEngine();
self.selectiveColorSizer = self.selectiveColor.createSelectiveColorSizer(parent, self.selectiveColorEngine);
engine.selectiveColorEngine = self.selectiveColorEngine;
self.narrowband_leave_some_green_CheckBox = guitools.newCheckBox(parent, "Leave some green", par.leave_some_green,
"<p>Leave some green color on image when running SCNR. Useful with SHO color palette. </p>");
self.narrowband_leave_some_green_Edit = guitools.newNumericEdit(parent, "Amount", par.leave_some_green_amount, 0, 1,
"<p>Amount value 0 keeps all the green, value 1 removes all green.</p>");
self.narrowband_leave_some_green_sizer = new HorizontalSizer;
self.narrowband_leave_some_green_sizer.spacing = 4;
self.narrowband_leave_some_green_sizer.add( self.narrowband_leave_some_green_CheckBox );
self.narrowband_leave_some_green_sizer.add( self.narrowband_leave_some_green_Edit );
self.narrowband_leave_some_green_sizer.addStretch();
self.run_narrowband_SCNR_CheckBox = guitools.newCheckBox(parent, "Remove green cast", par.run_narrowband_SCNR,
"<p>Run SCNR to remove green cast. Useful with SHO color palette.</p>");
self.no_star_fix_mask_CheckBox = guitools.newCheckBox(parent, "No mask when fixing star colors", par.skip_star_fix_mask,
"<p>Do not use star mask when fixing star colors</p>" );
self.remove_magenta_color_CheckBox = guitools.newCheckBox(parent, "Remove magenta color", par.remove_magenta_color,
"<p>Remove magenta color from image.</p>" );
self.narrowbandOptions1_sizer = new VerticalSizer;
self.narrowbandOptions1_sizer.margin = 6;
self.narrowbandOptions1_sizer.spacing = 4;
self.narrowbandOptions1_sizer.add( self.ForaxxSizer );
self.narrowbandOptions1_sizer.add( self.enhancementsSHOMappingSizer );
self.narrowbandOptions1_sizer.add( self.narrowband_orangeblue_colors_CheckBox );
// self.narrowbandOptions1_sizer.add( self.narrowband_less_green_hue_shift_CheckBox );
self.narrowbandOptions1_sizer.add( self.narrowband_orange_hue_shift_CheckBox );
self.narrowbandOptions1_sizer.add( self.narrowband_hue_shift_CheckBox );
self.narrowbandOptions2_sizer = new VerticalSizer;
self.narrowbandOptions2_sizer.margin = 6;
self.narrowbandOptions2_sizer.spacing = 4;
self.narrowbandOptions2_sizer.add( self.run_narrowband_SCNR_CheckBox );
self.narrowbandOptions2_sizer.add( self.narrowband_leave_some_green_sizer );
self.narrowbandOptions2_sizer.add( self.remove_magenta_color_CheckBox );
self.narrowbandOptions2_sizer.add( self.fix_narrowband_star_color_CheckBox );
self.narrowbandOptions2_sizer.add( self.no_star_fix_mask_CheckBox );
var narrowbandEnhancementsLabeltoolTip =
"<p>" +
"Enhancements options to be applied on narrowband images. "+
"They are applied before other enhancements options in the following order:" +
"</p>" +
"<ol>" +
"<li>Hue shift for less green</li>" +
"<li>Hue shift for more orange</li>" +
"<li>Hue shift for SHO</li>" +
"<li>Colorized narrowband</li>" +
"<li>Remove green cast/Leave some green</li>" +
"<li>Remove magenta color</li>" +
"<li>Fix star colors</li>" +
"</ol>";
self.narrowbandEnhancementsOptionsSizer = new HorizontalSizer;
//self.narrowbandEnhancementsOptionsSizer.margin = 6;
//self.narrowbandEnhancementsOptionsSizer.spacing = 4;
self.narrowbandEnhancementsOptionsSizer.add( self.narrowbandOptions1_sizer );
self.narrowbandEnhancementsOptionsSizer.add( self.narrowbandOptions2_sizer );
self.narrowbandEnhancementsOptionsSizer.toolTip = narrowbandEnhancementsLabeltoolTip;
self.narrowbandEnhancementsOptionsSizer.addStretch();
// enhancements
var enhancementsRemoveStars_Tooltip =
"<p>Run Starnet2 or StarXTerminator on image to generate a starless image and a separate image for the stars.</p>" +
"<p>When this is selected, enhancements are applied to the starless image. Smaller stars option is run on star images.</p>" +
"<p>At the end of the processing a combined image can be created from starless and star images. Combine operation can be " +
"selected from the combo box.</p>" +
guitools.stars_combine_operations_Tooltip;
self.enhancementsRemoveStars_CheckBox = guitools.newCheckBox(parent, "Remove stars", par.enhancements_remove_stars, enhancementsRemoveStars_Tooltip);
self.enhancementsUnscreenStars_CheckBox = guitools.newCheckBox(parent, "Unscreen", par.enhancements_unscreen_stars, guitools.unscreen_tooltip);
self.enhancementsRemoveStars_Sizer = new HorizontalSizer;
self.enhancementsRemoveStars_Sizer.spacing = 4;
self.enhancementsRemoveStars_Sizer.add( self.enhancementsRemoveStars_CheckBox);
self.enhancementsRemoveStars_Sizer.add( self.enhancementsUnscreenStars_CheckBox);
self.enhancementsRemoveStars_Sizer.addStretch();
self.enhancementsFixStarCores_CheckBox = guitools.newCheckBox(parent, "Fix star cores", par.enhancements_fix_star_cores,
"<p>Fix star cores by applying a slight blur to then using a star mask.</p>");
var enhancementsCombineStarsReduce_Tooltip =
"<p>With reduce selection it is possible to reduce stars while combining. " +
"Star reduction uses PixelMath expressions created by Bill Blanshan.</p>" +
"<p>Different methods are:</p>" +
"<p>" +
"None - No reduction<br>" +
"Transfer - Method 1, Transfer method<br>" +
"Halo - Method 2, Halo method<br>" +
"Star - Method 3, Star method" +
"</p>";
var enhancementsCombineStars_Tooltip =
"<p>Create a combined image from starless and star images. Combine operation can be " +
"selected from the combo box. To use combine you need to have starless image selected as the " +
"target image. Stars image must be open in the desktop.</p>" +
"<p>Star image is searched using the following steps:</p>" +
"<ol>" +
"<li>All occurrences of text starless replaced with text stars</li>" +
"<li>All occurrences of text starless_edit followed by a number (starless_edit[1-9]*) replaced with text stars</li>" +
"<li>Text starless at the end replaced with text stars</li>" +
"<li>Text starless and any text that follows it (starless.*) replaced with text stars</li>" +
"<li>Text starless and any text that follows it (starless.*) replaced with text stars and any text after text stars " +
"is accepted (stars.*). So starless image <i>sameprefix</i>_starless_<i>whatever</i> is matched with stars image " +
"<i>sameprefix</i>_stars_<i>doesnotmatterwhatishere</i>.</li>" +
"</ol>" +
guitools.stars_combine_operations_Tooltip +
enhancementsCombineStarsReduce_Tooltip;
self.enhancementsCombineStars_CheckBox = guitools.newCheckBox(parent, "Combine starless and stars", par.enhancements_combine_stars, enhancementsCombineStars_Tooltip);
self.enhancementsCombineStars_ComboBox = guitools.newComboBox(parent, par.enhancements_combine_stars_mode, guitools.starless_and_stars_combine_values, enhancementsCombineStars_Tooltip);
self.enhancementsCombineStars_Sizer1= new HorizontalSizer;
self.enhancementsCombineStars_Sizer1.spacing = 4;
self.enhancementsCombineStars_Sizer1.add( self.enhancementsCombineStars_CheckBox);
self.enhancementsCombineStars_Sizer1.add( self.enhancementsCombineStars_ComboBox);
self.enhancementsCombineStars_Sizer1.toolTip = narrowbandEnhancementsLabeltoolTip;
self.enhancementsCombineStars_Sizer1.addStretch();
self.enhancementsCombineStarsReduce_Label = guitools.newLabel(parent, "Reduce stars", enhancementsCombineStarsReduce_Tooltip);
self.enhancementsCombineStarsReduce_ComboBox = guitools.newComboBox(parent, par.enhancements_combine_stars_reduce, star_reduce_methods,
enhancementsCombineStarsReduce_Tooltip);
self.enhancementsCombineStarsReduce_S_edit = guitools.newNumericEdit(parent, 'S', par.enhancements_combine_stars_reduce_S, 0.0, 1.0,
"<p>To reduce stars size more with Transfer and Halo, lower S value.<p>" + enhancementsCombineStarsReduce_Tooltip);
var enhancementsCombineStarsReduce_M_toolTip = "<p>Star method mode; 1=Strong; 2=Moderate; 3=Soft reductions.</p>" + enhancementsCombineStarsReduce_Tooltip;
self.enhancementsCombineStarsReduce_M_Label = guitools.newLabel(parent, "I", enhancementsCombineStarsReduce_M_toolTip);
self.enhancementsCombineStarsReduce_M_SpinBox = guitools.newSpinBox(parent, par.enhancements_combine_stars_reduce_M, 1, 3,
enhancementsCombineStarsReduce_M_toolTip);
self.enhancementsCombineStars_Sizer2 = new HorizontalSizer;
self.enhancementsCombineStars_Sizer2.spacing = 4;
self.enhancementsCombineStars_Sizer2.addSpacing(20);
self.enhancementsCombineStars_Sizer2.add( self.enhancementsCombineStarsReduce_Label);
self.enhancementsCombineStars_Sizer2.add( self.enhancementsCombineStarsReduce_ComboBox);
self.enhancementsCombineStars_Sizer2.add( self.enhancementsCombineStarsReduce_S_edit);
self.enhancementsCombineStars_Sizer2.add( self.enhancementsCombineStarsReduce_M_Label);
self.enhancementsCombineStars_Sizer2.add( self.enhancementsCombineStarsReduce_M_SpinBox);
self.enhancementsCombineStars_Sizer2.toolTip = narrowbandEnhancementsLabeltoolTip;
self.enhancementsCombineStars_Sizer2.addStretch();
self.enhancementsStarsImageLabel = guitools.newLabel(parent, "Starless image", "Text Auto or empty image uses default starless image.");
self.enhancementsStarsImageEdit = guitools.newTextEdit(parent, par.enhancements_combine_stars_image, self.enhancementsStarsImageLabel.toolTip);
var enhancementsStarsImageEdit = self.enhancementsStarsImageEdit;
self.enhancementsStarsImageSelectButton = new ToolButton(parent);
self.enhancementsStarsImageSelectButton.text = "Select";
self.enhancementsStarsImageSelectButton.icon = parent.scaledResource(":/icons/find.png");
self.enhancementsStarsImageSelectButton.toolTip = "<p>Select stars image manually from open images.</p>";
self.enhancementsStarsImageSelectButton.onClick = function()
{
let selectStars = new AutoIntegrateSelectStarsImageDialog(util);
selectStars.windowTitle = "Select Stars Image";
if (selectStars.execute()) {
if (selectStars.name == null) {
console.writeln("Stars image not selected");
return;
}
console.writeln("Stars image name " + selectStars.name);
enhancementsStarsImageEdit.text = selectStars.name;
par.enhancements_combine_stars_image.val = selectStars.name;
}
};
self.enhancementsCombineStarsSelect_Sizer = new HorizontalSizer;
self.enhancementsCombineStarsSelect_Sizer.spacing = 4;
self.enhancementsCombineStarsSelect_Sizer.addSpacing(20);
self.enhancementsCombineStarsSelect_Sizer.add( self.enhancementsStarsImageLabel);
self.enhancementsCombineStarsSelect_Sizer.add( self.enhancementsStarsImageEdit);
self.enhancementsCombineStarsSelect_Sizer.add( self.enhancementsStarsImageSelectButton);
self.enhancementsCombineStars_Sizer = new VerticalSizer;
self.enhancementsCombineStars_Sizer.spacing = 4;
self.enhancementsCombineStars_Sizer.add( self.enhancementsCombineStars_Sizer1);
self.enhancementsCombineStars_Sizer.add( self.enhancementsCombineStarsSelect_Sizer );
self.enhancementsCombineStars_Sizer.add( self.enhancementsCombineStars_Sizer2);
self.enhancementsCombineStars_Sizer.toolTip = narrowbandEnhancementsLabeltoolTip;
self.enhancementsCombineStars_Sizer.addStretch();
#ifndef AUTOINTEGRATE_STANDALONE
self.enhancementsRGBHamapping_CheckBox = guitools.newCheckBox(parent, "Ha to RGB mapping", par.enhancements_ha_mapping,
"<p>Run Ha to RGB mapping on the image.</p>" +
"<p>Integratrion_H, Integration_H_crop or Integration_H_enhanced image must be loaded to the desktop.</p>" );
#endif // AUTOINTEGRATE_STANDALONE
self.enhancementsDarkerBackground_CheckBox = guitools.newCheckBox(parent, "Darker background", par.enhancements_darker_background,
"<p>Make image background darker using a lightness mask.</p>" );
self.enhancementsDarkerHighlights_CheckBox = guitools.newCheckBox(parent, "Darker highlights", par.enhancements_darker_highlights,
"<p>Make image highlights darker using a lightness mask.</p>" );
self.enhancements_backgroundneutralization_CheckBox = guitools.newCheckBox(parent, "Background neutralization", par.enhancements_backgroundneutralization,
"<p>Run background neutralization to the image.</p>" );
#ifndef AUTOINTEGRATE_STANDALONE
self.enhancements_GC_CheckBox = guitools.newCheckBox(parent, "Gradient correction", par.enhancements_GC,
"<p>Do gradient correction to the image using the selected gradient correction method.</p>" );
self.enhancements_GC_values_Sizer = guitools.createGradientCorrectionChoiceSizer(parent);
self.enhancements_GC_Sizer = new HorizontalSizer;
self.enhancements_GC_Sizer.spacing = 4;
self.enhancements_GC_Sizer.add( self.enhancements_GC_CheckBox );
self.enhancements_GC_Sizer.add( self.enhancements_GC_values_Sizer );
self.enhancements_GC_Sizer.addStretch();
#endif
self.enhancementsBandinReduction_CheckBox = guitools.newCheckBox(parent, "Banding reduction", par.enhancements_banding_reduction,
"<p>Run banding reduction on the image.</p>" );
var enhancements_ET_tooltip = "<p>Run ExponentialTransform on image using a mask.</p>";
self.enhancements_ET_CheckBox = guitools.newCheckBox(parent, "ExponentialTransform,", par.enhancements_ET, enhancements_ET_tooltip);
self.enhancements_ET_order_edit = guitools.newNumericEdit(parent, 'Order', par.enhancements_ET_order, 0.1, 6, "Order value for ExponentialTransform.");
self.enhancements_ET_adjust_label = guitools.newLabel(parent, "Adjust", "<p>Adjust type to be used with ExponentialTransform.</p>" +
"<p>Lightness mask is used to get the desired adjustment.</p>" +
guitools.adjust_type_toolTip);
self.enhancements_ET_adjust_Combobox = guitools.newComboBox(parent, par.enhancements_ET_adjusttype, adjust_type_values, self.enhancements_ET_adjust_label.toolTip);
self.enhancements_ET_Sizer = new HorizontalSizer;
self.enhancements_ET_Sizer.spacing = 4;
self.enhancements_ET_Sizer.add( self.enhancements_ET_CheckBox );
self.enhancements_ET_Sizer.add( self.enhancements_ET_order_edit );
self.enhancements_ET_Sizer.add( self.enhancements_ET_adjust_label );
self.enhancements_ET_Sizer.add( self.enhancements_ET_adjust_Combobox );
self.enhancements_ET_Sizer.toolTip = enhancements_ET_tooltip;
self.enhancements_ET_Sizer.addStretch();
var enhancements_HDRMLT_tooltip = "<p>Run HDRMultiscaleTransform on image using a mask.</p>" +
"<p>Color option is used to select different methods to keep hue and saturation.</p> " +
"<ul>" +
"<li>Option 'None' uses HDRMLT To lightness option.</li>" +
"<li>Option 'Preserve hue' uses HDRMLT preserve hue option.</li>" +
"<li>Option 'Color corrected' uses To Intensity instead of To lightness. It applies HSI transformation to the intensity component. " +
#ifndef AUTOINTEGRATE_STANDALONE
"In PixInsight 1.8.9-1 or older it uses a method described by Russell Croman." +
#endif
"</li>" +
"</ul>" +
"<p>Layers selection specifies the layers value for HDRMLT.</p>";
self.enhancements_HDRMLT_CheckBox = guitools.newCheckBox(parent, "HDRMultiscaleTransform", par.enhancements_HDRMLT, enhancements_HDRMLT_tooltip);
self.enhancements_HDRMLT_Layers_Label = new Label( parent );
self.enhancements_HDRMLT_Layers_Label.text = "Layers";
self.enhancements_HDRMLT_Layers_Label.textAlignment = TextAlign_Left|TextAlign_VertCenter;
self.enhancements_HDRMLT_Layers_Label.toolTip = enhancements_HDRMLT_tooltip;
self.enhancements_HDRMLT_Layers_SpinBox = guitools.newSpinBox(parent, par.enhancements_HDRMLT_layers, 2, 10, enhancements_HDRMLT_tooltip);
self.enhancements_HDRMLT_Overdrive_Edit = guitools.newNumericEditPrecision(parent, "Overdrive", par.enhancements_HDRMLT_overdrive, 0, 1, enhancements_HDRMLT_tooltip, 3);
self.enhancements_HDRMLT_Iterations_Label = guitools.newLabel(parent, "Iterations", enhancements_HDRMLT_tooltip);
self.enhancements_HDRMLT_Iterations_SpinBox = guitools.newSpinBox(parent, par.enhancements_HDRMLT_iterations, 1, 16, enhancements_HDRMLT_tooltip);
self.enhancements_HDRMLT_Color_Label = new Label( parent );
self.enhancements_HDRMLT_Color_Label.text = "Color";
self.enhancements_HDRMLT_Color_Label.textAlignment = TextAlign_Left|TextAlign_VertCenter;
self.enhancements_HDRMLT_Color_Label.toolTip = enhancements_HDRMLT_tooltip;
self.enhancements_HDRMLT_color_ComboBox = guitools.newComboBox(parent, par.enhancements_HDRMLT_color, enhancements_HDRMLT_color_values, enhancements_HDRMLT_tooltip);
self.enhancements_HDRMLT_Options_Sizer = new HorizontalSizer;
self.enhancements_HDRMLT_Options_Sizer.spacing = 4;
self.enhancements_HDRMLT_Options_Sizer.addSpacing(20);
self.enhancements_HDRMLT_Options_Sizer.add( self.enhancements_HDRMLT_Layers_Label );
self.enhancements_HDRMLT_Options_Sizer.add( self.enhancements_HDRMLT_Layers_SpinBox );
self.enhancements_HDRMLT_Options_Sizer.add( self.enhancements_HDRMLT_Iterations_Label );
self.enhancements_HDRMLT_Options_Sizer.add( self.enhancements_HDRMLT_Iterations_SpinBox );
self.enhancements_HDRMLT_Options_Sizer.add( self.enhancements_HDRMLT_Overdrive_Edit );
self.enhancements_HDRMLT_Options_Sizer.addStretch();
self.enhancements_HDRMLT_Options_Sizer2 = new HorizontalSizer;
self.enhancements_HDRMLT_Options_Sizer2.spacing = 4;
self.enhancements_HDRMLT_Options_Sizer2.addSpacing(20);
self.enhancements_HDRMLT_Options_Sizer2.add( self.enhancements_HDRMLT_Color_Label );
self.enhancements_HDRMLT_Options_Sizer2.add( self.enhancements_HDRMLT_color_ComboBox );
self.enhancements_HDRMLT_Options_Sizer2.addStretch();
self.enhancements_HDRMLT_Sizer = new VerticalSizer;
self.enhancements_HDRMLT_Sizer.spacing = 4;
self.enhancements_HDRMLT_Sizer.add( self.enhancements_HDRMLT_CheckBox );
self.enhancements_HDRMLT_Sizer.add( self.enhancements_HDRMLT_Options_Sizer );
self.enhancements_HDRMLT_Sizer.add( self.enhancements_HDRMLT_Options_Sizer2 );
var enhancements_LHE_tooltip = "<p>Run LocalHistogramEqualization on image using a mask.</p>";
self.enhancements_LHE_CheckBox = guitools.newCheckBox(parent, "LocalHistogramEqualization,", par.enhancements_LHE, enhancements_LHE_tooltip);
self.enhancements_LHE_kernelradius_edit = guitools.newNumericEdit(parent, 'Kernel Radius', par.enhancements_LHE_kernelradius, 16, 512, "<p>Kernel radius value for LocalHistogramEqualization.</p>");
self.enhancements_LHE_contrastlimit_edit = guitools.newNumericEdit(parent, 'Contrast limit', par.enhancements_LHE_contrastlimit, 1, 64,
"<p>Contrast limit value for LocalHistogramEqualization.</p>" +
"<p>With darks adjust usually you should increase the contrast limit value, for example 2.5.</p>");
self.enhancements_LHE_adjust_label = guitools.newLabel(parent, "Adjust", "<p>Mask type to be used with LocalHistogramEqualization.</p>" +
"<p>Lightness mask is used to get the desired adjustment.</p>" +
guitools.adjust_type_toolTip +
"<p>With darks adjust usually you should increase the contrast limit value, for example 2.5.</p>");
self.enhancements_LHE_adjust_Combobox = guitools.newComboBox(parent, par.enhancements_LHE_adjusttype, adjust_type_values, self.enhancements_LHE_adjust_label.toolTip);
self.enhancements_LHE_sizer1 = new HorizontalSizer;
self.enhancements_LHE_sizer1.spacing = 4;
self.enhancements_LHE_sizer1.add( self.enhancements_LHE_CheckBox );
self.enhancements_LHE_sizer1.add( self.enhancements_LHE_adjust_label );
self.enhancements_LHE_sizer1.add( self.enhancements_LHE_adjust_Combobox );
self.enhancements_LHE_sizer1.toolTip = enhancements_LHE_tooltip;
self.enhancements_LHE_sizer1.addStretch();
self.enhancements_LHE_sizer2 = new HorizontalSizer;
self.enhancements_LHE_sizer2.spacing = 4;
self.enhancements_LHE_sizer2.addSpacing(20);
self.enhancements_LHE_sizer2.add( self.enhancements_LHE_kernelradius_edit );
self.enhancements_LHE_sizer2.add( self.enhancements_LHE_contrastlimit_edit );
self.enhancements_LHE_sizer2.toolTip = enhancements_LHE_tooltip;
self.enhancements_LHE_sizer2.addStretch();
self.enhancements_LHE_sizer = new VerticalSizer;
self.enhancements_LHE_sizer.spacing = 4;
self.enhancements_LHE_sizer.add( self.enhancements_LHE_sizer1 );
self.enhancements_LHE_sizer.add( self.enhancements_LHE_sizer2 );
self.enhancements_LHE_sizer.toolTip = enhancements_LHE_tooltip;
self.enhancements_LHE_sizer.addStretch();
self.enhancements_Contrast_CheckBox = guitools.newCheckBox(parent, "Add contrast", par.enhancements_contrast,
"<p>Run slight S shape curves transformation on image to add contrast.</p>" );
self.contrastIterationsSpinBox = guitools.newSpinBox(parent, par.enhancements_contrast_iterations, 1, 5, "Number of iterations for contrast enhancement");
self.contrastIterationsLabel = new Label( parent );
self.contrastIterationsLabel.text = "iterations";
self.contrastIterationsLabel.textAlignment = TextAlign_Left|TextAlign_VertCenter;
self.contrastIterationsLabel.toolTip = self.contrastIterationsSpinBox.toolTip;
self.enhancementsContrastSizer = new HorizontalSizer;
self.enhancementsContrastSizer.spacing = 4;
self.enhancementsContrastSizer.add( self.enhancements_Contrast_CheckBox );
self.enhancementsContrastSizer.add( self.contrastIterationsSpinBox );
self.enhancementsContrastSizer.add( self.contrastIterationsLabel );
self.enhancementsContrastSizer.toolTip = self.contrastIterationsSpinBox.toolTip;
self.enhancementsContrastSizer.addStretch();
var enhancementsAutoContrastTooltip = "<p>Do automatic contrast enhancement. Works best with starless image.</p>";
self.enhancementsAutoContrastCheckBox = guitools.newCheckBox(parent, "Auto contrast,", par.enhancements_auto_contrast, enhancementsAutoContrastTooltip);
self.enhancementsAutoContrastEditLow = guitools.newNumericEditPrecision(parent, 'low', par.enhancements_auto_contrast_limit_low, 0, 100, "Percentage of clipped low pixels.", 4);
self.enhancementsAutoContrastEditHigh = guitools.newNumericEditPrecision(parent, 'high', par.enhancements_auto_contrast_limit_high, 0, 100, "Percentage of preserved high pixels.", 4);
self.enhancementsAutoContrastChannelsCheckBox = guitools.newCheckBox(parent, "channels", par.enhancements_auto_contrast_channels, "Apply auto contrast separately for each channel.");
self.enhancementsAutoContrastSizer = new HorizontalSizer;
self.enhancementsAutoContrastSizer.spacing = 4;
self.enhancementsAutoContrastSizer.add( self.enhancementsAutoContrastCheckBox );
self.enhancementsAutoContrastSizer.add( self.enhancementsAutoContrastEditLow );
self.enhancementsAutoContrastSizer.add( self.enhancementsAutoContrastEditHigh );
self.enhancementsAutoContrastSizer.add( self.enhancementsAutoContrastChannelsCheckBox );
self.enhancementsAutoContrastSizer.toolTip = enhancementsAutoContrastTooltip;
self.enhancementsAutoContrastSizer.addStretch();
#ifndef AUTOINTEGRATE_STANDALONE
self.enhancements_stretch_CheckBox = guitools.newCheckBox(parent, "Auto stretch", par.enhancements_stretch,
"<p>Run automatic stretch on image. Can be helpful in some rare cases but it is most useful on testing stretching settings with Apply button.</p>" );
self.enhancements_autostf_CheckBox = guitools.newCheckBox(parent, "AutoSTF", par.enhancements_autostf,
"<p>Run unlinked AutoSTF stretch on image. Can be helpful in balancing image.</p>" );
#endif
self.enhancements_signature_CheckBox = guitools.newCheckBox(parent, "Signature", par.enhancements_signature,
"<p>Add signature to the image.</p>" );
self.enhancements_signature_path_Edit = guitools.newTextEdit(parent, par.enhancements_signature_path, "Path to signature file.");
self.enhancements_signature_path_Button = new ToolButton( parent );
self.enhancements_signature_path_Button.icon = parent.scaledResource(":/icons/select-file.png");
self.enhancements_signature_path_Button.toolTip = self.enhancements_signature_path_Edit.toolTip;
self.enhancements_signature_path_Button.setScaledFixedSize( 20, 20 );
var enhancements_signature_path_Edit = self.enhancements_signature_path_Edit;
self.enhancements_signature_path_Button.onClick = function()
{
var ofd = new OpenFileDialog;
ofd.multipleSelections = false;
if (!ofd.execute()) {
return;
}
enhancements_signature_path_Edit.text = ofd.fileName;
par.enhancements_signature_path.val = ofd.fileName;
console.writeln("Signature file path: " + ofd.fileName);
};
self.enhancements_signature_scale_Label = guitools.newLabel(parent, "Scale",
"<p>Scale for signature image. Scale is the signature file height in percentages relative to the main image. " +
"For example scale 10 means that the signature file height will be 10% of the main image height. " +
"Value zero means no scaling.</p>");
self.enhancements_signature_scale_SpinBox = guitools.newSpinBox(parent, par.enhancements_signature_scale, 0, 100, self.enhancements_signature_scale_Label.toolTip);
self.enhancements_signature_position_ComboBox = guitools.newComboBox(parent, par.enhancements_signature_position, signature_positions_values, "<p>Signature position.</p>");
self.enhancements_force_new_mask_CheckBox = guitools.newCheckBox(parent, "New mask", par.enhancements_force_new_mask,
"<p>Do not use existing mask but create a new luminance or star mask when needed.</p>" );
self.enhancements_range_mask_CheckBox = guitools.newCheckBox(parent, "range_mask", par.enhancements_range_mask,
"<p>Use a user created range mask. It is used as is, it is not for example inverted.</p>" +
"<p>White selects, black protects.</p>" +
"<p>Note that this option overwrites any adjust settings selected for an option.</p>");
self.enhancements_auto_reset_CheckBox = guitools.newCheckBox(parent, "Auto reset", par.enhancements_auto_reset,
"<p>If using Apply button, uncheck options when they are applied.</p>" );
var shadowclipTooltip = "<p>Adjust shadows in the image. Adjust percentage tells how much shadow pixels are clipped.</p>" +
"<p>With a value of 0, no shadow pixels are clipped but histogram, is moved to the left.</p>" +
"<p>You can use the Enhnacements / Misc options clipped tool to see clipped pixels.</p>";
self.enhancements_shadowclip_CheckBox = guitools.newCheckBox(parent, "Adjust shadows,", par.enhancements_shadowclipping, shadowclipTooltip);
self.enhancements_shadowclipperc_edit = guitools.newNumericEditPrecision(parent, '%', par.enhancements_shadowclippingperc, 0, 100, shadowclipTooltip, 4);
self.enhancements_shadowclip_Sizer = new HorizontalSizer;
self.enhancements_shadowclip_Sizer.spacing = 4;
self.enhancements_shadowclip_Sizer.add( self.enhancements_shadowclip_CheckBox );
self.enhancements_shadowclip_Sizer.add( self.enhancements_shadowclipperc_edit );
self.enhancements_shadowclip_Sizer.toolTip = shadowclipTooltip;
self.enhancements_shadowclip_Sizer.addStretch();
var enhancementsEnhanceShadowsTooltip = "<p>Enhance shadows by using log function on each pixel.</p>";
self.enhancementsEnhanceShadowsCheckBox = guitools.newCheckBox(parent, "Enhance shadows", par.enhancements_shadow_enhance, enhancementsEnhanceShadowsTooltip);
self.enhancementsEnhanceShadowsSizer = new HorizontalSizer;
self.enhancementsEnhanceShadowsSizer.spacing = 4;
self.enhancementsEnhanceShadowsSizer.add( self.enhancementsEnhanceShadowsCheckBox );
self.enhancementsEnhanceShadowsSizer.toolTip = shadowclipTooltip;
self.enhancementsEnhanceShadowsSizer.addStretch();
var enhancementsEnhanceHighlightsTooltip = "<p>Enhance highlights by using exp function on each pixel.</p>";
self.enhancementsEnhanceHighlightsCheckBox = guitools.newCheckBox(parent, "Enhance highlights", par.enhancements_highlight_enhance, enhancementsEnhanceHighlightsTooltip);
self.enhancementsEnhanceHighlightsSizer = new HorizontalSizer;
self.enhancementsEnhanceHighlightsSizer.spacing = 4;
self.enhancementsEnhanceHighlightsSizer.add( self.enhancementsEnhanceHighlightsCheckBox );
self.enhancementsEnhanceHighlightsSizer.toolTip = shadowclipTooltip;
self.enhancementsEnhanceHighlightsSizer.addStretch();
var enhancementsGammaTooltip = "<p>Apply gamma correction to the image.</p>" +
"<p>Value below 1 will make the image lighter. Value above 1 will make image darker.</p>";
self.enhancementsGammaCheckBox = guitools.newCheckBox(parent, "Gamma", par.enhancements_gamma, enhancementsGammaTooltip);
self.enhancementsGammaEdit = guitools.newNumericEdit(parent, '', par.enhancements_gamma_value, 0, 2, enhancementsGammaTooltip);
self.enhancementsGammaSizer = new HorizontalSizer;
self.enhancementsGammaSizer.spacing = 4;
self.enhancementsGammaSizer.add( self.enhancementsGammaCheckBox );
self.enhancementsGammaSizer.add( self.enhancementsGammaEdit );
self.enhancementsGammaSizer.toolTip = enhancementsGammaTooltip;
self.enhancementsGammaSizer.addStretch();
var smoothBackgroundTooltip =
"<p>Smoothen background below a given pixel value. Pixel value can be found for example " +
"from the preview image using a mouse.</p>" +
"<p>A limit value specifies below which the smoothing is done. " +
"The value should be selected so that no foreground data is lost.</p>" +
"<p>Smoothing sets a new relative value for pixels that are below the given limit value. " +
"If the factor is below 1, new pixel values will be higher than the old values. " +
"If factor is above 1, new pixel values will be lower than the old values.</p>" +
"<p>With a factor value below 1, smoothening can help gradient correction to clean up the background better in case of " +
"very uneven background.</p>" +
"<p>With a factor value above 1, smoothening can make dark parts of the image darker.</p>";
self.enhancements_smoothBackground_CheckBox = guitools.newCheckBox(parent, "Smoothen background,", par.enhancements_smoothbackground, smoothBackgroundTooltip);
self.enhancements_smoothBackgroundval_edit = guitools.newNumericEditPrecision(parent, 'value', par.enhancements_smoothbackgroundval, 0, 100, smoothBackgroundTooltip, 4);
self.enhancements_smoothBackgroundfactor_edit = guitools.newNumericEditPrecision(parent, 'factor', par.enhancements_smoothbackgroundfactor, 0, 10, smoothBackgroundTooltip, 2);
self.enhancements_smoothBackground_Sizer = new HorizontalSizer;
self.enhancements_smoothBackground_Sizer.spacing = 4;
self.enhancements_smoothBackground_Sizer.add( self.enhancements_smoothBackground_CheckBox );
self.enhancements_smoothBackground_Sizer.add( self.enhancements_smoothBackgroundval_edit );
self.enhancements_smoothBackground_Sizer.add( self.enhancements_smoothBackgroundfactor_edit );
self.enhancements_smoothBackground_Sizer.toolTip = smoothBackgroundTooltip;
self.enhancements_smoothBackground_Sizer.addStretch();
self.enhancementsNormalizeChannelsCheckBox = guitools.newCheckBox(parent, "Normalize channels,", par.enhancements_normalize_channels,
"<p>Normalize black point and brightness on all channels based on a reference channel.<p>" +
"<p>Can be useful for example on narrowband images where Halpha data (typically on channel B) is much stronger than S or O.<p>" +
"<p>Normalization uses similar PixelMath expressions as Bill Blanshan in his <i>Narrowband Normalization using Pixnsight Pixelmath</i> " +
"script. See more information in his YouTube channel AnotherAstroChannel.</p>");
self.enhancementsNormalizeChannelsReferenceLabel = guitools.newLabel(parent, "reference", "Reference channel for normalization." + self.enhancementsNormalizeChannelsCheckBox.toolTip);
self.enhancementsNormalizeChannelsReferenceComboBox = guitools.newComboBox(parent, par.enhancements_normalize_channels_reference, normalize_channels_reference_values, self.enhancementsNormalizeChannelsReferenceLabel.toolTip);
self.enhancementsNormalizeChannelsMaskCheckBox = guitools.newCheckBox(parent, "Mask", par.enhancements_normalize_channels_mask,
"<p>Use a lightness mask when normalizing. It can help to avoid overstretching dark parts of the image.</p>" +
self.enhancementsNormalizeChannelsCheckBox.toolTip);
self.enhancementsNormalizeChannelsRescaleCheckBox = guitools.newCheckBox(parent, "Rescale", par.enhancements_normalize_channels_rescale,
"<p>Rescales the image to [0, 1] during PixelMath operation. Can be useful if there is clipping in normalization.</p>" +
self.enhancementsNormalizeChannelsCheckBox.toolTip);
self.enhancementsNormalizeChannelsSizer = new HorizontalSizer;
self.enhancementsNormalizeChannelsSizer.spacing = 4;
// self.enhancementsNormalizeChannelsSizer.margin = 2;
self.enhancementsNormalizeChannelsSizer.add( self.enhancementsNormalizeChannelsCheckBox );
self.enhancementsNormalizeChannelsSizer.add( self.enhancementsNormalizeChannelsReferenceLabel );
self.enhancementsNormalizeChannelsSizer.add( self.enhancementsNormalizeChannelsReferenceComboBox );
self.enhancementsNormalizeChannelsSizer.add( self.enhancementsNormalizeChannelsMaskCheckBox );
self.enhancementsNormalizeChannelsSizer.add( self.enhancementsNormalizeChannelsRescaleCheckBox );
self.enhancementsNormalizeChannelsSizer.addStretch();
var enhancementsAdjustChannelsToolTip = "<p>Adjust channels in PixelMath by multiplying them with a given value.</p>" +
"<p>If option Only K is checked then value R/K is used to adjust the whole image.</p>";
self.enhancementsAdjustChannelsCheckBox = guitools.newCheckBox(parent, "Adjust channels,", par.enhancements_adjust_channels, enhancementsAdjustChannelsToolTip);
self.enhancementsAdjustChannelR = guitools.newNumericEdit(parent, "R/K", par.enhancements_adjust_R, 0, 100, enhancementsAdjustChannelsToolTip);
self.enhancementsAdjustChannelG = guitools.newNumericEdit(parent, "G", par.enhancements_adjust_G, 0, 100, enhancementsAdjustChannelsToolTip);
self.enhancementsAdjustChannelB = guitools.newNumericEdit(parent, "B", par.enhancements_adjust_B, 0, 100, enhancementsAdjustChannelsToolTip);
var enhancementsAdjustChannelR = self.enhancementsAdjustChannelR;