rs_xform_specify(data_in, aux)
[xforms,aux_out]=rs_xform_specify(data_in,aux)
creates a transformation structure in the affine model class based the coordinates in a dataset structure
A transformation structure is a cell array of geometric transformations.
The transformation structures created by this module are combinations of linear transformations and translations.
These transformations can be chosen to center the coordinates in data_in
(i.e., move the centroid to the origin), to move the coordinates of a
specific stimulus to the origin, and/or or rotate the coordinates into their principal components.
To fit a geometric model to a transformation between coordinate sets, see rs_geofit
Input arguments:
-
data_in(struct) –dataset structureto use for specifying the transformations, with fieldsds(cell array) –coordinate structure, ds{k}{idim} is an array of [nstims idim] of coordinates for the kth recordsas(cell array) –stimulus metadata structure, sas{k} is the stimulus metadata for the kth recordsets(cell array) –set metadata structure, sets{k} is the response metadata for the kth record
-
aux(struct) –auxiliary options, may be omitted, with fields
opts_xform(struct) – specification of the transformation, with fieldsmode(char) – One of 'none', 'translate','offset_pca','translate_then_pca'; default is 'none'- 'none': the identity transformation
- 'translate': a point specified by 'centering_specifier' (see below) is translated to the origin
- 'offset_pca': the data are rotated into the principal components around the point specified by 'centering_specifier' (see below). The first coordinate explains the most variance around that point, the second coordinate explains the next-most-variance, etc. The point specified by the 'centering_specifier' is not moved.
- 'translate_then_pca': the point specified by 'centering_specifier') is translated to the origin, and then standard pca is done.
source(char) – 'global','local', or an integer in [1:n], where n is the number of records, equal to length(data_in.ds); default is 'global'- 'global' (default): the centering specifier is determined from the mean across records; pca is computed across all records; the transformations specified for all records are identical
- 'local': the centering specifier and pca is computed separately for each record; tranformations for each record typically differ
- an integer: the specified record is used for the centering specifier and pca; transformations foe all records are identical
centering_specifier(char) – 'none','centroid','index','typename','value'; default is 'none'- 'none': no centering is done
- 'centroid': centroid is the centering point
- 'typename': use the stimulus corresponding to aux.opts_xform.centering_typename in data_in.sas{k}.typenames for centering
- 'index': use the value in aux.opts_xform.centering_index, as the index number of the stimulus whose coordinates are to be used for centering. Caution: the index refers to the position of the stimulus in data_in.ds{k}, and stimulus order may differ across datasets. To avoid mis-referencing stimuli, specify by typename.
- 'value': use the coordinates in aux.opts_xform.,centering_value for centering
centering_typename(char) – the label of the stimulus in data_in.sas{k} to be used for centeringcentering_index(int) – the index in data_in.ds{k} to be used for centeringcentering_value(float 1-D array) – the coordinates to be used for centering; for coordinate sets of dimension k, only the first k are used aux.opts_xform.centering_[index|typename|value]: see above in aux.opts_xform.centering_specifierif_warn(int) – 1 (default) to show warnings
opts_check(struct) – options for consistency checking, with fieldif_warn(int) – 1 to show warnings when datasets are checked for consistency, 0 to suppress; default is 1
Output arguments:
-
xforms(struct) –the transformations, with fields
ts(cell array) – ts{k}{idim} is the transformation to be applied to the coordinates of dimension idim in record k. See note below regarding transformationsclass(string) – model class of the transformation; this is always 'affine'. Seetransformation structurespipeline(structure) – a structure that indicates how the transformation is specified, and can serve as the 'pipeline' field of aset metadata structurewhen the transformations are applied
-
aux_out(struct) –auxiliary outputs and parameter values used, with fields
Note regarding transformations
- The transformations specified by
rs_xform_specifyare combinations of translations and linear transformations, and belong to the model class 'affinedescribed intransformation structures`. With ts=xforms.ts{k}{idim}, and each input a row vector, the transformation is [output]=ts.b[input]ts.T+ts.c, where ts.b is a scalar, ts.T is an array of size [idim,idim], [input] is an array of size [nstims,idim], and c is a row vector of length idim. - This structure is identical to the output of Matlab's procrustes.m, [??how to hyperlink], except that the translation ts.c in procrustes.m is an array of identical rows; here it is just one row.
- This structure is also identical to that of
aux_out.knit_stats.ts{idim}{k}, where the roles of ts.b, ts.T, and ts.c are
replaced by ts.scaling, ts.orthog, and ts.translation.
ts_specify{k}{idim}=procrustes_compat(ts_knit{idim}{k}) can be used
to convert the transformations produced by
ts_knit_coordsetsto the transformations produced byrs_xform_specify.
See also: rs_aux_customize, rs_check_coordsets, PSG_PCAOFFSET, rs_xform_specify_test, rs_xform_apply.
Source code in src/rs_xform_specify.m
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |