Login  Register

Re: Calling Pairwise Stitch plugin from a script

Posted by Alex-2 on Jun 10, 2020; 6:05pm
URL: http://imagej.273.s1.nabble.com/Calling-Pairwise-Stitch-plugin-from-a-script-tp5023466p5023473.html

 I'm getting closer but still not there yet ... 
In the FIJI script editor I can do 

from ij import IJ

import ij.plugin

imp1 = IJ.openImage('/path/to/composite0.tif')

imp2 = IJ.openImage('/path/to/composite1.tif')

imp3 = IJ.createImage("Stitched","RGB",1,1,1)

IJ.run(imp3, "Pairwise stitching", "first_image=" + imp1.getTitle() + " second_image=" + imp2.getTitle() + " fusion_method=[Linear Blending] fused_image=result.tif check_peaks=20 ignore display_fusion compute_overlap subpixel_accuracy x=-1056.3646 y=-5.4877 registration_channel_image_1=[Only channel 1] registration_channel_image_2=[Only channel 1]")

That works.  However, in my IDE IJ.run returns

Unrecognized command: "Pairwise stitching"

So I'm trying 
from ij import IJ
import ij.plugin

imp1 = IJ.openImage('/Users/alex/Desktop/test_files/D12/merged/composite0.tif')


imp2 = IJ.openImage('/Users/alex/Desktop/test_files/D12/merged/composite1.tif')


imp3 = IJ.createImage("Stitched","RGB",1,1,1)
IJ.runPlugIn('plugin.Stitching_Pairwise', imp3.getTitle(),
             'first_image=' + imp1.getTitle() +
             ' second_image=' + imp2.getTitle() +
             ' fusion_method=[Linear Blending]' +
             ' fused_image=result.tif' +
             ' check_peaks=20' +
             ' ignore display_fusion' +
             ' compute_overlap' +
             ' subpixel_accuracy' +
             ' x=-1056.3646 y=-5.4877' +
             ' registration_channel_image_1=[Only channel 1]' +
             ' registration_channel_image_2=[Only channel 1]')

This seems to execute but the result is not in imp3.
Any thoughts would be greatly appreciated.







    On Wednesday, June 10, 2020, 01:04:28 AM PDT, Alex <[hidden email]> wrote:  
 
 I'm trying to figure out the syntax for calling the Pairwise Stitch plugin from a Python Script.
I can get the plugin to react but I can't figure out the syntax for the input arguments.  I tired the macro recorder but its hints don't seem to be helpful.
I've tried: 
imp1 = IJ.openImage('/path/to/image1.tif')
imp2 = IJ.openImage('/path/to/image2.tif')IJ.runPlugIn('plugin.Stitching_Pairwise', 'imp1', 'imp2')
That doesn't complain about argument 1 not being a string or less than 2 images being open, but I can't figure out how to pass the additional input arguments to setup the plugin, or how to return the result.
Any help would be greatly appreciated.
ThanksAlex

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

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