summaryrefslogtreecommitdiff
path: root/siril-cli-extractHaOIII
blob: a3704554eb258e315f2505f05157b4aa67b5c722 (plain)
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
#!/bin/sh

# Shell script to extra Ha and OIII data from smallband images

# ------------------------------------------------------------------
# CONFIGURATION

# Directory names
LIGHTDIR=Light
FLATDIR=Flat
DARKDIR=Dark
BIASDIR=Bias
MASTERDIR=Master
CALIBRATEDDIR=Calibrated
PROCESSDIR=Process

# Output file names
MASTERDARK=master_dark
MASTERBIAS=master_bias
MASTERFLAT=master_flat

# Framing style 
# --framing=[cog|max|min]
OPT_FRAMING=min

# ------------------------------------------------------------------
# COMMAND LINE OPTIONS

while [ ! -z "$1" ]; do

	case "$1" in
		-f | --framing)
			shift
			OPT_FRAMING=$1
			echo "Framing ${OPT_FRAMING}"
			shift
			;;
		*)
			echo "Invalid option $1"
			exit 1;
			;;
	esac
done

# ------------------------------------------------------------------
# SAFETY CHECK

if [ ! -d "${PROCESSDIR}" ]; then
	echo "${PROCESSDIR} directory does not exist!"
	exit 1
fi

# ------------------------------------------------------------------
# EXTRACT Ha AND OIII


# ------------------------------------------------------------------
# REGISTER LIGHTS

echo "------------------------------------------------------------------"
echo "Extracting Ha and OIII"
#notify-send "${NOTIFICATIONTITLE}" "Extracting Ha and OIII"

siril-cli -d . -s - <<ENDSIRILEXTRACT

requires 1.3.4

cd ${PROCESSDIR}

# Extract Ha and OIII
seqextract_HaOIII preprocess -resample=ha

# Align Ha lights
register Ha_preprocess

# Stack calibrated Ha lights to Ha_stack (temporary)
stack r_Ha_preprocess rej 3 3 -norm=addscale -output_norm -32b -out=results_00001

# and flip if required
mirrorx_single results_00001

# Align OIII lights
register OIII_preprocess

# Stack calibrated OIII lights to OIII_stack (temporary)
stack r_OIII_preprocess rej 3 3 -norm=addscale -output_norm -32b -out=results_00002

# and flip if required
mirrorx_single results_00002

# Align the result images, small shifts and chromatic aberrations can occur
register results -transf=shift -interp=none

# Renorm OIII to Ha using PixelMath
pm \$r_results_00002\$*mad(\$r_results_00001\$)/mad(\$r_results_00002\$)-mad(\$r_results_00001\$)/mad(\$r_results_00002\$)*median(\$r_results_00002\$)+median(\$r_results_00001\$)
save ../result_OIII_\$LIVETIME:%d\$s

# Save Ha final result
load r_results_00001
save ../result_Ha_\$LIVETIME:%d\$s

ENDSIRILEXTRACT

notify-send -a "Siril" "Extracting Ha and OIII (Finished)"