com.pixelmed.display
Class SingleImagePanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.pixelmed.display.SingleImagePanel
All Implemented Interfaces:
KeyListener, MouseListener, MouseMotionListener, ImageObserver, MenuContainer, Serializable, EventListener

public class SingleImagePanel
extends JComponent
implements KeyListener, MouseListener, MouseMotionListener

Implements a component that can display a single or multi-frame image in a single panel with window center/width adjustment, scrolling through frames of a multi-frame image, resizing to the size of the panel, annotation of pre-defined text and shapes, feedback of cursor position status (2D and 3D position, pixel value, window).

Includes a main() method for testing that will display a single image from a file in a JFrame.

About the most minimal code to display a single DICOM image looks like this:

 JFrame p = new JFrame();
 p.add(new SingleImagePanel(new SourceImage(filename)));
 p.setBackground(Color.BLACK);
 p.setSize(512,512);
 p.setVisible(true);
 

See Also:
SourceImage, Serialized Form

Nested Class Summary
protected  class SingleImagePanel.LeftMouseMode
           
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  double[] currentLocationIn3DSpace
          This value is outside mouseMoved() only so that it doesn't need to be constantly reallocated - it is not used by any other method
protected  Vector<Shape> interactiveDrawingShapes
           
protected  SingleImagePanel.LeftMouseMode leftMouseMode
           
protected  Vector<Shape> localizerShapes
           
protected  com.pixelmed.display.OrientationAnnotations orientationAnnotations
           
protected  Color orientationColor
           
protected  Font orientationFont
           
protected  DisplayedAreaSelection originalDisplayedAreaSelection
           
protected  Vector<Shape>[] perFrameDrawingShapes
           
protected  Vector<Shape> persistentDrawingShapes
           
protected  Vector<com.pixelmed.display.TextAnnotation> persistentDrawingText
           
protected  double pixelSpacingInSourceImage
           
protected  Vector<Shape> preDefinedShapes
           
protected  Vector<Shape> preDefinedText
           
protected  Vector<Shape> selectedDrawingShapes
           
protected  boolean showOrientationsLeftSide
           
protected  boolean showSideAndViewAnnotationLeftSide
           
protected  boolean showZoomFactor
           
protected  boolean showZoomFactorLeftSide
           
protected  Color sideAndViewAnnotationColor
           
protected  Font sideAndViewAnnotationFont
           
protected  String sideAndViewAnnotationString
           
protected  int sideAndViewAnnotationVerticalOffset
           
protected  Vector<SuperimposedImage> superimposedImages
           
protected  String typeOfPixelSpacing
           
protected  boolean useVOILUTNotFunction
          whether or not to use the supplied VOI LUT, rather than a linear or sigmoid window function
protected  int voiLUTBitsPerEntry
          the currently selected VOI LUT bits per entry
protected  short[] voiLUTData
          the currently selected VOI LUT Data
protected  int voiLUTEntryMax
          the currently selected VOI LUT maximum entry value
protected  int voiLUTEntryMin
          the currently selected VOI LUT minimum entry value
protected  int voiLUTFirstValueMapped
          the currently selected VOI LUT first value mapped
protected  double voiLUTIdentityWindowCenter
          the currently selected VOI LUT window center value that will result in the application of the VOI LUT rescaling the input (index) values
protected  double voiLUTIdentityWindowWidth
          the currently selected VOI LUT window width value that will result in the application of the VOI LUT rescaling the input (index) values
protected  int voiLUTNumberOfEntries
          the currently selected VOI LUT number of entries
protected  int voiLUTTopOfEntryRange
          the currently selected VOI LUT top of entry range (which may be less than (2^voiLUTNumberOfEntries)-1, e.g., in buggy Agfa images)
protected  Vector<Shape> volumeLocalizationShapes
           
protected  double windowCenter
          the currently selected, default or user modified window center
