ImagJ/Fiji 'binding' wrong argument type - help welcome

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ImagJ/Fiji 'binding' wrong argument type - help welcome

David Pirotte
Hi again,

While expecting some help wrt my previous message, I tried another 'binding' using
another class of the same plugin [1]

This time, though I will later want to avoid it, I wrote 'binding' so it calls the
imagej/fiji 'ecosystem', which means calling the procedure "run", defined in ij.IJ
(which I 'bind' in my ij-core.scm module). This works fine, but then my problem is
to get access to the result, see:

1-

  (import (ij-core))

  (export ij-geometry-to-distance-map)

  (define (ij-geometry-to-distance-map iplus1 #!optional (threshold 128))
    (ij-run iplus1
            "Geometry to Distance Map"
            (string-append "threshold="
                           (number->string threshold))))

then

  export CLASSPATH=.:./jars/ij.jar:./jars/local-thickness.jar
  kawa -C ij-local-thickness.scm

and using it

  david@capac:~/lpdi/projects/kawa 16 $ kawa -Dplugins.dir=/usr/lpdi/projects/kawa/jars
  #|kawa:1|# (import (ij-core)
          (ij-local-thickness))
  #|.....2|# #|kawa:3|# (define iplus1 (ij-open "images/camada-mapa.png"))
  #|kawa:4|# (ij-geometry-to-distance-map iplus1)
  #!null
  #|kawa:5|#

perfect, but I don't get the resulted computed image, because "run" doesn't return
anything in their ecosystem with their string based API


2-

I add a binding to the getResultImage of that class

  (define-alias get-result-image-edt
    sc.fiji.localThickness.EDT_S1D:getResultImage)

I use it, and I pass a wrong first argument on purpose, to see
what the system expects:

  (define (ij-geometry-to-distance-map iplus1 #!optional (threshold 128))
    (ij-run iplus1
            "Geometry to Distance Map"
            (string-append "threshold="
                           (number->string threshold)))
    (get-result-image-edt iplus1))

-|
...
#|kawa:4|# (ij-geometry-to-distance-map iplus1)
Argument #1 (null) to 'sc.fiji.localThickness.EDT_S1D.getResultImage()' has wrong type (expected: sc.fiji.localThickness.EDT_S1D)


So it seems that these methods (including the one in my previous mail), expect as
their first argument the instance of the class upon which to run the code ...

But how do I get access to the instance created by imagej or
these plugin classes?


Thanks,
David

[1] https://github.com/fiji/LocalThickness/blob/master/src/main/java/sc/fiji/localThickness/EDT_S1D.java

attachment0 (499 bytes) Download Attachment