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 SummaryFields Modifier and Type Field Description static intBLURDOCUMENT ME!static intCANCELDOCUMENT ME!static intDELETEDOCUMENT ME!static intFINDDOCUMENT ME!private float[]kernXBufferDOCUMENT ME!private float[]kernYBufferDOCUMENT ME!private float[]kernZBufferDOCUMENT ME!private boolean[]m_abMaskface mask to keep track of which voxels are in the face:.private int[]m_aiAxisparameters for finding and bluring the face:.private int[]m_asOriginalthe original unblurred data:.private booleanm_bFinishm_bFinish is set to true on an OK or Cancel message:.private doublem_dMinValuem_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 intm_iBlurDOCUMENT ME!private intm_iFaceDeletedDOCUMENT ME!private intm_iFaceFoundDOCUMENT ME!private intm_iMaxDOCUMENT ME!private intm_iMinDOCUMENT ME!private intm_iQuantityDOCUMENT ME!private intm_iRangeDOCUMENT ME!private intm_iStatestate variables to keep track of which step the algorithm is on:.private intm_iXBoundimage parameters:.private intm_iYBoundDOCUMENT ME!private intm_iZBoundDOCUMENT ME!private ModelImagem_kHeadOriginalDOCUMENT ME!static intOKDOCUMENT ME!private intsliceSizeDOCUMENT ME!private intxMaskMaxDOCUMENT ME!private intxMaskMinDOCUMENT ME!private intyMaskMaxDOCUMENT ME!private intyMaskMinDOCUMENT ME!private intzMaskMaxDOCUMENT ME!private intzMaskMinDOCUMENT ME!- 
Fields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBasedestFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStopped
 
- 
 - 
Constructor SummaryConstructors Constructor Description AlgorithmFaceAnonymizer(ModelImage srcImg, int[] aiAxis, int iMin, int iMax, int iRange)Create a face Anonymizer.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidanonymizeFace()Find face, blur face, commit, or cancel based on which buttons in the dialog are pressed.voidblurFace()Blurs the face mask voxels The blurred face volume is copied into the ModelImage and displayed to the user.voiddeleteFace()Cancel Button has been pressed: Copy the unaltered original data into the ModelImage.voidfinalize()Prepares this class for destruction.voidfindFace()Computes which voxels in the ModelImage are face voxels.voidfindFaceX()The head points along the X axis: rays are traced in the +/- x direction:voidfindFaceY()The head points along the Y axis: rays are traced in the +/- y direction:voidfindFaceZ()The head points along the Z axis: rays are traced in the +/- z direction:booleanisFinished()Called by the dialog.voidokFace()OK Button has been pressed: Copy the blurred face volume and the original data into the ModelImage.voidpreBlur()Extends the m_abMask so all the voxels in the neighborhood are blurred.voidrunAlgorithm()Starts the program.voidsetAxis(int[] aiAxis)Set the axis toward which the face points.voidsetBlur()Called when the Blur Face button is pressed. the algorithm computes the blurred face and sets the displayed image to be the blurred region.voidsetBlur(int iBlur)Sets the blur factor in number of voxels.voidsetCancel()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.voidsetDelete()DOCUMENT ME!voidsetFind()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.voidsetMax(int iMax)Sets the maximum voxel value for the skin.voidsetMin(int iMin)Sets the minimum voxel value for the skin.voidsetOK()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.voidsetRange(int iRange)Sets the thickness in number of voxels value for the skin.voidundoFace()Cancel Button has been pressed: Copy the unaltered original data into the ModelImage.- 
Methods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBaseactionPerformed, 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.ThreadactiveCount, 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- 
FINDpublic static final int FIND DOCUMENT ME!- See Also:
- Constant Field Values
 
 - 
BLURpublic static final int BLUR DOCUMENT ME!- See Also:
- Constant Field Values
 
 - 
DELETEpublic static final int DELETE DOCUMENT ME!- See Also:
- Constant Field Values
 
 - 
OKpublic static final int OK DOCUMENT ME!- See Also:
- Constant Field Values
 
 - 
CANCELpublic static final int CANCEL DOCUMENT ME!- See Also:
- Constant Field Values
 
 - 
kernXBufferprivate float[] kernXBuffer DOCUMENT ME!
 - 
kernYBufferprivate float[] kernYBuffer DOCUMENT ME!
 - 
kernZBufferprivate float[] kernZBuffer DOCUMENT ME!
 - 
m_abMaskprivate boolean[] m_abMask face mask to keep track of which voxels are in the face:.
 - 
m_aiAxisprivate int[] m_aiAxis parameters for finding and bluring the face:.
 - 
m_asOriginalprivate int[] m_asOriginal the original unblurred data:.
 - 