protected  double windowWidth
          the currently selected, default or user modified window width
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SingleImagePanel(SourceImage sImg)
           
SingleImagePanel(SourceImage sImg, EventContext typeOfPanelEventContext)
           
SingleImagePanel(SourceImage sImg, EventContext typeOfPanelEventContext, GeometryOfVolume imageGeometry)
           
SingleImagePanel(SourceImage sImg, EventContext typeOfPanelEventContext, int[] sortOrder, Vector preDefinedShapes, Vector preDefinedText, GeometryOfVolume imageGeometry)
           
 
Method Summary
static BufferedImage applyVOILUT(BufferedImage src, double center, double width, double identityCenter, double identityWidth, boolean signed, boolean inverted, double useSlope, double useIntercept, boolean hasPad, int pad, int padRangeLimit, int numberOfEntries, int firstValueMapped, int bitsPerEntry, short[] grayTable, int entryMin, int entryMax, int topOfEntryRange)
           
static BufferedImage applyWindowCenterAndWidthLinear(BufferedImage src, double center, double width, boolean signed, boolean inverted, double useSlope, double useIntercept, boolean hasPad, int pad, int padRangeLimit)
           
static BufferedImage applyWindowCenterAndWidthLinear(BufferedImage src, double center, double width, boolean signed, boolean inverted, double useSlope, double useIntercept, boolean hasPad, int pad, int padRangeLimit, boolean useExactCalculationInsteadOfDICOMStandardMethod)
           
static BufferedImage applyWindowCenterAndWidthLogistic(BufferedImage src, double center, double width, boolean signed, boolean inverted, double useSlope, double useIntercept, boolean hasPad, int pad, int padRangeLimit)
           
static BufferedImage applyWindowCenterAndWidthWithPaletteColor(BufferedImage src, double center, double width, boolean signed, boolean inverted, double useSlope, double useIntercept, boolean hasPad, int pad, int padRangeLimit, int largestGray, int bitsPerEntry, int numberOfEntries, short[] redTable, short[] greenTable, short[] blueTable)
           
 void deconstruct()
           
static void deconstructAllSingleImagePanelsInContainer(Container container)
           
 void dirty()
           
 void dirty(SourceImage sImg)
           
 void dirtyPanned()
           
 void dirtySource()
           
 void dirtySource(SourceImage sImg)
           
 void dirtyWindowing()
           
 void displayReset()
           
 void displaySelectedMagnificationRatio(double ratio)
           
protected  void establishInitialWindowOrVOILUT()
           
protected  void finalize()
           
protected  Point2D getImageCoordinateFromWindowCoordinate(double xw, double yw)
          Get location on source image from window relative location.
 GeometryOfVolume getImageGeometry()
          Get the geometry of the frames currently loaded in the single image panel.
 Vector getPersistentDrawingShapes()
          Get the unselected region shapes to to be displayed on the currently selected and displayed frame.
 Vector getSelectedDrawingShapes()
          Get the selected region shapes to to be displayed on the currently selected and displayed frame.
protected  int getSourceImageHeight()
           
protected  int getSourceImageWidth()
           
 Vector<SuperimposedImage> getSuperimposedImages()
          Get the superimposed images to to be displayed on the appropriate frames.
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
static void main(String[] arg)
           
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void paintComponent(Graphics g)
           
 void setApplyShutter(boolean applyShutter)
          Set whether or not to apply shutter.
 void setDemographicAndTechniqueAnnotations(DemographicAndTechniqueAnnotations demographicAndTechniqueAnnotations, String demographicAndTechniqueFontName, int demographicAndTechniqueFontStyle, int demographicAndTechniqueFontSize, Color demographicAndTechniqueColor)
          Set annotative attribute values to be displayed on the currently selected and displayed frame at defined positions.
 void setDisplayedAreaSelection(DisplayedAreaSelection displayedAreaSelection)
          Select the sub-region of the image to display.
 void setLocalizerShapes(Vector shapes)
          Set the shapes of any localizer postings to be displayed on the currently selected and displayed frame.
 void setOrientationAnnotations(com.pixelmed.display.OrientationAnnotations orientationAnnotations, String orientationFontName, int orientationFontStyle, int orientationFontSize, Color orientationColor)
          Set orientation values to be displayed on the currently selected and displayed frame.
 void setOrientationAnnotations(com.pixelmed.display.OrientationAnnotations orientationAnnotations, String orientationFontName, int orientationFontStyle, int orientationFontSize, Color orientationColor, boolean leftSide)
          Set orientation values to be displayed on the currently selected and displayed frame.
 void setPerFrameDrawingShapes(Vector<Shape>[] arrayOfShapes)
          Set the array of per-frame shapes to be displayed on the respective frame when it is selected and displayed.
 void setPersistentDrawingShapes(Vector shapes)
          Set the unselected region shapes to to be displayed on the currently selected and displayed frame.
 void setPixelSpacingInSourceImage(double pixelSpacingInSourceImage)
          Set pixel spacing in source image.
 void setPixelSpacingInSourceImage(double pixelSpacingInSourceImage, String typeOfPixelSpacing)
          Set pixel spacing in source image.
 void setPreDefinedShapes(Vector shapes)
          Set the predefined shapes to to be displayed on the currently selected and displayed frame.
 void setPreTransformImageRelativeCoordinates(AffineTransform transform)
          Select the AffineTransform to apply to image-relative coordinates.
 void setSelectedDrawingShapes(Vector shapes)
          Set the selected region shapes to to be displayed on the currently selected and displayed frame.
 void setShowOverlays(boolean showOverlays)
          Set whether or not to show graphics such as overlays.
 void setShowSuperimposedImages(boolean showSuperimposedImages)
          Set whether or not to show superimposed images.
 void setShowZoomFactor(boolean showZoomFactor, boolean leftSide, double pixelSpacingInSourceImage)
          Select whether or not to annotate displayed image with zoom factor.
 void setShowZoomFactor(boolean showZoomFactor, boolean leftSide, double pixelSpacingInSourceImage, String typeOfPixelSpacing)
          Select whether or not to annotate displayed image with zoom factor.
 void setSideAndViewAnnotationString(String annotationString, int verticalOffset, String annotationFontName, int annotationFontStyle, int annotationFontSize, Color annotationColor, boolean leftSide)
          Set side and view annotation string.
 void setSuperimposedImages(Vector<SuperimposedImage> superimposedImages)
          Set the superimposed images to to be displayed on the appropriate frames.
 void setVOIFunctionToLinear()
          Set the VOI function to the (default) window center/width linear transformation.
 void setVOIFunctionToLogistic()
          Set the VOI function to a non-linear transformation using a logistic (sigmoid) curve with window center and width as parameters.
 void setVolumeLocalizationShapes(Vector shapes)
          Set the shapes of any volume localization postings to be displayed on the currently selected and displayed frame.
 void setWindowingAccelerationValue(double value)
          Set the windowing acceleration value to use.
 void setWindowLinearCalculationToDicom()
          Set the VOI linear function to use the DICOM offset window center/width linear transformation when applying to rescaled pixels.
 void setWindowLinearCalculationToExact()
          Set the VOI linear function to use the exact window center/width linear transformation when applying to rescaled pixels.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

useVOILUTNotFunction

protected boolean useVOILUTNotFunction
whether or not to use the supplied VOI LUT, rather than a linear or sigmoid window function


windowCenter

protected double windowCenter
the currently selected, default or user modified window center


windowWidth

protected double windowWidth
the currently selected, default or user modified window width


voiLUTIdentityWindowWidth

protected double voiLUTIdentityWindowWidth
the currently selected VOI LUT window width value that will result in the application of the VOI LUT rescaling the input (index) values


voiLUTIdentityWindowCenter

protected double voiLUTIdentityWindowCenter
the currently selected VOI LUT window center value that will result in the application of the VOI LUT rescaling the input (index) values


voiLUTNumberOfEntries

protected int voiLUTNumberOfEntries
the currently selected VOI LUT number of entries


voiLUTFirstValueMapped

protected int voiLUTFirstValueMapped
the currently selected VOI LUT first value mapped


voiLUTBitsPerEntry

protected int voiLUTBitsPerEntry
the currently selected VOI LUT bits per entry


voiLUTData

protected short[] voiLUTData
the currently selected VOI LUT Data


voiLUTEntryMin

protected int voiLUTEntryMin
the currently selected VOI LUT minimum entry value


voiLUTEntryMax

protected int voiLUTEntryMax
the currently selected VOI LUT maximum entry value


voiLUTTopOfEntryRange

protected int voiLUTTopOfEntryRange
the currently selected VOI LUT top of entry range (which may be less than (2^voiLUTNumberOfEntries)-1, e.g., in buggy Agfa images)


preDefinedShapes

protected Vector<Shape> preDefinedShapes

preDefinedText

protected Vector<Shape> preDefinedText

localizerShapes

protected Vector<Shape> localizerShapes

volumeLocalizationShapes

protected Vector<Shape> volumeLocalizationShapes

interactiveDrawingShapes

protected Vector<Shape> interactiveDrawingShapes

persistentDrawingShapes

protected Vector<Shape> persistentDrawingShapes

selectedDrawingShapes

protected Vector<Shape> selectedDrawingShapes

persistentDrawingText

protected Vector<com.pixelmed.display.TextAnnotation> persistentDrawingText

perFrameDrawingShapes

protected Vector<Shape>[] perFrameDrawingShapes

superimposedImages

protected Vector<SuperimposedImage> superimposedImages

orientationAnnotations

protected com.pixelmed.display.OrientationAnnotations orientationAnnotations

orientationColor

protected Color orientationColor

orientationFont

protected Font orientationFont

showOrientationsLeftSide

protected boolean showOrientationsLeftSide

sideAndViewAnnotationString

protected String sideAndViewAnnotationString

sideAndViewAnnotationVerticalOffset

protected int sideAndViewAnnotationVerticalOffset

sideAndViewAnnotationColor

protected Color sideAndViewAnnotationColor

sideAndViewAnnotationFont

protected Font sideAndViewAnnotationFont

showSideAndViewAnnotationLeftSide

protected boolean showSideAndViewAnnotationLeftSide

originalDisplayedAreaSelection

protected DisplayedAreaSelection originalDisplayedAreaSelection

showZoomFactor

protected boolean showZoomFactor

showZoomFactorLeftSide

protected boolean showZoomFactorLeftSide

pixelSpacingInSourceImage

protected double pixelSpacingInSourceImage

typeOfPixelSpacing

protected String typeOfPixelSpacing

leftMouseMode

protected SingleImagePanel.LeftMouseMode leftMouseMode

currentLocationIn3DSpace

protected double[] currentLocationIn3DSpace
This value is outside mouseMoved() only so that it doesn't need to be constantly reallocated - it is not used by any other method

Constructor Detail

SingleImagePanel

public SingleImagePanel(SourceImage sImg,
                        EventContext typeOfPanelEventContext,
                        int[] sortOrder,
                        Vector preDefinedShapes,
                        Vector preDefinedText,
                        GeometryOfVolume imageGeometry)
Parameters:
sImg -
typeOfPanelEventContext -
sortOrder -
preDefinedShapes -
preDefinedText -
imageGeometry -

SingleImagePanel

public SingleImagePanel(SourceImage sImg,
                        EventContext typeOfPanelEventContext,
                        GeometryOfVolume imageGeometry)
Parameters:
sImg -
typeOfPanelEventContext -
imageGeometry -

SingleImagePanel

public SingleImagePanel(SourceImage sImg,
                        EventContext typeOfPanelEventContext)
