Source code for Channel
# CellTracking.py
# By MW, Jun 2013
# GPLv3+
#
# Class representing a channel
import imp, logging
[docs]class Channel :
def __init__(self, name=None) :
Loader = imp.load_source("Loader", './bin/Movies/Loader/Loader.py') # Loading the Loader
self.Loader = Loader.Loader()
self.name = name
[docs] def set_name(self, name) :
self.name = name
[docs] def get_name(self) :
return self.name
[docs] def get_frame_nb(self) :
return self.Loader.get_frame_nb()
[docs] def get_frame(self, index, rgb=True) :
"""Returns a frame as an OpenCV object given its index in the list"""
return self.Loader.get_frame(index, rgb)
[docs] def get_size(self) :
return self.Loader.get_size()
[docs] def get_save_dict(self) :
dic = {}
n = {'descr' : 'name of the channel', 'value' : self.get_name()}
l = {'descr' : 'loader object of the channel', 'value' : self.Loader.get_save_dict()}
dic['name'] = n
dic['loader'] = l
return {'descr' : 'Channel object', 'value' : dic}
[docs] def load_save_dict(self, dic) :
n = dic['value']['name']['value']
l = dic['value']['loader']
self.set_name(n)
self.Loader.load_save_dict(l)