(io): use Preferences and Series data to automate the output of SFrameWriter, SVideoWriter and SMatrixWriter
Description
- Add auto/ask mode to SFrameWriter, SVideoWriter, SMatrixWriter
Functional specifications
- Add a new configuration tag to either:
- ask for a dialog to be opened to get the recording directory (current behavior)
- automatically set a directory to a safe default or a xml pre-defined path + timestamp
- Set a base path, via the preferences
Technical specifications
v1
New config tagoutputMode
set to eitherprompt
orauto
Ifprompt
is selected, the current behavior is maintained-
Ifauto
is selected, the output files will be saved without user queriesIf the additional tagoutputPrefix
is set, content will be saved in<outputPrefix>/<YYYYMMDD_HHMMSS>
If it is not set, data will be saved in the same path as the launched executable in the following subdirectory:<bin_directory>/<app_name>/<YYYYMMDD_HHMMSS>
Time precision is set up to the second to make sure folders don't collide
v2
-
a path is set in the config, you use it (either a preference key or a real path).-
if this is a preference:you prompt for the path when the preference is not set and then you store ityou propose a button in the UI to change the path anytime
-
a path is not set in the config, you prompt for it every time. If the user cancels, you refuse to write anything.
v3
- Create an ID generation service, taking as inout a Series object, and doing the following in the update method
- If the Series contains data, do nothing, but sending an updated signal
- If the Series is empty, write a timestamp somewhere, then send an updated signal
- Add an optional Series to SFrameWriter, SVideoWriter, SMatrixWriter
- Update the previous services:
- a root write path is set in the config, you use it (either a preference key or a real path).
- if this is a preference:
- you prompt for the path when the preference is not set and then you store it
- you propose a button in the UI to change the path anytime
- a path is not set in the config, you prompt for it every time. If the user cancels, you refuse to write anything.
- if this is a preference:
- If the optional series is empty or not present, directly write to the root path previously mentioned
- If the optional series is filled, write to the root path + concatenate relevant information to the path (timestamp, patient)
- a root write path is set in the config, you use it (either a preference key or a real path).
- USRecorder Signal/slot flow (for each writer a different GenID service must be used):
- UI button -> GenID/update
- GenID/updated -> /update
v4
- Do not consider the patient data for now, this will be managed by the appropriate DICOM writer (TBD, will use the Series)
-
For the timestamp:
- Generalize the "timestamp" feature in
IWriter
with a prefix - Use it in other modes (folder/files). So to sum up:
- For "File"
<prefix>/<filename>
- For "Files"
<prefix>/<filename>
- For "Folder"
<prefix>/<folder>
- For "File"
- Use
STimestampSlotCaller
to set the suffix and synchronize the writers-
STimestampSlotCaller
emits acore::HiResClock::HiResClockType
but we want astd::string
- Either modify
STimestampSlotCaller
(configuration might be complicated) - Or create a new service that sends a signal with a
std::string
. If we add a second signal that sends acore::HiResClock::HiResClockType
, this service could replaceSTimestampSlotCaller
(based on SSignal)
- Either modify
-
- Generalize the "timestamp" feature in
-
For the base folder:
- Use the preference system
- Add support to set a preference key in the configured path :
path="%BASE_DIR%/{folder,filename}"
- Automatic GUI prompt if the key does not exist to be coded in
SPreferencesConfiguration
- Automatic GUI prompt if the key does not exist to be coded in
Test plan
- Test both modes in existing applications