Parameters:
sImg -
typeOfPanelEventContext -

SingleImagePanel

public SingleImagePanel(SourceImage sImg)
Parameters:
sImg -
Method Detail

dirty

public void dirty()

dirtySource

public void dirtySource()

dirty

public void dirty(SourceImage sImg)

dirtySource

public void dirtySource(SourceImage sImg)

dirtyWindowing

public void dirtyWindowing()

dirtyPanned

public void dirtyPanned()

getImageGeometry

public GeometryOfVolume getImageGeometry()

Get the geometry of the frames currently loaded in the single image panel.

Returns:
the geometry of the frames

setPreDefinedShapes

public final void setPreDefinedShapes(Vector shapes)

Set the predefined shapes to to be displayed on the currently selected and displayed frame.

Parameters:
shapes - a java.util.Vector of java.awt.Shape, may be null or empty

setLocalizerShapes

public final void setLocalizerShapes(Vector shapes)

Set the shapes of any localizer postings to be displayed on the currently selected and displayed frame.

Parameters:
shapes - a java.util.Vector of java.awt.Shape, may be null or empty

setVolumeLocalizationShapes

public final void setVolumeLocalizationShapes(Vector shapes)

Set the shapes of any volume localization postings to be displayed on the currently selected and displayed frame.

Parameters:
shapes - a java.util.Vector of java.awt.Shape, may be null or empty

setPersistentDrawingShapes

public final void setPersistentDrawingShapes(Vector shapes)

Set the unselected region shapes to to be displayed on the currently selected and displayed frame.

Parameters:
shapes - a java.util.Vector of java.awt.Shape, may be null or empty

getPersistentDrawingShapes

public final Vector getPersistentDrawingShapes()

Get the unselected region shapes to to be displayed on the currently selected and displayed frame.

Returns:
a java.util.Vector of java.awt.Shape, may be null or empty

setSelectedDrawingShapes

public final void setSelectedDrawingShapes(Vector shapes)

Set the selected region shapes to to be displayed on the currently selected and displayed frame.

Parameters:
shapes - a java.util.Vector of java.awt.Shape, may be null or empty

getSelectedDrawingShapes

public final Vector getSelectedDrawingShapes()

Get the selected region shapes to to be displayed on the currently selected and displayed frame.

Returns:
a java.util.Vector of java.awt.Shape, may be null or empty

setPerFrameDrawingShapes

public final void setPerFrameDrawingShapes(Vector<Shape>[] arrayOfShapes)

Set the array of per-frame shapes to be displayed on the respective frame when it is selected and displayed.

Parameters:
arrayOfShapes - an array of java.util.Vector of java.awt.Shape

setSuperimposedImages

public final void setSuperimposedImages(Vector<SuperimposedImage> superimposedImages)

Set the superimposed images to to be displayed on the appropriate frames.

Parameters:
superimposedImages - a java.util.Vector of com.pixelmed.display.SuperimposedImage, may be null or empty

getSuperimposedImages

public final Vector<SuperimposedImage> getSuperimposedImages()

Get the superimposed images to to be displayed on the appropriate frames.

Returns:
a java.util.Vector of com.pixelmed.display.SuperimposedImage, may be null or empty

setDemographicAndTechniqueAnnotations

public final void setDemographicAndTechniqueAnnotations(DemographicAndTechniqueAnnotations demographicAndTechniqueAnnotations,
                                                        String demographicAndTechniqueFontName,
                                                        int demographicAndTechniqueFontStyle,
                                                        int demographicAndTechniqueFontSize,
                                                        Color demographicAndTechniqueColor)

Set annotative attribute values to be displayed on the currently selected and displayed frame at defined positions.

Parameters:
demographicAndTechniqueAnnotations - the set of annotations, indexed per frame
demographicAndTechniqueFontName - the name of the font, e.g. "SansSerif"
demographicAndTechniqueFontStyle - the style of the font, e.g. Font.PLAIN
demographicAndTechniqueFontSize - the size of the font in points, e.g. 10
demographicAndTechniqueColor - the color to draw, e.g. Color.pink

