cd "/newdata"
//cd "c:/Users/ott/Desktop/LBT/LUCI/20171024"

ooo2 = ""

luci = 2

{
if (nelements(manualfilenames) > 0) {
filenames_ = manualfilenames
} else {
filenames_ = findfile("luci" + luci + "*.fits")
n = nelements(filenames_)
filenames_ = filenames_[n-2:n]
updategui "luci2files", filenames_
}
Diff_ = preparediff(filenames_)
MaskIm_ = readfits(filenames_[3])
Mask_ = preparemask(MaskIm_)
OMask_ = outline(Mask_, 2)
Sim = preparesim(Diff_, OMask_)
view Sim,/scale995,/linear
message "Please mark star and mask positions using the \"m\" key"
cent_ = markpos(Sim)
result2_ = offsets(cent_, Diff_, Mask_, luci)
updategui "luci2align", result2_
luci2dx = result2_[1]
luci2dy = result2_[2]
luci2dphi = result2_[3]
ooo2 += "luci2: xshift: " + result2_[1] + " yshift: " + result2_[2] + " angle: " + result2_[3]
preview2 = shift(rotate(Diff_, -result2_[3], 1009.5, 1033.4), result2_[4], result2_[5]) + 2 * max(Diff_) * OMask_
view preview2, /scale995, /linear
}
