{"action":"created","issue":{"url":"https://api.github.com/repos/imagej/imagej-ops/issues/88","labels_url":"https://api.github.com/repos/imagej/imagej-ops/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/imagej/imagej-ops/issues/88/comments","events_url":"https://api.github.com/repos/imagej/imagej-ops/issues/88/events","html_url":"https://github.com/imagej/imagej-ops/pull/88","id":53346722,"number":88,"title":"Fix README's example, once and for all","user":{"login":"dscho","id":127790,"avatar_url":"https://avatars.githubusercontent.com/u/127790?v=3","gravatar_id":"","url":"https://api.github.com/users/dscho","html_url":"https://github.com/dscho","followers_url":"https://api.github.com/users/dscho/followers","following_url":"https://api.github.com/users/dscho/following{/other_user}","gists_url":"https://api.github.com/users/dscho/gists{/gist_id}","starred_url":"https://api.github.com/users/dscho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dscho/subscriptions","organizations_url":"https://api.github.com/users/dscho/orgs","repos_url":"https://api.github.com/users/dscho/repos","events_url":"https://api.github.com/users/dscho/events{/privacy}","received_events_url":"https://api.github.com/users/dscho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-01-04T20:03:26Z","updated_at":"2015-01-13T19:11:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/imagej/imagej-ops/pulls/88","html_url":"https://github.com/imagej/imagej-ops/pull/88","diff_url":"https://github.com/imagej/imagej-ops/pull/88.diff","patch_url":"https://github.com/imagej/imagej-ops/pull/88.patch"},"body":"When running `UsingOps`, the user is greeted thusly:\r\n\r\n```\r\n[INFO] Found 199 ops\r\n[INFO] Available operations:\r\n\t[111.0] (net.imglib2.img.array.ArrayImg<net.imglib2.type.numeric.real.DoubleType, net.imglib2.img.basictypeaccess.array.DoubleArray> image) = net.imagej.ops.arithmetic.add.parallel.AddConstantToArrayDoubleImageP(net.imglib2.img.array.ArrayImg<net.imglib2.type.numeric.real.DoubleType, net.imglib2.img.basictypeaccess.array.DoubleArray> image, byte value)\r\n\t[110.0] (net.imglib2.img.array.ArrayImg<net.imglib2.type.numeric.integer.ByteType, net.imglib2.img.basictypeaccess.array.ByteArray> image) = net.imagej.ops.arithmetic.add.parallel.AddConstantToArrayByteImageP(net.imglib2.img.array.ArrayImg<net.imglib2.type.numeric.integer.ByteType, net.imglib2.img.basictypeaccess.array.ByteArray> image, byte value)\r\n\t[101.0] (net.imglib2.img.array.ArrayImg<net.imglib2.type.numeric.real.DoubleType, net.imglib2.img.basictypeaccess.array.DoubleArray> image) = net.imagej.ops.arithmetic.add.AddConstantToArrayDoubleImage(net.imglib2.img.array.ArrayImg<net.imglib2.type.numeric.real.DoubleType, net.imglib2.img.basictypeaccess.array.DoubleArray> image, double value)\r\n\t[100.0] (net.imglib2.img.array.ArrayImg<net.imglib2.type.numeric.integer.ByteType, net.imglib2.img.basictypeaccess.array.ByteArray> image) = net.imagej.ops.arithmetic.add.AddConstantToArrayByteImage(net.imglib2.img.array.ArrayImg<net.imglib2.type.numeric.integer.ByteType, net.imglib2.img.basictypeaccess.array.ByteArray> image, byte value)\r\n\t[100.0] (java.lang.Object result) = net.imagej.ops.onthefly.ArithmeticOp$AddOp(java.lang.Object result, java.lang.Object a, java.lang.Object b)\r\n\t[0.6] (double a) = net.imagej.ops.arithmetic.add.AddConstantToDouble(double a, double b)\r\n\t[0.5] (long a) = net.imagej.ops.arithmetic.add.AddConstantToLong(long a, long b)\r\n\t[0.4] (float a) = net.imagej.ops.arithmetic.add.AddConstantToFloat(float a, float b)\r\n\t[0.3] (int a) = net.imagej.ops.arithmetic.add.AddConstantToInteger(int a, int b)\r\n\t[0.2] (short a) = net.imagej.ops.arithmetic.add.AddConstantToShort(short a, short b)\r\n\t[0.1] (byte a) = net.imagej.ops.arithmetic.add.AddConstantToByte(byte a, byte b)\r\n\t[0.0] (net.imglib2.IterableRealInterval<capture of ?> image) = net.imagej.ops.arithmetic.add.AddConstantToImageInPlace(net.imglib2.IterableRealInterval<capture of ?> image, capture of ? value)\r\n\t[0.0] (net.imglib2.IterableInterval<capture of ?> a) = net.imagej.ops.arithmetic.add.AddRandomAccessibleIntervalToIterableInterval(net.imglib2.IterableInterval<capture of ?> a, net.imglib2.RandomAccessibleInterval<capture of ?> b)\r\n\t[0.0] (net.imglib2.img.planar.PlanarImg<net.imglib2.type.numeric.real.DoubleType, net.imglib2.img.basictypeaccess.array.DoubleArray> image) = net.imagej.ops.arithmetic.add.AddConstantToPlanarDoubleImage(net.imglib2.img.planar.PlanarImg<net.imglib2.type.numeric.real.DoubleType, net.imglib2.img.basictypeaccess.array.DoubleArray> image, double value)\r\n\t[-100.0] (capture of ? out?) = net.imagej.ops.arithmetic.add.AddConstantToNumericType(capture of ? out?, capture of ? in, capture of ? value)\r\n\t[-10000.0] (net.imglib2.RandomAccessibleInterval<capture of ?> out) = net.imagej.ops.arithmetic.add.AddConstantToImageFunctional(net.imglib2.RandomAccessibleInterval<capture of ?> out, net.imglib2.IterableInterval<capture of ?> in, capture of ? value)\r\n[INFO] What is 2 + 5? 7.0\r\nException in thread \"main\" java.lang.IllegalArgumentException: No candidate 'createImg' ops\r\n\tat net.imagej.ops.DefaultOpMatchingService.findModule(DefaultOpMatchingService.java:93)\r\n\tat net.imagej.ops.DefaultOpService.module(DefaultOpService.java:110)\r\n\tat net.imagej.ops.DefaultOpService.run(DefaultOpService.java:77)\r\n\tat net.imagej.ops.DefaultOpService.create(DefaultOpService.java:391)\r\n\tat UsingOps.main(UsingOps.java:33)\r\n```\r\n\r\nMaybe this should be tested as part of a unit test, what with the `README` suggesting to use `createImg` and all..."},"comment":{"url":"https://api.github.com/repos/imagej/imagej-ops/issues/comments/69800672","html_url":"https://github.com/imagej/imagej-ops/pull/88#issuecomment-69800672","issue_url":"https://api.github.com/repos/imagej/imagej-ops/issues/88","id":69800672,"user":{"login":"ctrueden","id":556626,"avatar_url":"https://avatars.githubusercontent.com/u/556626?v=3","gravatar_id":"","url":"https://api.github.com/users/ctrueden","html_url":"https://github.com/ctrueden","followers_url":"https://api.github.com/users/ctrueden/followers","following_url":"https://api.github.com/users/ctrueden/following{/other_user}","gists_url":"https://api.github.com/users/ctrueden/gists{/gist_id}","starred_url":"https://api.github.com/users/ctrueden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctrueden/subscriptions","organizations_url":"https://api.github.com/users/ctrueden/orgs","repos_url":"https://api.github.com/users/ctrueden/repos","events_url":"https://api.github.com/users/ctrueden/events{/privacy}","received_events_url":"https://api.github.com/users/ctrueden/received_events","type":"User","site_admin":false},"created_at":"2015-01-13T19:11:27Z","updated_at":"2015-01-13T19:11:27Z","body":"OK, I have this sorted out. My commit to fix the README behavior is: 41ffba8757f1bdc87e2ed6579b59057cde64b7c2.\r\n\r\nThis \"does the right thing\" by adding a createimg signature that takes only a `long[] dims`, so that the README stays simple and keeps working as is. Then we no longer need that factory complexity.\r\n\r\nThanks @dscho for that awesome unit test. It indeed fails without 41ffba8757f1bdc87e2ed6579b59057cde64b7c2, and passes with it. BTW, I also fixed up the `DefaultOpService` to use the name constants, and cleaned up the discrepancy between those built-in signatures and the built-ins listed in the `net.imagej.ops.Ops` class. And downcased `createImg` everywhere, as it should have been."}}