Created
August 21, 2025 13:25
-
-
Save romainGuiet/00d7cf5e96cb9b4c52edd2d923b46998 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #@ File(style="directory") dir | |
| frames = 3 | |
| IJ.run("Close All", ""); | |
| ArrayList<ImagePlus> imps = new ArrayList<>(frames); | |
| dir.eachFile { | |
| //println(it) | |
| if ( it.toString().endsWith("png") ){ | |
| def imp = IJ.openImage( it.toString() ) | |
| imps.add(imp.duplicate()) | |
| } | |
| } | |
| ImagePlus[] impsArray = imps.toArray(new ImagePlus[0]); | |
| concat_imp = Concatenator.run(impsArray); | |
| concat_imp.show() | |
| IJ.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"); | |
| aligned_concat_imp = IJ.getImage(); | |
| // remove black border after alignment | |
| min_proj_imp = ZProjector.run(aligned_concat_imp,"min"); | |
| IJ.run(min_proj_imp, "8-bit", ""); | |
| IJ.setRawThreshold(min_proj_imp, 1, 255); | |
| IJ.run(min_proj_imp, "Create Selection", ""); | |
| roi = min_proj_imp.getRoi() | |
| aligned_concat_imp.setRoi(roi) | |
| final_imp = aligned_concat_imp.crop("stack"); | |
| final_imp.setTitle("Holywood") | |
| final_imp.show() | |
| movie_path = new File(dir ,"Holywood" + ".avi") | |
| IJ.run(final_imp, "AVI... ", "compression=JPEG frame=1 save="+ movie_path.toString() ); | |
| import ij.IJ | |
| import ij.ImagePlus; | |
| import ij.plugin.Concatenator; | |
| import ij.plugin.ZProjector; | |
| import java.util.ArrayList; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment