Solved

How to modify Settings of Geometric Bitmap Image Analysis?

  • 16 March 2022
  • 3 replies
  • 419 views

I’m using ZOS-API by matlab.

I’ve tried to run Geometric Bitmap Image Analysis and succeed Running Analysis by using Interactive Extension.

GeoBitIA = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.GeometricBitmapImageAnalysis);

I want to control some setting by using matlab. However I do not find right method to modify Settings.

Do me a favor to do that things.

Thank you.

icon

Best answer by David.Nguyen 16 March 2022, 11:38

View original

3 replies

Userlevel 7
Badge +2

Hi Taehyun,

 

I don’t think that this analysis has specific settings and you need to use the MODIFYSETTINGS method, which is illustrated in Example 17 of the ZOS-API. In Python, for your analysis, I would do something like:

import os

# New Geometric Bitmap Image Analysis
GeoBitIA = TheSystem.Analyses.New_Analysis(ZOSAPI.Analysis.AnalysisIDM.GeometricBitmapImageAnalysis)

# Get settings
TheSettings = GeoBitIA.GetSettings()

# Create settings file if necessary (Save() will save at the same location as the lens, use SaveTo() to save it elsewhere)
TheSettings.Save()

# Settings file path (same as the lens except with *.CFG extension)
pre, ext = os.path.splitext(TheSystem.SystemFile)
CFGPath = pre + '.CFG'

# Modify Settings
TheSettings.ModifySettings(CFGPath, 'GBM_XSIZ', '17')

# Save the settings
TheSettings.LoadFrom(CFGPath)

# Run the analysis
GeoBitIA.ApplyAndWaitForCompletion()

 

This is similar to the MODIFYSETTINGS ZPL keyword, which will give you the string codes that you need to use to edit the settings (found in the Help File [F1] under: The Programming Tab > About the ZPL > KEYWORDS (about the zpl) > MODIFYSETTINGS (keywords)), and reads as follow for Geometric Bitmap Image analysis:

Geometric Bitmap Image Analysis

GBM_FIELDSIZE: The field Y size.

GBM_RAYS: The number of rays per source pixel.

GBM_XPIX: The number of X pixels.

GBM_YPIX: The number of Y pixels.

GBM_XSIZ: The X pixel size.

GBM_YSIZ: The Y pixel size.

GBM_INPUT: The input file name

GBM_OUTPUT: The output file name

GBM_SURFACE: The surface number

GBM_ROTATION: The rotation setting

 

Let me know if that answers your question and take care,

 

David

Thank you, a lot. It will be very helpful.

Hello, I am also interested in modifying Geometric Bitmap Image Analysis files.
I wrote this macro in ZPL to save the images obtained for different configurations:

! Read the # of configs
NCONFIG = NCON()
!Read path
settingfiles$ = "...\Zemax\Configs\IMB.CFG"

! Execute for each config
FOR i, 1, NCONFIG, 1
    ! Set config
    SETCONFIG i
    img_file$ = $STR(i) + ".png"
    MODIFYSETTINGS settingfiles$, GBM_OUTPUT, img_file$
    OPENANALYSISWINDOW "IBM"
    PAUSE THREADS
    
NEXT
PRINT "DONE!"

The configuration changes and the Geometric Bitmap Image Analysis window opens up and displays the right image but nothing is saved. Moreover, the output file name keeps the initial name and it isn’t modifying for each configuration. Do you have any idea to save those images ? (the folder path doesn’t matter)

 

I also wrote another ZPL macro which works and saves the image of the opened window following the different configuration but it still not really what I want since it’s not just the image itself that is saved.

Here the other macro:
! Read the # of configs
NCONFIG = NCON()

! Execute for each config
FOR i, 1, NCONFIG, 1
    ! Set config
    SETCONFIG i
    OPENANALYSISWINDOW "IBM"
    window = WINL()
    PAUSE THREADS
    img_path$ =  “...”
    filename$ = img_path$ + "\Red" + $STR(i)
    EXPORTBMP window, filename$     
NEXT
PRINT "DONE!"

 

Thank you in advance.
(sorry if I’m not in the good topic)

Reply