Simplify loops
The idea was initially in the context of #62 to optimize execution speed.
This commit is contained in:
		@@ -30,14 +30,15 @@ rmss = []
 | 
			
		||||
minColor = None
 | 
			
		||||
maxColor = None
 | 
			
		||||
 | 
			
		||||
returnSingleColorChannelImage = lambda singleColorChannelImage, _minColor, _maxColor: singleColorChannelImage
 | 
			
		||||
 | 
			
		||||
for computeExtremes in tqdm(([True] if minColor is None or maxColor is None else []) + [False], 'Compute extremes'):
 | 
			
		||||
    rescaleIfNeeded = returnSingleColorChannelImage if computeExtremes else rescaleRawImageForDenoiser
 | 
			
		||||
    for subgroupImageIndex in tqdm(range(numberOfImagesPerSubgroup), 'Subgroup image index'):
 | 
			
		||||
        for subgroupIndex in tqdm(range(NUMBER_OF_SUBGROUPS), 'Subgroup'):
 | 
			
		||||
            imageIndex = (subgroupIndex * NUMBER_OF_SUBGROUPS) + subgroupImageIndex
 | 
			
		||||
            imageFileName = imagesFileNames[imageIndex]
 | 
			
		||||
            imageFilePath = f'{IMAGES_FOLDER}/{imageFileName}'
 | 
			
		||||
            returnSingleColorChannelImage = lambda singleColorChannelImage, _minColor, _maxColor: singleColorChannelImage
 | 
			
		||||
            rescaleIfNeeded = returnSingleColorChannelImage if computeExtremes else rescaleRawImageForDenoiser
 | 
			
		||||
            singleColorChannelImages = {color: rescaleIfNeeded(getColorChannel(imageFilePath, color), minColor, maxColor) for color in Color}
 | 
			
		||||
            multipleColorsImage = mergeSingleColorChannelImagesAccordingToBayerFilter(singleColorChannelImages)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user