# Path: timestream/manipulate/pipecomponents.py
# LOG = logging.getLogger("timestreamlib")
#             TLC = self.backgroundWindow[0:2]
#             BRC = self.backgroundWindow[2:]
#             W = 2.0*np.tan(self.fieldOfView[0]/2.0/180.0*np.pi)
#             H = 2.0*np.tan(self.fieldOfView[1]/2.0/180.0*np.pi)
#             H, T = os.path.split(fpath)
# class PipeComponent (object):
# class ImageMarginAdder(PipeComponent):
# class ImageUndistorter (PipeComponent):
# class ColorCardDetector (PipeComponent):
# class ImageColorCorrector (PipeComponent):
# class TrayDetector (PipeComponent):
# class PotDetector (PipeComponent):
# class PotDetectorGlassHouse (PipeComponent):
# class PlantExtractor (PipeComponent):
# class FeatureExtractor (PipeComponent):
# class ResultingFeatureWriter(PipeComponent):
# class ResultingImageWriter (PipeComponent):
# class ResizeImage (PipeComponent):
# class DerandomizeTimeStreams (PipeComponent):
# class ResizeAndWriteImage (PipeComponent):
#     def __init__(self, *args, **kwargs):
#     def __call__(self, context, *args):
#     def __chkExcept__(self, context, *args):
#     def __exec__(self, context, *args):
#     def info(cls, _str=True):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def padlocal(self, vector, pad_width, iaxis, kwargs):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __call__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def segAllPots(self):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def __chkExcept__(self, context, *args):
#     def _guessTimeStamp(self, img):
#     def _addErrStr(self, timestamp, filename):
#     def _recoverFromPrev(self, timestamp, featName):
#     def _initHeaders(self, fPath, ipm, potIds):
#     def _initPrevCsvIndex(self):
#     def _appendToAudit(self, ts, val):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def createCompoundImage(self, timestamp):
#     def getMidGrpImg(self, mid, potList, maxPotRect, numPotPerMidSize):
#     def refreshMids(self, timestamp=None):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):


import csv
import glob
import docopt
import sys, os
import timestream
import logging
import timestream.manipulate.configuration as pipeconf
import timestream.manipulate.pipeline as pipeline
import yaml
import datetime
from timestream.manipulate.pipecomponents import PCExBrakeInPipeline
from __future__ import absolute_import, division, print_function


#def getColumnCVS(FileCVS, columnID):
#    if len(FileCVS) == 0:
#        print('File name is empty')
#        return []
#    column = []
#    with open(FileCVS, 'rb') as csvfile:
#        fp = csv.reader(csvfile, delimiter=',')
#        for i,row in enumerate(fp):
#            if i == 0: # header
#                print(', '.join(row))
#            else:
#                column.append(row[columnID])
#    return column

#PlantListCSV = '/home/chuong/Data/phenocam/a_data/TimeStreams/Borevitz/BVZ0038/_data/BVZ0038-WheatDroughtTrial-Labels.csv'
#ExpFolder = '/home/chuong/Data/phenocam/a_data/TimeStreams/Borevitz/BVZ0038/_data/BVZ0038-PlantTS'
##ExpFolder = '/home/chuong/Data/BVZ0038-PlantTS'
#plantList = getColumnCVS(PlantListCSV, 2)
#print(plantList)
#
#TSFolderList = glob.glob(os.path.join(ExpFolder, '*'))
#for TSFolder in TSFolderList:
#    print(TSFolder)
#    ts =
#    break

CLI_OPTS = """

# Path: timestream/manipulate/pipecomponents.py
# LOG = logging.getLogger("timestreamlib")
#             TLC = self.backgroundWindow[0:2]
#             BRC = self.backgroundWindow[2:]
#             W = 2.0*np.tan(self.fieldOfView[0]/2.0/180.0*np.pi)
#             H = 2.0*np.tan(self.fieldOfView[1]/2.0/180.0*np.pi)
#             H, T = os.path.split(fpath)
# class PipeComponent (object):
# class ImageMarginAdder(PipeComponent):
# class ImageUndistorter (PipeComponent):
# class ColorCardDetector (PipeComponent):
# class ImageColorCorrector (PipeComponent):
# class TrayDetector (PipeComponent):
# class PotDetector (PipeComponent):
# class PotDetectorGlassHouse (PipeComponent):
# class PlantExtractor (PipeComponent):
# class FeatureExtractor (PipeComponent):
# class ResultingFeatureWriter(PipeComponent):
# class ResultingImageWriter (PipeComponent):
# class ResizeImage (PipeComponent):
# class DerandomizeTimeStreams (PipeComponent):
# class ResizeAndWriteImage (PipeComponent):
#     def __init__(self, *args, **kwargs):
#     def __call__(self, context, *args):
#     def __chkExcept__(self, context, *args):
#     def __exec__(self, context, *args):
#     def info(cls, _str=True):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def padlocal(self, vector, pad_width, iaxis, kwargs):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __call__(self, context, *args):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def segAllPots(self):
#     def show(self):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def __chkExcept__(self, context, *args):
#     def _guessTimeStamp(self, img):
#     def _addErrStr(self, timestamp, filename):
#     def _recoverFromPrev(self, timestamp, featName):
#     def _initHeaders(self, fPath, ipm, potIds):
#     def _initPrevCsvIndex(self):
#     def _appendToAudit(self, ts, val):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def createCompoundImage(self, timestamp):
#     def getMidGrpImg(self, mid, potList, maxPotRect, numPotPerMidSize):
#     def refreshMids(self, timestamp=None):
#     def __init__(self, context, **kwargs):
#     def __exec__(self, context, *args):
#     def show(self):


# Path: scripts/tscli/pipelineGlasshouse.py
import csv
import glob
import docopt
import sys, os
import timestream
import logging
import timestream.manipulate.configuration as pipeconf
import timestream.manipulate.pipeline as pipeline
import yaml
import datetime
from timestream.manipulate.pipecomponents import PCExBrakeInPipeline

from __future__ import absolute_import, division, print_function


#def getColumnCVS(FileCVS, columnID):
#    if len(FileCVS) == 0:
#        print('File name is empty')
#        return []
#    column = []
#    with open(FileCVS, 'rb') as csvfile:
#        fp = csv.reader(csvfile, delimiter=',')
#        for i,row in enumerate(fp):
#            if i == 0: # header
#                print(', '.join(row))
#            else:
#                column.append(row[columnID])
#    return column

#PlantListCSV = '/home/chuong/Data/phenocam/a_data/TimeStreams/Borevitz/BVZ0038/_data/BVZ0038-WheatDroughtTrial-Labels.csv'
#ExpFolder = '/home/chuong/Data/phenocam/a_data/TimeStreams/Borevitz/BVZ0038/_data/BVZ0038-PlantTS'
##ExpFolder = '/home/chuong/Data/BVZ0038-PlantTS'
#plantList = getColumnCVS(PlantListCSV, 2)
#print(plantList)
#
#TSFolderList = glob.glob(os.path.join(ExpFolder, '*'))
#for TSFolder in TSFolderList:
#    print(TSFolder)
#    ts =
#    break

CLI_OPTS = """

USAGE: