ImageJ macro floor() versus round() versus?

Hi ImageJ macro fans,

I’m wondering if there is a ceil(n) function - or if not, why not? Obviously, there is round(n) and floor(n) but no ceil(n)? Or am I searching for the wrong term?

Thanks!

Cheers,
Robert

1 Like

See this thread from 2011 on the mailing list:
http://imagej.1557.x6.nabble.com/ceiling-function-tp3683582.html

3 Likes

I ran into this recently too. To save people a click. There is no ceil() function in ImageJ macro language. Use -floor(-n) for the equivalent.

1 Like

Thanks @imagejan and @quantixed,

Thanks for the workaround! Shall we try to get a ceil method in the macro language? Would make sense, no? Also wondering what @Wayne thinks about that. Thanks!

Cheers,
Robert

There is no ceil() function in the macro language. Use -floor(-n) as the equivalent. I added this information to the description of the floor() function.

http://wsr.imagej.net/developer/macro/functions.html#floor

Update: The latest ImageJ daily build (1.52u51) adds a Math.ceil(n) macro function, along with Math.abs(n), Math.acos(n), Math.asin(n), Math.atan(n), Math.atan2(n1,n2), Math.cos(n), Math.exp(n), Math.floor(n), Math.log(n), Math.log10(n), Math.min(n1,n2), Math.max(n1,n2), Math.pow(n1,n2), Math.round(n), Math.sin(n), Math.sqr(n), Math.sqrt(n) and Math.tan(n).

6 Likes

Wow, thank you @Wayne! This is awesome!

1 Like