[ome-users] Running Bio-Formats from a plugin

Ved P. Sharma vedsharma at gmail.com
Fri Jun 26 18:50:14 BST 2015


Dear Balaji,

I think the ActionListener in my plugin is slowing the Bio-Formats
Importer. Take a look at a sample code below. The first call to BF importer
from inside BF_plugin() opens image quickly but when I press the "open
images" button, it takes 5-10 sec to open the same image. Any thoughts on
why ActionListener is slowing things down and how to remedy this?

Thanks,

Ved


// ******************* plugin starts here ****************************
import ij.plugin.frame.*;
import java.awt.event.*;
import ij.*;
import ij.gui.*;
import javax.swing.*;

public class BF_plugin extends PlugInFrame implements ActionListener {
    private JPanel panel;
    public BF_plugin() {
        super("BF_plugin");
        panel = new JPanel();
        JButton b = new JButton("open images");
        b.addActionListener(this);
        panel.add(b);
        add(panel);
        pack();
        GUI.center(this);
        setVisible(true);
        IJ.run("Bio-Formats Importer",
"open=[d:\\Users\\ved\\Test\\image.dv] autoscale color_mode=Default
split_channels view=[Standard ImageJ] stack_order=Default");
    }
    public void actionPerformed(ActionEvent e) {
        IJ.run("Bio-Formats Importer",
"open=[d:\\Users\\ved\\Test\\image.dv] autoscale color_mode=Default
split_channels view=[Standard ImageJ] stack_order=Default");
    }
}
// ******************* plugin ends here ****************************


On Fri, Jun 26, 2015 at 10:33 AM, Balaji Ramalingam (Staff) <
b.ramalingam at dundee.ac.uk> wrote:

>  Hi,
>
>  Thank you for reporting your issue.
> It would be great if you could expand the “options” that were used to open
> the image within the plugin.
>
>  Could you please check the following,
>
>    1. open ImageJ. Go to Plugins—>Macro—> Record
>    2. In the Macro Recorder window , please use the drop down menu for
>    “Record” and select “Java” as the option.
>    3. Repeat the Manual workflow described in your post (which opens the
>    file within a fraction of a second).This will record the api method call ,
>    in the Recorder window.
>    4. And check if the “options” in your plugin, matches the “options” in
>    the Macro Recorder, for the IJ.Run method.
>
> If they match, there should be no difference in terms of performance in
> the import call.
> Please let us know, if you find otherwise.
>
>  Best,
> Balaji
>
>  __________________
>
> Mr Balaji Ramalingam
>
> Software Developer
>
> OME Team
>
> College of Life Sciences
>
> University of Dundee
>
>   From: "Ved P. Sharma" <vedsharma at gmail.com>
> Reply-To: "ved.sharma at gmail.com" <ved.sharma at gmail.com>, OME User Support
> List <ome-users at lists.openmicroscopy.org.uk>
> Date: Thursday, 25 June 2015 20:11
> To: "ome-users at lists.openmicroscopy.org.uk" <
> ome-users at lists.openmicroscopy.org.uk>
> Subject: [ome-users] Running Bio-Formats from a plugin
>
>    Hi,
>
>  When I run *Bio-Formats Importer* from ImageJ, it opens an image file of
> size ~ 20MB within a fraction of a second. When I open the same image file
> by calling *Bio-Formats Importer* from inside a plugin using
> IJ.run("Bio-Formats Importer", "options"), it takes a long time to open the
> file (~ 10 sec). It starts with a white background and then after about
> ~5-10 seconds, the image is displayed. Can anybody tell me what am I doing
> wrong when calling BF Importer from inside a plugin?
>
> *System info:* I have ImageJ 1.49v running on WIndows 7, 64-bit computer
> and I have installed bioformats_package.jar (ver 5.1.2) in the plugins
> folder of ImageJ.
>
>  Thanks,
>
>  Ved
>
> _________________________________
> Ved P. Sharma, PhD
> Dept. of Anatomy and Structural Biology
> Albert Einstein College of Medicine
> Bronx, NY 10461
>
>
> The University of Dundee is a registered Scottish Charity, No: SC015096
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20150626/0aa6f7fe/attachment.html>


More information about the ome-users mailing list