Class JDialogFaceAnonymizerBET

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

public class JDialogFaceAnonymizerBET extends JDialogScriptableBase implements AlgorithmInterface, ActionDiscovery, ScriptableActionInterface
Dialog used to input parameters and start the BET-based face anonymizer.
Author:
mccreedy
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • FACING_UNKNOWN

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

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

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

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

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

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

      private 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:
    • PARAM_EXTRA_MMS_TO_PAD

      private static final String PARAM_EXTRA_MMS_TO_PAD
      Millimeters to add to brain mask.
      See Also:
    • PARAM_BET_DO_SPHERE_ESTIMATION

      private static final String PARAM_BET_DO_SPHERE_ESTIMATION
      Flag indicates BET should approximate initial brain by sphere.
      See Also:
    • PARAM_BET_IMG_INFLUENCE

      private static final String PARAM_BET_IMG_INFLUENCE
      BET based parameter for the depth to calculate in approximating brain maximum and minimum intensities.
      See Also:
    • PARAM_BET_STIFFNESS

      private static final String PARAM_BET_STIFFNESS
      Controls the stiffness of the brain approximation mesh.
      See Also:
    • defaceAlgo

      private AlgorithmFaceAnonymizerBET defaceAlgo
      The algorithm corresponding to this dialog box.
    • estimateWithSphereBET

      private boolean estimateWithSphereBET
      Flag indicates BET should approximate initial brain by sphere. Initially set to false.
    • estimateWithSphereCheckbox

      private JCheckBox estimateWithSphereCheckbox
      Check box corresponding to estimateSphereBET.
    • 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.
    • 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.
    • imageInfluenceBET

      private float imageInfluenceBET
      the depth to calculate in approximating brain maximum and minimum intensities. Initially set to .1
    • imageInfluenceField

      private JTextField imageInfluenceField
      The text field corresponding to imageInfluenceField.
    • srcImage

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

      private float stiffnessBET
      Controls the stiffness of the brain approximation mesh. Initially set to 0.15.
    • stiffnessField

      private JTextField stiffnessField
      The text field corresponding to stiffnessBET.
  • Constructor Details

    • JDialogFaceAnonymizerBET

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

      public JDialogFaceAnonymizerBET(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)
    • init

      private void init()
      Makes the GUI elements of the dialog. Not called at present because it is not necessary.
    • 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.