Package gov.nih.mipav.view
Class WindowLevel
java.lang.Object
gov.nih.mipav.view.WindowLevel
The WindowLevel class provides mouse-driven window-level controls for the
ModelLUT or ModelRGB lookup tables. The WindowLevel class can be used to
attach mouse-control or any user-interface control to both the ModelLUT and
ModelRGB classes.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanIf true, window/level adjusted relative to the current transfer function values If false, window/level adjusted to the absolute image position valuesprivate float[]Member variables used to adjust the window and level (contrast and brightness) by dragging with the right-mouse button:.private float[]Member variables used to adjust the window and level (contrast and brightness) by dragging with the right-mouse button:.private floatDefault alpha blending value:private floatimage max valueprivate floatimage min valueprivate floatprevious mouse x-positionprivate floatprevious mouse y-positionprivate floatprivate float -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClean memory.floatfloatprivate voidinitWinLevelGray(ModelLUT kLUT, ModelImage kImage) initWinLevelGray, initializes the ModelLUT for gray-scale images before window-level operations.private voidinitWinLevelRGB(ModelRGB kRGBT, ModelImage kImage) initWinLevelRGB, initializes the ModelRGB for window-level changes.voidsetAlpha(float fAlpha) Sets alpha for the notifyWindowDisplayListeners callbooleanupdateWinLevel(float fX, float fY, boolean bFirstUpdate, ModelStorageBase kLookupTable, ModelImage kImage) updateWinLevel updates the window-level for the input lookup table based on two normalized parameters (fX, fY).private voidupdateWinLevelGray(ModelLUT kLUT, ModelImage kImage, float[] afXWin, float[] afYWin) updateWinLevelGray, updates the ModelLUT with the new transfer function.private voidupdateWinLevelRGB(ModelRGB kRGBT, ModelImage kImage, float[] afXWin, float[] afYWin) updateWinLevelRGB, updates the ModelRGB with the new transfer functions.private voidwinLevelGray(ModelLUT kLUT, ModelImage kImage) winLevelGray finds old_fWindow and old_fLevelprivate voidwinLevelRGB(ModelRGB kRGBT, ModelImage kImage) winLevelRGB finds old_fWindow and old_fLevel.
-
Field Details
-
m_afXWin
private float[] m_afXWinMember variables used to adjust the window and level (contrast and brightness) by dragging with the right-mouse button:. -
m_afYWin
private float[] m_afYWinMember variables used to adjust the window and level (contrast and brightness) by dragging with the right-mouse button:. -
m_fMax
private float m_fMaximage max value -
m_fMin
private float m_fMinimage min value -
m_fOldX
private float m_fOldXprevious mouse x-position -
m_fOldY
private float m_fOldYprevious mouse y-position -
m_fAlpha
private float m_fAlphaDefault alpha blending value: -
doRelative
private boolean doRelativeIf true, window/level adjusted relative to the current transfer function values If false, window/level adjusted to the absolute image position values -
old_fWindow
private float old_fWindow -
old_fLevel
private float old_fLevel
-
-
Constructor Details
-
WindowLevel
public WindowLevel()Default constructor.
-
-
Method Details
-
disposeLocal
public void disposeLocal()Clean memory. -
updateWinLevel
public boolean updateWinLevel(float fX, float fY, boolean bFirstUpdate, ModelStorageBase kLookupTable, ModelImage kImage) updateWinLevel updates the window-level for the input lookup table based on two normalized parameters (fX, fY). These parameters may be derived from a normalized x,y mouse position, from slider values, or from any variable. In ViewJComponentEditImage and PlaneRender classesL If the right mouse button is pressed and dragged. updateWinLevel updates the HistoLUT window and level (contrast and brightness) for the ViewJComponentEditImage and PlaneRender classes. The input parameters fX and fY must be in normalized screen space (0-1).- Parameters:
fX- the normalized window parameter (0-1)fY- the normalized level parameter (0-1)bFirstUpdate- when true initialize the WindowLevel functionkLookupTable- either the ModelLUT or the ModelRGB being modifiedkImage- the ModelImage the lookup table describes.- Returns:
- true when the lookup table changes, false when no change
-
setAlpha
public void setAlpha(float fAlpha) Sets alpha for the notifyWindowDisplayListeners call- Parameters:
fAlpha- the alpha value for blending between images. Needed to pass to the notifyWindowDisplayListeners function.
-
initWinLevelRGB
initWinLevelRGB, initializes the ModelRGB for window-level changes. The transfer function is set to have four control points, and is reset to the default linear.- Parameters:
kRGBT- the ModelRGB to be initializedkImage- the ModelImage that the min/max values are derived from for initializing the ModelRGB.
-
winLevelRGB
winLevelRGB finds old_fWindow and old_fLevel.- Parameters:
kRGBT- the ModelRGBkImage- the ModelImage
-
initWinLevelGray
initWinLevelGray, initializes the ModelLUT for gray-scale images before window-level operations. The transfer function is set to have four control points, and is reset to the default linear.- Parameters:
kLUT- the ModelLUT to be initialized.kImage- the ModelImage attached to kLUT
-
winLevelGray
winLevelGray finds old_fWindow and old_fLevel- Parameters:
kLUT- the ModelLUTkImage- the ModelImage attached to kLUT
-
updateWinLevelRGB
updateWinLevelRGB, updates the ModelRGB with the new transfer functions. Updates depend on the activation of the different rgb functions, so if the getROn returns false the red function is not updated.- Parameters:
kRGBT- the ModelRGB being updatedkImage- the ModelImage that the ModelRGB describesafXWin- the x-transfer functionafYWin- the y-transfer function
-
updateWinLevelGray
updateWinLevelGray, updates the ModelLUT with the new transfer function.- Parameters:
kLUT- the ModelLUT being updatedkImage- the ModelImage that the ModelLUT describesafXWin- the x-transfer functionafYWin- the y-transfer function
-
getWindowValue
public float getWindowValue() -
getLevelValue
public float getLevelValue()
-