# Path: lib/replay_memory.py
# class ReplayMemory(object):
#     def __init__(self, filepath, max_size, max_size_tolerance):
#     def create_instance_supervised(val=False):
#     def create_instance_reinforced(val=False):
#     def create_instance_by_config(cfg_name):
#     def add_states(self, states, shrink=True):
#     def add_state(self, state, commit=True, shrink=True):
#     def update_state(self, idx, state, commit=True):
#     def get_state_by_id(self, idx):
#     def get_states_by_ids(self, ids):
#     def get_random_states(self, count):
#     def get_states_range(self, pos_start, length):
#     def get_random_state_chain(self, length, from_pos_range=None):
#     def get_random_state_chain_timediff(self, length, max_timediff_ms=500, depth=50):
#     def update_caches(self):
#     def is_above_tolerance(self):
#     def shrink_to_max_size(self, force=False):
#     def commit(self):
#     def close(self):
#     def connect(self):
# 
# Path: lib/util.py
# def template_match(needle, haystack):
# def compress_to_jpg(img):
# def compress_img(img, method):
# def decompress_img(img_compressed):
# def draw_image(img, other_img, x, y, copy=True, raise_if_oob=False):
# def draw_point(img, y, x, size=5, color=[255, 0, 0], alpha=1.0, copy=True):
# def draw_line(img, y1, x1, y2, x2, color=[0, 255, 0], alpha=1.0, thickness=1, clip_result=True, copy=True):
# def draw_direction_circle(img, y, x, r_inner, r_outer, angle_start, angle_end, color_border=[0, 255, 0], color_fill=[0, 200, 0], alpha=1.0):
# def draw_text(img, y, x, text, color=[0, 255, 0], size=25):
# def to_variable(inputs, volatile=False, requires_grad=True):
# def to_variables(inputs, volatile=False, requires_grad=True):
# def to_cuda(inputs, gpu=Config.GPU):
# def to_numpy(var):
# def draw_heatmap_overlay(img, heatmap, alpha=0.5):
# def create_2d_gaussian_old(size, fwhm=3, center=None):
# def create_2d_gaussian(size, sigma):
# FONT_CACHE = dict()


import sys
import os
import Tkinter
import numpy as np
import cPickle as pickle
import time
import imgaug as ia
from lib import replay_memory
from lib import util
from PIL import Image, ImageTk

"""
class OnToggleEraser(object):
    def __init__(self, window_state):
        self.window_state = window_state

    def __call__(self, event):
        self.window_state.toggle_eraser(save=True)

class OnPreviousState(object):
    def __init__(self, window_state):
        self.window_state = window_state

    def __call__(self, event):
        self.window_state.previous_state()

class OnNextState(object):
    def __init__(self, window_state):
        self.window_state = window_state

    def __call__(self, event):
        self.window_state.next_state()
"""

def draw_normal_distribution(height, width, x, y, size):
    if 0 <= y < height and 0 <= x < width:
        pad_by = size * 10
        img = np.zeros((pad_by+height+pad_by, pad_by+width+pad_by), dtype=np.float32)
        #img = img.pad(img, ((20, 20), (20, 20)))
        #normal = util.create_2d_gaussian(size=size*2, fwhm=size)

# Path: lib/replay_memory.py
# class ReplayMemory(object):
#     def __init__(self, filepath, max_size, max_size_tolerance):
#     def create_instance_supervised(val=False):
#     def create_instance_reinforced(val=False):
#     def create_instance_by_config(cfg_name):
#     def add_states(self, states, shrink=True):
#     def add_state(self, state, commit=True, shrink=True):
#     def update_state(self, idx, state, commit=True):
#     def get_state_by_id(self, idx):
#     def get_states_by_ids(self, ids):
#     def get_random_states(self, count):
#     def get_states_range(self, pos_start, length):
#     def get_random_state_chain(self, length, from_pos_range=None):
#     def get_random_state_chain_timediff(self, length, max_timediff_ms=500, depth=50):
#     def update_caches(self):
#     def is_above_tolerance(self):
#     def shrink_to_max_size(self, force=False):
#     def commit(self):
#     def close(self):
#     def connect(self):
# 
# Path: lib/util.py
# def template_match(needle, haystack):
# def compress_to_jpg(img):
# def compress_img(img, method):
# def decompress_img(img_compressed):
# def draw_image(img, other_img, x, y, copy=True, raise_if_oob=False):
# def draw_point(img, y, x, size=5, color=[255, 0, 0], alpha=1.0, copy=True):
# def draw_line(img, y1, x1, y2, x2, color=[0, 255, 0], alpha=1.0, thickness=1, clip_result=True, copy=True):
# def draw_direction_circle(img, y, x, r_inner, r_outer, angle_start, angle_end, color_border=[0, 255, 0], color_fill=[0, 200, 0], alpha=1.0):
# def draw_text(img, y, x, text, color=[0, 255, 0], size=25):
# def to_variable(inputs, volatile=False, requires_grad=True):
# def to_variables(inputs, volatile=False, requires_grad=True):
# def to_cuda(inputs, gpu=Config.GPU):
# def to_numpy(var):
# def draw_heatmap_overlay(img, heatmap, alpha=0.5):
# def create_2d_gaussian_old(size, fwhm=3, center=None):
# def create_2d_gaussian(size, sigma):
# FONT_CACHE = dict()


# Path: annotate/annotate_street_boundaries.py
import sys
import os
import Tkinter
import numpy as np
import cPickle as pickle
import time
import imgaug as ia
from lib import replay_memory
from lib import util
from PIL import Image, ImageTk


"""
class OnToggleEraser(object):
    def __init__(self, window_state):
        self.window_state = window_state

    def __call__(self, event):
        self.window_state.toggle_eraser(save=True)

class OnPreviousState(object):
    def __init__(self, window_state):
        self.window_state = window_state

    def __call__(self, event):
        self.window_state.previous_state()

class OnNextState(object):
    def __init__(self, window_state):
        self.window_state = window_state

    def __call__(self, event):
        self.window_state.next_state()
"""

def draw_normal_distribution(height, width, x, y, size):
    if 0 <= y < height and 0 <= x < width:
        pad_by = size * 10
        img = np.zeros((pad_by+height+pad_by, pad_by+width+pad_by), dtype=np.float32)
        #img = img.pad(img, ((20, 20), (20, 20)))
        #normal = util.create_2d_gaussian(size=size*2, fwhm=size)

        normal = util.create_2d_gaussian(size=size*4, sigma=size)