Package gov.nih.mipav.model.provenance
Class ProvenanceRecorder
- java.lang.Object
-
- gov.nih.mipav.model.provenance.ProvenanceRecorder
-
public class ProvenanceRecorder extends java.lang.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 Summary
Fields Modifier and Type Field Description protected ImageVariableTable
imageTable
The table containing image-placeholder-to-image-name mappings for the script we are currently recording.protected java.util.Vector<java.lang.String>
inputImages
Vector of Strings holding the registers of images used as inputprotected static java.lang.String
LINE_SEPARATOR
The line separator to use for scripts.protected java.util.Vector<java.lang.String>
outputImages
Vector of Strings holding the registers of images used as outputstatic int
PAUSED
Status indicating that the script recorder is currently paused.protected int
recorderStatus
The current status of the recorder, either PAUSED, RECORDING, or STOPPED.static int
RECORDING
Status indicating that the script recorder is currently recording.protected java.util.Vector
recordingListeners
A list of listeners who want to know about lines added to the script.protected static ProvenanceRecorder
singletonReference
The reference to the only occurrance of this class.static java.lang.String[]
statusStrings
Strings describing the various recorder statuses.static int
STOPPED
Status indicating that the script recorder is currently stopped (either never started, or recording is over).
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProvenanceRecorder()
Creates a new ProvenanceRecorder object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInputImage(java.lang.String var)
Adds an image register as an input-imagevoid
addLine(ScriptableActionInterface scriptAction)
Adds a scriptable action to an image's data provenancevoid
addLine(java.lang.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.void
addOutputImage(java.lang.String var)
ImageVariableTable
getImageTable()
Returns a reference to the image table being used to run the current script.int
getRecorderStatus()
Returns the current status of the script recorder.static ProvenanceRecorder
getReference()
Returns a reference to the provenance recorder.void
pauseRecording()
Pauses the recording of the script we are currently recording.void
resetRecorder()
Erases the current script.protected void
setRecorderStatus(int status)
Changes the current status of the script recorder and notifies any recorder listeners of the change.boolean
startRecording()
Starts the recording of a new script (if one isn't already being recorded).void
stopRecording()
Stops script recording.java.lang.String
storeImage(java.lang.String imageName)
Convenience method used to store the name of an image in the image table being recorded/used in the current script.
-
-
-
Field Detail
-
LINE_SEPARATOR
protected static final java.lang.String LINE_SEPARATOR
The line separator to use for scripts.- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
RECORDING
public static final int RECORDING
Status indicating that the script recorder is currently recording.- See Also:
- Constant Field Values
-
STOPPED
public static final int STOPPED
Status indicating that the script recorder is currently stopped (either never started, or recording is over).- See Also:
- Constant Field Values
-
statusStrings
public static final java.lang.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 java.util.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 java.util.Vector<java.lang.String> inputImages
Vector of Strings holding the registers of images used as input
-
outputImages
protected java.util.Vector<java.lang.String> outputImages
Vector of Strings holding the registers of images used as output
-
-
Method Detail
-
getReference
public static final ProvenanceRecorder getReference()
Returns a reference to the provenance recorder.- Returns:
- A reference to the provenance recorder.
-
addInputImage
public void addInputImage(java.lang.String var)
Adds an image register as an input-image- Parameters:
var
-
-
addOutputImage
public void addOutputImage(java.lang.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(java.lang.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. CallgetScript()
to get the recorded script.
-
storeImage
public java.lang.String storeImage(java.lang.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).
-
-