Class 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 Detail

      • 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 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

      • 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 class AlgorithmBase
      • 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.
      • 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.