Class ProvenanceRecorder

java.lang.Object
gov.nih.mipav.model.provenance.ProvenanceRecorder

public class ProvenanceRecorder extends Object
Singleton class modelled after ScriptRecorder that is turned on when Mipav starts if DATA_PROVENANCE boolean is set to true in preferences (set through Mipav-Options) Records data provenance line by line (after running algorithms or doing other important actions (Change name) etc images are placed in registers (similar to the script recorder) but there are also Vectors of input and output images so that the data provenance is placed into the correct place(s)
  • Field Details

    • LINE_SEPARATOR

      protected static final String LINE_SEPARATOR
      The line separator to use for scripts.
      See Also:
    • singletonReference

      protected static ProvenanceRecorder singletonReference
      The reference to the only occurrance of this class.
    • PAUSED

      public static final int PAUSED
      Status indicating that the script recorder is currently paused.
      See Also:
    • RECORDING

      public static final int RECORDING
      Status indicating that the script recorder is currently recording.
      See Also:
    • STOPPED

      public static final int STOPPED
      Status indicating that the script recorder is currently stopped (either never started, or recording is over).
      See Also:
    • statusStrings

      public static final String[] statusStrings
      Strings describing the various recorder statuses.
    • recorderStatus

      protected int recorderStatus
      The current status of the recorder, either PAUSED, RECORDING, or STOPPED.
    • recordingListeners

      protected Vector recordingListeners
      A list of listeners who want to know about lines added to the script.
    • imageTable

      protected ImageVariableTable imageTable
      The table containing image-placeholder-to-image-name mappings for the script we are currently recording.
    • inputImages

      protected Vector<String> inputImages
      Vector of Strings holding the registers of images used as input
    • outputImages

      protected Vector<String> outputImages
      Vector of Strings holding the registers of images used as output
  • Constructor Details

    • ProvenanceRecorder

      protected ProvenanceRecorder()
      Creates a new ProvenanceRecorder object. May only be called by getReference() since this is a singleton class.
  • Method Details

    • getReference

      public static final ProvenanceRecorder getReference()
      Returns a reference to the provenance recorder.
      Returns:
      A reference to the provenance recorder.
    • addInputImage

      public void addInputImage(String var)
      Adds an image register as an input-image
      Parameters:
      var -
    • addOutputImage

      public void addOutputImage(String var)
    • addLine

      public void addLine(ScriptableActionInterface scriptAction)
      Adds a scriptable action to an image's data provenance
      Parameters:
      scriptAction - script action such as changing name, changing resolutions etc
    • addLine

      public void addLine(String action, ParameterTable parameterList)
      Appends a line of text to the current script (if one is being recorded) using a script action and list of parameters.
      Parameters:
      action - The action to put into the new script line.
      parameterList - The list of parameters to include in the new script line.
    • resetRecorder

      public void resetRecorder()
      Erases the current script.
    • getImageTable

      public ImageVariableTable getImageTable()
      Returns a reference to the image table being used to run the current script.
      Returns:
      The image table which should be used to run the current script, or null if no script is being run at the moment.
    • getRecorderStatus

      public int getRecorderStatus()
      Returns the current status of the script recorder.
      Returns:
      Either PAUSED, RECORDING, or STOPPED.
    • setRecorderStatus

      protected void setRecorderStatus(int status)
      Changes the current status of the script recorder and notifies any recorder listeners of the change.
      Parameters:
      status - The new status for the script recorder.
    • startRecording

      public boolean startRecording()
      Starts the recording of a new script (if one isn't already being recorded). Any script text which was previously recorded and stored in the recorder is erased (unless we are resuming from a recorder pause).
      Returns:
      True if recording was started successfully, false otherwise.
    • pauseRecording

      public void pauseRecording()
      Pauses the recording of the script we are currently recording.
    • stopRecording

      public void stopRecording()
      Stops script recording. Call getScript() to get the recorded script.
    • storeImage

      public String storeImage(String imageName)
      Convenience method used to store the name of an image in the image table being recorded/used in the current script.
      Parameters:
      imageName - The name of the image to store.
      Returns:
      The image variable placeholder which has been assigned to the image name (may not be a new variable if the name is already in the table).