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:
ActionListener,WindowListener,Runnable,EventListener
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!static final intDOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private float[]DOCUMENT ME!private boolean[]face mask to keep track of which voxels are in the face:.private int[]parameters for finding and bluring the face:.private int[]the original unblurred data:.private booleanm_bFinish is set to true on an OK or Cancel message:.private doublem_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 intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intstate variables to keep track of which step the algorithm is on:.private intimage parameters:.private intDOCUMENT ME!private intDOCUMENT ME!private ModelImageDOCUMENT ME!static final intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT ME!private intDOCUMENT 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, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmFaceAnonymizer(ModelImage srcImg, int[] aiAxis, int iMin, int iMax, int iRange) Create a face Anonymizer. -
Method Summary
Modifier and TypeMethodDescriptionvoidFind 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.voidCancel 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.voidThe head points along the X axis: rays are traced in the +/- x direction:voidThe head points along the Y axis: rays are traced in the +/- y direction:voidThe head points along the Z axis: rays are traced in the +/- z direction:booleanCalled 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.voidStarts 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.voidCalled 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.voidDOCUMENT 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.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, windowOpenedMethods 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, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
FIND
public static final int FINDDOCUMENT ME!- See Also:
-
BLUR
public static final int BLURDOCUMENT ME!- See Also:
-
DELETE
public static final int DELETEDOCUMENT ME!- See Also:
-
OK
public static final int OKDOCUMENT ME!- See Also:
-
CANCEL
public static final int CANCELDOCUMENT ME!- See Also:
-
kernXBuffer
private float[] kernXBufferDOCUMENT ME! -
kernYBuffer
private float[] kernYBufferDOCUMENT ME! -
kernZBuffer
private float[] kernZBufferDOCUMENT ME! -
m_abMask
private boolean[] m_abMaskface mask to keep track of which voxels are in the face:. -
m_aiAxis
private int[] m_aiAxisparameters for finding and bluring the face:. -
m_asOriginal
private int[] m_asOriginalthe original unblurred data:. -
m_bFinish
private boolean m_bFinishm_bFinish is set to true on an OK or Cancel message:. -
m_dMinValue
private double m_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. -
m_iBlur
private int m_iBlurDOCUMENT ME! -
m_iFaceDeleted
private int m_iFaceDeletedDOCUMENT ME! -
m_iFaceFound
private int m_iFaceFoundDOCUMENT ME! -
m_iMax
private int m_iMaxDOCUMENT ME! -
m_iMin
private int m_iMinDOCUMENT ME! -
m_iQuantity
private int m_iQuantityDOCUMENT ME! -
m_iRange
private int m_iRangeDOCUMENT ME! -
m_iState
private int m_iStatestate variables to keep track of which step the algorithm is on:. -
m_iXBound
private int m_iXBoundimage parameters:. -
m_iYBound
private int m_iYBoundDOCUMENT ME! -
m_iZBound
private int m_iZBoundDOCUMENT ME! -
m_kHeadOriginal
DOCUMENT ME! -
sliceSize
private int sliceSizeDOCUMENT ME! -
xMaskMax
private int xMaskMaxDOCUMENT ME! -
xMaskMin
private int xMaskMinDOCUMENT ME! -
yMaskMax
private int yMaskMaxDOCUMENT ME! -
yMaskMin
private int yMaskMinDOCUMENT ME! -
zMaskMax
private int zMaskMaxDOCUMENT ME! -
zMaskMin
private int zMaskMinDOCUMENT ME!
-
-
Constructor Details
-
AlgorithmFaceAnonymizer
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 Details
-
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:
finalizein 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:
runAlgorithmin 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.
-