Commit 86753b5b authored by Andrei Roibu's avatar Andrei Roibu
Browse files

bug fix - only 1 target was returned

parent 7b808175
......@@ -88,7 +88,12 @@ def convert_hdf5(data_parameters, file_information):
crop_flag = data_parameters['crop_flag']
)
write_hdf5(train_dMRI, train_rsfMRI, file_information, mode='train')
print("The lenght of the training inputs is {} and the size of the elements is {}".format(len(train_dMRI), train_dMRI[len(train_dMRI)-1].shape))
print("The lenght of the training targets is {} and the size of the elements is {}".format(len(train_rsfMRI), train_dMRI[len(train_rsfMRI)-1].shape))
write_hdf5(train_dMRI, train_rsfMRI, file_information, mode='train')
del train_dMRI, train_rsfMRI
# Then, we'll do it for the validation data
......@@ -114,8 +119,12 @@ def convert_hdf5(data_parameters, file_information):
crop_flag = data_parameters['crop_flag']
)
print("The lenght of the validation inputs is {} and the size of the elements is {}".format(len(validation_dMRI), train_dMRI[len(validation_dMRI)-1].shape))
print("The lenght of the validation targets is {} and the size of the elements is {}".format(len(validation_rsfMRI), train_dMRI[len(validation_rsfMRI)-1].shape))
write_hdf5(validation_dMRI, validation_rsfMRI, file_information, mode='validation')
del validation_dMRI, validation_rsfMRI
def write_hdf5(input_volumes, target_volumes, file_information, mode):
""" HDF5 Writer
......
......@@ -319,9 +319,9 @@ def load_datasets(subjects, data_directory, input_file, output_target, mean_regr
input_volumes.append(input_volume)
target_volumes.append(target_volume)
print("\r Processed {:.3f}%".format(index/len_subjects * 100.0), end='')
print("\r Processed {:.3f}%: {}/{} inputs, {}/{} targets".format(index/len_subjects * 100.0, len(input_volumes), len_subjects, len(target_volumes), len_subjects), end='')
return input_volumes, target_volume
return input_volumes, target_volumes
def load_and_preprocess(subject, data_directory, input_file, output_target, mean_regression_flag, mean_regression_all_flag, regression_weights_path,
dMRI_mean_mask_path, rsfMRI_mean_mask_path, mean_subtraction_flag, scale_volumes_flag, normalize_flag, minus_one_scaling_flag, negative_flag,
......@@ -431,7 +431,7 @@ def preprocess(input_volume, target_volume, subject, mean_regression_flag, mean_
target_volume = linear_regress_mean(target_volume, subject, regression_weights_path, crop_flag, target_flag=True, rsfMRI_mean_mask_path=rsfMRI_mean_mask_path)
# Set scaling parameters to Andrei Scaling
scaling_parameters = [-0.0626, 0.1146, -14.18, 16.9475]
else:
elif mean_regression_all_flag == False:
# Regress only targets, leave inputs as they are
target_volume = linear_regress_mean(target_volume, subject, regression_weights_path, crop_flag, target_flag=True, rsfMRI_mean_mask_path=rsfMRI_mean_mask_path)
# Set scaling parameters to Mixed Scaling
......@@ -441,8 +441,6 @@ def preprocess(input_volume, target_volume, subject, mean_regression_flag, mean_
target_volume = subtract_mean(target_volume, crop_flag, rsfMRI_mean_mask_path)
# Set Scaling parameters to Steve Scaling
scaling_parameters = [0.0, 0.2, 0.0, 10.0]
else:
pass
if scale_volumes_flag == True:
input_volume = volume_scaling(input_volume, scaling_parameters, normalize_flag, minus_one_scaling_flag, negative_flag, outlier_flag, shrinkage_flag, hard_shrinkage_flag, target_flag=False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment