예제 #1
0
import basepath
BASEPATH = basepath.get_basepath(printInfo=True)
import sys
sys.path.insert(0, BASEPATH + 'Leo/code/helperfunctions')
import filehandling
import dataconversions as dc
import cropping
import plotting
from plotting import print_dict
# Standard python libraries
import numpy as np
import matplotlib.pyplot as plt


#%% Define parameters, load metadata

whole_scan_metadata = filehandling.pload(BASEPATH + 'Leo/data/F15/region.pickledump')

segmentation_all_patches = filehandling.pload(BASEPATH + 'Leo/data/F15/segmentation.pickledump')

mets_of_all_patches = segmentation_all_patches['metastases']

ROI_width = 50

CURRENT_PATCH = 403 # good ones: 402, 403, 412, 501, 515, 452, 459, 522, 523, 361, 922

#%% Main code


'''
print('\n')
import basepath
BASEPATH = basepath.get_basepath()
DATAPATH = BASEPATH + 'Leo/data/F15/'
import sys
sys.path.insert(0, BASEPATH + 'Leo/code/helperfunctions')
import filehandling
import p_leo
import numpy as np

#%% Parameters

whole_scan_metadata = filehandling.pload(BASEPATH +
                                         'Leo/data/F15/region.pickledump')

segmentation_all_patches = filehandling.pload(
    BASEPATH + 'Leo/data/F15/segmentation.pickledump')

mets_of_all_patches = segmentation_all_patches['metastases']

# manually add another metastasis to the dataset (one that I stumbled upon)
patch403_met16 = filehandling.pload(BASEPATH +
                                    'Leo/data/F15/m_403_16.pickledump')
patch403_met16['global_id'] = len(mets_of_all_patches)
patch403_met16['patch_id'] = 403
patch403_met16['location'] = {}
patch403_met16['location']['center'] = [4062, 1673, 2676]
mets_of_all_patches.append(patch403_met16)

#%% Step 1) Merge all segmentations

segmentation_ambig_mets = {}