run_pipelines_windows.py 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from view.python_core.processing_pipelines import PipelineManager
  2. # this tells view all settings including the folder structure of your project
  3. # On Windows, if you copy paths from the file explorer, make sure the string below is always of the form r"......"
  4. ymlfile = r"E:\MR_Till\usage_till_windows.yml"
  5. # specify the pipeline definition file to use
  6. pipelines_definition_file = r"E:\MR_Till\progs\pipelines_settings\processing_pipelines.yml"
  7. # specify the animals whose data is to be processed; and their corresponding pipelines
  8. animals = {
  9. # "<animal name>": ['pipeline1', 'pipeline2', 'pipeline3'],
  10. "MR_190510b_or47a": ['pipeline1', 'pipeline2'],
  11. }
  12. # ----------------------------------------------------------------------------------------------------------------------
  13. # visualization flags
  14. # These flags control some aspects of the graphs and plots of evaluation reports
  15. # -----------------------------------------------------------------------------------------------------------------------
  16. # Specifies a threshold that is used when creating and drawing contours of detected components
  17. # from their spatial footprints. Footprints are normalized by dividing by their maximum before being thresholded.
  18. # NOTE: Since this flag is also used when overlaying ROI information in TIF on overviews and movies,
  19. # please set for consistency the flag "RM_ROIThreshold" in your project YML file.
  20. roi_threshold = 0.75 # a float value between 0 and 1, like 0.75
  21. # A maximum-correlation summary image is created from the data and used as the background for showing
  22. # detected components. Maximum-correlation summary image is created by binning frames into non-overlapping bins, and the
  23. # size of these bins are controlled by this flag
  24. frame_bin_size = 200 # an integer value, like 200
  25. # ----------------------------------------------------------------------------------------------------------------------
  26. # required on windows when code spawns subprocesses
  27. # https://stackoverflow.com/questions/18204782/runtimeerror-on-windows-trying-python-multiprocessing
  28. if __name__ == '__main__':
  29. for animal, pipelines in animals.items():
  30. visualization_flags = {
  31. "roi_threshold": roi_threshold,
  32. "frame_bin_size": frame_bin_size
  33. }
  34. pipline_manager = PipelineManager(
  35. project_yml_file=ymlfile, animal=animal, pipelines_config_file=pipelines_definition_file,
  36. pipeline_names=pipelines, visualization_flags=visualization_flags)
  37. pipline_manager.run_all_pipelines(analyse_value_to_use=(1,))