Package gov.nih.mipav.view.dialogs
Class JFrameRegistrationMosaic
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- javax.swing.JFrame
-
- gov.nih.mipav.view.dialogs.JFrameRegistrationMosaic
-
- All Implemented Interfaces:
AlgorithmInterface
,java.awt.event.ActionListener
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
public class JFrameRegistrationMosaic extends javax.swing.JFrame implements java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, AlgorithmInterface
JFrameRegistrationMosaic is a window/gui that enables the user to manually align two images with the mouse and then call the AlgorithmRegOAR2D registration algorithm to create a mosaic image with the two aligned images. Multiple images can be added to the mosaic and aligned one at a time.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description private boolean[][]
m_aabReference
For masking, set to true if the reference image is written into the same location:.private boolean[][]
m_aabReferenceBackup
backup:.private javax.media.j3d.Shape3D[]
m_akBackupBorders
Backup shape for Undo:.private ModelImage[]
m_akBackupImages
Backup Image for Undo:.private javax.media.j3d.Shape3D[]
m_akBackupPolygons
Backup shape for Undo:.private javax.media.j3d.TransformGroup[]
m_akBackupTG
Backup Transform for Undo:.private javax.media.j3d.Shape3D[]
m_akBorderShapes
Reference to the border shape data structure for changing the color based on which image is selected:.private ModelImage[]
m_akImages
Reference to the model images:.private javax.media.j3d.TransformGroup[]
m_akImageTransforms
Reference and tile image transformations:.private javax.media.j3d.Shape3D[]
m_akPolygonShapes
Reference to the texture-mapped polygon on which the image is displayed:.private boolean
m_bBruteForce
Brute force default is off:.private boolean
m_bDisplayTransform
Display transfromed image in separate window: set to false (no display).private boolean
m_bDoMultiThread
private boolean
m_bDoSubsample
Default subsample set to true:.private boolean
m_bFileLoaded
Boolean to check that a file is loaded before mouse operations are allowed to occur.private boolean
m_bFirst
For blending the reference and tile images, reference image is not blended with background, reset when initData() is called.private boolean
m_bResetAlpha
To reset m_kReferenceAlpha:.private boolean
m_bSetScale
True when scale factor should be used:.private float
m_fCoarseRate
Default rotation coarse rate, set to 2 degrees:.private float
m_fFineRate
Default rotation fine rate, set to 1 degree:.private float
m_fRotateBegin
Default rotation start, set to negative 5 degrees:.private float
m_fRotateEnd
Default rotation end, set to postive 5 degrees:.private float
m_fRotationRange
default rotation range (0).private float
m_fScale
Scale factor for large images:.private float
m_fXScaleRange
default x scale range (0).private float
m_fYScaleRange
default y scale range (0).private int
m_iCost
Default cost function, set to correlation ratio (smoothed, weighted):.private int
m_iDOF
Default degrees of freedom:.private int
m_iInterp
Default image interpolation, set to be bilinear interpolation:.private int
m_iInterp2
Default interpolation for the transform algorithm:.private int
m_iMaxIterations
Default number of iteration set to 2:.private int
m_iNumMinima
Default number of minima to test from level 8 at level 4 (set to 3):.private int
m_iOpen
index of the non-selected image:.private int
m_iOpenSave
Backup of the open index:.private int
m_iReference
Index of the reference image:.private int
m_iReferenceSave
Backup of the reference index:.private int
m_iScaleSteps
default number of divisions for scale optimazation:.private int
m_iSelected
index of the selected image:private int
m_iTile
Index of the tile image:.private int
m_iTranslationRange
default x,y translation range (0).private int
m_iXClick
x,y positions of the mouse when one of the mouse buttons is pressed:.private int
m_iYClick
x,y positions of the mouse when one of the mouse buttons is pressed:.private javax.swing.JButton
m_kAdvancedOptionsButton
Launches the JDialogRegistrationOAR2D dialog to set registration options:.private javax.media.j3d.Canvas3D
m_kCanvas
Drawing canvas:.private javax.swing.JButton
m_kCloseAllButton
Close all images and remove them from the scene:.private javax.media.j3d.Transform3D
m_kCurrentTransform
current transformation based on mouseDragged event:.private javax.swing.JButton
m_kHelpButton
Open the mosaic image help.private java.awt.event.MouseEvent
m_kMouseEvent
Reference to the mousePressed event:.private javax.media.j3d.Transform3D
m_kOldTransform
Accumulated transformation prior to current mouseDrag:.private javax.swing.JButton
m_kOpenReferenceButton
Open reference image:.private javax.swing.JButton
m_kOpenTileButton
Open tile image:.private ModelImage
m_kReferenceAlpha
For blending between refernce and transformed tile images:.private ModelImage
m_kReferenceAlphaBackup
For blending between refernce and transformed tile images:.private javax.swing.JButton
m_kRegisterButton
Initialize and start the registration based on how the user positioned the two images:.private javax.swing.JButton
m_kSaveButton
Save the mosaic image:.private javax.media.j3d.BranchGroup
m_kScene
Scene graph root node:.private ModelImage
m_kTileAlpha
For blending between refernce and transformed tile images:.private javax.swing.JButton
m_kToggleSelectedButton
Toggle which image is currently selected:.private javax.swing.JButton
m_kUndoButton
Undo the last registration for the mosaic image:.private com.sun.j3d.utils.universe.SimpleUniverse
m_kUniverse
SimpleUniverse:.private static long
serialVersionUID
Use serialVersionUID for interoperability.-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Constructor Description JFrameRegistrationMosaic()
JFrameRegistrationMosaic - Creates new window for manual (mouse-based) registration of two images.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent event)
actionPerformed - JButton events:void
algorithmPerformed(AlgorithmBase kAlgorithm)
algorithmPerformed - when the alignment algorithm finishes, the transformed tile is blended with the reference image and displayed:private void
backupMosaic()
backupMosaic -- Backs up the reference & tile polygon shapes, borders, ModelImages, and TransformGroups before the registration is called, so that registration can be undone by the user:private void
closeAllImages(boolean bResetAlpha)
closeAllImages -- clears the scenegraph of all displayed images and deletes references to the images:private javax.media.j3d.Canvas3D
createCanvas(javax.swing.JPanel kPanel)
createCanvas - Creates the Canvas3D for rendering the images.private boolean
createMosaicOpenDialog(boolean bSave)
createMosaicOpenDialog - Creates a file open dialog for image files (.jpg, tiff, etc.).private void
createTexturedPolygon(javax.media.j3d.TransformGroup kTransformGroup, java.awt.image.BufferedImage kImage, int iWidth, int iHeight, int iWidthPow2, int iHeightPow2)
createTexturedPolygon - Creates a texture-mapped polygon with the BufferedImage displayed as the texture.void
dispose()
dispose - Removes member variables.void
getVariablesFromDialog(JDialogRegistrationOAR2D kOptionsDialog, boolean bCallAlgorithm)
Called from inside the JDialogRegistrationOAR2D class when the user has set the parameters and closes the dialog.private void
initData()
initData -- Initializes the selected, open, reference and tile indexes.private void
initGUI()
initGUI - Initializes GUI toolbar and buttons and displays the registration window.void
mouseClicked(java.awt.event.MouseEvent e)
mouseClicked.void
mouseDragged(java.awt.event.MouseEvent e)
mouseDragged.void
mouseEntered(java.awt.event.MouseEvent e)
mouseEntered.void
mouseExited(java.awt.event.MouseEvent e)
mouseExited.void
mouseMoved(java.awt.event.MouseEvent e)
mouseMoved.void
mousePressed(java.awt.event.MouseEvent kMouseEvent)
mousePressed, store the current transformation for the selected image so the new transformations calculated in the mouseDragged function can be concatenated onto the current transform.void
mouseReleased(java.awt.event.MouseEvent e)
mouseReleased.private boolean
registerImages()
registerImages - Registers the reference and tile images based on the how the user positions the images with the mouse.private void
repaintButtons()
private boolean
saveMosaic()
saveMosaic -- Opens a save dialog and saves the mosaic image in the selected file format.private void
storeImage(ModelImage kImage)
storeImage - creates a BufferedImage from the ModelImage data where the BufferedImage's size is the next-largest power of two from the ModelImage size.private void
toggleSelectedImage()
toggleSelectedImage - Toggles which image is currently selected.private void
undoMosaic()
undoMosaic -- Restores the backed-up ImageTransforms, PolygonShapes, BorderShapes, and ModelImages after an undo button press:-
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Use serialVersionUID for interoperability.- See Also:
- Constant Field Values
-
m_aabReference
private boolean[][] m_aabReference
For masking, set to true if the reference image is written into the same location:.
-
m_aabReferenceBackup
private boolean[][] m_aabReferenceBackup
backup:.
-
m_akBackupBorders
private javax.media.j3d.Shape3D[] m_akBackupBorders
Backup shape for Undo:.
-
m_akBackupImages
private ModelImage[] m_akBackupImages
Backup Image for Undo:.
-
m_akBackupPolygons
private javax.media.j3d.Shape3D[] m_akBackupPolygons
Backup shape for Undo:.
-
m_akBackupTG
private javax.media.j3d.TransformGroup[] m_akBackupTG
Backup Transform for Undo:.
-
m_akBorderShapes
private javax.media.j3d.Shape3D[] m_akBorderShapes
Reference to the border shape data structure for changing the color based on which image is selected:.
-
m_akImages
private ModelImage[] m_akImages
Reference to the model images:.
-
m_akImageTransforms
private javax.media.j3d.TransformGroup[] m_akImageTransforms
Reference and tile image transformations:.
-
m_akPolygonShapes
private javax.media.j3d.Shape3D[] m_akPolygonShapes
Reference to the texture-mapped polygon on which the image is displayed:.
-
m_bBruteForce
private boolean m_bBruteForce
Brute force default is off:.
-
m_bDisplayTransform
private boolean m_bDisplayTransform
Display transfromed image in separate window: set to false (no display).
-
m_bDoSubsample
private boolean m_bDoSubsample
Default subsample set to true:.
-
m_bDoMultiThread
private boolean m_bDoMultiThread
-
m_bFileLoaded
private boolean m_bFileLoaded
Boolean to check that a file is loaded before mouse operations are allowed to occur.
-
m_bFirst
private boolean m_bFirst
For blending the reference and tile images, reference image is not blended with background, reset when initData() is called.
-
m_bResetAlpha
private boolean m_bResetAlpha
To reset m_kReferenceAlpha:.
-
m_bSetScale
private boolean m_bSetScale
True when scale factor should be used:.
-
m_fCoarseRate
private float m_fCoarseRate
Default rotation coarse rate, set to 2 degrees:.
-
m_fFineRate
private float m_fFineRate
Default rotation fine rate, set to 1 degree:.
-
m_fRotateBegin
private float m_fRotateBegin
Default rotation start, set to negative 5 degrees:.
-
m_fRotateEnd
private float m_fRotateEnd
Default rotation end, set to postive 5 degrees:.
-
m_fRotationRange
private float m_fRotationRange
default rotation range (0).
-
m_fScale
private float m_fScale
Scale factor for large images:.
-
m_fXScaleRange
private float m_fXScaleRange
default x scale range (0).
-
m_fYScaleRange
private float m_fYScaleRange
default y scale range (0).
-
m_iCost
private int m_iCost
Default cost function, set to correlation ratio (smoothed, weighted):.
-
m_iDOF
private int m_iDOF
Default degrees of freedom:.
-
m_iInterp
private int m_iInterp
Default image interpolation, set to be bilinear interpolation:.
-
m_iInterp2
private int m_iInterp2
Default interpolation for the transform algorithm:.
-
m_iMaxIterations
private int m_iMaxIterations
Default number of iteration set to 2:.
-
m_iNumMinima
private int m_iNumMinima
Default number of minima to test from level 8 at level 4 (set to 3):.
-
m_iOpen
private int m_iOpen
index of the non-selected image:.
-
m_iOpenSave
private int m_iOpenSave
Backup of the open index:.
-
m_iReference
private int m_iReference
Index of the reference image:.
-
m_iReferenceSave
private int m_iReferenceSave
Backup of the reference index:.
-
m_iScaleSteps
private int m_iScaleSteps
default number of divisions for scale optimazation:.
-
m_iSelected
private int m_iSelected
index of the selected image:
-
m_iTile
private int m_iTile
Index of the tile image:.
-
m_iTranslationRange
private int m_iTranslationRange
default x,y translation range (0).
-
m_iXClick
private int m_iXClick
x,y positions of the mouse when one of the mouse buttons is pressed:.
-
m_iYClick
private int m_iYClick
x,y positions of the mouse when one of the mouse buttons is pressed:.
-
m_kAdvancedOptionsButton
private javax.swing.JButton m_kAdvancedOptionsButton
Launches the JDialogRegistrationOAR2D dialog to set registration options:.
-
m_kCanvas
private javax.media.j3d.Canvas3D m_kCanvas
Drawing canvas:.
-
m_kCloseAllButton
private javax.swing.JButton m_kCloseAllButton
Close all images and remove them from the scene:.
-
m_kCurrentTransform
private javax.media.j3d.Transform3D m_kCurrentTransform
current transformation based on mouseDragged event:.
-
m_kMouseEvent
private java.awt.event.MouseEvent m_kMouseEvent
Reference to the mousePressed event:.
-
m_kOldTransform
private javax.media.j3d.Transform3D m_kOldTransform
Accumulated transformation prior to current mouseDrag:.
-
m_kOpenReferenceButton
private javax.swing.JButton m_kOpenReferenceButton
Open reference image:.
-
m_kOpenTileButton
private javax.swing.JButton m_kOpenTileButton
Open tile image:.
-
m_kReferenceAlpha
private ModelImage m_kReferenceAlpha
For blending between refernce and transformed tile images:.
-
m_kReferenceAlphaBackup
private ModelImage m_kReferenceAlphaBackup
For blending between refernce and transformed tile images:.
-
m_kRegisterButton
private javax.swing.JButton m_kRegisterButton
Initialize and start the registration based on how the user positioned the two images:.
-
m_kSaveButton
private javax.swing.JButton m_kSaveButton
Save the mosaic image:.
-
m_kHelpButton
private javax.swing.JButton m_kHelpButton
Open the mosaic image help.
-
m_kScene
private javax.media.j3d.BranchGroup m_kScene
Scene graph root node:.
-
m_kTileAlpha
private ModelImage m_kTileAlpha
For blending between refernce and transformed tile images:.
-
m_kToggleSelectedButton
private javax.swing.JButton m_kToggleSelectedButton
Toggle which image is currently selected:.
-
m_kUndoButton
private javax.swing.JButton m_kUndoButton
Undo the last registration for the mosaic image:.
-
m_kUniverse
private com.sun.j3d.utils.universe.SimpleUniverse m_kUniverse
SimpleUniverse:.
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed - JButton events:- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Parameters:
event
- button event
-
repaintButtons
private void repaintButtons()
-
algorithmPerformed
public void algorithmPerformed(AlgorithmBase kAlgorithm)
algorithmPerformed - when the alignment algorithm finishes, the transformed tile is blended with the reference image and displayed:- Specified by:
algorithmPerformed
in interfaceAlgorithmInterface
- Parameters:
kAlgorithm
- AlgorithmBase
-
dispose
public void dispose()
dispose - Removes member variables.- Overrides:
dispose
in classjava.awt.Window
-
getVariablesFromDialog
public void getVariablesFromDialog(JDialogRegistrationOAR2D kOptionsDialog, boolean bCallAlgorithm)
Called from inside the JDialogRegistrationOAR2D class when the user has set the parameters and closes the dialog.- Parameters:
kOptionsDialog
- the JDialogRegistrationOAR2D object containing the updated registration parametersbCallAlgorithm
- boolean when true this function activates the registration algorithm, when false, the user must then press the "register images" button to register.
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked.- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
- Parameters:
e
- MouseEvent
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged.- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
- Parameters:
e
- MouseEvent
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered.- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
- Parameters:
e
- MouseEvent
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited.- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
- Parameters:
e
- MouseEvent
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved.- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
- Parameters:
e
- MouseEvent
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent kMouseEvent)
mousePressed, store the current transformation for the selected image so the new transformations calculated in the mouseDragged function can be concatenated onto the current transform.- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
- Parameters:
kMouseEvent
- MouseEvent
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased.- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
- Parameters:
e
- MouseEvent
-
backupMosaic
private void backupMosaic()
backupMosaic -- Backs up the reference & tile polygon shapes, borders, ModelImages, and TransformGroups before the registration is called, so that registration can be undone by the user:
-
closeAllImages
private void closeAllImages(boolean bResetAlpha)
closeAllImages -- clears the scenegraph of all displayed images and deletes references to the images:- Parameters:
bResetAlpha
- true if all images are closed, false if a new mosaic is created
-
createCanvas
private javax.media.j3d.Canvas3D createCanvas(javax.swing.JPanel kPanel)
createCanvas - Creates the Canvas3D for rendering the images.- Parameters:
kPanel
- the JPanel that contains the Canvas3D in the frame- Returns:
- Canvas3D the new canvas
-
createMosaicOpenDialog
private boolean createMosaicOpenDialog(boolean bSave)
createMosaicOpenDialog - Creates a file open dialog for image files (.jpg, tiff, etc.). If a new file is opened it is mapped onto a polygon and placed in the scene graph:- Parameters:
bSave
- open file for saving (true) or open file for reading (false)- Returns:
- boolean, success or failure for the file open
-
createTexturedPolygon
private void createTexturedPolygon(javax.media.j3d.TransformGroup kTransformGroup, java.awt.image.BufferedImage kImage, int iWidth, int iHeight, int iWidthPow2, int iHeightPow2)
createTexturedPolygon - Creates a texture-mapped polygon with the BufferedImage displayed as the texture. The texture-mapped polygon is created so that the displayed texture and size of the polygon match the size in pixels of the original image loaded from file -- even when the original image size is not a power of two. The displayed image must match the original data image so that the registration is accurate.- Parameters:
kTransformGroup
- the TransformGroup which will contain the new textured polygon in the scene graphkImage
- the BufferedImage, power or two size image, padded if necessary, containing the original image data.iWidth
- the original image widthiHeight
- the original image heightiWidthPow2
- the next-largest power of two widthiHeightPow2
- the next-largest power of two height
-
initData
private void initData()
initData -- Initializes the selected, open, reference and tile indexes. Called on startup and after a closeAllImages()
-
initGUI
private void initGUI()
initGUI - Initializes GUI toolbar and buttons and displays the registration window.
-
registerImages
private boolean registerImages()
registerImages - Registers the reference and tile images based on the how the user positions the images with the mouse. Two new registered images are created, each containing one registered sub-image. The AlgorithmRegOAR2D is then called on the two new registered images, to better refine the registration. Upon completion of the registration algorithm, a new mosaic image is created.- Returns:
- boolean, sucess/failure of registeration
-
saveMosaic
private boolean saveMosaic()
saveMosaic -- Opens a save dialog and saves the mosaic image in the selected file format.- Returns:
- boolean, sucess/failure of file save
-
storeImage
private void storeImage(ModelImage kImage)
storeImage - creates a BufferedImage from the ModelImage data where the BufferedImage's size is the next-largest power of two from the ModelImage size. The BufferedImage is then passed to the createTexturedPolygon function for display in the scene graph.- Parameters:
kImage
- the input ModelImage containing the image data.
-
toggleSelectedImage
private void toggleSelectedImage()
toggleSelectedImage - Toggles which image is currently selected. Changes the color of the image borders.
-
undoMosaic
private void undoMosaic()
undoMosaic -- Restores the backed-up ImageTransforms, PolygonShapes, BorderShapes, and ModelImages after an undo button press:
-
-