Package gov.nih.mipav.model.algorithms
Class AlgorithmFaceAnonymizer
- java.lang.Object
-
- java.lang.Thread
-
- gov.nih.mipav.model.algorithms.AlgorithmBase
-
- gov.nih.mipav.model.algorithms.AlgorithmFaceAnonymizer
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.awt.event.WindowListener
,java.lang.Runnable
,java.util.EventListener
public class AlgorithmFaceAnonymizer extends AlgorithmBase
FaceAnonymizer algorithm computes the "face" from a ModelImage based on input parameters that specify the min/max voxel values for the face voxels, and the maximum skin thinkness. The algorithm also blurs the face voxels based on input parameter for blur factor. The face and blured face are stored in the ModelImage so the user can see the results. On getting an OK message, the blurred face is recombined with the rest of the head volume. On getting a Cancel message the original volume is restored.- Author:
- Alexandra Bokinsky, Magic Software. Under contract from NIH.
-
-
Field Summary
Fields Modifier and Type Field Description static int
BLUR
DOCUMENT ME!static int
CANCEL
DOCUMENT ME!static int
DELETE
DOCUMENT ME!static int
FIND
DOCUMENT ME!private float[]
kernXBuffer
DOCUMENT ME!private float[]
kernYBuffer
DOCUMENT ME!private float[]
kernZBuffer
DOCUMENT ME!private boolean[]
m_abMask
face mask to keep track of which voxels are in the face:.private int[]
m_aiAxis
parameters for finding and bluring the face:.private int[]
m_asOriginal
the original unblurred data:.private boolean
m_bFinish
m_bFinish is set to true on an OK or Cancel message:.private double
m_dMinValue
m_iMinValue is used to set the minimum value in the face and blurred face images so that the image is displayed "nicely" in the image window.private int
m_iBlur
DOCUMENT ME!private int
m_iFaceDeleted
DOCUMENT ME!private int
m_iFaceFound
DOCUMENT ME!private int
m_iMax
DOCUMENT ME!private int
m_iMin
DOCUMENT ME!private int
m_iQuantity
DOCUMENT ME!private int
m_iRange
DOCUMENT ME!private int
m_iState
state variables to keep track of which step the algorithm is on:.private int
m_iXBound
image parameters:.private int
m_iYBound
DOCUMENT ME!private int
m_iZBound
DOCUMENT ME!private ModelImage
m_kHeadOriginal
DOCUMENT ME!static int
OK
DOCUMENT ME!private int
sliceSize
DOCUMENT ME!private int
xMaskMax
DOCUMENT ME!private int
xMaskMin
DOCUMENT ME!private int
yMaskMax
DOCUMENT ME!private int
yMaskMin
DOCUMENT ME!private int
zMaskMax
DOCUMENT ME!private int
zMaskMin
DOCUMENT ME!-
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
-
-
Constructor Summary
Constructors Constructor Description AlgorithmFaceAnonymizer(ModelImage srcImg, int[] aiAxis, int iMin, int iMax, int iRange)
Create a face Anonymizer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
anonymizeFace()
Find face, blur face, commit, or cancel based on which buttons in the dialog are pressed.void
blurFace()
Blurs the face mask voxels The blurred face volume is copied into the ModelImage and displayed to the user.void
deleteFace()
Cancel Button has been pressed: Copy the unaltered original data into the ModelImage.void
finalize()
Prepares this class for destruction.void
findFace()
Computes which voxels in the ModelImage are face voxels.void
findFaceX()
The head points along the X axis: rays are traced in the +/- x direction:void
findFaceY()
The head points along the Y axis: rays are traced in the +/- y direction:void
findFaceZ()
The head points along the Z axis: rays are traced in the +/- z direction:boolean
isFinished()
Called by the dialog.void
okFace()
OK Button has been pressed: Copy the blurred face volume and the original data into the ModelImage.void
preBlur()
Extends the m_abMask so all the voxels in the neighborhood are blurred.void
runAlgorithm()
Starts the program.void
setAxis(int[] aiAxis)
Set the axis toward which the face points.void
setBlur()
Called when the Blur Face button is pressed. the algorithm computes the blurred face and sets the displayed image to be the blurred region.void
setBlur(int iBlur)
Sets the blur factor in number of voxels.void
setCancel()
Called when the dialog Cancel button is pressed. this sets up the Algorithm state to revert to the original copy of the image and to tell the dialog to cleanup and delete this algorithm.void
setDelete()
DOCUMENT ME!void
setFind()
Called when the Find Face button is pressed. the algorithm computes the face region of the volume and sets the displayed image to be that region.void
setMax(int iMax)
Sets the maximum voxel value for the skin.void
setMin(int iMin)
Sets the minimum voxel value for the skin.void
setOK()
Called when the dialog OK button is pressed. this sets up the Algorithm state to commit the changes in the image and to tell the dialog to cleanup and delete this algorithm.void
setRange(int iRange)
Sets the thickness in number of voxels value for the skin.void
undoFace()
Cancel Button has been pressed: Copy the unaltered original data into the ModelImage.-
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
FIND
public static final int FIND
DOCUMENT ME!- See Also:
- Constant Field Values
-
BLUR
public static final int BLUR
DOCUMENT ME!- See Also:
- Constant Field Values
-
DELETE
public static final int DELETE
DOCUMENT ME!- See Also:
- Constant Field Values
-
OK
public static final int OK
DOCUMENT ME!- See Also:
- Constant Field Values
-
CANCEL
public static final int CANCEL
DOCUMENT ME!- See Also:
- Constant Field Values
-
kernXBuffer
private float[] kernXBuffer
DOCUMENT ME!
-
kernYBuffer
private float[] kernYBuffer
DOCUMENT ME!
-
kernZBuffer
private float[] kernZBuffer
DOCUMENT ME!
-
m_abMask
private boolean[] m_abMask
face mask to keep track of which voxels are in the face:.
-
m_aiAxis
private int[] m_aiAxis
parameters for finding and bluring the face:.
-
m_asOriginal
private int[] m_asOriginal
the original unblurred data:.
-
m_bFinish
private boolean m_bFinish
m_bFinish is set to true on an OK or Cancel message:.
-
m_dMinValue
private double m_dMinValue
m_iMinValue is used to set the minimum value in the face and blurred face images so that the image is displayed "nicely" in the image window.
-
m_iBlur
private int m_iBlur
DOCUMENT ME!
-
m_iFaceDeleted
private int m_iFaceDeleted
DOCUMENT ME!
-
m_iFaceFound
private int m_iFaceFound
DOCUMENT ME!
-
m_iMax
private int m_iMax
DOCUMENT ME!
-
m_iMin
private int m_iMin
DOCUMENT ME!
-
m_iQuantity
private int m_iQuantity
DOCUMENT ME!
-
m_iRange
private int m_iRange
DOCUMENT ME!
-
m_iState
private int m_iState
state variables to keep track of which step the algorithm is on:.
-
m_iXBound
private int m_iXBound
image parameters:.
-
m_iYBound
private int m_iYBound
DOCUMENT ME!
-
m_iZBound
private int m_iZBound
DOCUMENT ME!
-
m_kHeadOriginal
private ModelImage m_kHeadOriginal
DOCUMENT ME!
-
sliceSize
private int sliceSize
DOCUMENT ME!
-
xMaskMax
private int xMaskMax
DOCUMENT ME!
-
xMaskMin
private int xMaskMin
DOCUMENT ME!
-
yMaskMax
private int yMaskMax
DOCUMENT ME!
-
yMaskMin
private int yMaskMin
DOCUMENT ME!
-
zMaskMax
private int zMaskMax
DOCUMENT ME!
-
zMaskMin
private int zMaskMin
DOCUMENT ME!
-
-
Constructor Detail
-
AlgorithmFaceAnonymizer
public AlgorithmFaceAnonymizer(ModelImage srcImg, int[] aiAxis, int iMin, int iMax, int iRange)
Create a face Anonymizer.- Parameters:
srcImg
- the source imageaiAxis
- the axis that the face points towardsiMin
- the minimum intensity value for the faceiMax
- the maximum intensity value for the faceiRange
- thickness in number of voxels value for the skin
-
-
Method Detail
-
anonymizeFace
public void anonymizeFace()
Find face, blur face, commit, or cancel based on which buttons in the dialog are pressed.
-
blurFace
public void blurFace()
Blurs the face mask voxels The blurred face volume is copied into the ModelImage and displayed to the user.
-
deleteFace
public void deleteFace()
Cancel Button has been pressed: Copy the unaltered original data into the ModelImage.
-
finalize
public void finalize()
Prepares this class for destruction.- Overrides:
finalize
in classAlgorithmBase
-
findFace
public void findFace()
Computes which voxels in the ModelImage are face voxels. This is done based on the min/max voxel values for the face, and the maximum face thickness value, which are set by the FaceAnonymizer dialog. The face volume is copied into the ModelImage and displayed to the user.
-
findFaceX
public void findFaceX()
The head points along the X axis: rays are traced in the +/- x direction:
-
findFaceY
public void findFaceY()
The head points along the Y axis: rays are traced in the +/- y direction:
-
findFaceZ
public void findFaceZ()
The head points along the Z axis: rays are traced in the +/- z direction:
-
isFinished
public boolean isFinished()
Called by the dialog.- Returns:
- DOCUMENT ME!
-
okFace
public void okFace()
OK Button has been pressed: Copy the blurred face volume and the original data into the ModelImage.
-
preBlur
public void preBlur()
Extends the m_abMask so all the voxels in the neighborhood are blurred.
-
runAlgorithm
public void runAlgorithm()
Starts the program.- Specified by:
runAlgorithm
in classAlgorithmBase
-
setAxis
public void setAxis(int[] aiAxis)
Set the axis toward which the face points.- Parameters:
aiAxis
- the new axis.
-
setBlur
public void setBlur()
Called when the Blur Face button is pressed. the algorithm computes the blurred face and sets the displayed image to be the blurred region.
-
setBlur
public void setBlur(int iBlur)
Sets the blur factor in number of voxels.- Parameters:
iBlur
- the new blur factor.
-
setCancel
public void setCancel()
Called when the dialog Cancel button is pressed. this sets up the Algorithm state to revert to the original copy of the image and to tell the dialog to cleanup and delete this algorithm.
-
setDelete
public void setDelete()
DOCUMENT ME!
-
setFind
public void setFind()
Called when the Find Face button is pressed. the algorithm computes the face region of the volume and sets the displayed image to be that region.
-
setMax
public void setMax(int iMax)
Sets the maximum voxel value for the skin.- Parameters:
iMax
- the new max value.
-
setMin
public void setMin(int iMin)
Sets the minimum voxel value for the skin.- Parameters:
iMin
- the new min value.
-
setOK
public void setOK()
Called when the dialog OK button is pressed. this sets up the Algorithm state to commit the changes in the image and to tell the dialog to cleanup and delete this algorithm.
-
setRange
public void setRange(int iRange)
Sets the thickness in number of voxels value for the skin.- Parameters:
iRange
- the new thickness.
-
undoFace
public void undoFace()
Cancel Button has been pressed: Copy the unaltered original data into the ModelImage.
-
-