setOrientationAnnotations

public final void setOrientationAnnotations(com.pixelmed.display.OrientationAnnotations orientationAnnotations,
                                            String orientationFontName,
                                            int orientationFontStyle,
                                            int orientationFontSize,
                                            Color orientationColor)

Set orientation values to be displayed on the currently selected and displayed frame.

Parameters:
orientationAnnotations - the set of orientations, indexed per frame
orientationFontName - the name of the font, e.g. "SansSerif"
orientationFontStyle - the style of the font, e.g. Font.PLAIN
orientationFontSize - the size of the font in points, e.g. 20
orientationColor - the color to draw, e.g. Color.pink

setOrientationAnnotations

public final void setOrientationAnnotations(com.pixelmed.display.OrientationAnnotations orientationAnnotations,
                                            String orientationFontName,
                                            int orientationFontStyle,
                                            int orientationFontSize,
                                            Color orientationColor,
                                            boolean leftSide)

Set orientation values to be displayed on the currently selected and displayed frame.

Parameters:
orientationAnnotations - the set of orientations, indexed per frame
orientationFontName - the name of the font, e.g. "SansSerif"
orientationFontStyle - the style of the font, e.g. Font.PLAIN
orientationFontSize - the size of the font in points, e.g. 20
orientationColor - the color to draw, e.g. Color.pink
leftSide - show row orientation on left (true) or right (false) side of view port

setSideAndViewAnnotationString

public final void setSideAndViewAnnotationString(String annotationString,
                                                 int verticalOffset,
                                                 String annotationFontName,
                                                 int annotationFontStyle,
                                                 int annotationFontSize,
                                                 Color annotationColor,
                                                 boolean leftSide)

Set side and view annotation string.

Parameters:
annotationString - additional side (image laterality) and view (e.g., mammo CC) string to show on same side
verticalOffset -
annotationFontName - the name of the font, e.g. "SansSerif"
annotationFontStyle - the style of the font, e.g. Font.PLAIN
annotationFontSize - the size of the font in points, e.g. 20
annotationColor - the color to draw, e.g. Color.pink
leftSide - show row orientation on left (true) or right (false) side of view port

setDisplayedAreaSelection

public final void setDisplayedAreaSelection(DisplayedAreaSelection displayedAreaSelection)

Select the sub-region of the image to display.

Parameters:
displayedAreaSelection - the selection, or null to reset to using the entire image

displayReset

public void displayReset()

displaySelectedMagnificationRatio

public void displaySelectedMagnificationRatio(double ratio)

setPreTransformImageRelativeCoordinates

public final void setPreTransformImageRelativeCoordinates(AffineTransform transform)

Select the AffineTransform to apply to image-relative coordinates.

Used in cases where the supplied image has already been flipped or rotated but the coordinates relative to the original image have not.

Parameters:
transform - the transform, or null to reset to no transform

setShowZoomFactor

public final void setShowZoomFactor(boolean showZoomFactor,
                                    boolean leftSide,
                                    double pixelSpacingInSourceImage)

Select whether or not to annotate displayed image with zoom factor.

Uses same font parameters as set for orientation annotations.

Also implicitly effects setPixelSpacingInSourceImage().

Parameters:
showZoomFactor - true or false to activate annotation of zoom factor
leftSide - show zoom factor on left (true) or right (false) side of view port
pixelSpacingInSourceImage - a single value that is the (square) row and column pixel spacing, or 0 if not known

setShowZoomFactor

public final void setShowZoomFactor(boolean showZoomFactor,
                                    boolean leftSide,
                                    double pixelSpacingInSourceImage,
                                    String typeOfPixelSpacing)

Select whether or not to annotate displayed image with zoom factor.

