Exemplo n.º 1
0
image_mods = ["Proton"]
channel_size = len(image_mods)

print("Reading reorientation template " + reorient_template_file_name)
start_time = time.time()
reorient_template = ants.image_read(reorient_template_file_name)
end_time = time.time()
elapsed_time = end_time - start_time
print("  (elapsed time: ", elapsed_time, " seconds)")

resampled_image_size = reorient_template.shape

unet_model = antspynet.create_unet_model_3d(
    (*resampled_image_size, channel_size),
    number_of_outputs=number_of_classification_labels,
    number_of_layers=4,
    number_of_filters_at_base_layer=16,
    dropout_rate=0.0,
    convolution_kernel_size=(7, 7, 5),
    deconvolution_kernel_size=(7, 7, 5))

print("Loading weights file")
start_time = time.time()
weights_file_name = "./lungSegmentationWeights.h5"

if not os.path.exists(weights_file_name):
    weights_file_name = antspynet.get_pretrained_network(
        "protonLungMri", weights_file_name)

unet_model.load_weights(weights_file_name)
end_time = time.time()
elapsed_time = end_time - start_time
Exemplo n.º 2
0
image_mods = ["T1"]
channel_size = len(image_mods)

print("Reading reorientation template " + reorient_template_file_name)
start_time = time.time()
reorient_template = ants.image_read(reorient_template_file_name)
end_time = time.time()
elapsed_time = end_time - start_time
print("  (elapsed time: ", elapsed_time, " seconds)")

resampled_image_size = reorient_template.shape

unet_model = antspynet.create_unet_model_3d( (*resampled_image_size, channel_size),
  number_of_outputs = number_of_classification_labels,
  number_of_layers = 4, number_of_filters_at_base_layer = 8, dropout_rate = 0.0,
  convolution_kernel_size = (3, 3, 3), deconvolution_kernel_size = (2, 2, 2),
  weight_decay = 1e-5 )

print( "Loading weights file" )
start_time = time.time()
weights_file_name = "./brainExtractionWeights.h5"

if not os.path.exists(weights_file_name):
    weights_file_name = antspynet.get_pretrained_network("brainExtraction", weights_file_name)

unet_model.load_weights(weights_file_name)
end_time = time.time()
elapsed_time = end_time - start_time
print("  (elapsed time: ", elapsed_time, " seconds)")