MatrixOP, extension of SumRows
LTKunneman
Currently, I have two main options:
1) MatrixOP Wout = mat x Wsel, where Wsel is a column vector, with zeroes outside the region of interest. The matrix multiplication takes care of the summation and reduces the dimensionality. It is neat and works, but a bit too general and not necessarily the fastest, as a lot of unnecessary multiplication takes place outside the region of interest.
2) Duplicate the matrix, delete the range of rows or cols not used, and use MatrixOP Wout=SumRows(WmatChopped). The duplication/free and the deletepoints are unfortunate, as they take time.
Ideally, MatrixOP would have the extended command which allows for summation over a restricted range of rows/cols/layer, e.g. SumRows(Wmat,RowLower,RowUpper)
This feature would be highly welcome!
In IP6 the fastest way to get averages over rectangular image regions is actually with ImageStats (look at the /G flag).
Now for MatrixOP: your suggestion above is a good one. In fact, it has already been implemented for IP7. Here is the relevant documentation:
subRange(w , rs , re, cs, ce)
Returns a contiguous subset of the wave w specified by starting row rs and ending row re , starting column cs to ending column ce (inclusive). This is similar to Duplicate/R except scaling or dimension information are not supported in MatrixOP.
A.G.
WaveMetrics, Inc.
June 26, 2014 at 12:40 pm - Permalink
Imagestats/G takes statistics in a ROI of a matrix, but it doesn’t seem to return a 1D wave with the averages per row (or column).
June 27, 2014 at 01:41 am - Permalink
ImageStats can be invoked with /M=1 so you do not get all the high order statistics that you do not need. The /G flag is appropriate if you have a single region of interest. Otherwise, you can define arrays of ROI's and use /BRXY flag. I'm not sure which is faster for N rows/cols.
A.G.
June 27, 2014 at 11:04 am - Permalink
July 4, 2014 at 02:36 am - Permalink