Ejemplo n.º 1
0
def find_normalization_params(pat_dce, pat_gt, label, pat_model):
    # Create the normalization object and load the model
    dce_norm = StandardTimeNormalization(DCEModality())
    dce_norm.load_model(pat_model)

    # Read the DCE
    dce_mod = DCEModality()
    dce_mod.read_data_from_path(pat_dce)

    # Read the GT
    gt_mod = GTModality()
    gt_mod.read_data_from_path(label, pat_gt)

    # Find the normalization parameters
    dce_norm.fit(dce_mod, ground_truth=gt_mod, cat=label[0])

    return dce_norm
Ejemplo n.º 2
0
# Define the list of path for the GT
path_gt = ['/data/prostate/experiments/Patient 383/GT_inv/prostate']
# Define the associated list of label for the GT
label_gt = ['prostate']

# Read the DCE
dce_mod = DCEModality()
dce_mod.read_data_from_path(path_dce)

# Read the GT
gt_mod = GTModality()
gt_mod.read_data_from_path(label_gt, path_gt)

# Create the object to normalize the DCE data
dce_norm = StandardTimeNormalization(dce_mod)
# Fit the data to get the normalization parameters
dce_norm.partial_fit_model(dce_mod, ground_truth=gt_mod,
                           cat='prostate')

print dce_norm.model_

# Define the path for the DCE
path_dce = '/data/prostate/experiments/Patient 387/DCE'

# Define the list of path for the GT
path_gt = ['/data/prostate/experiments/Patient 387/GT_inv/prostate']
# Define the associated list of label for the GT
label_gt = ['prostate']

# Read the DCE
Ejemplo n.º 3
0
# Generate the different path to be later treated
path_patients_list_dce = []
path_patients_list_gt = []
# Create the generator
id_patient_list = (name for name in os.listdir(path_patients)
                   if os.path.isdir(os.path.join(path_patients, name)))
for id_patient in id_patient_list:
    # Append for the DCE data
    path_patients_list_dce.append(os.path.join(path_patients, id_patient,
                                               path_dce))
    # Append for the GT data - Note that we need a list of gt path
    path_patients_list_gt.append([os.path.join(path_patients, id_patient,
                                               path_gt)])

# Create the model iteratively
dce_norm = StandardTimeNormalization(DCEModality())
for pat_dce, pat_gt in zip(path_patients_list_dce, path_patients_list_gt):
    # Read the DCE
    dce_mod = DCEModality()
    dce_mod.read_data_from_path(pat_dce)

    # Read the GT
    gt_mod = GTModality()
    gt_mod.read_data_from_path(label_gt, pat_gt)

    # Fit the model
    dce_norm.partial_fit_model(dce_mod, ground_truth=gt_mod,
                               cat=label_gt[0])

# Define the path where to store the model
path_store_model = '/data/prostate/pre-processing/lemaitre-2016-nov/model'