-
Notifications
You must be signed in to change notification settings - Fork 0
Customisation
miresearch makes use of configuration (*.conf) files for customisation.
One can use multiple conf files and may even pass a conf file as a commandline argument for "codefree" manipulation.
miresearch looks for conf files at:
os.path.join(rootDir,'miresearch.conf'), # this is the default 'miresearch.conf' included at installation
os.path.join(os.path.expanduser("~"),'miresearch.conf'),
os.path.join(os.path.expanduser("~"),'.'+'miresearch.conf'),
os.path.join(os.path.expanduser("~"), '.config','miresearch.conf'),
os.environ.get("MIRESEARCH_CONF", '')The default 'miresearch.conf' file looks like this:
[DEFAULT]
debug=False
data_root_dir=
subject_prefix =
# Choose: HARD, SOFT, NONE
anon_level = NONE
class_path =
stable_directory_age_sec=60
directories = [["RAW", "DICOM"], "META"]
[app]
# Override DEFAULT parameters here
[parameters]
# Add application specific parameters hereImportant features to take note of:
-
class_path Can point to a custom class that subclasses mi_subject.AbstractSubject
- this should be formed like this: my_module.mySubClass
- my_module is a my_module.py file found in your PYTHONPATH
- mySubClass is the custom class, found in the my_module.py file, which subclasses mi_subject.AbstractSubject
- this should be formed like this: my_module.mySubClass
- Anything under parameters will be save to a dictionary for use within your mySubClass
- To use:
- add the following import statement to your my_module.py file:
- from miresearch.mi_config import MIResearch_config
- add your variables to one of the 'miresearch.conf' files listed above (or to a .conf file you pass in as a commandline option) see custom conf file below
- access your variables:
MIResearch_config.parameters[extra_data_path]- NOTE the MIResearch_config.parameters dictionary will also contain all default parameters and their default values.
- add the following import statement to your my_module.py file:
- To use:
A basic, yet complete, example customisation is seen below with a custom subclass and a custom conf file.
In addition a linux systemd service file is included systemd service for miresearch.
Note: not only does the custom subclass override methods from the mi_subject.AbstractSubject parent class, it also adds additional options to the commandline interface provided by mirsearch.
Following is a custom subclass of mi_subject.AbstractSubject . Full functionality is not filled out but basic potential is described.
[parameters]
storage_path = /path/to/storage/
extra_data_path = /path/to/data/