Class TurboReg_
java.lang.Object
TurboReg_
- All Implemented Interfaces:
ij.plugin.PlugIn
This class is the only one that is accessed directly by imageJ;
it launches a modeless dialog and dies. Note that it implements
PlugIn
rather than PlugInFilter
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble[][]
Accessor method for the(double[][])sourcePoints
variable.double[][]
Accessor method for the(double[][])targetPoints
variable.ij.ImagePlus
Accessor method for the(ImagePlus)transformedImage
variable.void
This method is the only one called by ImageJ.
-
Constructor Details
-
TurboReg_
public TurboReg_()
-
-
Method Details
-
run
This method is the only one called by ImageJ. It checks that there are at least two grayscale images to register. If the command line is empty, then the plugin is executed in interactive mode. Else, the command line has the following syntax:
Commands command parameter index comment −help 00 prints out the syntax −align 00 do refine the landmarks −file
−window01 reference type sourceFilename
sourceWindowTitle02 string with optional quotes sourceCropLeft 03 integer sourceCropTop 04 integer sourceCropRight 05 integer sourceCropBottom 06 integer −file
−window07 reference type targetFilename
targetWindowTitle08 string with optional quotes targetCropLeft 09 integer targetCropTop 10 integer targetCropRight 11 integer targetCropBottom 12 integer −translation
−rigidBody
−scaledRotation
−affine
−bilinear13 transformation (TRSAB) sourcePoints[0][0] 14 floating-point (TRSAB) sourcePoints[0][1] 15 floating-point (TRSAB) targetPoints[0][0] 16 floating-point (TRSAB) targetPoints[0][1] 17 floating-point (TRSAB) sourcePoints[1][0] 18 floating-point (RSAB) sourcePoints[1][1] 19 floating-point (RSAB) targetPoints[1][0] 20 floating-point (RSAB) targetPoints[1][1] 21 floating-point (RSAB) sourcePoints[2][0] 22 floating-point (RAB) sourcePoints[2][1] 23 floating-point (RAB) targetPoints[2][0] 24 floating-point (RAB) targetPoints[2][1] 25 floating-point (RAB) sourcePoints[3][0] 26 floating-point (B) sourcePoints[3][1] 27 floating-point (B) targetPoints[3][0] 28 floating-point (B) targetPoints[3][1] 29 floating-point (B) −hideOutput
−showOutput18 (T)
22 (S)
26 (RA)
30 (B)−transform 00 do not refine the landmarks −file
−window01 reference type sourceFilename
sourceWindowTitle02 string with optional quotes outputWidth 03 integer outputHeight 04 integer −translation
−rigidBody
−scaledRotation
−affine
−bilinear05 transformation (TRSAB) sourcePoints[0][0] 06 floating-point (TRSAB) sourcePoints[0][1] 07 floating-point (TRSAB) targetPoints[0][0] 08 floating-point (TRSAB) targetPoints[0][1] 09 floating-point (TRSAB) sourcePoints[1][0] 10 floating-point (RSAB) sourcePoints[1][1] 11 floating-point (RSAB) targetPoints[1][0] 12 floating-point (RSAB) targetPoints[1][1] 13 floating-point (RSAB) sourcePoints[2][0] 14 floating-point (RAB) sourcePoints[2][1] 15 floating-point (RAB) targetPoints[2][0] 16 floating-point (RAB) targetPoints[2][1] 17 floating-point (RAB) sourcePoints[3][0] 18 floating-point (B) sourcePoints[3][1] 19 floating-point (B) targetPoints[3][0] 20 floating-point (B) targetPoints[3][1] 21 floating-point (B) −hideOutput
−showOutput10 (T)
14 (S)
18 (RA)
22 (B)
Example: The command line
−align −file path/source.tif 40 80 639 479 −file path/target.tif 0 0 639 479 −translation 320 240 331.7 210 −showOutput
aligns 'source.tif' to 'target.tif' by translation, by refining an initial horizontal offset
dx = (331.7 − 320) = 11.7
and an initial vertical offset
dy = (210 − 240) = −30
The effective size of 'source.tif' is 600 x 400. The effective size of 'target.tif' is 640 x 480. The source and target points are given in relation to the original (uncropped) system of coordinates. The resulting output will be displayed.
IMPORTANT: You MUST use a pair of double quotes to enclose paths and filenames that contain white characters. Example:"my path/my file"
. Escape characters (e.g., a backslash) are not interpreted.- Specified by:
run
in interfaceij.plugin.PlugIn
- Parameters:
commandLine
-String
optional list of parameters.
-
getSourcePoints
public double[][] getSourcePoints()Accessor method for the(double[][])sourcePoints
variable. This variable is valid only after a call torun
with the option-align
has been issued. What is returned is a two-dimensional array of typedouble[][]
that contains coordinates from the imagesourceFilename
. These coordinates are given relative to the original image, before that the cropping described by thesourceCropLeft
,sourceCropTop
,sourceCropRight
, andsourceCropBottom
has been applied. These coordinates match those available fromtargetPoints
. The total number of coordinates, equal tosourcePoints[*].length
, is given by the constantturboRegPointHandler.NUM_POINTS
which corresponds to four coordinates in the present version. The second index gives the horizontal component for[0]
and the vertical component for[1]
. The number of useful coordinates depends on the specific transformation for which the alignment has been performed: translation (1), scaled rotation (2), rotation (3), affine transformation (3), and bilinear transformation (4).- Returns:
- Array of source points
- See Also:
-
getTargetPoints
public double[][] getTargetPoints()Accessor method for the(double[][])targetPoints
variable. This variable is valid only after a call torun
with the option-align
has been issued. What is returned is a two-dimensional array of typedouble[][]
that contains coordinates from the imagetargetFilename
. These coordinates are given relative to the original image, before that the cropping described by thetargetCropLeft
,targetCropTop
,targetCropRight
, andtargetCropBottom
has been applied. These coordinates match those available fromsourcePoints
. The total number of coordinates, equal totargetPoints[*].length
, is given by the constantturboRegPointHandler.NUM_POINTS
which corresponds to four coordinates in the present version. The second index gives the horizontal component for[0]
and the vertical component for[1]
. The number of useful coordinates depends on the specific transformation for which the alignment has been performed: translation (1), scaled rotation (2), rotation (3), affine transformation (3), and bilinear transformation (4).- Returns:
- Array of target points
- See Also:
-
getTransformedImage
public ij.ImagePlus getTransformedImage()Accessor method for the(ImagePlus)transformedImage
variable. This variable is valid only after a call torun
with the option-transform
has been issued. What is returned is anImagePlus
object of the size described by theoutputWidth
andoutputHeight
parameters of the call to therun
method ofTurboReg_
.- Returns:
- Transformed image
- See Also:
-