AddLat2D / Data_Generation /Dataset_Generation_Functions.py
marta-marta's picture
First commit
60acf32
raw
history blame
1.51 kB
import numpy as np
########################################################################################################################
# Make the data using all the code in Shape_Generation_Functions.py
def make_boxes(image_size, densities, shapes):
"""
:param image_size: [int] - the pixel height and width of the generated arrays
:param densities: [list] - of the values of each of the active pixels in each shape
:param shapes: [list] - of the various shapes desired for the dataset
:return: [list[tuple]] - [Array, Density, Thickness, Shape]
"""
matrix = []
for function in shapes: # Adds different types of shapes
# Adds different density values
for i in range(len(densities)):
# Loops through the possible thickness values
for j in range(image_size): # Adds additional Pixels
thickness = j
Array = (function(thickness, densities[i], image_size))
# Checks if there are any 0's left in the array to append
if (np.where((Array == float(0)))[0] > 0).any():
the_tuple = (Array, str(function.__name__), densities[i], thickness)
matrix.append(the_tuple)
# Prevents solids shapes from being appended to the array
else:
break
return matrix
########################################################################################################################