Class JDialogFaceAnonymize

All Implemented Interfaces:
AlgorithmInterface, ScriptableActionInterface, DialogDefaultsInterface, ActionDiscovery, ActionListener, FocusListener, ItemListener, WindowListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class JDialogFaceAnonymize extends JDialogScriptableBase implements AlgorithmInterface, ActionDiscovery, ScriptableActionInterface
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • FACING_UNKNOWN

      public static final int FACING_UNKNOWN
      Face orientation not obtained from file information.
      See Also:
    • FACING_RIGHT

      public static final int FACING_RIGHT
      Indicates sagittal image with x-axis oriented posterior to anterior.
      See Also:
    • FACING_LEFT

      public static final int FACING_LEFT
      Indicates sagittal image with x-axis oriented anterior to posterior.
      See Also:
    • FACING_DOWN

      public static final int FACING_DOWN
      Indicates axial image with y-axis oriented posterior to anterior.
      See Also:
    • FACING_UP

      public static final int FACING_UP
      Indicates axial with y-axis oriented anterior to posterior.
      See Also:
    • FACING_INTO_SCREEN

      public static final int FACING_INTO_SCREEN
      Indicates coronal image with z-axis oriented posterior to anterior.
      See Also:
    • FACING_OUT_OF_SCREEN

      public static final int FACING_OUT_OF_SCREEN
      Indicates coronal image with z-axis oriented anterior to posterior.
      See Also:
    • PARAM_FACE_ORIENTATION

      private static final String PARAM_FACE_ORIENTATION
      The face orientation parameter.
      See Also:
    • defaceAlgo

      private AlgorithmSkullRemoval defaceAlgo
      The algorithm corresponding to this dialog box.
    • faceOrientation

      private int faceOrientation
      Indicates face orientation of the image.
    • facingDownRadio

      private JRadioButton facingDownRadio
      Button for facing down image.
    • facingIntoRadio

      private JRadioButton facingIntoRadio
      Button for facing into the screen image.
    • facingLeftRadio

      private JRadioButton facingLeftRadio
      Button for facing left image.
    • facingOutRadio

      private JRadioButton facingOutRadio
      Button for facing out image.
    • facingRightRadio

      private JRadioButton facingRightRadio
      Button for facing right image.
    • facingUpRadio

      private JRadioButton facingUpRadio
      Button for facing up image.
    • blurFaceRadio

      private JRadioButton blurFaceRadio
      Button for blurring just the face.
    • removeFaceRadio

      private JRadioButton removeFaceRadio
      Button for removing just the face.
    • blurAllRadio

      private JRadioButton blurAllRadio
      Button for blurring the face / skull.
    • removeAllRadio

      private JRadioButton removeAllRadio
      Button for removing the face / skull.
    • showFaceSegmentationRadio

      private JRadioButton showFaceSegmentationRadio
      Button for displaying the face segmentation.
    • showAllSegmentationRadio

      private JRadioButton showAllSegmentationRadio
      Button for displaying the full segmentation.
    • extraBrainPaddingField

      private JTextField extraBrainPaddingField
      Text field corresponding to brain padding parameter.
    • extraMMsToPad

      private int extraMMsToPad
      FaceAnonymizer parameter. Guarantees that the extracted brain will be avoided by the specified number of millimeters. Initially set to 20.
    • imageTextField

      private JTextField imageTextField
    • srcImage

      private ModelImage srcImage
      The image that face anonymization will be performed on.
    • blur

      private boolean blur
    • remove

      private boolean remove
    • face

      private boolean face
    • showFaceSegmentation

      private boolean showFaceSegmentation
    • showSkullSegmentation

      private boolean showSkullSegmentation
    • atlasImage

      private ModelImage atlasImage
  • Constructor Details

    • JDialogFaceAnonymize

      public JDialogFaceAnonymize()
      Empty constructor needed for dynamic instantiation (used during scripting).
    • JDialogFaceAnonymize

      public JDialogFaceAnonymize(Frame theParentFrame, ModelImage im)
      Creates the face anonymizer dialog.
      Parameters:
      theParentFrame - Parent frame.
      im - Source image.
  • Method Details

    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Presently only the script function calls this method. When the script sends this dialog the action command, this method calls run.
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class JDialogBase
      Parameters:
      event - event that triggers function
    • algorithmPerformed

      public void algorithmPerformed(AlgorithmBase algorithm)
      This method is required if the AlgorithmPerformed interface is implemented. It is called by the algorithms when it has completed or failed to to complete, so that the dialog can display the result image and/or clean up.
      Specified by:
      algorithmPerformed in interface AlgorithmInterface
      Parameters:
      algorithm - Algorithm that caused the event.
    • setGUIFromParams

      public void setGUIFromParams()
      Set the dialog GUI using the script parameters while running this algorithm as part of a script.
      Specified by:
      setGUIFromParams in class JDialogScriptableBase
    • storeParamsFromGUI

      public void storeParamsFromGUI() throws ParserException
      Record the parameters just used to run this algorithm in a script.
      Specified by:
      storeParamsFromGUI in class JDialogScriptableBase
      Throws:
      ParserException - If there is a problem creating/recording the new parameters.
    • callAlgorithm

      protected void callAlgorithm()
      Calls the algorithm.
      Specified by:
      callAlgorithm in class JDialogScriptableBase
    • getFaceOrientation

      private static int getFaceOrientation(ModelImage img)
      Return the guess at the face's orientation based on the image orientation information.
      Parameters:
      img - the image to guess from
      Returns:
      the direction the face is likely pointing in (or FACING_UNKNOWN if a guess cannot be made)
    • initDirection

      private void initDirection()
      Makes the GUI elements of the dialog. Not called at present because it is not necessary.
    • init

      private void init()
      Makes the GUI elements of the dialog. Not called at present because it is not necessary.
    • setVariablesDirection

      private boolean setVariablesDirection()
      Use the GUI results to set up the variables needed to run the algorithm.
      Returns:
      true if parameters set successfully, false otherwise.
    • setVariables

      private boolean setVariables()
      Use the GUI results to set up the variables needed to run the algorithm.
      Returns:
      true if parameters set successfully, false otherwise.
    • getActionMetadata

      public ActionMetadata getActionMetadata()
      Return meta-information about this discoverable action for categorization and labeling purposes.
      Specified by:
      getActionMetadata in interface ActionDiscovery
      Returns:
      Metadata for this action.
    • createInputParameters

      public ParameterTable createInputParameters()
      Returns a table listing the input parameters of this algorithm (which should match up with the scripting parameters used in setGUIFromParams()).
      Specified by:
      createInputParameters in interface ActionDiscovery
      Returns:
      A parameter table listing the inputs of this algorithm.
    • createOutputParameters

      public ParameterTable createOutputParameters()
      Returns a table listing the output parameters of this algorithm (usually just labels used to obtain output image names later).
      Specified by:
      createOutputParameters in interface ActionDiscovery
      Returns:
      A parameter table listing the outputs of this algorithm.
    • getOutputImageName

      public String getOutputImageName(String imageParamName)
      Returns the name of an image output by this algorithm, the image returned depends on the parameter label given (which can be used to retrieve the image object from the image registry).
      Specified by:
      getOutputImageName in interface ActionDiscovery
      Parameters:
      imageParamName - The output image parameter label for which to get the image name.
      Returns:
      The image name of the requested output image parameter label.
    • isActionComplete

      public boolean isActionComplete()
      Returns whether the action has successfully completed its execution.
      Specified by:
      isActionComplete in interface ActionDiscovery
      Returns:
      True, if the action is complete. False, if the action failed or is still running.