MATLAB Examples

GUI_MACE_Debye

This is a Matlab GUI designed to compute the acousto-electric conductivity modulation signal and Debye signals for a given electric geometry. Different parameters are included in this GUI to modify them easily and see their effect on the resulting signal. It is useful also to determine the values of the different acoustic parameters. Many figures can be displayed to visually analyse the acoustic field.

Contents

Syntax

This GUI takes his information based on the structure of information used by NumSim. It requires that the electrostatic problem is solved.

  • GUI_MACE_Debye_V1_00; % In this case, a window asking for the simulation result to load (the electrostatic problem should be solved).
  • GUI_MACE_Debye_V1_00(stcnum); % The structure stcnum is the simulation result with the electrostatic problem solved.
  • GUI_MACE_Debye_V1_00(stcnum,obj_US_GUSAFP); % obj_US_GUSAFP_V1_00 is an object of type US_GUSAFP.
  • GUI_MACE_Debye_V1_00(stcnum,obj_US_GUSAFP,stc_config); % stc_config is a structure for the configuration of the GUI (position of the figures, what to display, ...). That structure is generally taken as an output from a previous call to this same GUI (see the information about stc_GUI_config below).

Example of call

% Loading of the simulation result, including the geometry information
% Before this is done, the adjustment of the root filenames might be necessary to do in the function "change_root_filenames".
stcnum = NumSim([pwd,'\Documentation\Demos\Thinplate_imaging\Sim_outputs\NumSim_result.mat'],{},'not_save');

% Loading of the Matlab GUI
GUI_MACE_Debye_V1_00(stcnum);

Parts of the GUI

Time control

A slider allows the time evaluation for the display (sampled at 50 MHz). The current time is written (here, as 40.00 mus, meaning 40.00 microseconds). The numeric box above the time slider is the time delay to increase/decrease when the arrows of the time slider are used. This is useful to increment the time with a desired value.

Translation of the acoustic field

The focal point of the acoustic monoelement transducer can be translated using the GUI controls. The "x", "y" and "z" coordinates are written at right, while the arrows can be used to translate the focal point of the distance written in the box in the middle. The check box "Translate GUSAFP" is to toggle what is to be done with the acoustic grid when the focal point is changed: when checked, the acoustic grid is translated with the same amount of displacement; when unchecked, the acoustic grid keeps the same coordinates.

Rotation of the propagation axis

The rotation of the propagation axis around a given axis passing by the rotation center can be controlled with these buttons. The arrows performs the incrementation of the angle with a value as given in the middle box (in degrees).

Computation

When the values in the GUI are changed, there may be some computation to be done in order to have valid information (for example, when the acoustic field is modified, the resulting AECM and Debye signals have to be re-computed). The computation that is done depends on what the user wants to see. For example, if the figure of AECM signal is not displayed, this signal is not computed. The indicator of computation specifies if a computation is to be done in order to have all the figures updated. To launch the computation when all the parameters have been set properly, click on the button "Compute now!". The GUI buttons are disabled during the computation. When the check box "Compute as needed" is checked, the computation is launched every time there is something to compute.

Figures display

Different figures can be displayed, for different plots. What is displayed on each of these figures can also be selected. When a figure has to be closed, the check box on the GUI for the corresponding figure can be unchecked, or the "X" on the top-right corner of the figure can be clicked (both actions are equivalent).

Figure configuration: figure for the general configuration of the acoustic field relatively to the electric configuration. This figure can display:

  • the ultrasound geometry object;
  • the ultrasound grid;
  • the amplitude of the acoustic field on a central slice of the transducer;
  • a representation of the location of the transducer;
  • the integration grid;
  • the location of the rotation center.

Figure US beam: figure for the acoustic beam analysis. The intensity of the acoustic beam is displayed on the acoustic grid with color points. This figure can display:

  • the electric geometry;
  • isosurfaces of pressure of the acoustic field;
  • the amplitude of the acoustic field on a central slice of the transducer;
  • a representation of the location of the transducer;
  • the location of the rotation center.

