Commit e165d3e4 authored by Clement Vachet's avatar Clement Vachet

First commit

parents
Pipeline #2707 canceled with stages
#!/usr/bin/env python3
import imageio
import numpy as np
import sys
import argparse
import time
def arg_parser():
parser = argparse.ArgumentParser(description='Concatenating layer to 3D volume')
required = parser.add_argument_group('Required')
required.add_argument('--input', type=str, required=True,
help='3D TIFF file (multi-layer)')
required.add_argument('--layer1', type=str, required=True,
help='2D TIFF file (single layer)')
required.add_argument('--output', type=str, required=True,
help='Combined TIFF file (multi-layer)')
options = parser.add_argument_group('Options')
required.add_argument('--layer2', type=str, required=True,
help='2D TIFF file (single layer)')
options.add_argument('--repeat', type=int, default=15,
help='Repeat tile number (default 15)')
return parser
#MAIN
def main(args=None):
args = arg_parser().parse_args(args)
Time1 = time.time()
#print(bcolors.BOLDWHITE+"Time1: "+str(Time1)+bcolors.ENDC)
imgInput_name = args.input
imgLayer1_name = args.layer1
imgLayer2_name = args.layer2
output_name = args.output
repeatNb = args.repeat
# Read Combined image - all layers
print("\nReading input file - 3D volume...")
imgInput = imageio.mimread(imgInput_name,memtest=False)
imgInput = np.array(imgInput)
# print('\nimgInput type: ', imgInput.dtype)
print('\t imgInput shape: ', imgInput.shape)
# Read Layer1 image
print("Reading Layer1 file...")
imgLayer1 = imageio.imread(imgLayer1_name)
# print('imgLayer1 type: ', imgLayer1.dtype)
print('\t imgLayer1 shape: ', imgLayer1.shape)
# Resample layer1 (repeating values, to match input size)
imgLayer1_repeat0 = np.repeat(imgLayer1, repeatNb, axis=0)
imgLayer1_repeat = np.repeat(imgLayer1_repeat0, repeatNb, axis=1)
imgLayer1_repeat = np.expand_dims(imgLayer1_repeat, axis=0)
print('\t imgLayer1_repeat shape: ', imgLayer1_repeat.shape)
# Stack layer to imgInput, to generate one 3D volume
print("Adding 2D layer to 3D volume...")
imgAll = np.concatenate((imgInput,imgLayer1_repeat), axis = 0)
if args.layer2:
print("Reading Layer2 file...")
imgLayer2 = imageio.imread(imgLayer2_name)
# print('imgLayer2 type: ', imgLayer2.dtype)
print('\t imgLayer2 shape: ', imgLayer2.shape)
imgLayer2_repeat0 = np.repeat(imgLayer2, repeatNb, axis=0)
imgLayer2_repeat = np.repeat(imgLayer2_repeat0, repeatNb, axis=1)
imgLayer2_repeat = np.expand_dims(imgLayer2_repeat, axis=0)
print('\t imgLayer2_repeat shape: ', imgLayer2_repeat.shape)
# Stack layer to imgInput, to generate one 3D volume
print("Adding 2D layer to 3D volume...")
imgAll = np.concatenate((imgAll,imgLayer2_repeat), axis = 0)
print("Saving output volume...")
print('\t imgAll shape: ', imgAll.shape)
imageio.mimwrite(output_name,imgAll)
Time2 = time.time()
TimeDiff = Time2 - Time1
print("Execution Time: "+str(TimeDiff))
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
#!/usr/bin/env python3
import imageio
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
import sys
import argparse
import time
import os
def arg_parser():
parser = argparse.ArgumentParser(description='Data analysis - density computation')
required = parser.add_argument_group('Required')
required.add_argument('--pred', type=str, required=True,
help='Prediction TIFF file (single layer)')
required.add_argument('--groundtruth', type=str, required=True,
help='Ground Truth TIFF file (single layer)')
required.add_argument('--adjtilesdim', type=int, required=True,
help='Adjacent tiles dimensions (e.g. 1, 3 or 5) to exclude NaN border')
required.add_argument('--output', type=str, required=True,
help='CSV file')
options = parser.add_argument_group('Options')
options.add_argument('--inclusionmask', type=str,
help='save inclusion mask as output (diff < 2 pixels)')
options.add_argument('--exclusionmask', type=str,
help='save exclusion mask as output (diff >= 2 pixels)')
options.add_argument('--threshold', type=float, default = 2.0,
help='threshold for inclusion / exclusion mask')
options.add_argument('--verbose', action="store_true",
help='verbose mode')
return parser
#MAIN
def main(args=None):
args = arg_parser().parse_args(args)
# print(args)
Time1 = time.time()
#print(bcolors.BOLDWHITE+"Time1: "+str(Time1)+bcolors.ENDC)
imgPred_name = args.pred
imgPred_basename = os.path.basename(imgPred_name)
AdjacentTilesDim = args.adjtilesdim
imgGT_name = args.groundtruth
output_name = args.output
inclusion_mask_name = args.inclusionmask
exclusion_mask_name = args.exclusionmask
threshold = args.threshold
# Read Pred and GroundTruth images
#print("Reading Pred file...")
imgPred = imageio.imread(imgPred_name)
#print("Reading GroundTruth file...")
imgGT = imageio.imread(imgGT_name)
# Remove NaN border when needed
imgPred_Crop = imgPred
imgGT_Crop = imgGT
if (AdjacentTilesDim == 3):
Border = 1
imgPred_Crop = imgPred[Border:-Border,Border:-Border]
imgGT_Crop = imgGT[Border:-Border,Border:-Border]
elif (AdjacentTilesDim == 5):
Border = 2
imgPred_Crop = imgPred[Border:-Border,Border:-Border]
imgGT_Crop = imgGT[Border:-Border,Border:-Border]
# Quality control - NaN
TestNaN_imgPred_Crop = np.any(np.isnan(imgPred_Crop))
TestNaN_imgGT_Crop = np.any(np.isnan(imgGT_Crop))
# # List indices with Nan values
# ListNaN_imgPred_Crop = np.argwhere(np.isnan(imgPred_Crop))
# print('ListNaN_imgPred_Crop: ', ListNaN_imgPred_Crop)
# Verbose mode
if args.verbose:
print('imgPred type: ', imgPred.dtype)
print('imgPred shape: ', imgPred.shape)
print('imgGT type: ', imgGT.dtype)
print('imgGT shape: ', imgGT.shape)
print('imgPred_Crop shape: ', imgPred_Crop.shape)
print('imgGT_Crop shape: ', imgGT_Crop.shape)
print('TestNaN_imgPred_Crop: ', TestNaN_imgPred_Crop)
print('TestNaN_imgGT_Crop: ', TestNaN_imgGT_Crop)
# Compute Image difference
np_diff = np.abs(imgPred_Crop - imgGT_Crop)
print('np_diff type: ', np_diff.dtype)
print('np_diff shape: ', np_diff.shape)
# Generate output mask
np_exclusionmask = np.uint8(np.where(np_diff >= threshold, 1, 0))
np_inclusionmask = np.uint8(np.where(np_diff < threshold, 1, 0))
print('np_inclusionmask type: ', np_inclusionmask.dtype)
print('np_inclusionmask shape: ', np_inclusionmask.shape)
# Compute density
density = np.sum(np_inclusionmask) / (np_inclusionmask.shape[0] * np_inclusionmask.shape[1])
print('density: ',density)
QC_data = np.array([[imgPred_basename,density]])
Columns = ['FileName','Density']
df = pd.DataFrame(QC_data,columns=Columns)
print(df.head())
df.to_csv(output_name, index=False)
if inclusion_mask_name is not None:
print('\t\t Writing output inclusion mask - imageio...')
imageio.imwrite(inclusion_mask_name, np_inclusionmask)
if inclusion_mask_name is not None:
print('\t\t Writing output exclusion mask - imageio...')
imageio.imwrite(exclusion_mask_name, np_exclusionmask)
Time2 = time.time()
#print(bcolors.BOLDWHITE+"Time2: "+str(Time2)+bcolors.ENDC)
TimeDiff = Time2 - Time1
#print("Computing Time: "+str(TimeDiff))
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
#!/usr/bin/env python3
import imageio
import numpy as np
import pandas as pd
import sys
import argparse
import time
import os
def arg_parser():
parser = argparse.ArgumentParser(description='Data analysis - NaN computation')
required = parser.add_argument_group('Required')
required.add_argument('--disp_lma', type=str, required=True,
help='Prediction TIFF file (single layer)')
required.add_argument('--output', type=str, required=True,
help='Output CSV file')
options = parser.add_argument_group('Options')
options.add_argument('--verbose', action="store_true",
help='verbose mode')
options.add_argument('--mask', type=str,
help='verbose mode')
return parser
#MAIN
def main(args=None):
args = arg_parser().parse_args(args)
Time1 = time.time()
#print(bcolors.BOLDWHITE+"Time1: "+str(Time1)+bcolors.ENDC)
DispLMA_name = args.disp_lma
output_name = args.output
# Read Pred and GroundTruth images
#print("Reading Pred file...")
imgDispLMA = imageio.imread(DispLMA_name)
# Verbose mode
if args.verbose:
print('imgDispLMA type: ', imgDispLMA.dtype)
print('imgDispLMA shape: ', imgDispLMA.shape)
# print('imgGT type: ', imgGT.dtype)
# Compute NaN
Bool_NaN = np.isnan(imgDispLMA)
Nb_NaN = np.count_nonzero(Bool_NaN)
Nb_NotNaN = np.count_nonzero(~Bool_NaN)
Nb_Total = imgDispLMA.shape[0] * imgDispLMA.shape[1]
NaN_Percent = Nb_NaN / Nb_Total
if args.verbose:
print('Nb_NaN: ', Nb_NaN)
print('Nb_NotNaN: ', Nb_NotNaN)
print('Nb_Total: ', Nb_Total)
print('NaN_Percent: ', NaN_Percent)
# Mask
DispLMA_Mask = np.uint8(np.reshape(~Bool_NaN, imgDispLMA.shape))
if args.verbose:
print('DispLMA_Mask type: ', DispLMA_Mask.dtype)
print('DispLMA_Mask shape: ', DispLMA_Mask.shape)
QC_data = np.array([[DispLMA_name, Nb_NaN, Nb_NotNaN, Nb_Total, NaN_Percent]])
Columns = ['FileName','Nb_NaN', 'Nb_NotNaN', 'Nb_Total', 'NaN_Percent']
df = pd.DataFrame(QC_data,columns=Columns)
print(df.head())
df.to_csv(output_name, index=False)
if (args.mask is not None):
Mask_FileName = args.mask
imageio.imwrite(Mask_FileName, DispLMA_Mask * 255)
Time2 = time.time()
#print(bcolors.BOLDWHITE+"Time2: "+str(Time2)+bcolors.ENDC)
TimeDiff = Time2 - Time1
#print("Computing Time: "+str(TimeDiff))
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
#!/usr/bin/env python3
import imageio
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
import sys
import argparse
import time
import os
def arg_parser():
parser = argparse.ArgumentParser(description='Data analysis - RMSE computation')
required = parser.add_argument_group('Required')
required.add_argument('--pred', type=str, required=True,
help='Prediction TIFF file (single layer)')
required.add_argument('--groundtruth', type=str, required=True,
help='Ground Truth TIFF file (single layer)')
required.add_argument('--adjtilesdim', type=int, required=True,
help='Adjacent tiles dimensions (e.g. 1, 3 or 5) to exclude NaN border')
required.add_argument('--output', type=str, required=True,
help='CSV file')
options = parser.add_argument_group('Options')
options.add_argument('--verbose', action="store_true",
help='verbose mode')
return parser
#MAIN
def main(args=None):
args = arg_parser().parse_args(args)
Time1 = time.time()
#print(bcolors.BOLDWHITE+"Time1: "+str(Time1)+bcolors.ENDC)
imgPred_name = args.pred
imgPred_basename = os.path.basename(imgPred_name)
AdjacentTilesDim = args.adjtilesdim
imgGT_name = args.groundtruth
output_name = args.output
# Read Pred and GroundTruth images
#print("Reading Pred file...")
imgPred = imageio.imread(imgPred_name)
#print("Reading GroundTruth file...")
imgGT = imageio.imread(imgGT_name)
# Remove NaN border when needed
imgPred_Crop = imgPred
imgGT_Crop = imgGT
if (AdjacentTilesDim == 3):
Border = 1
imgPred_Crop = imgPred[Border:-Border,Border:-Border]
imgGT_Crop = imgGT[Border:-Border,Border:-Border]
elif (AdjacentTilesDim == 5):
Border = 2
imgPred_Crop = imgPred[Border:-Border,Border:-Border]
imgGT_Crop = imgGT[Border:-Border,Border:-Border]
# Quality control - NaN
TestNaN_imgPred_Crop = np.any(np.isnan(imgPred_Crop))
TestNaN_imgGT_Crop = np.any(np.isnan(imgGT_Crop))
# # List indices with Nan values
# ListNaN_imgPred_Crop = np.argwhere(np.isnan(imgPred_Crop))
# print('ListNaN_imgPred_Crop: ', ListNaN_imgPred_Crop)
# Verbose mode
if args.verbose:
# print('imgPred type: ', imgPred.dtype)
print('imgPred shape: ', imgPred.shape)
# print('imgGT type: ', imgGT.dtype)
print('imgGT shape: ', imgGT.shape)
print('imgPred_Crop shape: ', imgPred_Crop.shape)
print('imgGT_Crop shape: ', imgGT_Crop.shape)
print('TestNaN_imgPred_Crop: ', TestNaN_imgPred_Crop)
print('TestNaN_imgGT_Crop: ', TestNaN_imgGT_Crop)
# Compute RMSE
rmse = mean_squared_error(imgGT_Crop, imgPred_Crop, squared=False)
print('rmse: ',rmse)
QC_data = np.array([[imgPred_basename,rmse]])
Columns = ['FileName','RMSE']
df = pd.DataFrame(QC_data,columns=Columns)
print(df.head())
df.to_csv(output_name, index=False)
Time2 = time.time()
#print(bcolors.BOLDWHITE+"Time2: "+str(Time2)+bcolors.ENDC)
TimeDiff = Time2 - Time1
#print("Computing Time: "+str(TimeDiff))
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
#!/usr/bin/env python3
import imageio
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
import sys
import argparse
import time
import os
def arg_parser():
parser = argparse.ArgumentParser(description='Data analysis - RMSE computation')
required = parser.add_argument_group('Required')
required.add_argument('--pred', type=str, required=True,
help='Prediction TIFF file (single layer)')
required.add_argument('--groundtruth', type=str, required=True,
help='Ground Truth TIFF file (single layer)')
required.add_argument('--confidence', type=str, required=True,
help='Confidence TIFF file (single layer)')
required.add_argument('--disp_lma', type=str, required=True,
help='LMA disparity TIFF file (single layer)')
required.add_argument('--adjtilesdim', type=int, required=True,
help='Adjacent tiles dimensions (e.g. 1, 3 or 5) to exclude NaN border')
required.add_argument('--output', type=str, required=True,
help='CSV file')
options = parser.add_argument_group('Options')
options.add_argument('--threshold', type=float, default = 0.15,
help='threshold on confidence map')
options.add_argument('--output_mask', type=str,
help='output mask image (TIFF file)')
options.add_argument('--verbose', action="store_true",
help='verbose mode')
return parser
# Remove NaN border
def cropping(img, border):
if border == 0:
return img
else:
img_cropped = img[border:-border,border:-border]
return img_cropped
#MAIN
def main(args=None):
args = arg_parser().parse_args(args)
Time1 = time.time()
#print(bcolors.BOLDWHITE+"Time1: "+str(Time1)+bcolors.ENDC)
imgPred_name = args.pred
imgPred_basename = os.path.basename(imgPred_name)
AdjacentTilesDim = args.adjtilesdim
imgGT_name = args.groundtruth
imgDispLMA_name = args.disp_lma
imgConfidence_name = args.confidence
output_name = args.output
outputmask_name = args.output_mask
threshold = args.threshold
# Read images
#print("Reading Pred file...")
imgPred = imageio.imread(imgPred_name)
#print("Reading GroundTruth file...")
imgGT = imageio.imread(imgGT_name)
#print("Reading Confidence file...")
imgConfidence = imageio.imread(imgConfidence_name)
#print("Reading DispLMA file...")
imgDispLMA = imageio.imread(imgDispLMA_name)
# Remove NaN border when needed
if (AdjacentTilesDim == 3):
Border = 1
elif (AdjacentTilesDim == 5):
Border = 2
else:
Border = 0
imgPred_Crop = cropping(imgPred, Border)
imgGT_Crop = cropping(imgGT, Border)
imgConfidence_Crop = cropping(imgConfidence, Border)
imgDispLMA_Crop = cropping(imgDispLMA, Border)
# Quality control - NaN
TestNaN_imgPred_Crop = np.any(np.isnan(imgPred_Crop))
TestNaN_imgGT_Crop = np.any(np.isnan(imgGT_Crop))
# # List indices with Nan values
# ListNaN_imgPred_Crop = np.argwhere(np.isnan(imgPred_Crop))
# print('ListNaN_imgPred_Crop: ', ListNaN_imgPred_Crop)
# Verbose mode
if args.verbose:
# print('imgPred type: ', imgPred.dtype)
print('imgPred shape: ', imgPred.shape)
# print('imgGT type: ', imgGT.dtype)
print('imgGT shape: ', imgGT.shape)
print('imgPred_Crop shape: ', imgPred_Crop.shape)
print('imgGT_Crop shape: ', imgGT_Crop.shape)
print('TestNaN_imgPred_Crop: ', TestNaN_imgPred_Crop)
print('TestNaN_imgGT_Crop: ', TestNaN_imgGT_Crop)
# Define sample_weight using Confidence and DispLMA maps
imgDispLMAMask_Crop = np.uint8(np.reshape(~np.isnan(imgDispLMA_Crop), imgDispLMA_Crop.shape))
imgConfidenceMask_Crop = np.uint8(np.where(imgConfidence_Crop >= threshold, 1, 0))
imgSampleWeight_Crop = np.uint8(np.logical_and(imgDispLMAMask_Crop, imgConfidenceMask_Crop))
if outputmask_name is not None:
imageio.imwrite(outputmask_name, imgSampleWeight_Crop * 255)
# Compute RMSE
rmse = mean_squared_error(imgGT_Crop, imgPred_Crop, sample_weight=imgSampleWeight_Crop, squared=False)
print('rmse: ',rmse)
QC_data = np.array([[imgPred_basename,rmse]])
Columns = ['FileName','RMSE']
df = pd.DataFrame(QC_data,columns=Columns)
#print(df.head())
print('Saving CSV file...')
df.to_csv(output_name, index=False)
Time2 = time.time()
#print(bcolors.BOLDWHITE+"Time2: "+str(Time2)+bcolors.ENDC)
TimeDiff = Time2 - Time1
#print("Computing Time: "+str(TimeDiff))
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
#!/usr/bin/env python3
import imageio
import numpy as np
import pandas as pd
from sklearn.metrics import mean_squared_error
import sys
import argparse
import time
import os
def arg_parser():
parser = argparse.ArgumentParser(description='Data analysis - RMSE computation')
required = parser.add_argument_group('Required')
required.add_argument('--pred', type=str, required=True,
help='Prediction TIFF file (single layer)')
required.add_argument('--groundtruth', type=str, required=True,
help='Ground Truth TIFF file (single layer)')
required.add_argument('--adjtilesdim', type=int, required=True,
help='Adjacent tiles dimensions (e.g. 1, 3 or 5) to exclude NaN border')
required.add_argument('--output', type=str, required=True,
help='CSV file')
options = parser.add_argument_group('Options')
options.add_argument('--threshold', type=float, default = 2.0,
help='threshold on image difference')
options.add_argument('--output_mask', type=str,
help='output mask image (TIFF file)')
options.add_argument('--verbose', action="store_true",
help='verbose mode')
return parser
# Remove NaN border
def cropping(img, border):
if border == 0:
return img
else:
img_cropped = img[border:-border,border:-border]
return img_cropped
#MAIN
def main(args=None):
args = arg_parser().parse_args(args)
Time1 = time.time()
#print(bcolors.BOLDWHITE+"Time1: "+str(Time1)+bcolors.ENDC)
imgPred_name = args.pred
imgPred_basename = os.path.basename(imgPred_name)
AdjacentTilesDim = args.adjtilesdim
imgGT_name = args.groundtruth
output_name = args.output
outputmask_name = args.output_mask
threshold = args.threshold
# Read images
#print("Reading Pred file...")
imgPred = imageio.imread(imgPred_name)
#print("Reading GroundTruth file...")
imgGT = imageio.imread(imgGT_name)
# Remove NaN border when needed
if (AdjacentTilesDim == 3):
Border = 1
elif (AdjacentTilesDim == 5):
Border = 2
else:
Border = 0
imgPred_Crop = cropping(imgPred, Border)
imgGT_Crop = cropping(imgGT, Border)
# Quality control - NaN
TestNaN_imgPred_Crop = np.any(np.isnan(imgPred_Crop))
TestNaN_imgGT_Crop = np.any(np.isnan(imgGT_Crop))
# # List indices with Nan values
# ListNaN_imgPred_Crop = np.argwhere(np.isnan(imgPred_Crop))
# print('ListNaN_imgPred_Crop: ', ListNaN_imgPred_Crop)
# Verbose mode
if args.verbose:
# print('imgPred type: ', imgPred.dtype)
print('imgPred shape: ', imgPred.shape)
# print('imgGT type: ', imgGT.dtype)
print('imgGT shape: ', imgGT.shape)
print('imgPred_Crop shape: ', imgPred_Crop.shape)
print('imgGT_Crop shape: ', imgGT_Crop.shape)
print('TestNaN_imgPred_Crop: ', TestNaN_imgPred_Crop)
print('TestNaN_imgGT_Crop: ', TestNaN_imgGT_Crop)
# Define sample_weight, where absolute difference is below threshold (2 pixels), to remove outliers
imgAbsDiff_Crop = np.absolute(imgPred_Crop - imgGT_Crop)
imgSampleWeight_Crop = np.uint8(np.where(imgAbsDiff_Crop < threshold, 1, 0))
if outputmask_name is not None:
imageio.imwrite(outputmask_name, imgSampleWeight_Crop * 255)
# Compute RMSE
rmse = mean_squared_error(imgGT_Crop, imgPred_Crop, sample_weight=imgSampleWeight_Crop, squared=False)
print('rmse: ',rmse)
QC_data = np.array([[imgPred_basename,rmse]])
Columns = ['FileName','RMSE_WithThreshold']
df = pd.DataFrame(QC_data,columns=Columns)
#print(df.head())
print('Saving CSV file...')
df.to_csv(output_name, index=False)
Time2 = time.time()
#print(bcolors.BOLDWHITE+"Time2: "+str(Time2)+bcolors.ENDC)
TimeDiff = Time2 - Time1
#print("Computing Time: "+str(TimeDiff))
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
This diff is collapsed.
#!/usr/bin/env python3
import imageio
import numpy as np
import sys
import argparse
import time
def arg_parser():
parser = argparse.ArgumentParser(description='Combine images to generate 3D volume')
required = parser.add_argument_group('Required')
required.add_argument('--corr', type=str, required=True,
help='2D Corr TIFF file (multi-layer)')
required.add_argument('--targetdisp', type=str, required=True,
help='Target Disparity TIFF file (single layer)')
required.add_argument('--groundtruth', type=str, required=True,
help='Ground Truth TIFF file (single layer)')
required.add_argument('--confidence', type=str, required=True,
help='Confidence TIFF file (single layer)')
required.add_argument('--disp_lma', type=str, required=True,
help='LMA Disparity TIFF file (single layer)')
required.add_argument('--output', type=str, required=True,
help='Combined TIFF file (multi-layer)')
options = parser.add_argument_group('Options')
options.add_argument('--repeat', type=int, default=15,
help='Repeat tile number (default 15)')
return parser
#MAIN
def main(args=None):
args = arg_parser().parse_args(args)
Time1 = time.time()
#print(bcolors.BOLDWHITE+"Time1: "+str(Time1)+bcolors.ENDC)
img2DCorr_name = args.corr
imgTargetDisp_name = args.targetdisp
imgGT_name = args.groundtruth
imgConfidence_name = args.confidence
imgDispLMA_name = args.disp_lma
output_name = args.output
repeatNb = args.repeat
# Read 2dcorr image - all layers
print("Reading 2dcorr file...")
img2DCorr = imageio.mimread(img2DCorr_name,memtest=False)
img2DCorr = np.array(img2DCorr)
# print('\nimg2DCorr type: ', img2DCorr.dtype)
# print('img2DCorr shape: ', img2DCorr.shape)
# Read TargetDisp and GroundTruth images
print("Reading TargetDisp file...")
imgTargetDisp = imageio.imread(imgTargetDisp_name)