Login  Register

Re: imagej scripting using kawa - can't use plugins

Posted by David Pirotte on Oct 05, 2015; 10:31pm
URL: http://imagej.273.s1.nabble.com/imagej-scripting-using-kawa-can-t-use-plugins-tp5014487p5014553.html

Hi Kyle,
Curtis,

        thanks both, sorry for the delay, I had to jump on another project and
        experiment a bit with the proposed solutions as well...


A] NL Mean works!

Using the directory setting and ij-core.scm -> ij$Mncore.class mentioned in my
previous emal, plus this define in ij-nl-mean.scm [kawa -C  ij-nl-mean.scm ->
ij$Mnnl$Mnmean.class]:

        (define (ij-nl-mean iplus1 sigma)
          (ij-run iplus1
                  "Non-local Means Denoising"
                  (string-append "sigma="
                                 (number->string sigma))))

then the nl-mean kawa script does work [1]



B] "Linear Stack Alignment with SIFT" does not work

                Note: the images we use are too big to send them here, but who might
                help probably knows the mpicbg source code and has images to
                test locally ...

        ~/lpdi/projects/kawa
                jars/
                        ij-1.49v.jar
                        ij.jar -> ij-1.49v.jar
                        mpicbg_-1.0.2.jar
                        mpicbg.jar -> mpicbg_-1.0.2.jar
                ij-core.scm
                ij$Mncore.class

Session example:

david@capac:~/lpdi/projects/kawa 67 $ export CLASSPATH=.:./jars/ij.jar:./jars/mpicbg.jar
david@capac:~/lpdi/projects/kawa 68 $ kawa -Dplugins.dir=./jars
#|kawa:1|# (import (ij-core))
#|kawa:2|# (define iplus1 (ij-open "/usr/lpdi/projects/tests/mfer/vale/dipe/mosaic1/bf.png"))
#|kawa:3|# (define iplus2 (ij-open "/usr/lpdi/projects/tests/mfer/vale/dipe/mosaic1/cpol.png"))
#|kawa:4|# (ij-show iplus1)
#|kawa:6|# (ij-show iplus2)
#|kawa:7|# (ij-run "Images to Stack" "method=[Copy (center)] name=Stack title=[] use")
#|kawa:9|#   (ij-run "Linear Stack Alignment with SIFT" "initial_gaussian_blur=1.60 steps_per_scale_octave=3 minimum_image_size=64 maximum_image_size=1024 feature_descriptor_size=4 feature_descriptor_orientation_bins=8 closest/next_closest_ratio=0.92 maximal_alignment_error=25 inlier_ratio=0.05 expected_transformation=Translation interpolate")

->
        Class not found while attempting to run "SIFT_Align"
           java.lang.NoClassDefFoundError: mpicbg/models/TranslationModel2D

        Indeed, it is not in mpcibg

What other plugin/jar should I add to my CLASSPATH to make this work?

Thanks,
David


[1] nl-mean kawa script

#!/bin/sh
# -*- mode: scheme; coding: utf-8 -*-
export CLASSPATH=\
/usr/lpdi/projects/kawa:\
/usr/lpdi/projects/kawa/jars/ij.jar:\
/usr/lpdi/projects/kawa/jars/nl-mean.jar
exec kawa -Dplugins.dir=/usr/lpdi/projects/kawa/jars --script8 "$0" "$@"
!#

;;;;
;;;; Copyright (C) 2015
;;;; David Pirotte <david at altosw dot be>

;;;; This module is part of a set of image processing modules and
;;;; scripts written using Kawa and ImageJ.

;;;; This module is free software: you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published
;;;; by the Free Software Foundation, either version 3 of the License,
;;;; or (at your option) any later version.

;;;; It is distributed in the hope that it will be useful, but WITHOUT
;;;; ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;;;; General Public License for more details.

;;;; You should have received a copy of the GNU General Public License
;;;; along with this s/w.  If not, see <http://www.gnu.org/licenses/>.
;;;;

;;; Commentary:

;;; Code:


(import (utils)
        (ij-core)
        (ij-nl-mean))


(let* ((cmd (command-line))
       (dir (list-ref cmd 1))
       (im-name (list-ref cmd 2))
       (im-type (list-ref cmd 3))
       (im-out (list-ref cmd 4))
       (sigma (string->number (list-ref cmd 5)))
       (im-filename (string-append dir "/" im-name "." im-type))
       (iplus (ij-open im-filename)))
  (ij-nl-mean iplus sigma)
  (ij-save iplus
           (string-append dir "/" im-out "." im-type))
  (exit))


#|

 ./nl-mean . images/nlm-small png images/nlm-out 30

|#

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

attachment0 (484 bytes) Download Attachment