# Wtfa img

Jump to navigation
Jump to search

### Purpose

Window target factor analysis for images.

### Synopsis

- [rho,angl,q] = wtfa_img(spec,tspec,window,p,options)

### Description

#### Inputs

**spec**= MxNxP 3-way data matrix/image (spatial modes 1 and 2 MxN, and spectral mode is 3 w/ P channels).**tspec**= KxP matrix of target/candidate spectra.**window**= 2 element vector containing the window width in the x- and y-directions {each element should be > 1} (Note: if a scalar is input then the window in both directions is set to the scalar).

**p**= The number of principal components, PCs, for modeling each window of spectra.`p >= 1`: (integer) number PCs is a constant p,`0 < p < 1`: sets a relative criterion for selecting number of PCs in each window i.e. only the first set of PCs that together capture >=p*100% of the variance in the window are used`p < 0`: sets an absolute value for number of PCs i.e. factors with singular values <|p| are not used.

#### Outputs

**rho**= direction cosine between tspec and a p component PCA model of (spec) in each window.**angl**= angle between targets and PCA model [= acos(rho)].**q**= Q residuals.

### Options

options = a structure array with the following fields:

**plots**: [ 'off' | {'angle'} | 'rho' | 'q' ]

- 'off' : nothing is plotted,
- 'angle' : projection angle (angle) plotted {default},
- 'rho' : direction cosine (rho) are plotted, or
- 'q' : Q residuals (q) are plotted.

**inds**: [ ] a 2 column matrix of indices corresponding to the location in the image to test {default uses entire image}.