"No stored apertures"

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

"No stored apertures"

johnthelast
I'm running a macro that loads an aperture and then runs the multi aperture process on a set of images. It was working fine, but now I am getting the message

"There are no stored apertures in line 106" followed by the command that runs the multiaperture.

If I manual open the apertures and place them, it works fine but the macro fails.

I've included the macro as an upload.PPhotoBuild.ijm

However, there are apertures in the directory. The log of the macro is as follows:

Arguments are = D:/Done/2026-02-14/LIGHT/AD Leo/Phoranso Bayer Binning|AD Leo
Argument 0 = D:/Done/2026-02-14/LIGHT/AD Leo/Phoranso Bayer Binning
Argument 1 = AD Leo
aijResults = D:/Done/2026-02-14/LIGHT/AD Leo/Phoranso Bayer Binning/RESULTS/AIJ/
[AIJ] InputDir: D:/Done/2026-02-14/LIGHT/AD Leo/Phoranso Bayer Binning/
[AIJ] Star: AD Leo
[AIJ] AIJ Dir: D:/Done/2026-02-14/LIGHT/AD Leo/Phoranso Bayer Binning/RESULTS/AIJ/
\n[AIJ] --- Processing filter: TR ---
[AIJ] Found 695 matching files for TR
[AIJ] Opened stack: Phoranso Bayer Binning
C:/ProgramData/AstroImageJ/
apFile = C:/ProgramData/AstroImageJ/AD Leo TR.apertures
[AIJ] Loaded apertures file: C:/ProgramData/AstroImageJ/AD Leo TR.apertures
Starting MultiAperture Run
Reply | Threaded
Open this post in threaded view
|

Re: "No stored apertures"

keastrid
How did you create the apertures file? That message indicates that there are no apertures in the file.

If you are creating the apertures file by doing the following:
1. Opening MultiAperture and placing apertures
2. Hitting escape to cancel MA/immediately saving the apertures via File > Save Apertures

Then you need to hit enter/run MA for at least 1 images to get it to save the apertures into memory before saving the file. This could be better.

So you would need to do this instead:
1. Opening MultiAperture and placing apertures
2. Hitting enter to run MA for at least one slice (you can immediately cancel the run)
3. Save the apertures via File > Save Apertures

Hardcoding the path, I am unable to reproduce this issue.
open(normalizeDir("H:/Research Data/LCO Downloader/lco/TIC458987621-01_20231023_LCO-Hal-0m4p_gp_104/TIC458987621-01_20231023_LCO-Hal-0m4p_gp_110s_0f0_104/test.apertures"));

call("ij.Prefs.set","multiaperture.automode","true");

run("MultiAperture ", "use_previous_apertures=true pause_at_each_image=false centroid_apertures=true save_measurements_file=true");

        waiting = true;

        while (waiting) {
	wait(1000);
	finished = call("ij.Prefs.get","multiaperture.finished","false");
	if(finished == "true") {
		waiting = false;
		call("ij.Prefs.set","multiaperture.automode","false");
		call("ij.Prefs.set","multiaperture.finished","false");
		print ("Multi Aperture analysis finished");
	          }
        }
		
function normalizeDir(p) {
    p = replace(p, "\\\\", "/");
    return p;
}
Reply | Threaded
Open this post in threaded view
|

Re: "No stored apertures"

johnthelast
I did the following sequence for each filter

1) File->Import>Image Sequence
2) On the Image File->Open apertures for that filter's previously created aperture file (Apertures show up as white on the image, positions and magnitudes are correct)
3) Clicked the clean measurements icon and then place apertures icon
4) Multi-Aperture window opens with the Place 3 imported...   checked
5) Hit Place Apertures
6) Moved the curso over the image and hit Enter
7) Let it run for a few images and then hit ESC
8) File->Save Apertures saved it over the existing file that I had loaded
9) Repeat for the other two filters
9) Close Astroimagej

Ran Astroimagej from the command line with the macro invoked and it failed. But if I do the same set of processes manually, it will work

Now, for the interesting part

If I do the same process, BUT instead of loading the apertures from the file, I place new apertures manually  (step 2 is not performed and step 4 places new apertures) the macro will work on the next run and on subsequent runs.

Is there something that invalidates an aperture file? I didn't get any error messages when I loaded the file from the previously saved file, but obviously rebuilding the file from scratch fixed the problem. But then, why did the original file work if I load it manually, but fail when I do the macro (until I rebuilt the file)?
Reply | Threaded
Open this post in threaded view
|

Re: "No stored apertures"

keastrid
The apertures should be valid. The "No stored apertures" error shows when it cannot find the aperture x coordinates in the file.

I wasn't able to replicate this issue to get "No stored apertures", but I did get a related error - "Error reading apertures file" when running your macro. I have a fix for this for the next version of AIJ. For now, you can try adding a wait after your open the stack in the macro:
run("Image Sequence...", "open=[" + inDir + "] filter=" + flt + " sort use");

stackTitle = getTitle();
 print("[AIJ] Opened stack: " + stackTitle);
		
wait(200); // Could probably be faster
Reply | Threaded
Open this post in threaded view
|

Re: "No stored apertures"

johnthelast
Thanks, I'll add that in. Could you elaborate a bit on "cannot find the aperture x coordinates in the file". Are you referring to the aperture file itself?
Reply | Threaded
Open this post in threaded view
|

Re: "No stored apertures"

keastrid
The error message "No stored apertures" only occurs when MA cannot find the aperture x positions (since it checks for those first). In the case of using imported apertures, that essentially means it failed to read the apertures file, the aperture file stored a set of empty apertures, or no apertures have been imported.

Let us know if adding the wait to the macro fixes the issue.
Reply | Threaded
Open this post in threaded view
|

Re: "No stored apertures"

johnthelast
Will do. I put the wait into the macro. So far so good.
Reply | Threaded
Open this post in threaded view
|

Re: "No stored apertures"

karenacollins
Administrator
This fix is included in 6.0.4.03 and later.