Login  Register

Re: accessing the ImageStack created by Linear Stack Alignment with SIFT?

Posted by ctrueden on Mar 05, 2018; 7:18pm
URL: http://imagej.273.s1.nabble.com/accessing-the-ImageStack-created-by-Linear-Stack-Alignment-with-SIFT-tp5020207p5020211.html

Hi Kenneth,

The plugin source code is here:
https://github.com/axtimwalde/mpicbg/blob/2f411b380cffb580e35410b6517ffeb2c72489e2/mpicbg_/src/main/java/SIFT_Align.java

The run method does many things; the next level down programmatically is
probably the SIFT class here:
https://github.com/axtimwalde/mpicbg/blob/2f411b380cffb580e35410b6517ffeb2c72489e2/mpicbg/src/main/java/mpicbg/ij/SIFT.java

But it is quite low level. It may be simplest to copy/paste/edit code from
the plugin.

And of course, PRs welcome if you want to improve the modularity.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden
Did you know ImageJ has a forum? http://forum.imagej.net/


On Mon, Mar 5, 2018 at 12:34 PM, Kenneth Sloan <[hidden email]>
wrote:

> Context: Java plugin.
>
> Assume that I have an ImageStack
>
> ++++++++++++++++++++++++++
>    ImageStack enFaceStack;
>    ...populate the stack with individual images...
> ++++++++++++++++++++++++++
>
> I would like to register this stack - probably using SIFT (but I'm open to
> suggestion).
>
> From the macro recorder, I get:
>
> ++++++++++++++++++++++++++
> 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=Rigid interpolate");
> ++++++++++++++++++++++++++
>
> Based on the online documentation, I'm guessing I want to code this in
> Java as something like:
>
> ++++++++++++++++++++++++++
> ImagePlus ipl = new ImagePlus("enFaceStack", enFaceStack);
>
> run(ipl,"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=Rigid interpolate", null);
> ++++++++++++++++++++++++++
>
> My questions are:
>
> a) does the above look correct?
>
> b) How do I get a reference to the resulting ImageStack?
>
> When I do this manually, the original ImageStack (packaged up in a
> StackWindow) is left untouched, and a new StackWindow is created with the
> title "Aligned 9 of 9" - there were 9 slices.
>
> But, I want my Java program to (perhaps at the user's option) replace the
> original slices, in the original ImageStack, with the registered versions.
>
> If it matters, the original StackWindow is actually a MyStackWindow which
> extends StackWindow.  So, I want to keep the same MyStackWindow but replace
> the contained ImageStack.  I'd be happy to either replace the entire stack,
> or remove/add slices to replace the individual slices.
>
> I'm guessing that one way to do this is to (how?) get a list of all open
> windows and search for the one with the right title.  Better would be some
> way to get a reference to the window created by the "run" command.
>
> This is probably very basic - but I haven't done it before, and haven't
> been able to find anything in the documentation.
>
> At a different level, is it possible to get lower level access to the
> "Linear Stack Alignment with SIFT" (or something else - but it seems to
> work just fine) s.t. I can pass an ImageStack and get an aligned ImageStack
> returned?  It might be convenient to *not* display another StackWindow.
> But, that would be a bonus.
>
>
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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