-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathread3Dfits.cl
executable file
·50 lines (37 loc) · 1.07 KB
/
read3Dfits.cl
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
# Le um fits 3D (por exemplo, saido do CCD Ikon no modo dinâmico) e escreve
# as imagens individuais (2D)
procedure read3Dfits(image)
string image="" {prompt="Fits filename (without the .fits, '*' is accepted)"}
string prefix="cp_" {prompt="Prefix added to the output"}
struct *flist1
begin
int i,nframes
string suffix,imag,lista
imag = image
#Gera lista de arquivos a serem processados
lista = mktemp("lista")
files(imag//"*", > lista)
flist1 = lista
while (fscan(flist1, imag) != EOF) {
print ("# Extracting 2D Fits files from 3D File: ", imag)
#retira o .fits do nome
imag = substr(imag,1,(strlen(imag)-5))
#Apaga arquivos anteriores
imdel (images=prefix//imag//"_*",go_ahead=yes, verify=no, >& "dev$null")
#$
unlearn imgets
imgets(imag,"NUMKIN")
nframes = int(imgets.value)
for (i = 1; i <= nframes; i += 1) {
suffix = "_"//i
if (i < 1000) suffix = "_0"//i
if (i < 100) suffix = "_00"//i
if (i < 10) suffix = "_000"//i
imcopy(input=imag//"[*,*,"//i//"]",
output=prefix//imag//suffix,verbose=no)
}
}
delete (lista, ver-, >& "dev$null")
#$
flist1 = ""
end