Package gov.nih.mipav.model.algorithms
Class AlgorithmFaceAnonymizerBET
java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.AlgorithmFaceAnonymizerBET
- All Implemented Interfaces:
ActionListener,WindowListener,Runnable,EventListener
Anonymize an image of a patient's head by removing the face.
This version of of the de-facer uses BET to find the brain, the brain's location is then used to calculate a plane. This plane is then used to remove the patient's face from the image.
- Author:
- mccreedy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classPrivate utility class for operations on BitSetsNested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanParameter for brain extraction by default set tofalseprivate intThe orientation of an image.static final intFor indicating the axial image is facing down.static final intFor indicating the coronal image is facing into the screen.static final intFor indicating the sagittal image is facing left.static final intFor indicating the coronal image is facing out of the screen.static final intFor indicating the sagittal image is facing right.static final intFor indicating the axial image is facing up.private floatParameter for brain extraction by default set to .1static final intMay no longer be necessary.private intLength to buffer brain by in millimeters.static final intEventually won't be necessary.private final intComputed as xDim*yDimprivate floatParameter for brain extraction by default set to .15private final intComputed as xDim*yDim*zDimprivate final intLength of the x dimension in pixels.private final intLength of the y dimension in pixels.private final intLength of the z dimension in pixels.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
ConstructorsConstructorDescriptionAlgorithmFaceAnonymizerBET(ModelImage srcImg, int faceDirection, int extraMMsToPad) Construct the face anonymizer, but do not run it yet. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidExecutes the de-facing algorithm.private BitSetbufferBrain(BitSet brainMaskTemp, int mmToPad) Appends the givenbrainMaskTempbymmToPadin pixels in all directions.private BitSetdefineInitialRegion(BitSet interestRegion) Defines an initial region for face de-identification.private BitSetDefines the bounding region for face de-identification.private BitSetPerforms the BET brain extraction using parameters specified from JDialogFaceAnonymizer.private BitSetextractFace(BitSet interestRegion, BitSet initialRegion, BitSet brainMask) Performs the face de-identification within the bounding area by approximating the given shape using a geometry suitable for the given shape.voidfinalize()Clean up memory used by the algorithm.voidRun the de-facing algorithm.voidsetBETParameters(boolean estimateWithSphere, float imageInfluence, float stiffness) Changes the BET algorithm parameters from their defaults (which we choose).private BitSetsmoothFace(BitSet removeRegion) Connects near neighbors of set values inremoveRegion.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
-
REMOVED_INTENSITY
public static final int REMOVED_INTENSITYEventually won't be necessary.- See Also:
-
MIN_RADIUS
public static final int MIN_RADIUSMay no longer be necessary.- See Also:
-
FACING_RIGHT
public static final int FACING_RIGHTFor indicating the sagittal image is facing right.- See Also:
-
FACING_LEFT
public static final int FACING_LEFTFor indicating the sagittal image is facing left.- See Also:
-
FACING_DOWN
public static final int FACING_DOWNFor indicating the axial image is facing down.- See Also:
-
FACING_UP
public static final int FACING_UPFor indicating the axial image is facing up.- See Also:
-
FACING_INTO_SCREEN
public static final int FACING_INTO_SCREENFor indicating the coronal image is facing into the screen.- See Also:
-
FACING_OUT_OF_SCREEN
public static final int FACING_OUT_OF_SCREENFor indicating the coronal image is facing out of the screen.- See Also:
-
mmToPad
private int mmToPadLength to buffer brain by in millimeters. -
faceOrientation
private int faceOrientationThe orientation of an image. -
estimateWithSphereBET
private boolean estimateWithSphereBETParameter for brain extraction by default set tofalse -
imageInfluenceBET
private float imageInfluenceBETParameter for brain extraction by default set to .1 -
stiffnessBET
private float stiffnessBETParameter for brain extraction by default set to .15 -
sliceSize
private final int sliceSizeComputed as xDim*yDim -
volumeSize
private final int volumeSizeComputed as xDim*yDim*zDim -
xDim
private final int xDimLength of the x dimension in pixels. -
yDim
private final int yDimLength of the y dimension in pixels. -
zDim
private final int zDimLength of the z dimension in pixels.
-
-
Constructor Details
-
AlgorithmFaceAnonymizerBET
Construct the face anonymizer, but do not run it yet.- Parameters:
srcImg- The image to de-facefaceDirection- the orientation of the patient's face, as determined by the dialogextraMMsToPad- the number of millimeters to buffer brain by after extraction
-
-
Method Details
-
finalize
public void finalize()Clean up memory used by the algorithm.- Overrides:
finalizein classAlgorithmBase
-
runAlgorithm
public void runAlgorithm()Run the de-facing algorithm.- Specified by:
runAlgorithmin classAlgorithmBase
-
setBETParameters
public void setBETParameters(boolean estimateWithSphere, float imageInfluence, float stiffness) Changes the BET algorithm parameters from their defaults (which we choose).- Parameters:
estimateWithSphere- whether to estimate the brain with a sphere initiallyimageInfluence- the image influence ratiostiffness- the mesh stiffness
-
anonymizeFace
private void anonymizeFace()Executes the de-facing algorithm. -
extractBrain
Performs the BET brain extraction using parameters specified from JDialogFaceAnonymizer.- Returns:
- A
BitSetof sizesrcImage.getSize()where set values are the location of brain.
-
bufferBrain
Appends the givenbrainMaskTempbymmToPadin pixels in all directions. TODO: Use Algorithms -> Morphological -> Dilate- Parameters:
brainMaskTemp- TheBitSetreturned bythis.extractBrain().mmToPad- Length in millimeters that the brain'sBitSetshould be extended.- Returns:
- The original
BitSetwithmmToPadin pixels appended to thisBitSet
-
defineInterestRegion
Defines the bounding region for face de-identification.- Returns:
- A
BitSetof sizesrcImage.getSize()where set values are the inital shape's location.
-
defineInitialRegion
Defines an initial region for face de-identification.- Parameters:
interestRegion- The bounding area of the face de-identification.- Returns:
- A
BitSetof sizesrcImage.getSize()where set values are the inital shape's location.
-
extractFace
Performs the face de-identification within the bounding area by approximating the given shape using a geometry suitable for the given shape. For example, the approximation of a quarter cylinder is performed using spheres with centers on the boundary points of theinitialRegionwith further iterations on the boundary points of the resulting shape.- Parameters:
interestRegion- The bounding area for face de-identification.initialRegion- Initial area.brainMask- Brain extraction derived from BET and apended bythis.bufferBrain(BitSet, int)- Returns:
- A
BitSetof sizesrcImage.getSize()where set values denote face de-identification may be performed.
-
smoothFace
Connects near neighbors of set values inremoveRegion. Near neighbors are those values which are set and are within five percent of the image resolution.- Parameters:
removeRegion- The originalBitSetfor face de-identification.interestRegion- The bounding region.brainMask- The location of the brain in this image.- Returns:
- A
BitSetof sizesrcImage.getSize()where set values denote face de-identification may be performed.
-