Ejemplo n.º 1
0
def segment_SLIP_pos(data_direc, mask_direc):
    data_location = data_direc
    phase_location = mask_direc

    phase_channel_names = ['Phase']  #['channel000']

    trained_network_phase_directory = "/home/nquach/DeepCell2/trained_networks/ecoli/ecoli_all/"

    phase_prefix = "2016-07-20_ecoli_all_31x31_bn_feature_net_31x31_"
    #"2017-02-12_ecoli_90x_31x31_ecoli_90x_feature_net_31x31_"

    win_phase = 30

    image_size_x, image_size_y = get_image_sizes(data_location,
                                                 phase_channel_names)
    image_size_x /= 2
    image_size_y /= 2

    list_of_phase_weights = []
    for j in xrange(5):
        phase_weights = os.path.join(trained_network_phase_directory,
                                     phase_prefix + str(j) + ".h5")
        print(phase_weights)
        list_of_phase_weights += [phase_weights]

    phase_predictions = run_models_on_directory(
        data_location,
        phase_channel_names,
        phase_location,
        model_fn=fn,
        list_of_weights=list_of_phase_weights,
        image_size_x=image_size_x,
        image_size_y=image_size_y,
        win_x=win_phase,
        win_y=win_phase,
        std=False,
        split=False)

    #phase_masks = segment_nuclei(phase_predictions, mask_location = mask_location, threshold = 0.75, area_threshold = 100, solidity_threshold = 0.75, eccentricity_threshold = 0.95)
Ejemplo n.º 2
0
nuclear_location = os.path.join(direc_name, 'Nuclear')
mask_location = os.path.join(direc_name, 'Masks')

# cyto_channel_names = ['Pos3']
nuclear_channel_names = ['nucleus']

# trained_network_cyto_directory = "/home/vanvalen/DeepCell/trained_networks/"
trained_network_nuclear_directory = "/home/vanvalen/DeepCell/trained_networks/theriot/"

# cyto_prefix = "2016-08-02_ecoli_all_31x31_bn_feature_net_31x31_"
nuclear_prefix = "2017-04-13_theriot_61x61_bn_feature_net_61x61_"

# win_cyto = 15
win_nuclear = 30

image_size_x, image_size_y = get_image_sizes(data_location,
                                             nuclear_channel_names)
"""
Define model
"""

# list_of_cyto_weights = []
# for j in xrange(5):
# 	cyto_weights = os.path.join(trained_network_cyto_directory,  cyto_prefix + str(j) + ".h5")
# 	list_of_cyto_weights += [cyto_weights]

list_of_nuclear_weights = []
for j in xrange(1):
    nuclear_weights = os.path.join(trained_network_nuclear_directory,
                                   nuclear_prefix + str(j) + ".h5")
    list_of_nuclear_weights += [nuclear_weights]
Ejemplo n.º 3
0
for f in folders:
   if not os.path.exists(os.path.join(mainfolder, f, 'Output')):
        os.makedirs(os.path.join(mainfolder, f, 'Output'))


for f in folders:

    if os.path.isdir(os.path.join(mainfolder, f,'Output')):
        numfiles = len(os.listdir(os.path.join(mainfolder, f,'Output')));
        if numfiles == 0:
                        print f
                        direc_name = os.path.join(mainfolder, f)
                        data_location = direc_name
                        cyto_location = os.path.join(direc_name, 'Output')
                        image_size_x, image_size_y = get_image_sizes(data_location,cyto_channel_names)
                        #image_size_x /= 4                                                                                                     
                        #image_size_y /= 4                                                                                                     

                        """                                                                                                                    
                        Define model                                                                                                           
                        """

                        list_of_cyto_weights = []
                        for j in xrange(1):
                                cyto_weights = os.path.join(trained_network_cyto_directory,  cyto_prefix + str(j) + ".h5")
                                list_of_cyto_weights += [cyto_weights]


                        """                                                                                                                    
                        Run model on directory