Is it possible to subtract one image in a stack from all the others?
Otherwise, is there a way to make sure two images, opened separately, are actually aligned, before doing the subtraction?
I'm interested in trying to get AIJ to be able to subtract galaxy templates, for photometry of SN. I know this is not going to be "great" - maybe some kind of PSF or other modeling is "better" - but just wanna get something better than what we do now (pretend the galaxy isn't there....).
So what I can do is take an image of the galaxy without the SN in it (say, 6 months later, all images with WCS), and load it up in a stack with the SN images. I can then align them all, and do it virtually so they are saved in their own folder. Now, I can open the aligned comparison image and create a template:
1. Determine background value
2. Copy galaxy region with the circle tool thing
3. zero out the entire image (math -> set)
4. copy the region back in.
The result looks kinda reasonable to me. But, I can't quite get the subtraction. I can't seem to subtract one image in a stack from another....I can subtract an image from an entire stack, but even when those images *were* aligned, the subtraction doesn't happen in the right place - it's the same place in every image, but the separate image is not aligned with the stack, so the subtraction isn't in the right place.
So, that's where those questions come from. Thoughts?
I think I'm following what you have tried. I think the only thing that you may need to do differently is to include the reference image maybe at the beginning or end of the stack you are wanting to subtract it from (so that it gets aligned with all of the other images). Using virtual stack is a good idea, as you have done, so that you can then deal with the images on disk, and exact the aligned reference image back out of the aligned stack folder and save it somewhere else.
Next open the aligned stack (this time in memory) and then open the aligned reference image into a different AIJ image display window.
Then use the Image_Display > Process > "Image/stack calculator" to subtract the reference image from all slices in the stack with a single subtract operation.
Let us know if we're missing something on where you are running into trouble.
Ok great, I figured it out based on what you said.
I did exactly your process (one difference to what I was doing being after creating the template, I opened the stack IN memory, instead of virtual...not sure that matters), but it still didn't work.
I thought it might be the "cut and pasting" of the region, so what I actually did this time was
1. Subtract off the background
2. Circle the galaxy
3. Choose "clear outside"
and use that as a template, and it worked! (Oh, I also did the Process -> "Image/stack calculator" in the "main AIJ window", and not the window that held either my stack or the template - not sure what you meant there, just being complete.)
I still have to work out normalizing the images first (since the galaxy brightness is different in all of them), and the fact that subtracting out the average background leaves some negative pixels in the template image - if anyone has suggestions about that, I'll take them, but my main question has been answered, thanks!