Alexander,
According to your error log, you are using global variables inside a function which is creating this error. Kindly go through the grader cell before get_Sub volume and check where you must have done this and do the correction.
In this code while randomly sampling you misplaced or mixed(incorrect code) the output with your sampling. Check the first 3 code lines, you will get what mistake you have done. you needs randomly sample from the same sub volume and don’t mix it y with x or z with x while randomly sampling.
while tries < max_tries:
# randomly sample sub-volume by sampling the corner voxel
# hint: make sure to leave enough room for the output dimensions!
# do not remove/delete the '0’s
start_y = …(…, … - …_x + …)???
start_z = …(…, …-…_x + …)???
If unable to find, then send me the notebook
Regards
DP