## bug #37410: image.m has a wrong check for linearly-spaced x and y

 Submitted by: Francesco Potortì Submitted on: Thu 20 Sep 2012 11:44:33 AM UTC Category: Libraries Severity: 3 - Normal Priority: 5 - Normal Item Group: Regression Status: Fixed Assigned to: None Originator Name: Open/Closed: Closed Release: 3.6.2 Operating System: GNU/Linux

You are not logged in

Mon 14 Oct 2013 01:09:14 AM UTC, comment #6:

We don't necessarily need std(), but we would like something that is dimensionless and the coefficient of variation was one such measure.

Consider the following example which has small, but non-linear, spacing and would still pass your criterion.

which displays "linear".

I think this code should work which uses the percentage change (dimensionless) from the mean delta.

I checked it in here http://hg.savannah.gnu.org/hgweb/octave/rev/a433244dd697.

Rik <rik5>
Sat 12 Oct 2013 02:18:31 PM UTC, comment #5:

Why do we need std in the linearity check? Isn't something like

sufficient? Regards, Andy

Andreas Weber <andy1978>
Thu 20 Sep 2012 01:50:18 PM UTC, comment #4:

I'd like to eliminate the use of length in Octave because the definition of length (inherited from prehistoric Matlab) is weird. So please use numel instead unless there is some specific case that actually needs the strange behavior of the length function. And in that case, please comment why it is needed.

John W. Eaton <jwe>
Thu 20 Sep 2012 01:29:14 PM UTC, comment #3:

Yes. This is the code as I am currently using it:

dx = diff (x);
dy = diff (y);
dx = std (dx) / mean (abs (dx));
dy = std (dy) / mean (abs (dy));
tol = 100*eps;
if (any (dx > length(x)*tol) || any (dy > length(y)*tol))
warning ("Image does not map to non-linearly spaced coordinates")
endif

The only change is in the 'if' condition.

Francesco Potortì <pot>
Thu 20 Sep 2012 01:18:12 PM UTC, comment #2:

Did you mean:
tol = 100*length(x) * eps;

Doug Stewart <dastew>
Thu 20 Sep 2012 12:05:25 PM UTC, comment #1:

Sorry, I meant length(x) rather than rows(x).

Francesco Potortì <pot>
Thu 20 Sep 2012 11:44:33 AM UTC, original submission:

The check in image.m is

dx = diff (x);
dx = std (dx) / mean (abs (dx));
tol = 100*eps;
if (any (dx > tol))
warning

but this is too strict.

I stumbled upon it with x=linspace(0,10.43,743);

I suggest to set

tol = 100*rows(x);

Francesco Potortì <pot>

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Comment:

No files currently attached

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by rik5 (Posted a comment)
• -email is unavailable- added by andy1978 (Posted a comment)
• -email is unavailable- added by jwe (Posted a comment)
• -email is unavailable- added by dastew (Posted a comment)
• -email is unavailable- added by pot (Submitted the item)
•

Do you think this task is very important?
This task has 0 encouragements so far.

Only project members can vote.

Please enter the title of George Orwell's famous dystopian book (it's a date):