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

public class AlgorithmFaceAnonymizerBET extends AlgorithmBase
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
  • Field Details

    • REMOVED_INTENSITY

      public static final int REMOVED_INTENSITY
      Eventually won't be necessary.
      See Also:
    • MIN_RADIUS

      public static final int MIN_RADIUS
      May no longer be necessary.
      See Also:
    • FACING_RIGHT

      public static final int FACING_RIGHT
      For indicating the sagittal image is facing right.
      See Also:
    • FACING_LEFT

      public static final int FACING_LEFT
      For indicating the sagittal image is facing left.
      See Also:
    • FACING_DOWN

      public static final int FACING_DOWN
      For indicating the axial image is facing down.
      See Also:
    • FACING_UP

      public static final int FACING_UP
      For indicating the axial image is facing up.
      See Also:
    • FACING_INTO_SCREEN

      public static final int FACING_INTO_SCREEN
      For indicating the coronal image is facing into the screen.
      See Also:
    • FACING_OUT_OF_SCREEN

      public static final int FACING_OUT_OF_SCREEN
      For indicating the coronal image is facing out of the screen.
      See Also:
    • mmToPad

      private int mmToPad
      Length to buffer brain by in millimeters.
    • faceOrientation

      private int faceOrientation
      The orientation of an image.
    • estimateWithSphereBET

      private boolean estimateWithSphereBET
      Parameter for brain extraction by default set to false
    • imageInfluenceBET

      private float imageInfluenceBET
      Parameter for brain extraction by default set to .1
    • stiffnessBET

      private float stiffnessBET
      Parameter for brain extraction by default set to .15
    • sliceSize

      private final int sliceSize
      Computed as xDim*yDim
    • volumeSize

      private final int volumeSize
      Computed as xDim*yDim*zDim
    • xDim

      private final int xDim
      Length of the x dimension in pixels.
    • yDim

      private final int yDim
      Length of the y dimension in pixels.
    • zDim

      private final int zDim
      Length of the z dimension in pixels.
  • Constructor Details

    • AlgorithmFaceAnonymizerBET

      public AlgorithmFaceAnonymizerBET(ModelImage srcImg, int faceDirection, int extraMMsToPad)
      Construct the face anonymizer, but do not run it yet.
      Parameters:
      srcImg - The image to de-face
      faceDirection - the orientation of the patient's face, as determined by the dialog
      extraMMsToPad - the number of millimeters to buffer brain by after extraction
  • Method Details

    • finalize

      public void finalize()
      Clean up memory used by the algorithm.
      Overrides:
      finalize in class AlgorithmBase
    • runAlgorithm

      public void runAlgorithm()
      Run the de-facing algorithm.
      Specified by:
      runAlgorithm in class AlgorithmBase
    • 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 initially
      imageInfluence - the image influence ratio
      stiffness - the mesh stiffness
    • anonymizeFace

      private void anonymizeFace()
      Executes the de-facing algorithm.
    • extractBrain

      private BitSet extractBrain()
      Performs the BET brain extraction using parameters specified from JDialogFaceAnonymizer.
      Returns:
      A BitSet of size srcImage.getSize() where set values are the location of brain.
    • bufferBrain

      private BitSet bufferBrain(BitSet brainMaskTemp, int mmToPad)
      Appends the given brainMaskTemp by mmToPad in pixels in all directions. TODO: Use Algorithms -> Morphological -> Dilate
      Parameters:
      brainMaskTemp - The BitSet returned by this.extractBrain().
      mmToPad - Length in millimeters that the brain's BitSet should be extended.
      Returns:
      The original BitSet with mmToPad in pixels appended to this BitSet
    • defineInterestRegion

      private BitSet defineInterestRegion()
      Defines the bounding region for face de-identification.
      Returns:
      A BitSet of size srcImage.getSize() where set values are the inital shape's location.
    • defineInitialRegion

      private BitSet defineInitialRegion(BitSet interestRegion)
      Defines an initial region for face de-identification.
      Parameters:
      interestRegion - The bounding area of the face de-identification.
      Returns:
      A BitSet of size srcImage.getSize() where set values are the inital shape's location.
    • extractFace

      private BitSet extractFace(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. For example, the approximation of a quarter cylinder is performed using spheres with centers on the boundary points of the initialRegion with 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 by this.bufferBrain(BitSet, int)
      Returns:
      A BitSet of size srcImage.getSize() where set values denote face de-identification may be performed.
    • smoothFace

      private BitSet smoothFace(BitSet removeRegion)
      Connects near neighbors of set values in removeRegion. Near neighbors are those values which are set and are within five percent of the image resolution.
      Parameters:
      removeRegion - The original BitSet for face de-identification.
      interestRegion - The bounding region.
      brainMask - The location of the brain in this image.
      Returns:
      A BitSet of size srcImage.getSize() where set values denote face de-identification may be performed.