1 #ifndef SRC_CORE_COMMAND_LIST_H_
2 #define SRC_CORE_COMMAND_LIST_H_
3 
4 
5 #include "siril.h"
6 #include "command.h"
7 #include "command_def.h"
8 
9 #define MAX_COMMAND_WORDS 50		// max number of words to split in command line input
10 
11 extern char *word[MAX_COMMAND_WORDS];	// NULL terminated
12 
13 typedef
14 struct {
15 	char *name;
16 	int nbarg;
17 	char *usage;
18 	int (* process)(int);
19 	char *definition;
20 	gboolean scriptable;
21 } command;
22 
23 static command commands[] = {
24 	/* name,	nbarg,	usage,		function pointer, definition, scriptable */
25 	{"addmax", 1,	"addmax filename", process_addmax, STR_ADDMAX, FALSE},
26 	{"asinh", 1,	"asinh stretch", process_asinh, STR_ASINH, TRUE},
27 
28 	{"bg", 0, "bg", process_bg, STR_BG, TRUE},
29 	{"bgnoise", 0, "bgnoise", process_bgnoise, STR_BGNOISE, TRUE},
30 
31 	{"cd", 1, "cd directory", process_cd, STR_CD, TRUE},
32 	{"cdg", 0, "cdg", process_cdg, STR_CDG, TRUE},
33 	{"clahe", 2, "clahe cliplimit tileSize", process_clahe, STR_CLAHE, TRUE},
34 	{"clear", 0, "clear", process_clear, STR_CLEAR, FALSE},
35 	{"clearstar", 0, "clearstar", process_clearstar, STR_CLEARSTAR, FALSE},
36 	{"close", 0, "close", process_close, STR_CLOSE, TRUE},
37 	{"convert", 1, "convert basename [-debayer] [-fitseq] [-start=index] [-out=]", process_convert, STR_CONVERT, TRUE},
38 	{"convertraw", 1, "convertraw basename [-debayer] [-fitseq] [-start=index] [-out=]", process_convertraw, STR_CONVERTRAW, TRUE},
39 	{"cosme", 1, "cosme [filename].lst", process_cosme, STR_COSME, TRUE},
40 	{"cosme_cfa", 1, "cosme_cfa [filename].lst", process_cosme, STR_COSME_CFA, TRUE},
41 	{"crop", 0, "crop [x y width height]", process_crop, STR_CROP, TRUE},
42 
43 	{"ddp", 3, "ddp level coef sigma", process_ddp, STR_DDP, FALSE},
44 
45 	{"entropy", 0, "entropy", process_entropy, STR_ENTROPY, TRUE},
46 	{"exit", 0, "exit", process_exit, STR_EXIT, TRUE},
47 	{"extract", 1, "extract NbPlans", process_extract, STR_EXTRACT, TRUE},
48 	{"extract_Ha", 0, "extract_Ha", process_extractHa, STR_EXTRACTHA, TRUE},
49 	{"extract_Green", 0, "extract_Green", process_extractGreen, STR_EXTRACTGREEN, TRUE},
50 	{"extract_HaOIII", 0, "extract_HaOIII", process_extractHaOIII, STR_EXTRACTHAOIII, TRUE},
51 
52 	{"fdiv", 2, "fdiv filename scalar", process_fdiv, STR_FDIV, TRUE},
53 	{"fftd", 2, "fftd modulus phase", process_fft, STR_FFTD, TRUE},
54 	{"ffti", 2, "ffti modulus phase", process_fft, STR_FFTI, TRUE},
55 	{"fill", 1, "fill value [x y width height]", process_fill, STR_FILL, TRUE},
56 	{"fill2", 1, "fill2 value [x y width height]", process_fill2, STR_FILL2, TRUE},
57 	{"find_cosme", 2, "find_cosme cold_sigma hot_sigma", process_findcosme, STR_FIND_COSME, TRUE},
58 	{"find_cosme_cfa", 2, "find_cosme_cfa cold_sigma hot_sigma", process_findcosme, STR_FIND_COSME_CFA, TRUE},
59 	{"find_hot", 3, "find_hot filename cold_sigma hot_sigma", process_findhot, STR_FIND_HOT, TRUE},
60 	{"findstar", 0, "findstar", process_findstar, STR_FINDSTAR, FALSE},
61 	{"fix_xtrans", 0, "fix_xtrans", process_fix_xtrans, STR_FIXXTRANS, TRUE},
62 	{"fixbanding", 2, "fixbanding amount sigma", process_fixbanding, STR_FIXBANDING, TRUE},
63 	{"fmedian", 2, "fmedian ksize modulation", process_fmedian, STR_FMEDIAN, TRUE},
64 	{"fmul", 1, "fmul scalar", process_fmul, STR_FMUL, TRUE},
65 
66 	{"gauss", 1, "gauss sigma", process_gauss, STR_GAUSS, TRUE},
67 	{"grey_flat", 0, "grey_flat", process_grey_flat, STR_GREY_FLAT, TRUE},
68 
69 	{"help", 0, "help", process_help, STR_HELP, FALSE},
70 	{"histo", 1, "histo channel (channel=0, 1, 2 with 0: red, 1: green, 2: blue)", process_histo, STR_HISTO, TRUE},
71 
72 	/* commands oper filename and curent image */
73 	{"iadd", 1, "iadd filename", process_imoper, STR_IADD, TRUE},
74 	{"idiv", 1, "idiv filename", process_imoper, STR_IDIV, TRUE},
75 	{"imul", 1, "imul filename", process_imoper, STR_IMUL, TRUE},
76 	{"isub", 1, "isub filename", process_imoper, STR_ISUB, TRUE},
77 
78 	{"linear_match", 2, "linear_match reference low high", process_linear_match, STR_LMATCH, TRUE}, /* logarifies current image */
79 	{"link", 1, "link basename [-start=index] [-out=]", process_link, STR_LINK, TRUE},
80 	{"load", 1, "load filename.[ext]", process_load, STR_LOAD, TRUE},
81 	// specific loads are not required, but could be used to force the
82 	// extension to a higher priority in case two files with same basename
83 	// exist (stat_file() manages that priority order for now).
84 	{"log", 0, "log", process_log, STR_LOG, TRUE}, /* logarifies current image */
85 #ifndef _WIN32
86 	{"ls", 0, "ls", process_ls, STR_LS, FALSE},
87 #endif
88 
89 	{"merge", 3, "merge sequence1 sequence2 [sequence3 ...] output_sequence", process_merge, STR_MERGE, TRUE},
90 	{"mirrorx", 0, "mirrorx", process_mirrorx, STR_MIRRORX, TRUE},
91 	{"mirrory", 0, "mirrory", process_mirrory, STR_MIRRORY, TRUE},
92 	{"mtf", 3, "mtf low mid high", process_mtf, STR_MTF, TRUE},
93 
94 	{"neg", 0, "neg", process_neg, STR_NEG, TRUE},
95 	{"new", 3, "new width height nb_channel", process_new, STR_NEW, FALSE},
96 	{"nozero", 1, "nozero level (replaces null values by level)", process_nozero, STR_NOZERO, TRUE}, /* replaces null values by level */
97 
98 	{"offset", 1, "offset value", process_offset, STR_OFFSET, TRUE},
99 
100 	{"preprocess", 1, "preprocess sequencename [-bias=filename] [-dark=filename] [-flat=filename] [-cfa] [-debayer] [-flip] [-equalize_cfa] [-opt] [-prefix=]", process_preprocess, STR_PREPROCESS, TRUE},
101 	{"psf", 0, "psf", process_psf, STR_PSF, FALSE},
102 
103 	{"register", 1, "register sequence [-norot] [-drizzle] [-prefix=] [-minpairs=]", process_register, STR_REGISTER, TRUE},
104 	{"reloadscripts", 0, "reloadscripts", process_reloadscripts, STR_RELOADSCRIPTS, FALSE},
105 	{"requires", 1, "requires", process_requires, STR_REQUIRES, TRUE},
106 	{"resample", 1, "resample factor", process_resample, STR_RESAMPLE, TRUE},
107 	{"rgradient", 4, "rgradient xc yc dR dalpha", process_rgradient, STR_RGRADIENT, TRUE},
108 	{"rl", 3, "rl sigma corner_radius_boost iterations", process_rl, STR_RL, TRUE},
109 	{"rmgreen", 1, "rmgreen type", process_scnr, STR_RMGREEN, TRUE},
110 	{"rotate", 1, "rotate degree [-nocrop]", process_rotate, STR_ROTATE, TRUE},
111 	{"rotatePi", 0, "rotatePi", process_rotatepi, STR_ROTATEPI, TRUE},
112 
113 	{"satu", 1, "satu coeff", process_satu, STR_SATU, TRUE},
114 	{"save", 1, "save filename", process_save, STR_SAVE, TRUE},
115 	{"savebmp", 1, "savebmp filename", process_savebmp, STR_SAVEBMP, TRUE},
116 #ifdef HAVE_LIBJPEG
117 	{"savejpg", 1, "savejpg filename [quality]", process_savejpg, STR_SAVEJPG, TRUE},
118 #endif
119 #ifdef HAVE_LIBPNG
120 	{"savepng", 1, "savepng filename", process_savepng, STR_SAVEPNG, TRUE},
121 #endif
122 	{"savepnm", 1, "savepnm filename", process_savepnm, STR_SAVEPNM, TRUE},
123 #ifdef HAVE_LIBTIFF
124 	{"savetif", 1, "savetif filename", process_savetif, STR_SAVETIF, TRUE},
125 	{"savetif32", 1, "savetif32 filename", process_savetif, STR_SAVETIF32, TRUE},
126 	{"savetif8", 1, "savetif8 filename", process_savetif, STR_SAVETIF8, TRUE},
127 #endif
128 	{"select", 2, "select from to", process_select, STR_SELECT, FALSE},
129 	{"seqextract_Ha", 1, "seqextract_Ha sequencename [-prefix=]", process_seq_extractHa, STR_SEQEXTRACTHA, TRUE},
130 	{"seqextract_Green", 1, "seqextract_Green sequencename [-prefix=]", process_seq_extractGreen, STR_SEQEXTRACTGREEN, TRUE},
131 	{"seqextract_HaOIII", 1, "seqextract_HaOIII sequencename", process_seq_extractHaOIII, STR_SEQEXTRACTHAOIII, TRUE},
132 	{"seqcrop", 0, "seqcrop [x y width height] [-prefix=]", process_seq_crop, STR_SEQCROP, FALSE},
133 	{"seqfind_cosme", 3, "seqfind_cosme sequencename cold_sigma hot_sigma [-prefix=]", process_findcosme, STR_SEQFIND_COSME, TRUE},
134 	{"seqfind_cosme_cfa", 3, "seqfind_cosme_cfa sequencename cold_sigma hot_sigma [-prefix=]", process_findcosme, STR_SEQFIND_COSME_CFA, TRUE},
135 	{"seqmtf", 4, "seqmtf sequencename low mid high [-prefix=]", process_seq_mtf, STR_SEQMTF, TRUE},
136 	{"seqpsf", 0, "seqpsf", process_seq_psf, STR_SEQPSF, FALSE},
137 	{"seqsplit_cfa", 1, "seqsplit_cfa sequencename [-prefix=]", process_seq_split_cfa, STR_SEQSPLIT_CFA, TRUE},
138 	{"seqstat", 2, "seqstat sequencename output [option]", process_seq_stat, STR_SEQSTAT, TRUE},
139 	{"seqsubsky", 2, "seqsubsky sequencename degree [-prefix=]", process_subsky, STR_SEQSUBSKY, TRUE},
140 	{"set16bits", 0, "set16bits", process_set_32bits, STR_SET16, TRUE},
141 	{"set32bits", 0, "set32bits", process_set_32bits, STR_SET32, TRUE},
142 	{"setcompress", 1, "setcompress 0/1 [-type=] [q] [hscale_factor]", process_set_compress, STR_SETCOMPRESS, TRUE},
143 #ifdef _OPENMP
144 	{"setcpu", 1, "setcpu number", process_set_cpu, STR_SETCPU, TRUE},
145 #endif
146 	{"setext", 1, "setext extension", process_set_ext, STR_SETEXT, TRUE},
147 	{"setfindstar", 2, "setfindstar sigma roundness", process_set_findstar, STR_SETFINDSTAR, TRUE},
148 	{"setmag", 1, "setmag magnitude", process_set_mag, STR_SETMAG, FALSE},
149 	{"setmagseq", 1, "setmagseq magnitude", process_set_mag_seq, STR_SETMAGSEQ, FALSE},
150 	{"setmem", 1, "setmem ratio", process_set_mem, STR_SETMEM, TRUE},
151 	{"setref", 2, "setref sequencename image_number", process_set_ref, STR_SETREF, TRUE},
152 	{"split", 3, "split R G B", process_split, STR_SPLIT, TRUE},
153 	{"split_cfa", 0, "split_cfa", process_split_cfa, STR_SPLIT_CFA, TRUE},
154 	{"stack", 1, "stack sequencename [type] [rejection type] [sigma low] [sigma high] [-nonorm, norm=] [-output_norm] [-out=result_filename] [-filter-fwhm=value[%]] [-filter-wfwhm=value[%]] [-filter-round=value[%]] [-filter-quality=value[%]] [-filter-incl[uded]] [-weighted]", process_stackone, STR_STACK, TRUE},
155 	{"stackall", 0, "stackall [type] [rejection type] [sigma low] [sigma high] [-nonorm, norm=] [-output_norm] [-filter-fwhm=value[%]] [-filter-wfwhm=value[%]] [-filter-round=value[%]] [-filter-quality=value[%]] [-filter-incl[uded]] [-weighted]", process_stackall, STR_STACKALL, TRUE},
156 	{"stat", 0, "stat", process_stat, STR_STAT, TRUE},
157 	{"subsky", 1, "subsky degree", process_subsky, STR_SUBSKY, TRUE},
158 
159 	{"threshlo", 1, "threshlo level", process_threshlo, STR_THRESHLO, TRUE},
160 	{"threshhi", 1, "threshi level", process_threshhi, STR_THRESHHI, TRUE},
161 	{"thresh", 2, "thresh lo hi", process_thresh, STR_THRESH, TRUE}, /* threshes hi and lo */
162 
163 	{"unselect", 2, "unselect from to", process_unselect, STR_UNSELECT, FALSE},
164 	{"unsetmag", 0, "unsetmag", process_unset_mag, STR_UNSETMAG, FALSE},
165 	{"unsetmagseq", 0, "unsetmagseq", process_unset_mag_seq, STR_UNSETMAGSEQ, FALSE},
166 	{"unsharp", 2, "unsharp sigma multi", process_unsharp, STR_UNSHARP, TRUE},
167 	{"visu", 2, "visu low high", process_visu, STR_VISU, FALSE},
168 
169 	/* wavelet transform in nbr_plan plans */
170 	{"wavelet", 1, "wavelet nbr_plan type", process_wavelet, STR_WAVELET, TRUE},
171 	/* reconstruct from wavelet transform and weighs plans with c1, c2, c3... */
172 	{"wrecons", 2, "wrecons c1 c2 c3 ...", process_wrecons, STR_WRECONS, TRUE},
173 
174 	{"",0,"",0, STR_NONE, FALSE}
175 };
176 
177 #endif /* SRC_CORE_COMMAND_LIST_H_ */
178