Uses same font parameters as set for orientation annotations.

Also implicitly effects setPixelSpacingInSourceImage().

Parameters:
showZoomFactor - true or false to activate annotation of zoom factor
leftSide - show zoom factor on left (true) or right (false) side of view port
pixelSpacingInSourceImage - a single value that is the (square) row and column pixel spacing, or 0 if not known
typeOfPixelSpacing - a String that describes the type of pixel spacing (e.g., detector plane, calibrated, accounting for geometric magnification, etc.), or null if not to be described when making measurements

setPixelSpacingInSourceImage

public final void setPixelSpacingInSourceImage(double pixelSpacingInSourceImage)

Set pixel spacing in source image.

Used for displaying zoom factor and making measurements, therefore should be appropriate choice of Pixel Spacing or Imager Pixel Spacing (appropriately corrected for radiographic magnification factor, if any), etc.

Parameters:
pixelSpacingInSourceImage - a single value that is the (square) row and column pixel spacing, or 0 if not known

setPixelSpacingInSourceImage

public final void setPixelSpacingInSourceImage(double pixelSpacingInSourceImage,
                                               String typeOfPixelSpacing)

Set pixel spacing in source image.

Used for displaying zoom factor and making measurements, therefore should be appropriate choice of Pixel Spacing or Imager Pixel Spacing (appropriately corrected for radiographic magnification factor, if any), etc.

Parameters:
pixelSpacingInSourceImage - a single value that is the (square) row and column pixel spacing, or 0 if not known
typeOfPixelSpacing - a String that describes the type of pixel spacing (e.g., detector plane, calibrated, accounting for geometric magnification, etc.), or null if not to be described when making measurements

setVOIFunctionToLinear

public final void setVOIFunctionToLinear()

Set the VOI function to the (default) window center/width linear transformation.


setVOIFunctionToLogistic

public final void setVOIFunctionToLogistic()

Set the VOI function to a non-linear transformation using a logistic (sigmoid) curve with window center and width as parameters.


setWindowLinearCalculationToExact

public final void setWindowLinearCalculationToExact()

Set the VOI linear function to use the exact window center/width linear transformation when applying to rescaled pixels.


setWindowLinearCalculationToDicom

public final void setWindowLinearCalculationToDicom()

Set the VOI linear function to use the DICOM offset window center/width linear transformation when applying to rescaled pixels.

The DICOM offset subtracts 0.5 from the window center and subtracts 1.0 from the window width before applying to rescaled pixels.


setWindowingAccelerationValue

public final void setWindowingAccelerationValue(double value)

Set the windowing acceleration value to use.


setShowOverlays

public final void setShowOverlays(boolean showOverlays)

Set whether or not to show graphics such as overlays.


setApplyShutter

public final void setApplyShutter(boolean applyShutter)

Set whether or not to apply shutter.


setShowSuperimposedImages

public final void setShowSuperimposedImages(boolean showSuperimposedImages)

Set whether or not to show superimposed images.


keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener
Parameters:
e -

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener
Parameters:
e -

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener
Parameters:
e -

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener
Parameters:
e -

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener
Parameters:
e -

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener
Parameters:
e -

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener
Parameters:
e -

getSourceImageHeight

protected int getSourceImageHeight()

getSourceImageWidth

protected int getSourceImageWidth()

getImageCoordinateFromWindowCoordinate

protected Point2D getImageCoordinateFromWindowCoordinate(double xw,
                                                         double yw)
Get location on source image from window relative location.

Parameters:
xw - x coordinate in AWT window as returned by MouseEvent.getX()
yw - y coordinate in AWT window as returned by MouseEvent.getY()
Returns:
source image-relative coordinates with sub-pixel resolution clamped to image size but including BLHC of BLHC pixel (per DICOM PS 3.3 Figure C.10.5-1)

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener
Parameters:
e -

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener
Parameters:
e -

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener
Parameters:
e -

