I assume you want imgA to go to imgC's space.
In cat_matvec, you will then use: reg2.aff12.1D reg1.aff12.1D
It may seem backwards, but the order comes from how algebraic operations are applied.
The following aren't formal notations, but hopefully they make sense:
You have spaces A, B and C, and have made maps between pairs: map_AtoB and map_BtoC.
The maps are linear, and we denote 'applying a map' by multiplication 'x' from the left.
First, you want to map A -> B: AinB = map_AtoB x A .
Now you map the result -> C: AinC = map_BtoC x AinB .
Substituting the first expression into the second, we see that:
AinC = map_BtoC x ( map_AtoB x A ).
These are linear operations, so we can rearrange parentheses as we wish (associative property).
AinC = (map_BtoC x map_AtoB) x A .
... and that last map combination in parentheses is what you are making using cat_matvec:
map_AtoC = map_BtoC x map_AtoB
Note the order.
Essentially, because the maps are applied by starting with the one next to the variable and moving to the left, the ordering might look opposite to how it would be read as a Western sentence (starting from the left and moving right).
--pt