Beispiel #1
0
from keras.callbacks import Callback
from keras.utils.np_utils import to_categorical
import numpy as np
import nibabel as nb
import pandas as pd
import pylab as plt
from PIL import Image
import scipy.ndimage.interpolation as itp
from scipy.ndimage.measurements import center_of_mass

# Internal
import dvpy as dv
import segcnn
import os

cg = segcnn.Experiment()
#fs = segcnn.FileSystem(cg.base_dir, cg.data_dir,cg.local_dir)

adapt_size = (int(os.environ['CG_CROP_X']), int(os.environ['CG_CROP_Y']),
              int(os.environ['CG_CROP_Z']))


def in_adapt(x, target=adapt_size):
    x = nb.load(x).get_data()
    x = dv.crop_or_pad(x, target)
    x = np.expand_dims(x, axis=-1)
    return x


def relabel(x):
    # flip the label of LAA and LVOT
Beispiel #2
0
# Internal
import dvpy as dv
import segcnn

# experiments = OrderedDict()

# for spacing in ['1-0', '1-5', '2-0']:
#   with open('./.experiments/left-heart-all-spacing-{}.p'.format(spacing), 'rb') as f:
#     experiments[spacing] = pickle.load(f)

# with open('./experiments/00-all-both-1-5-spacing.sh', 'rb') as f:
#   experiments['1-5'] = pickle.load(f)
# FIGURE_PATH=os.path.expandvars('${HOME}/Dropbox/datasets/valve-plane-detection-figures/')
# STAT_PATH = ""
experiment = segcnn.Experiment()
class_labels = {
    0: 'Background',
    1: 'LV',
    2: 'LA',
    3: 'LAA',
    4: 'LVOT',
    5: 'Ascending Aorta',
    6: 'Left Inferior Pulmonary Vein',
    7: 'Right Inferior Pulmonary Vein',
    8: 'Left Superior Pulmonary Vein',
    9: 'Right Superior Pulmonary Vein',
}


def calculate_iou():