Class MeasureMTF_

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--ij.plugin.frame.PlugInFrame
                                |
                                +--MeasureMTF_
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, ij.plugin.PlugIn, java.io.Serializable

public class MeasureMTF_
extends ij.plugin.frame.PlugInFrame
implements java.awt.event.ActionListener

This plugin simplifies the task of measuring the Modulation Transfer Function (resolution) of an optical system, given an image of variously sized bar patterns.

This dialog-box-like plugin is based on the PlugInFrame class, and could serve as an example of how to automate repeated measurements.

Reference:

Sitter, D.N., Goddard, J.S., and Ferrell, R.K., (1995), "Method for the measurement of the modulation transfer function of sampled imaging systems from bar-target patterns.", Applied Optics, v. 34 n. 4, pp. 746-751.

Author:
Jeffrey Kuhn, The University of Texas at Austin, jkuhn@ccwf.cc.utexas.edu
See Also:
Serialized Form

Inner classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  boolean bFirstTopLeft
          first bar is at the top or on the left
(package private) static boolean bHasMtfData
           
(package private) static boolean bMtfHeadingsCreated
          Have the column headings in the main measurement window been created?
(package private)  boolean bPlotDFT
          plot the DFT result?
(package private)  java.awt.Button buttonClearMtf
           
(package private)  java.awt.Button buttonCreateRoi
           
(package private)  java.awt.Button buttonFirstBar
           
(package private)  java.awt.Button buttonMeasureBlack
           
(package private)  java.awt.Button buttonMeasureMtf
           
(package private)  java.awt.Button buttonMeasureWhite
           
(package private)  java.awt.Button buttonNextBar
           
(package private)  java.awt.Button buttonRecalculate
           
(package private)  java.awt.Button buttonRetrieveLength
           
(package private)  boolean bVertical
          measure vertically?
(package private)  java.awt.Checkbox checkFirstTopLeft
           
(package private)  java.awt.Checkbox checkPlotDFT
           
(package private)  java.awt.Checkbox checkVertical
           
(package private)  java.awt.Choice choiceBarSpacing
           
(package private) static double dBARLENGTH
          distance between each grating in um (micrometers)
(package private)  double dBarSpacing
          distance between cycles
(package private)  double dBlackLevel
          measured black bar intensity
(package private)  double dDutyCycle
          length of white portion/total spacing (i.e.
(package private)  double dKnownLength
          known length in um (micrometers)
(package private) static double dMeasuredLength
          measured length in pixels
(package private)  double dScale
          calculated scale in pix/um
(package private)  double dWhiteLevel
          measured white bar intensity
(package private)  int iCyclesToMeasure
          number of cycles to measure
(package private)  int iLinesToAverage
          how many lines of pixel data to average for each bar profile
(package private)  int iMeasurementSize
          total length of profile to measure
(package private)  java.awt.Label labelBlackLevel
           
(package private)  java.awt.Label labelMeasurementSize
           
(package private)  java.awt.Label labelScale
           
(package private)  java.awt.Label labelWhiteLevel
           
(package private) static int nHARMONICS
          number of DFT harmonics to plot
(package private)  java.awt.Panel panel
           
(package private)  java.awt.TextField textCyclesToMeasure
           
(package private)  java.awt.TextField textDutyCycle
           
(package private)  java.awt.TextField textKnownLength
           
(package private)  java.awt.TextField textLinesToAverage
           
(package private)  java.awt.TextField textMeasuredLength
           
 
Fields inherited from class ij.plugin.frame.PlugInFrame
title
 
Fields inherited from class java.awt.Frame
base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis
 
Fields inherited from class java.awt.Window
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, warningString, windowListener, windowSerializedDataVersion
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MeasureMTF_()
          Constructor.
 
Method Summary
(package private)  double[] AbsDFT(double[] adX, int iNK)
          Calculates the magnitude of the Discrete Fourier Transform of an array of values.
 void actionPerformed(java.awt.event.ActionEvent e)
          Handle button presses, etc.
(package private)  void clearMTF()
          Clears all MTF values from the ImageJ measurement list.
(package private)  void createROI(ij.ImagePlus imp)
          Creates a rectangular Region Of Interest that is the right size to perform the profile measurement.
(package private)  void measureMTF(ij.ImagePlus imp)
          Finds the profile, calculates the DFT of the data, then calculates the MTF for this bar spacing based on the fundamental frequency (zero'th harmonic).
(package private)  void moveROI(ij.ImagePlus imp, double dDistDown, double dDistOver)
          Moves the current Region Of Interest down by a certain distance in um.
(package private)  void recalculate()
          Recalculate all parameters from user inputs
(package private)  double sinc(double x)
          Calculates the sinc function of a number
 
Methods inherited from class ij.plugin.frame.PlugInFrame
processWindowEvent, run
 
Methods inherited from class java.awt.Frame
, addNotify, addToFrameList, constructComponentName, finalize, getAccessibleContext, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, initIDs, isResizable, paramString, postProcessKeyEvent, readObject, remove, removeFromFrameList, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle, writeObject
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, show, toBack, toFront, transferFocus
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, 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, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

panel

java.awt.Panel panel

textMeasuredLength

java.awt.TextField textMeasuredLength

buttonRetrieveLength

java.awt.Button buttonRetrieveLength

textKnownLength

java.awt.TextField textKnownLength

labelScale

java.awt.Label labelScale

labelWhiteLevel

java.awt.Label labelWhiteLevel

buttonMeasureWhite

java.awt.Button buttonMeasureWhite

labelBlackLevel

java.awt.Label labelBlackLevel

buttonMeasureBlack

java.awt.Button buttonMeasureBlack

textCyclesToMeasure

java.awt.TextField textCyclesToMeasure

choiceBarSpacing

java.awt.Choice choiceBarSpacing

textDutyCycle

java.awt.TextField textDutyCycle

textLinesToAverage

java.awt.TextField textLinesToAverage

labelMeasurementSize

java.awt.Label labelMeasurementSize

checkVertical

java.awt.Checkbox checkVertical

checkFirstTopLeft

java.awt.Checkbox checkFirstTopLeft

checkPlotDFT

java.awt.Checkbox checkPlotDFT

buttonRecalculate

java.awt.Button buttonRecalculate

buttonCreateRoi

java.awt.Button buttonCreateRoi

buttonMeasureMtf

java.awt.Button buttonMeasureMtf

buttonClearMtf

java.awt.Button buttonClearMtf

buttonFirstBar

java.awt.Button buttonFirstBar

buttonNextBar

java.awt.Button buttonNextBar

nHARMONICS

static final int nHARMONICS
number of DFT harmonics to plot

dBARLENGTH

static final double dBARLENGTH
distance between each grating in um (micrometers)

dMeasuredLength

static double dMeasuredLength
measured length in pixels

dKnownLength

double dKnownLength
known length in um (micrometers)

dScale

double dScale
calculated scale in pix/um

dWhiteLevel

double dWhiteLevel
measured white bar intensity

dBlackLevel

double dBlackLevel
measured black bar intensity

iCyclesToMeasure

int iCyclesToMeasure
number of cycles to measure

dBarSpacing

double dBarSpacing
distance between cycles

dDutyCycle

double dDutyCycle
length of white portion/total spacing (i.e. if white=1/4 width and black=3/4 width, Duty Cycle=0.25)

iLinesToAverage

int iLinesToAverage
how many lines of pixel data to average for each bar profile

iMeasurementSize

int iMeasurementSize
total length of profile to measure

bVertical

boolean bVertical
measure vertically?

bFirstTopLeft

boolean bFirstTopLeft
first bar is at the top or on the left

bPlotDFT

boolean bPlotDFT
plot the DFT result?

bMtfHeadingsCreated

static boolean bMtfHeadingsCreated
Have the column headings in the main measurement window been created?

bHasMtfData

static boolean bHasMtfData
Constructor Detail

MeasureMTF_

public MeasureMTF_()
Constructor. Creates the main user interface panel.
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handle button presses, etc.
Specified by:
actionPerformed in interface java.awt.event.ActionListener

createROI

void createROI(ij.ImagePlus imp)
Creates a rectangular Region Of Interest that is the right size to perform the profile measurement.

moveROI

void moveROI(ij.ImagePlus imp,
             double dDistDown,
             double dDistOver)
Moves the current Region Of Interest down by a certain distance in um. If we are measuring vertical bars, the ROI is moved to the right instead.

recalculate

void recalculate()
Recalculate all parameters from user inputs

clearMTF

void clearMTF()
Clears all MTF values from the ImageJ measurement list.

measureMTF

void measureMTF(ij.ImagePlus imp)
Finds the profile, calculates the DFT of the data, then calculates the MTF for this bar spacing based on the fundamental frequency (zero'th harmonic).

sinc

double sinc(double x)
Calculates the sinc function of a number

AbsDFT

double[] AbsDFT(double[] adX,
                int iNK)
Calculates the magnitude of the Discrete Fourier Transform of an array of values.