applyVOILUT

public static final BufferedImage applyVOILUT(BufferedImage src,
                                              double center,
                                              double width,
                                              double identityCenter,
                                              double identityWidth,
                                              boolean signed,
                                              boolean inverted,
                                              double useSlope,
                                              double useIntercept,
                                              boolean hasPad,
                                              int pad,
                                              int padRangeLimit,
                                              int numberOfEntries,
                                              int firstValueMapped,
                                              int bitsPerEntry,
                                              short[] grayTable,
                                              int entryMin,
                                              int entryMax,
                                              int topOfEntryRange)
Parameters:
src -
center -
width -
identityCenter -
identityWidth -
signed -
inverted -
useSlope -
useIntercept -
hasPad -
pad -
padRangeLimit -
numberOfEntries -
bitsPerEntry -
grayTable -
entryMin -
entryMax -
topOfEntryRange -

applyWindowCenterAndWidthLogistic

public static final BufferedImage applyWindowCenterAndWidthLogistic(BufferedImage src,
                                                                    double center,
                                                                    double width,
                                                                    boolean signed,
                                                                    boolean inverted,
                                                                    double useSlope,
                                                                    double useIntercept,
                                                                    boolean hasPad,
                                                                    int pad,
                                                                    int padRangeLimit)
Parameters:
src -
center -
width -
signed -
inverted -
useSlope -
useIntercept -
hasPad -
pad -
padRangeLimit -

applyWindowCenterAndWidthLinear

public static final BufferedImage applyWindowCenterAndWidthLinear(BufferedImage src,
                                                                  double center,
                                                                  double width,
                                                                  boolean signed,
                                                                  boolean inverted,
                                                                  double useSlope,
                                                                  double useIntercept,
                                                                  boolean hasPad,
                                                                  int pad,
                                                                  int padRangeLimit)
Parameters:
src -
center -
width -
signed -
inverted -
useSlope -
useIntercept -
hasPad -
pad -
padRangeLimit -

applyWindowCenterAndWidthLinear

public static final BufferedImage applyWindowCenterAndWidthLinear(BufferedImage src,
                                                                  double center,
                                                                  double width,
                                                                  boolean signed,
                                                                  boolean inverted,
                                                                  double useSlope,
                                                                  double useIntercept,
                                                                  boolean hasPad,
                                                                  int pad,
                                                                  int padRangeLimit,
                                                                  boolean useExactCalculationInsteadOfDICOMStandardMethod)
Parameters:
src -
center -
width -
signed -
inverted -
useSlope -
useIntercept -
hasPad -
pad -
padRangeLimit -
useExactCalculationInsteadOfDICOMStandardMethod -

applyWindowCenterAndWidthWithPaletteColor

public static final BufferedImage applyWindowCenterAndWidthWithPaletteColor(BufferedImage src,
                                                                            double center,
                                                                            double width,
                                                                            boolean signed,
                                                                            boolean inverted,
                                                                            double useSlope,
                                                                            double useIntercept,
                                                                            boolean hasPad,
                                                                            int pad,
                                                                            int padRangeLimit,
                                                                            int largestGray,
                                                                            int bitsPerEntry,
                                                                            int numberOfEntries,
                                                                            short[] redTable,
                                                                            short[] greenTable,
                                                                            short[] blueTable)
Parameters:
src -
center -
width -
signed -
inverted -
useSlope -
useIntercept -
hasPad -
pad -
padRangeLimit -
largestGray -
bitsPerEntry -
numberOfEntries -
redTable -
greenTable -
blueTable -

establishInitialWindowOrVOILUT

protected void establishInitialWindowOrVOILUT()

deconstruct

public void deconstruct()

deconstructAllSingleImagePanelsInContainer

public static void deconstructAllSingleImagePanelsInContainer(Container container)

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

paintComponent

public void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent
Parameters:
g -

main

public static void main(String[] arg)
Parameters:
arg -