Package gov.nih.mipav.model.provenance
Class ProvenanceRecorder
java.lang.Object
gov.nih.mipav.model.provenance.ProvenanceRecorder
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
FieldsModifier and TypeFieldDescriptionprotected ImageVariableTableThe table containing image-placeholder-to-image-name mappings for the script we are currently recording.Vector of Strings holding the registers of images used as inputprotected static final StringThe line separator to use for scripts.Vector of Strings holding the registers of images used as outputstatic final intStatus indicating that the script recorder is currently paused.protected intThe current status of the recorder, either PAUSED, RECORDING, or STOPPED.static final intStatus indicating that the script recorder is currently recording.protected VectorA list of listeners who want to know about lines added to the script.protected static ProvenanceRecorderThe reference to the only occurrance of this class.static final String[]Strings describing the various recorder statuses.static final intStatus indicating that the script recorder is currently stopped (either never started, or recording is over). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new ProvenanceRecorder object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInputImage(String var) Adds an image register as an input-imagevoidaddLine(ScriptableActionInterface scriptAction) Adds a scriptable action to an image's data provenancevoidaddLine(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(String var) Returns a reference to the image table being used to run the current script.intReturns the current status of the script recorder.static final ProvenanceRecorderReturns a reference to the provenance recorder.voidPauses the recording of the script we are currently recording.voidErases the current script.protected voidsetRecorderStatus(int status) Changes the current status of the script recorder and notifies any recorder listeners of the change.booleanStarts the recording of a new script (if one isn't already being recorded).voidStops script recording.storeImage(String imageName) Convenience method used to store the name of an image in the image table being recorded/used in the current script.
-
Field Details
-
LINE_SEPARATOR
The line separator to use for scripts.- See Also:
-
singletonReference
The reference to the only occurrance of this class. -
PAUSED
public static final int PAUSEDStatus indicating that the script recorder is currently paused.- See Also:
-
RECORDING
public static final int RECORDINGStatus indicating that the script recorder is currently recording.- See Also:
-
STOPPED
public static final int STOPPEDStatus indicating that the script recorder is currently stopped (either never started, or recording is over).- See Also:
-
statusStrings
Strings describing the various recorder statuses. -
recorderStatus
protected int recorderStatusThe current status of the recorder, either PAUSED, RECORDING, or STOPPED. -
recordingListeners
A list of listeners who want to know about lines added to the script. -
imageTable
The table containing image-placeholder-to-image-name mappings for the script we are currently recording. -
inputImages
Vector of Strings holding the registers of images used as input -
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 bygetReference()since this is a singleton class.
-
-
Method Details
-
getReference
Returns a reference to the provenance recorder.- Returns:
- A reference to the provenance recorder.
-
addInputImage
Adds an image register as an input-image- Parameters:
var-
-
addOutputImage
-
addLine
Adds a scriptable action to an image's data provenance- Parameters:
scriptAction- script action such as changing name, changing resolutions etc
-
addLine
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
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
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).
-