[ImageJ-devel] ImageJ2 scripting

Mark Hiner hiner at wisc.edu
Wed Apr 29 12:17:20 CDT 2015


Hi all,

>I would like to make things friendlier by automatically converting python
arrays to java, so I opened a new issue:
https://github.com/scijava/scripting-jython/issues/2

After further investigation, the problem wasn't type conversion but rather
that the createimg (and create) ops have a varargs parameter. Even though
an array was being passed, the individual values were being unwrapped (so
the Ops framework saw two parameters, instead of a single array parameter
with two elements).

The issue was not limited to jython scripting. I filed a PR to improve the
matching logic[1] - once it's merged, the following will all work:

   blank = ops.create(100, 50)

   blank = ops.create([100, 50])

   from jarray import array
   blank=ops.createimg(array([100, 50], 'l'))

Thanks again for the help and feedback!

Best,
Mark

[1] https://github.com/imagej/imagej-ops/pull/115

On Tue, Apr 28, 2015 at 1:54 PM, Mark Hiner <hiner at wisc.edu> wrote:

>
> from jarray import array
>> blank=ops.createimg(array([100, 50], 'l'))
>>
>
> Thanks for this Brian! It definitely worked for me.
>
> I would like to make things friendlier by automatically converting python
> arrays to java, so I opened a new issue:
> https://github.com/scijava/scripting-jython/issues/2
>
> Thanks for pointing this out Jan.
>
> Best,
> Mark
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20150429/1cad9a4c/attachment.html>


More information about the ImageJ-devel mailing list