m_bFinishprivate boolean m_bFinish m_bFinish is set to true on an OK or Cancel message:.
 - 
m_dMinValueprivate 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_iBlurprivate int m_iBlur DOCUMENT ME!
 - 
m_iFaceDeletedprivate int m_iFaceDeleted DOCUMENT ME!
 - 
m_iFaceFoundprivate int m_iFaceFound DOCUMENT ME!
 - 
m_iMaxprivate int m_iMax DOCUMENT ME!
 - 
m_iMinprivate int m_iMin DOCUMENT ME!
 - 
m_iQuantityprivate int m_iQuantity DOCUMENT ME!
 - 
m_iRangeprivate int m_iRange DOCUMENT ME!
 - 
m_iStateprivate int m_iState state variables to keep track of which step the algorithm is on:.
 - 
m_iXBoundprivate int m_iXBound image parameters:.
 - 
m_iYBoundprivate int m_iYBound DOCUMENT ME!
 - 
m_iZBoundprivate int m_iZBound DOCUMENT ME!
 - 
m_kHeadOriginalprivate ModelImage m_kHeadOriginal DOCUMENT ME!
 - 
sliceSizeprivate int sliceSize DOCUMENT ME!
 - 
xMaskMaxprivate int xMaskMax DOCUMENT ME!
 - 
xMaskMinprivate int xMaskMin DOCUMENT ME!
 - 
yMaskMaxprivate int yMaskMax DOCUMENT ME!
 - 
yMaskMinprivate int yMaskMin DOCUMENT ME!
 - 
zMaskMaxprivate int zMaskMax DOCUMENT ME!
 - 
zMaskMinprivate int zMaskMin DOCUMENT ME!
 
- 
 - 
Constructor Detail- 
AlgorithmFaceAnonymizerpublic AlgorithmFaceAnonymizer(ModelImage srcImg, int[] aiAxis, int iMin, int iMax, int iRange) Create a face Anonymizer.- Parameters:
- srcImg- the source image
- aiAxis- the axis that the face points towards
- iMin- the minimum intensity value for the face
- iMax- the maximum intensity value for the face
- iRange- thickness in number of voxels value for the skin
 
 
- 
 - 
Method Detail- 
anonymizeFacepublic void anonymizeFace() Find face, blur face, commit, or cancel based on which buttons in the dialog are pressed.
 - 
blurFacepublic void blurFace() Blurs the face mask voxels The blurred face volume is copied into the ModelImage and displayed to the user.
 - 
deleteFacepublic void deleteFace() Cancel Button has been pressed: Copy the unaltered original data into the ModelImage.
 - 
finalizepublic void finalize() Prepares this class for destruction.- Overrides:
- finalizein class- AlgorithmBase
 
 - 
findFacepublic 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.
 - 
findFaceXpublic void findFaceX() The head points along the X axis: rays are traced in the +/- x direction:
 - 
findFaceYpublic void findFaceY() The head points along the Y axis: rays are traced in the +/- y direction:
 - 
findFaceZpublic void findFaceZ() The head points along the Z axis: rays are traced in the +/- z direction:
 - 
isFinishedpublic boolean isFinished() Called by the dialog.- Returns:
- DOCUMENT ME!
 
 - 
okFacepublic void okFace() OK Button has been pressed: Copy the blurred face volume and the original data into the ModelImage.
 - 
preBlurpublic void preBlur() Extends the m_abMask so all the voxels in the neighborhood are blurred.
 - 
runAlgorithmpublic void runAlgorithm() Starts the program.- Specified by:
- runAlgorithmin class- AlgorithmBase
 
 - 
setAxispublic void setAxis(int[] aiAxis) Set the axis toward which the face points.- Parameters:
- aiAxis- the new axis.
 
 - 
setBlurpublic 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.
 - 
setBlurpublic void setBlur(int iBlur) Sets the blur factor in number of voxels.- Parameters:
- iBlur- the new blur factor.
 
 - 
setCancelpublic 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.
 - 
setDeletepublic void setDelete() DOCUMENT ME!
 - 
setFindpublic 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.
 - 
setMaxpublic void setMax(int iMax) Sets the maximum voxel value for the skin.- Parameters:
- iMax- the new max value.
 
 - 
setMinpublic void setMin(int iMin) Sets the minimum voxel value for the skin.- Parameters:
- iMin- the new min value.
 
 - 
setOKpublic 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.
 - 
setRangepublic void setRange(int iRange) Sets the thickness in number of voxels value for the skin.- Parameters:
- iRange- the new thickness.
 
 - 
undoFacepublic void undoFace() Cancel Button has been pressed: Copy the unaltered original data into the ModelImage.
 
- 
 
-