Figure impulse response: figure of the signal of the impulse response of the transducer. This figure can display:

  • a star marker at each time sample.

Figure excitation: figure of the signal of the excitation signal sent to the transducer. This figure can display:

  • a star marker at each time sample.

Figure Debye: figure of the AECM and Debye signals. This figure can display:

  • the Debye signal;
  • the AECM (=MACE) signal;
  • the sum of the Debye and the AECM signal;
  • a point marker at the current time;
  • a legend.

Figure MACE: figure of the AECM signal. This figure can display:

  • a point marker at the current time.

Parameters (general)

This section controls a set of different parameters related to the acoustic object, but also for the display and other functionalities.

The box above lists the parameters in different categories:

  • parameters US: parameters of the US_GUSAFP object. It relates to the acoustic parameters;
  • parameters US slice: parameters for the grid where the amplitude of the acoustic field on a central slice of the transducer is computed;
  • parameters GUSAFP: parameters of the acoustic grid (the geom_definition_GUSAFP field of the US_GUSAFP object);
  • parameters isosurfaces US beam: parameters for the display of isosurfaces of the acoustic field;
  • parameters GJ: a few parameters of the geometry object affecting his integration grid;
  • parameters JI: the value of current injection;
  • outputs: some useful outputs available: the AECM and Debye signals, the batch output and the structure of the GUI configuration (this is the structure that can be given as the third input argument of this GUI).

The box below displays the information. For the different parameters, a new value can be entered (click somewhere else on the GUI after editing the value to confirm the edition). If it is accepted, the box will turn green; if there is an error, the box will turn red. Moreover, an error message will be displayed in the lower box ((msg box)).

The button "To workspace" exports the parameter (or the category) selected to the workspace in the variable "GUI_MACE_Debye_var_export". The button "From workspace" imports the value of the variable "GUI_MACE_Debye_var_import" from the workspace into the parameter selected.

Saving

The displayed figures, the information about the simulation and the GUI configuration can be saved in the folder specified. The button with the icon of the open folder will open a folder browser window to select this output directory.

When the button "Save outputs" is pressed, the following is saved:

Displayed figures:

  • Figure configuration: "figConfig.jpg";
  • Figure US beam: "figUSbeam.jpg";
  • Figure impulse response: "figIR.jpg";
  • Figure excitation: "figExcitation.jpg";
  • Figure Debye: "figDebye.jpg";
  • Figure MACE: "figMACE.jpg".

Outputs variables: inside the file "GUI_output_variables.mat", the following variables are saved:

  • obj_US_GUI: the US_GUSAFP object for the acoustic beam;
  • obj_geom_definition_GJ_GUI: the AFP object of the electric simulation (this is saved because the integration part may have been changed by the user with the GUI);
  • obj_gen_infos_GUI: the gen_infos object from the electric simulation (to know what electric simulation was given to the GUI);
  • stc_outputs_GUI: a structure with the fields "current_injection", "signal_Debye", "signal_MACE" and "batch_output". These fields are some outputs of the GUI;
  • stc_GUI_config: the GUI configuration. This is a structure with the different values of the status of the GUI (position of figures, values of parameters, ...). This is the structure that could be given as third input argument in calling this GUI to recover the display configuration;
  • C_filename_figures_saved: a cell array of the complete filenames of the figures saved;
  • save_time: the date and time of this saving process.

Batch launching

A batch file can be used to perform some (usually, repetitive) tasks. Click on the button with the icon of an open folder to select a batch file. An example of such a file, named "batch_GUI_depl_x.m", is joined in this distribution. When this file is ready to be executed, click on the "Launch batch" button. The check box on the right of this button is a control available to the user to stop the batch process during a computation; while the batch is running, the controls of the GUI are disabled, except for this check box.

Known issue

This GUI has been designed to work with a 50 MHz time sampling for the acoustic beam. Inconsistencies will occur if the input object obj_US_GUSAFP has a beam computed with a downsampled frequency (if the method calc_hp_MG receives an input not equal to 1 in his third argument).

Copyright 2013 Mathieu Gendron