Solved

ZPL to save geometric image analysis images in a loop

  • 10 August 2023
  • 2 replies
  • 109 views

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.

icon

Best answer by Mark.Nicholson 11 August 2023, 20:14

View original

2 replies

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

Userlevel 7
Badge +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