Login  Register

accessing the ImageStack created by Linear Stack Alignment with SIFT?

Posted by Kenneth Sloan-2 on Mar 05, 2018; 6:34pm
URL: http://imagej.273.s1.nabble.com/accessing-the-ImageStack-created-by-Linear-Stack-Alignment-with-SIFT-tp5020207.html

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