# Path: sktracker/utils/progress.py
# def print_progress(progress, message=None, out=None):
#     """Display a progress bar filled with a variable value. print_progress
#     also works under IPython notebook.
# 
#     Set `progress` to -1 to remove the progress bar.
# 
#     Parameters
#     ----------
#     progress: int
#         Variable value use to fill the progress bar. Should be between 0
#         and 100.
#     out: OutStream
#         Where to stream progress bar. None will redirect output to `sys.stdout`.
# 
#     Returns
#     -------
#     None. Display the progress bar.
# 
#     Examples
#     --------
#     >>> import time
#     >>> from sktracker.utils import print_progress
# 
#     >>> n = 5
#     >>> for i in range(n):
#     >>>     time.sleep(1)
# 
#     >>>     print_progress((i + 1) * 100 / n)
#     100% [=================================================>]
#     >>> print_progress(-1)
# 
#     """
# 
#     if out is None:
#         out = sys.stdout
# 
#     # If process is finished
#     if progress == -1:
#         out.write("\r" + " " * 80 + "\r\r")
#         out.flush()
#         return
# 
#     # Size of the progress bar
#     size = 50
# 
#     # Compute current progress
#     progress_bar = (progress) * size / 100
# 
#     # Build progress bar
#     bar = "["
#     for i in range(int(progress_bar - 1)):
#         bar += "="
#     bar += ">"
#     for i in range(int(size - progress_bar)):
#         bar += " "
#     bar += "]"
# 
#     if message:
#         bar = " ".join([bar, message])
# 
#     # Write progress bar
#     bar_str = "\r%d%% " % (progress) + bar
#     out.write(bar_str)
#     out.flush()


import logging
import pandas as pd
import numpy as np
from scipy import integrate
from skimage.filters import threshold_otsu
from skimage.measure import regionprops
from skimage.segmentation import clear_border
from skimage.morphology import binary_closing
from skimage.morphology import square
from skimage.morphology import medial_axis
from skimage.morphology import label
from ..utils.progress import print_progress
                tophat = binary_closing(mask, square(n))
                n += 1
                skel = medial_axis(tophat)
                skel = (skel - 1) * (-1)
                cleared = clear_border(skel)
                labelized = label(cleared, 8, 0) + 1

                # add cell characteristic in the cellprop list
                if np.any(labelized):
                    prevcellprop = regionprops(
                        labelized, intensity_image=corr)[0]

                prevarea = area
                if prevcellprop:
                    area = prevcellprop['area']

            if prevcellprop:
                cellprop.append(prevcellprop)

            else:
                if len(cellprop) >= 1:
                    cellprop.append(cellprop[-1])
                else:
                    cellprop.append(None)
        else:
                if len(cellprop) >= 1:
                    cellprop.append(cellprop[-1])
                else:
                    cellprop.append(None)


# Path: sktracker/utils/progress.py
# def print_progress(progress, message=None, out=None):
#     """Display a progress bar filled with a variable value. print_progress
#     also works under IPython notebook.
# 
#     Set `progress` to -1 to remove the progress bar.
# 
#     Parameters
#     ----------
#     progress: int
#         Variable value use to fill the progress bar. Should be between 0
#         and 100.
#     out: OutStream
#         Where to stream progress bar. None will redirect output to `sys.stdout`.
# 
#     Returns
#     -------
#     None. Display the progress bar.
# 
#     Examples
#     --------
#     >>> import time
#     >>> from sktracker.utils import print_progress
# 
#     >>> n = 5
#     >>> for i in range(n):
#     >>>     time.sleep(1)
# 
#     >>>     print_progress((i + 1) * 100 / n)
#     100% [=================================================>]
#     >>> print_progress(-1)
# 
#     """
# 
#     if out is None:
#         out = sys.stdout
# 
#     # If process is finished
#     if progress == -1:
#         out.write("\r" + " " * 80 + "\r\r")
#         out.flush()
#         return
# 
#     # Size of the progress bar
#     size = 50
# 
#     # Compute current progress
#     progress_bar = (progress) * size / 100
# 
#     # Build progress bar
#     bar = "["
#     for i in range(int(progress_bar - 1)):
#         bar += "="
#     bar += ">"
#     for i in range(int(size - progress_bar)):
#         bar += " "
#     bar += "]"
# 
#     if message:
#         bar = " ".join([bar, message])
# 
#     # Write progress bar
#     bar_str = "\r%d%% " % (progress) + bar
#     out.write(bar_str)
#     out.flush()


# Path: sktracker/detection/cell_boundaries_detector.py
import logging
import pandas as pd
import numpy as np
from scipy import integrate
from skimage.filters import threshold_otsu
from skimage.measure import regionprops
from skimage.segmentation import clear_border
from skimage.morphology import binary_closing
from skimage.morphology import square
from skimage.morphology import medial_axis
from skimage.morphology import label
from ..utils.progress import print_progress

                tophat = binary_closing(mask, square(n))
                n += 1
                skel = medial_axis(tophat)
                skel = (skel - 1) * (-1)
                cleared = clear_border(skel)
                labelized = label(cleared, 8, 0) + 1

                # add cell characteristic in the cellprop list
                if np.any(labelized):
                    prevcellprop = regionprops(
                        labelized, intensity_image=corr)[0]

                prevarea = area
                if prevcellprop:
                    area = prevcellprop['area']

            if prevcellprop:
                cellprop.append(prevcellprop)

            else:
                if len(cellprop) >= 1:
                    cellprop.append(cellprop[-1])
                else:
                    cellprop.append(None)
        else:
                if len(cellprop) >= 1:
                    cellprop.append(cellprop[-1])
                else:
                    cellprop.append(None)


    print_progress(-1)