Skip to main content
Solved

ZPL to save geometric image analysis images in a loop


Lucia
  • Single Emitter
  • 1 reply

Hi, 

I’m trying to use ZPL to run a couple of loops and save geometric image analysis. This loops aim to change the field and wavelength in the settings of the image, but I cannot make it work. 

If I go for the text-only saving option, it doesn’t change either. 

To guide you into the code, first I define the x and y of the fields:

DECLARE setxfields, DOUBLE, 1, 9
DECLARE setyfields, DOUBLE, 1, 9
setxfields(1) = 0.0
setxfields(2)=9.68938        

setyfields(1)=-0.0    
setyfields(2)=-0.034

 

Then define the folders and filenames and then start the loop

FOR wave2, 1, 9, 1
    FOR field, 1, 9, 1
    field_x = setxfields(field)
    field_y = setyfields(field)
    SETSYSTEMPROPERTY 101, 9
    SYSP 102, 1, FLDX(field)
    SYSP 103, 1, FLDY(field)
    SYSP 202,1,WAVL(wave2)
    window=WINL()
    OPENANALYSISWINDOW "IMA"
    UPDATE ALL
    filename$ = arm$+"_"+mode$+"_"+"test_wave_"+$str(WAVL(wave2))+"_field_"+$str(field)+".bim"
    filename2$ = arm$+"_"+mode$+"_"+"test_wave_"+$str(WAVL(wave2))+"_field_"+$str(field)+".bmp"
    destinationFile$ = imaDirectory$ + filename$
    GETTEXTFILE destinationFile$, IMA
   MODIFYSETTINGS  settingsfilename$

    EXPORTBMP window, ImaDirectory$
    CLOSEWINDOW window

    NEXT
NEXT

 

Any hint would be appreciated.

Best answer by Mark.Nicholson

Hi Lucia,

What’s going wrong? Does the macro produce the correctly named files, but they all have the same data?

One thing...you get the window number of the last window opened with  window=WINL(), so when you open the Image Analysis window, it will be window number window + 1. You also seem to have the MODIFYSETTINGS after the call to GETTEXTFILE.

The best way to debug these things is to simplify things. Try writing a macro that makes one change to the settings and save the date. Once you have that working, it should be easy to plug it into your bigger code.

 

View original
Did this topic help you find an answer to your question?

2 replies

Lucia
  • Author
  • Single Emitter
  • 1 reply
  • August 10, 2023

I just wanted to add, that getting the txt output will also be great!


Mark.Nicholson
Luminary
Forum|alt.badge.img+3

Hi Lucia,

What’s going wrong? Does the macro produce the correctly named files, but they all have the same data?

One thing...you get the window number of the last window opened with  window=WINL(), so when you open the Image Analysis window, it will be window number window + 1. You also seem to have the MODIFYSETTINGS after the call to GETTEXTFILE.

The best way to debug these things is to simplify things. Try writing a macro that makes one change to the settings and save the date. Once you have that working, it should be easy to plug it into your bigger code.

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings