# Path: MEHI/serial/preprocess.py
# @exeTime
# def flip(img_stack):
#     def func(frame):
#         return frame[:,::-1]
#     return np.array(map(func, img_stack))
# 
# Path: MEHI/serial/IO.py
# @exeTime
# def load_tiff(pwd, start_index=None, end_index=None):
#     '''
#     Usage:
#      - just read all the image under the pwd
#     '''
#     if os.path.isdir(pwd):
#         img_stack = []
#         names = []
#         for imgname in os.listdir(pwd):
#             if imgname.endswith('.tif'):
#                 names.append(imgname)
#         names = sorted(names, key = lambda x: int(filter(str.isdigit, x)))
#         if (start_index) and (end_index) and (0 <= start_index < end_index) and (start_index < end_index <= len(names)):
#             names = names[start_index:end_index]
#         for z,imgname in enumerate(names):
#             msg = "reading %d-th frame" % (z+1)
#             end = len(names)
#             bar('info')(msg, z+1, end)
#             img_pwd = os.path.join(pwd, imgname)
#             if img_pwd.endswith('.tif'):
#                 img = tiff.imread(img_pwd)
#                 img_stack.append(img)
#         return np.array(img_stack)
#     else:
#         return tiff.imread(pwd)


from MEHI.serial.registration import *
from MEHI.serial.preprocess import flip
from MEHI.serial.IO import load_tiff
from test_utils import LocalTestCase
from nose.tools import assert_equals
import numpy as np
import os
################################
# Author   : septicmk
# Date     : 2015/07/24 19:02:34
# FileName : test_registration.py
################################


L_pwd = os.path.abspath('.') + '/test_data/L_side_8/'
R_pwd = os.path.abspath('.') + '/test_data/R_side_8/'

class LocalTestRegistrationCase(LocalTestCase):
    def setUp(self):
        super(LocalTestRegistrationCase, self).setUp()
        self.L_imgs = load_tiff(L_pwd)

# Path: MEHI/serial/preprocess.py
# @exeTime
# def flip(img_stack):
#     def func(frame):
#         return frame[:,::-1]
#     return np.array(map(func, img_stack))
# 
# Path: MEHI/serial/IO.py
# @exeTime
# def load_tiff(pwd, start_index=None, end_index=None):
#     '''
#     Usage:
#      - just read all the image under the pwd
#     '''
#     if os.path.isdir(pwd):
#         img_stack = []
#         names = []
#         for imgname in os.listdir(pwd):
#             if imgname.endswith('.tif'):
#                 names.append(imgname)
#         names = sorted(names, key = lambda x: int(filter(str.isdigit, x)))
#         if (start_index) and (end_index) and (0 <= start_index < end_index) and (start_index < end_index <= len(names)):
#             names = names[start_index:end_index]
#         for z,imgname in enumerate(names):
#             msg = "reading %d-th frame" % (z+1)
#             end = len(names)
#             bar('info')(msg, z+1, end)
#             img_pwd = os.path.join(pwd, imgname)
#             if img_pwd.endswith('.tif'):
#                 img = tiff.imread(img_pwd)
#                 img_stack.append(img)
#         return np.array(img_stack)
#     else:
#         return tiff.imread(pwd)


# Path: test/test_registration.py
from MEHI.serial.registration import *
from MEHI.serial.preprocess import flip
from MEHI.serial.IO import load_tiff
from test_utils import LocalTestCase
from nose.tools import assert_equals
import numpy as np
import os

################################
# Author   : septicmk
# Date     : 2015/07/24 19:02:34
# FileName : test_registration.py
################################


L_pwd = os.path.abspath('.') + '/test_data/L_side_8/'
R_pwd = os.path.abspath('.') + '/test_data/R_side_8/'

class LocalTestRegistrationCase(LocalTestCase):
    def setUp(self):
        super(LocalTestRegistrationCase, self).setUp()
        self.L_imgs = load_tiff(L_pwd)

        self.R_imgs = load_tiff(R_pwd)