# IMPOLGRID Polar-type grid for ultrasound images

IMPOLGRID returns a polar-type (fan-type) grid expressed in Cartesian coordinates. This is the "natural" grid (before scan-conversion) used when beamforming signals obtained with a cardiac phased array or a convex array.

## Syntax

[X,Z] = IMPOLGRID(SIZ,ZMAX,WIDTH,PARAM) returns the X,Z coordinates of the fan-type grid of size SIZ and angular width WIDTH (in rad) for a phased array described by PARAM. The maximal Z (maximal depth) is ZMAX.

[X,Z] = IMPOLGRID(SIZ,ZMAX,PARAM) returns the X,Z coordinates of the fan-type grid of size SIZ and angular width WIDTH (in rad) for a convex array described by PARAM. For a convex array, PARAM.radius is not Inf. The maximal Z (maximal depth) is ZMAX.

[X,Z,Z0] = IMPOLGRID(...) also returns the z-coordinate of the grid origin. Note that X0 = 0.

Units: X,Z,Z0 are in m. WIDTH must be in rad.

PARAM is a structure which must contain the following fields:

1. PARAM.pitch: pitch of the linear array (in m, required)
2. PARAM.Nelements: number of elements in the transducer array, (required)
3. PARAM.radius: radius of curvature (in m, default = Inf, linear array)

## Example #1: Low-resolution grids (for clarity purpose)

This example shows how polar-type grid look like for a phased array or convex array.

Choose a 2.7-MHz 64-element cardiac phased array with GETPARAM.

```param = getparam('P4-2v');
```

Create a 60-degrees wide polar-type 20-by-20 grid.

```[x,z] = impolgrid([20 20],10e-2,pi/3,param);
```

Display the grid.

```plot(x*1e2,z*1e2,'ko','MarkerFaceColor','k')
xlabel('[cm]')
ylabel('[cm]')
axis equal ij tight
title('A polar-type grid for a cardiac phased-array')
``` Now choose a 3.6-MHz 128-element curved linear array.

```param = getparam('C5-2v');
```

Create a polar-type 20-by-20 grid.

```[x,z] = impolgrid([20 20],10e-2,param);
```

Display the grid.

```plot(x*1e2,z*1e2,'ko','MarkerFaceColor','k')
xlabel('[cm]')
ylabel('[cm]')
axis equal ij tight
title('A polar-type grid for a curved array')
``` ## Example #2: A focused pressure field with a phased-array

This example shows how to simulate a pressure field on a polar-type grid.

Choose a 2.7-MHz 64-element cardiac phased array with GETPARAM.

```param = getparam('P4-2v');
```

Define a focus position.

```xf = 2e-2; zf = 5e-2;
```

Calculate the transmit delays with TXDELAY.

```txdel = txdelay(xf,zf,param);
```

Create a 60-degrees wide 10-cm deep 100-by-50 grid with IMPOLGRID.

```[x,z] = impolgrid([100 50],10e-2,pi/3,param);
```

Simulate the RMS pressure field with PFIELD.

```P = pfield(x,z,txdel,param);
```

Display a scatter plot of the pressure field.

```scatter(x(:)*1e2,z(:)*1e2,5,20*log10(P(:)/max(P(:))),'filled')
colormap jet
caxis([-20 0])
c = colorbar;
c.YTickLabel{end} = '0 dB';
axis equal ij tight
xlabel('[cm]')
ylabel('[cm]')
``` Display the pressure field.

```pcolor(x*1e2,z*1e2,20*log10(P/max(P(:))))
colormap hot
axis equal ij tight
xlabel('[cm]')
ylabel('[cm]')
caxis([-20 0])
c = colorbar;
c.YTickLabel{end} = '0 dB';
``` ```Damien Garcia, Eng., Ph.D.