Package gov.nih.mipav.model.provenance
Class ProvenanceRecorder
- java.lang.Object
-
- gov.nih.mipav.model.provenance.ProvenanceRecorder
-
public class ProvenanceRecorder extends java.lang.ObjectSingleton 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 ImageVariableTableimageTableThe table containing image-placeholder-to-image-name mappings for the script we are currently recording.protected java.util.Vector<java.lang.String>inputImagesVector of Strings holding the registers of images used as inputprotected static java.lang.StringLINE_SEPARATORThe line separator to use for scripts.protected java.util.Vector<java.lang.String>outputImagesVector of Strings holding the registers of images used as outputstatic intPAUSEDStatus indicating that the script recorder is currently paused.protected intrecorderStatusThe current status of the recorder, either PAUSED, RECORDING, or STOPPED.static intRECORDINGStatus indicating that the script recorder is currently recording.protected java.util.VectorrecordingListenersA list of listeners who want to know about lines added to the script.protected static ProvenanceRecordersingletonReferenceThe reference to the only occurrance of this class.static java.lang.String[]statusStringsStrings describing the various recorder statuses.static intSTOPPEDStatus indicating that the script recorder is currently stopped (either never started, or recording is over).
-
Constructor Summary
Constructors Modifier Constructor Description protectedProvenanceRecorder()Creates a new ProvenanceRecorder object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInputImage(java.lang.String var)Adds an image register as an input-imagevoidaddLine(ScriptableActionInterface scriptAction)Adds a scriptable action to an image's data provenancevoidaddLine(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.voidaddOutputImage(java.lang.String var)ImageVariableTablegetImageTable()Returns a reference to the image table being used to run the current script.intgetRecorderStatus()Returns the current status of the script recorder.static ProvenanceRecordergetReference()Returns a reference to the provenance recorder.voidpauseRecording()Pauses the recording of the script we are currently recording.voidresetRecorder()Erases the current script.protected voidsetRecorderStatus(int status)Changes the current status of the script recorder and notifies any recorder listeners of the change.booleanstartRecording()Starts the recording of a new script (if one isn't already being recorded).voidstopRecording()Stops script recording.java.lang.StringstoreImage(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
nullif 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:
Trueif recording was started successfully,falseotherwise.
-
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).
-
-