How to use Stack_Manipulation package within a plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use Stack_Manipulation package within a plugin

PEARSON Matthew
Hi all,

How could i run the Stack_Splitter menu command from within a plugin?  Its part of the Stack_Manipulation jar file so i can't simply do IJ.run().  I could look at the Stack_Splitter source code and use the relevant code but seems tidier to have a single run command to launch it if thats possible.

Thanks,

Matt

 





--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to use Stack_Manipulation package within a plugin

Herbie-3
Matt,

do you mean the "stack to images" command from the "Image > Stacks" menu?

If yes, you may try the Macro-recorder with Java-Option. The recorder
will tell you that you can indeed call this operation by

        IJ.run("Stack to Images", "");

HTH

Herbie

::::::::::::::::::::::::::::::::::::::
On 20.04.14 15:42, Matt Pearson wrote:

> Hi all,
>
> How could i run the Stack_Splitter menu command from within a plugin?
> Its part of the Stack_Manipulation jar file so i can't simply do
> IJ.run().  I could look at the Stack_Splitter source code and use the
> relevant code but seems tidier to have a single run command to launch
> it if thats possible.
>
> Thanks,
>
> Matt

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to use Stack_Manipulation package within a plugin

Herbie-3
Sorry Matt,

I can't say anything about FIJI.

In ImageJ I find the operation "Make Substack" that obviously does less
than you've mentioned. It can be called by

        run("Make Substack...", "  slices=3-4");

If you call it several times with the appropriately chosen slices it
should perform what you desire -- no?

HTH

Herbie

::::::::::::::::::::::::::::::::::::::
On 20.04.14 16:38, Matt Pearson wrote:

> Hi Herbie,
>
> I should have said, i'm using FIJI and in the Image menu is
> >Stacks>Tools>Stack Splitter
>
> This can divide a stack into a number of sub-stacks, so if i had 10
> images in the stack i could divide it by 5 to make 5 stacks of 2
> images.  So i'd like to use this stack splitter function from within
> my plugin but not sure how to run it.  In the plugins folder its
> called Stack_Manipulation.jar.
>
> I should also say that i'm new to JAVA plugins, i've been sticking
> with the macro language up to now.
>
> Thanks,
>
> Matt

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to use Stack_Manipulation package within a plugin

PEARSON Matthew
Hi Herbie,

Yes you're right that is one way of doing it.
Thanks for the help,

Matt

On 20 Apr 2014, at 16:01, Herbie <[hidden email]> wrote:

> Sorry Matt,
>
> I can't say anything about FIJI.
>
> In ImageJ I find the operation "Make Substack" that obviously does less than you've mentioned. It can be called by
>
> run("Make Substack...", "  slices=3-4");
>
> If you call it several times with the appropriately chosen slices it should perform what you desire -- no?
>
> HTH
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::
> On 20.04.14 16:38, Matt Pearson wrote:
>> Hi Herbie,
>>
>> I should have said, i'm using FIJI and in the Image menu is
>> >Stacks>Tools>Stack Splitter
>>
>> This can divide a stack into a number of sub-stacks, so if i had 10
>> images in the stack i could divide it by 5 to make 5 stacks of 2
>> images.  So i'd like to use this stack splitter function from within
>> my plugin but not sure how to run it.  In the plugins folder its
>> called Stack_Manipulation.jar.
>>
>> I should also say that i'm new to JAVA plugins, i've been sticking
>> with the macro language up to now.
>>
>> Thanks,
>>
>> Matt
>


--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to use Stack_Manipulation package within a plugin

Herbie-3
In reply to this post by Herbie-3
Matt,

of course it should be called by IJ.run...

But anyway, if you can call the PlugIn from the plugins folder, then in
general you may call it from your PlugIn by

        IJ.run( imp, "Stack Manipulation", etc. etc." );

HTH

Herbie

On 20.04.14 17:01, Herbie wrote:

> Sorry Matt,
>
> I can't say anything about FIJI.
>
> In ImageJ I find the operation "Make Substack" that obviously does less
> than you've mentioned. It can be called by
>
>      run("Make Substack...", "  slices=3-4");
>
> If you call it several times with the appropriately chosen slices it
> should perform what you desire -- no?
>
> HTH
>
> Herbie
>
> ::::::::::::::::::::::::::::::::::::::
> On 20.04.14 16:38, Matt Pearson wrote:
>> Hi Herbie,
>>
>> I should have said, i'm using FIJI and in the Image menu is
>> >Stacks>Tools>Stack Splitter
>>
>> This can divide a stack into a number of sub-stacks, so if i had 10
>> images in the stack i could divide it by 5 to make 5 stacks of 2
>> images.  So i'd like to use this stack splitter function from within
>> my plugin but not sure how to run it.  In the plugins folder its
>> called Stack_Manipulation.jar.
>>
>> I should also say that i'm new to JAVA plugins, i've been sticking
>> with the macro language up to now.
>>
>> Thanks,
>>
>> Matt
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to use Stack_Manipulation package within a plugin

dscho
In reply to this post by PEARSON Matthew
Hi Matt,

On Sun, 20 Apr 2014, Matt Pearson wrote:

> How could i run the Stack_Splitter menu command from within a plugin?

There are a couple of problems with this:

* it is in the default package, so you cannot really import it.

* apart from the run(), all of its methods are protected.

* there seems not to be a method that returns the split stacks, but
  instead they are displayed.

See:
http://jenkins.imagej.net/view/Fiji/job/Stack_Manipulation/ws/target/apidocs/Stack_Splitter.html

> Its part of the Stack_Manipulation jar file so i can't simply do
> IJ.run().

Just because a plugin is part of a .jar file does *not* mean you cannot
run it using IJ.run().

In your case -- because you probably need to access the individual
ImagePlus instances into which the stack was split -- I think that you'd
need to enhance the original Stack_Splitter class.

Happily, all of it is Open Source, and since I recently split the huge
Fiji source code repository into individual projects, it is pretty easy to
get started.

If you use an IDE such as Eclipse, you basically just have to clone
https://github.com/fiji/Stack_Splitter and import it as a Maven plugin.

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to use Stack_Manipulation package within a plugin

dscho
Hi Matt,

On Mon, 21 Apr 2014, Matt Pearson wrote:

> Thanks for the info, its good to know i can use IJ.run() for plugins
> contained within jar files.

Yes, this is possible, and there are actually two signatures. One which
takes the menu label and a macro-style argument string, and the other
taking an ImagePlus as a first argument. When calling from plugins, you
definitely want to use the latter because that minimizes chances of
interfering with other things going on in ImageJ (such as: running a macro
in parallel, or accidentally opening another image while your plugin is
running).

> I'll take a closer look at the Jenkins website.

For the record: it *is* the Jenkins website, but more specifically you are
looking at the Javadocs. Jenkins is our butler; she continually builds the
Javadocs (and does a lot of other tasks, too, proving once again how
useful computers are at automating things).

Ciao,
Johannes

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