Last active
October 29, 2024 09:45
-
-
Save NicoKiaru/b91f9f3f0069b765a49b5d4629a8b1c7 to your computer and use it in GitHub Desktop.
Test Fiji / Elastix bridge of BigDataViewer-Playground
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
/** | |
* BIOP, EPFL, Nicolas Chiaruttini, 18th April 2021 | |
* Simple script for a simple registration test | |
*/ | |
import ij.IJ | |
import ch.epfl.biop.wrappers.elastix.ij2commands.Elastix_Register | |
import ch.epfl.biop.wrappers.transformix.ij2commands.Transformix_TransformImgPlus | |
import ij.gui.WaitForUserDialog | |
#@CommandService cs | |
(new WaitForUserDialog( | |
"The PTBIOP update site should be enabled.\n"+ | |
"Elastix and Transformix should be installed and work in a command line interface.")).show(); | |
(new WaitForUserDialog("Set the location of elastix and transformix executable file")).show(); | |
// IJ.run("Set and Check Wrappers",""); | |
// Test images : blobs and rotated blobs | |
(new WaitForUserDialog("Click 'OK' to start a registration test, which should take about 10 seconds ...")).show(); | |
IJ.run("Blobs (25K)"); | |
IJ.run("Duplicate...", "title=blobs-rot15.gif"); | |
IJ.run("Rotate... ", "angle=8 grid=1 interpolation=Bilinear"); | |
// Get transformation | |
rh = cs.run(Elastix_Register.class, true, | |
"moving_image", "blobs.gif", | |
"fixed_image", "blobs-rot15.gif", | |
"rigid",false, | |
"fast_affine",true, | |
"affine",false, | |
"spline",false, | |
"spline_grid_spacing",40 | |
).get().getOutput("rh") | |
// Transform image | |
transformed_image = cs.run(Transformix_TransformImgPlus.class, true, | |
"img_in", "blobs.gif", | |
"rh", rh | |
).get().getOutput("img_out") | |
transformed_image.show() | |
IJ.run("Tile"); | |
(new WaitForUserDialog("The test is successful if the last and the next-to.last images look identical.")).show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment