from fcn_model import createModel from inputParser import parse_input from normalization import normalize_scans from metrics import dice import numpy as np import time import keras from keras.preprocessing.image import ImageDataGenerator from keras.models import load_model from keras.callbacks import ModelCheckpoint from keras.utils import np_utils import gc args = parse_input() data_dir = args.data_dir validation_dir = args.validation_dir model_file = args.model save_dir = args.save_dir tf_ordering = True if (keras.backend.image_dim_ordering() == "th"): tf_ordering = False print("Image ordering:", keras.backend.image_dim_ordering(), "tf_ordering", tf_ordering) use_N4Correction = False print("Using N4 correction", use_N4Correction) training_samples = 1000
from inputParser import parse_input import math points = parse_input() # Sort points by x points.sort(key=lambda point: point[0]) def euclidean_distance(p1, p2): return math.sqrt((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2) def x_belt_predicate(p1, p2, dist): return p1[0] - p2[0] < dist def y_belt_predicate(p1, p2, dist): return p1[1] - p2[1] < dist def get_min_dist_in_points(points): if (len(points) <= 1): return float('inf') minimum = float('inf') for i in range(0, len(points)): for i2 in range(i + 1, len(points)): distance = euclidean_distance(points[i], points[i2]) if distance < minimum: minimum = distance