Beispiel #1
0
 def __init__(self, name, points):
     self.name = name
     self.points = copy.deepcopy(points)
     self.keypoint = Bd.plane(self.points, self.name)
     self.boundary, self.step = Bd.boundary(self.points, self.keypoint, 5)
     self.line = []
     self.segments = []
def intensity_process(embryo_list, active_area_list, mode='pca'):
    
    n_samples = embryo_list.shape[0]
    if n_samples != len(active_area_list):
        print("Error: length mismatch")
        return
    
    intensity_curves =[]
    
    for i in range(n_samples):
        embryos = embryo_list[i,:]
        active_area = active_area_list[i]
        
        #print(i)
        curves = []
        for egg in embryos:
            print(egg.gene_name, egg.gene_position)
            bd = Boundary(egg)
            bd.detect_head_tail(mode)
            
            curves.append( Intensity.detect_intensity(egg, 
                                                       boundary=bd,
                                                       testing_area = active_area,
                                                       horizontal_flag = True,
                                                       bd_mode='pca')
                                    )
        
        intensity_curves.append(curves)
    
    return np.array(intensity_curves)
Beispiel #3
0
    def __init__(self, filename):
        points = RD.obj_vertices(filename)
        normals = RD.obj_normals(filename)
        self.pwns = [points[i] + normals[i] for i in range(len(points))]
        sorted_pwns = Lc.locate(self.pwns)
        self.plates = []
        for key in sorted_pwns:
            self.plates.append(Plate.plate(key, sorted_pwns[key]))

        self.intersect_matrix = np.matrix([[0, 0, 1], [0, 0, 1], [1, 1, 0]])
        n = 10
        self.inter_segments = []
        self.inter_segment_markers = []
        for i in range(len(self.plates)):
            for j in range(i + 1, len(self.plates)):
                if self.intersect_matrix[i, j] == 1:
                    segment = Bd.intersect_of_plate(self.plates[j],
                                                    self.plates[i])
                    Bd.sub_segment(segment, n)
                    self.inter_segments.append(segment)
                    self.plates[i].add_segment(segment)
                    self.plates[j].add_segment(segment)
                    self.inter_segment_markers.append(
                        [[i, len(self.plates[i].segments) - 1],
                         [j, len(self.plates[j].segments) - 1]])
Beispiel #4
0
 def view_inclination(self, bd_mode='curvature', boundary=None):
     if (boundary is None):
         bd = Boundary(self.ref_image)
         bd.detect_head_tail(bd_mode)
     else:
         bd = boundary
     return -bd.get_orientation(bd.mode)
Beispiel #5
0
def _main_():
    #pygame stuff
    h, w = 550, 550
    border = 50
    pygame.init()
    screen = pygame.display.set_mode((w + (2 * border), h + (2 * border)))
    pygame.display.set_caption("2D Raytracing")
    done = False
    clock = pygame.time.Clock()

    i = Image.new("RGB", (500, 500), (0, 0, 0))
    px = np.array(i)

    #reference image for background color
    im_file = Image.open("fondo.png")
    ref = np.array(im_file)

    #light positions
    #sources = [ Point(195, 200), Point( 294, 200) ]

    #light color
    light = np.array([1, 1, 0.75])

    while not done:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                done = True
        for i in range(500):
            for j in range(500):
                if (i > 250):
                    px[i][j] = ref[j][i][:3] * 3
                else:
                    px[i][j] = ref[j][i][:3]
                    px[i][j][0] = px[i][j][0] * 1
                    px[i][j][1] = px[i][j][1] * 1
                    px[i][j][2] = px[i][j][2] * 0.1

        # Clear screen to white before drawing
        screen.fill((255, 255, 255))

        # Get a numpy array to display from the simulation
        npimage = (px)

        # Convert to a surface and splat onto screen offset by border width and height
        surface = pygame.surfarray.make_surface(npimage)
        b = Boundary(195, 200, 294, 200)
        b.draw(surface)
        screen.blit(surface, (border, border))

        pygame.display.flip()

        clock.tick(60)
def active_area_process(embryo_list, mode='pca'):
    active_area_list=[]
    
    for egg in embryo_list:
        poly = Polygon(egg)
        bd = Boundary(egg)
        bd.detect_head_tail(mode)
        poly.detect_area(boundary=bd)
        #poly.view_area()
        
        active_area_list.append(poly)
        
    return np.array(active_area_list)
 def testName(self):
     boundaryGeometries = []
     with arcpy.da.SearchCursor(self._inputBoundary, "SHAPE@") as Cursor:
         for row in Cursor:
             boundaryGeometries.append(row[0])
             
     self._adjustPoints["InsideBoundary"].add(arcpy.Point(464373.99, 4199785.49))
     self._adjustPoints["InsideBoundary"].add(arcpy.Point(464367.32, 4197182.6)) 
        
     testBoundary = Boundary(self._adjustPoints["InsideBoundary"], boundaryGeometries[0])
     actualBndStartAndEnd = testBoundary._findStartAndEndIndex()
     actualStartIndex = actualBndStartAndEnd[0]
     actualEndIndex= actualBndStartAndEnd[1]
     print actualStartIndex
     print actualEndIndex
        
     self.assertTrue(actualStartIndex == 9 and actualEndIndex == 13, "Compare index to data")
Beispiel #8
0
def plot_classifier_examples():
    new_versicolor_xs = []
    new_versicolor_ys = []
    new_virginica_xs = []
    new_virginica_ys = []
    example_xs = iris.versicolor_xs[:3] + iris.virginica_xs[:3]
    example_ys = iris.versicolor_ys[:3] + iris.virginica_ys[:3]
    for i in range(len(example_xs)):
        if boundary.classify(example_xs[i], example_ys[i], boundary.linear_decision_boundary)\
                == iris.Classification.VERSICOLOR:
            new_versicolor_xs.append(example_xs[i])
            new_versicolor_ys.append(example_ys[i])
        else:
            new_virginica_xs.append(example_xs[i])
            new_virginica_ys.append(example_ys[i])
    pyplot.scatter(new_versicolor_xs, new_versicolor_ys, label='Versicolor')
    pyplot.scatter(new_virginica_xs, new_virginica_ys, label='Virginica')
    boundary.plot_linear_decision_boundary(boundary.linear_decision_boundary,
                                           pyplot)
Beispiel #9
0
 def mesh(self):
     self.mesh = Mesh.mesh(self)
     self.segment_nums = [[] for i in range(len(self.segments))]
     for i in range(len(self.segments)):
         for j in range(len(self.segments[i])):
             for k in range(len(self.mesh['vertices'])):
                 if Bd.P2P(self.segments[i][j], self.mesh['vertices'][k]) < 1e-5:
                     self.segment_nums[i].append(k)
                     break
     '''
Beispiel #10
0
def plot_radial_classification_at_center(centerx, centery, subplot):
    input_xs = iris.versicolor_xs
    input_ys = iris.versicolor_ys
    correct_xs, correct_ys, incorrect_xs, incorrect_ys = graph_radial_classification_class_at_center(
        centerx, centery, input_xs, input_ys, iris.Classification.VERSICOLOR)
    subplot.scatter(correct_xs, correct_ys, label='Versicolor', color='blue')
    subplot.scatter(incorrect_xs,
                    incorrect_ys,
                    label='Versicolor (erroneous)',
                    color='green')
    input_xs = iris.virginica_xs
    input_ys = iris.virginica_ys
    correct_xs, correct_ys, incorrect_xs, incorrect_ys = graph_radial_classification_class_at_center(
        centerx, centery, input_xs, input_ys, iris.Classification.VIRGINICA)
    subplot.scatter(correct_xs, correct_ys, label='Virginica', color='orange')
    subplot.scatter(incorrect_xs,
                    incorrect_ys,
                    label='Virginica (erroneous)',
                    color='red')
    boundary.plot_circle_boundary(centerx, centery, subplot)
Beispiel #11
0
def graph_radial_classification_class_at_center(centerx, centery, input_xs,
                                                input_ys, correct_class):
    correct_xs = []
    correct_ys = []
    incorrect_xs = []
    incorrect_ys = []
    for i in range(len(input_xs)):
        if boundary.radially_classify(input_xs[i], input_ys[i], centerx,
                                      centery) == correct_class:
            correct_xs.append(input_xs[i])
            correct_ys.append(input_ys[i])
        else:
            incorrect_xs.append(input_xs[i])
            incorrect_ys.append(input_ys[i])

    return correct_xs, correct_ys, incorrect_xs, incorrect_ys
import sys
sys.path.append('../lib/BeamDynamicsTools/')
from Boundary import *
from numpy import *
import pylab as pl
import timeit

# Import poloidal boundary points
Rb = loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[0])
Zb = loadtxt('../data/CmodCoordinatesRZ.dat', usecols=[1])

#------------------------------------------------------------------------------
# Generate vessel boundary
Vessel = Boundary(Rb, Zb)

#------------------------------------------------------------------------------
pl.figure(1)
Vessel.Border()

pl.figure(2)
Vessel.Plot2D(2)

#------------------------------------------------------------------------------
# 3D plot of vessel boundary
ax = Vessel.Figure3D(3)
Vessel.Plot3D(ax)

#===============================================================================
# Test Case for in-out detection algorithm
#===============================================================================
Beispiel #13
0
# test polygon class

testing_img = Polygon(egg1)
#testing_img.view()

print(testing_img.ref_image_dim)

# detect area from the image, using Fourier transformation and convex_hull curve
testing_img.detect_area()
#testing_img.view_area()

for (x, y) in testing_img.vertices:
    print('vertice: [', x, ',', y, ']')

#detect area with the help of a boundary curve

testing_img = Polygon(egg1)
#testing_img.view()

mode = 'curvature'
#mode = 'pca'
bd = Boundary(egg1)
bd.detect_head_tail(mode)

testing_img.detect_area(boundary=bd)
#testing_img.view_area()

for (x, y) in testing_img.vertices:
    print('vertice: [', x, ',', y, ']')

print('PASS: polygon class')
#egg1.view()
#rotated_embryo.view()



# test get_rotated_image
rotated_egg = Embryo(r.get_rotated_image())
print('pass: get rotation from image')

#rotated_egg.view()

# rotate back

#mode = 'curvature'
mode = 'pca'
bd = Boundary(rotated_egg)
bd.detect_head_tail(mode)
print('rotation angle:', -bd.get_orientation(mode))

#with the presence of the boundary
rotated_egg2 = r.rotate_embryo(rotated_embryo, boundary=bd)
#rotated_egg2.view()

# without boundary, using pca method to generate a boundary on the fly
rotated_egg3 = r.rotate_embryo(rotated_egg2, bd_mode = 'curvature')
print('rotation angle:', r.angle)
#rotated_egg3.view()

#without boundary, use pca method on the fly
rotated_egg4 = r.rotate_embryo(rotated_egg3, bd_mode = 'pca')
print('rotation angle:', r.angle)
# Using the above FTT for embryo data

from Embryo import *
from Boundary import *
import numpy as np
import skimage.filter

filename = "C1-WT-9.png"

gene1 = Embryo(filename)
gene1.rgb2gray()
plt.imshow(gene1.raw_image, 'gray')
plt.show()

boundary_gene1 = Boundary(gene1)
boundary_gene1.detect_boundary()

threshold = skimage.filters.threshold_otsu(gene1.raw_image)   
bw_image = gene1.raw_image > threshold

plt.imshow(boundary_gene1.ref_image)
plt.plot(boundary_gene1.boundary_curve[:,1], boundary_gene1.boundary_curve[:,0], color='r')
plt.show()


x = boundary_gene1.boundary_curve[:,1]
y = boundary_gene1.boundary_curve[:,0]

# the central of gravity is determined from the convex_hull
cgx = np.sum ( np.arange(0, gene1.raw_image.shape[1]) * np.sum(bw_image, axis = 0) ) / np.sum(bw_image)
Beispiel #16
0
egg2.denoise()
egg2.view()

egg2.clear_border()
egg2.view()

egg2.raw_image = egg2.raw_image * (egg1.raw_image > 0)
egg2.view()

# find convex hull
convex_hull = skimage.morphology.convex_hull_image(egg2.raw_image > 0)
plt.imshow(convex_hull)
plt.show()


bd = Boundary(egg2)
bd.detect_boundary()
bd.view_boundary_curve()

bd.detect_convex_hull()
plt.imshow(bd.convex_hull)
plt.show()

#%%





""""
The following are debug code for demo.py    
Beispiel #17
0
    example_ys = iris.versicolor_ys[:3] + iris.virginica_ys[:3]
    for i in range(len(example_xs)):
        if boundary.classify(example_xs[i], example_ys[i], boundary.linear_decision_boundary)\
                == iris.Classification.VERSICOLOR:
            new_versicolor_xs.append(example_xs[i])
            new_versicolor_ys.append(example_ys[i])
        else:
            new_virginica_xs.append(example_xs[i])
            new_virginica_ys.append(example_ys[i])
    pyplot.scatter(new_versicolor_xs, new_versicolor_ys, label='Versicolor')
    pyplot.scatter(new_virginica_xs, new_virginica_ys, label='Virginica')
    boundary.plot_linear_decision_boundary(boundary.linear_decision_boundary,
                                           pyplot)


# ASSIGNMENT 1a.
iris.load_iris_data()

iris.plot_iris_data()
boundary.plot_linear_decision_boundary(boundary.linear_decision_boundary,
                                       pyplot)  # ASSIGNMENT 1b.
iris.show_plot()

# ASSIGNMENT 1c.
plot_classifier_examples()
iris.show_plot()

# ASSIGNMENT 1d.
plot_radial_classification()
iris.show_plot()
Beispiel #18
0
 def generate_boundary_for_rotation(self, boundary=None, mode='curvature'):
     if (boundary is None):
         self.boundary = Boundary(self.ref_image)
         self.boundary.detect_head_tail(mode)
     else:
         self.boundary = boundary
Beispiel #19
0
# ASSIGNMENT 3.
iris.load_iris_data()
data_vectors = [[iris.versicolor_xs[d], iris.versicolor_ys[d]] for d in range(len(iris.versicolor_xs))]\
               + [[iris.virginica_xs[d], iris.virginica_ys[d]] for d in range(len(iris.virginica_xs))]
correct_classification = [iris.Classification.VERSICOLOR for c in range(len(iris.versicolor_xs))]\
                         + [iris.Classification.VIRGINICA for c in range(len(iris.virginica_xs))]

random.seed = 2083
boundary.weights = [random.uniform(0, 10), random.uniform(-10, 0)]
error_plot_values = []
iteration = 0
while iteration < 10000:
    error_plot_values.append(
        boundary.mean_squared_error(data_vectors,
                                    boundary.learned_decision_boundary,
                                    correct_classification))

    if iteration % 20 == 0 or error_plot_values[-1] < .15:
        boundary.plot_linear_decision_boundary(
            boundary.learned_decision_boundary, pyplot)
        pyplot.scatter(iris.versicolor_xs,
                       iris.versicolor_ys,
                       label='Versicolor')
        pyplot.scatter(iris.virginica_xs, iris.virginica_ys, label='Virginica')
        iris.show_plot()

        pyplot.plot(range(len(error_plot_values)), error_plot_values)
        pyplot.show()

    gradient = boundary.gradient([[1] + d for d in data_vectors], [
Beispiel #20
0
        dt = dt / np.sqrt(1 + 2 * ETA)

    half_dt = 0.5 * dt

    if NT == 0:
        NT = np.ceil(TT / dt)

    f = np.zeros([nglob, 1])
    v = np.zeros([nglob, 1])
    d = np.zeros([nglob, 1])

    time = np.array(range(0, NT.astype(np.int32))).T * dt

    impedance = RHO * VS
    if ABC_L == 1:
        BcLC, iBcL, noUsed = Boundary.BoundaryMatrix(wgll, [NELX, NELY], iglob,
                                                     dy_deta, 'L')
        BcLC = impedance * BcLC
        M[iBcL] = M[iBcL] + half_dt * BcLC

    if ABC_R == 1:
        BcRC, iBcR, noUsed = Boundary.BoundaryMatrix(wgll, [NELX, NELY], iglob,
                                                     dy_deta, 'R')
        BcRC = impedance * BcRC
        M[iBcR] = M[iBcR] + half_dt * BcRC

    if ABC_T == 1:
        BcTC, iBcT, noUsed = Boundary.BoundaryMatrix(wgll, [NELX, NELY], iglob,
                                                     dx_dxi, 'T')
        BcTC = impedance * BcTC
        M[iBcT] = M[iBcT] + half_dt * BcTC
Beispiel #21
0
 def createBoundaries(self):
     self.boundaries = set()
     self.boundaries.add(Boundary(self, '1', 0, 150, 50, 160, self.scale))
     self.boundaries.add(Boundary(self, '2', 0, 315, 50, 325, self.scale))
     self.boundaries.add(Boundary(self, '3', 55, 345, 105, 355, self.scale))
     self.boundaries.add(Boundary(self, '4', 60, 50, 110, 60, self.scale))
     self.boundaries.add(Boundary(self, 'Shift 1', 150, 440, 300, 450, self.scale,
                                  order = 0, shiftY = -95))
     self.boundaries.add(Boundary(self, 'Shift 2', 150, 150, 295, 355, self.scale,
                                  order = 1, shiftY = -50))
     self.boundaries.add(Boundary(self, 'Shift 3', 150, 100, 300, 110, self.scale,
                                  order = 2, shiftY = -50))
     self.boundaries.add(Boundary(self, 'Shift 4', 375, 280, 385, 400, self.scale,
                                  order = 4, shiftY = 75))
     self.boundaries.add(Boundary(self, '5', 350, 345, 450, 355, self.scale))
     self.boundaries.add(Boundary(self, '6', 325, 60, 425, 70, self.scale))
     self.boundaries.add(Boundary(self, 'Shift 5', 550, 70, 650, 80, self.scale,
                                  order = 3, shiftX = -80))
     self.boundaries.add(Boundary(self, '9', 650, 345, 800, 355, self.scale))
     self.boundaries.add(Boundary(self, '10', 675, 315, 700, 355, self.scale))
     self.boundaries.add(Boundary(self, '11', 700, 285, 750, 355, self.scale))
     self.boundaries.add(Boundary(self, '12', 750, 255, 800, 355, self.scale))
     self.boundaries.add(Boundary(self, '13', 450, 345, 460, 450, self.scale))
Beispiel #22
0
class Rotation(object):
    def __init__(self, data=None):
        # initialize angle
        self.angle = None

        # ref_image is a 2d array
        self.ref_image = None
        #self.set_ref_image(data)

        # boundary is of Boundary type
        self.boundary = None

        #private variables
        # rotated image is of 2d array
        self.__rotated_image = None

        self.set_ref_image(data)

    def set_ref_image(self, data):
        if (isinstance(data, np.ndarray) and (len(data.shape) == 2)):
            # data is an image
            self.ref_image = np.copy(data)
        elif (data.__class__.__name__ == 'Embryo'):
            # data is an Embryo object
            self.ref_image = np.copy(data.raw_image)
        elif (data is None):
            print('referenc image is not provided')
        else:
            print('data must have type of numpy.ndarry or Embryo')

    def get_rotated_image(self):
        return self.__rotated_image

    def set_boundary(self, boundary):
        self.boundary = boundary

    def set_angle(self, angle):
        self.angle = angle

    def set_angle_from_boundary(self, boundary):
        self.angle = -boundary.get_orientation(boundary.mode)

    def generate_boundary_for_rotation(self, boundary=None, mode='curvature'):
        if (boundary is None):
            self.boundary = Boundary(self.ref_image)
            self.boundary.detect_head_tail(mode)
        else:
            self.boundary = boundary

    def view_inclination(self, bd_mode='curvature', boundary=None):
        if (boundary is None):
            bd = Boundary(self.ref_image)
            bd.detect_head_tail(bd_mode)
        else:
            bd = boundary
        return -bd.get_orientation(bd.mode)

    def rotate_embryo(self,
                      embryo=None,
                      angle=None,
                      boundary=None,
                      inplace=False,
                      resize=True,
                      center_mode='simple',
                      bd_mode='curvature'):
        #return an Embryo object with an image after rotation
        if embryo is not None:
            self.set_ref_image(embryo)
        else:
            if self.ref_image is None:
                raise ValueError("no reference image provided")

        if angle is not None:
            self.set_angle(angle)
        else:
            self.generate_boundary_for_rotation(boundary, bd_mode)
            self.set_angle_from_boundary(self.boundary)

        if center_mode == 'simple':
            center = np.round(np.array(self.ref_image.shape) / 2).astype(int)
        elif center_mode == 'boundary':
            center = self.boundary.get_center(self.boundary.mode)

        self.__rotated_image = skimage.transform.rotate(self.ref_image.copy(),
                                                        self.angle / math.pi *
                                                        180,
                                                        resize=resize,
                                                        center=center,
                                                        preserve_range=True)

        if inplace:
            self.ref_image = np.copy(self.__rotated_image)

        if embryo is not None:
            embryo.raw_image = np.copy(self.__rotated_image)
            return embryo
        else:
            return Embryo(self.__rotated_image)
Beispiel #23
0
 def createBoundaries(self):
     self.boundaries = set()
     self.boundaries.add(Boundary(self, '1', 0, 150, 100, 170, self.scale))
     self.boundaries.add(Boundary(self, '34', 175, 190, 200, 210, self.scale, False, 0))
     self.boundaries.add(Boundary(self, '2', 0, 450, 100, 470, self.scale))
     self.boundaries.add(Boundary(self, '3', 175, 520, 275, 540, self.scale))
     self.boundaries.add(Boundary(self, '4', 320, 535, 330, 605, self.scale))
     self.boundaries.add(Boundary(self, '37', 320, 445, 365, 485, self.scale, True, 3))
     self.boundaries.add(Boundary(self, '5', 330, 595, 360, 605, self.scale))
     self.boundaries.add(Boundary(self, '6', 320, 505, 410, 535, self.scale))
     self.boundaries.add(Boundary(self, '7', 320, 485, 365, 505, self.scale))
     self.boundaries.add(Boundary(self, '35', 315, 420, 325, 430, self.scale, False, 1))
     self.boundaries.add(Boundary(self, '36', 410, 720, 440, 900, self.scale, True, 2))
     self.boundaries.add(Boundary(self, '38', 0, 0, 200, 10, self.scale, False, 4))
     self.boundaries.add(Boundary(self, '8', 320, 380, 365, 445, self.scale))
     self.boundaries.add(Boundary(self, '9', 365, 380, 400, 395, self.scale))
     self.boundaries.add(Boundary(self, '10', 400, 150, 410, 395, self.scale))
     self.boundaries.add(Boundary(self, '11', 310, 285, 330, 305, self.scale))
     self.boundaries.add(Boundary(self, '12', 200, 230, 210, 245, self.scale))
     self.boundaries.add(Boundary(self, '13', 125 , 175, 175, 190, self.scale))
     self.boundaries.add(Boundary(self, '14', 410, 535, 440, 720, self.scale))
     self.boundaries.add(Boundary(self, '15', 440, 700, 600, 720, self.scale))
     self.boundaries.add(Boundary(self, '16', 600, 580, 700, 720, self.scale))
     self.boundaries.add(Boundary(self, '17', 740, 590, 840, 610, self.scale))
     self.boundaries.add(Boundary(self, '18', 700, 710, 760, 720, self.scale))
     self.boundaries.add(Boundary(self, '19', 760, 675, 770, 720, self.scale))
     self.boundaries.add(Boundary(self, '20', 770, 675, 830, 685, self.scale))
     self.boundaries.add(Boundary(self, '21', 830, 610, 840, 685, self.scale))
     self.boundaries.add(Boundary(self, '22', 900, 590, 1000, 900, self.scale))
     self.boundaries.add(Boundary(self, '23', 830, 550, 840, 590, self.scale))
     self.boundaries.add(Boundary(self, '24', 830, 530, 945, 550, self.scale))
     self.boundaries.add(Boundary(self, '25', 935, 550, 945, 590, self.scale))
     self.boundaries.add(Boundary(self, '26', 910, 250, 925, 500, self.scale))
     self.boundaries.add(Boundary(self, '27', 770, 560, 790, 570, self.scale))
     self.boundaries.add(Boundary(self, '28', 900, 300, 910, 320, self.scale))
     self.boundaries.add(Boundary(self, '29', 725, 400, 825, 420, self.scale))
     self.boundaries.add(Boundary(self, '30', 850, 235, 925, 250, self.scale))
     self.boundaries.add(Boundary(self, '31', 210, 0, 500, 10, self.scale))
     self.boundaries.add(Boundary(self, '32', 500, 0, 575, 20, self.scale))
     self.boundaries.add(Boundary(self, '33', 625, 10, 700, 20, self.scale))
Beispiel #24
0
 def add_segment(self, segment):
     self.segments.append(segment)
     seg = copy.deepcopy(segment)
     Tf.bystep(seg, self.step)
     seg = [seg[i][0:2] for i in range(len(seg))]
     Bd.add_segment(self.boundary, seg)
Beispiel #25
0
"""
Todo:  test existence of a filename: 
    
egg = Embryo('aaa')

"""


#%%
"""
 Test boundary class:
"""

# initialization from an Embryo object
bd = Boundary(egg1)
bd.view()

# initialization from an array
egg2 = embryo_list[1]
bd.set_ref_image(egg2)
bd.view()

#detect boundary
bd = Boundary(egg1.raw_image)
bd.detect_boundary()
bd.view_boundary_curve()

#%%
#debug: detect head and tail
mode ='curvature'