Skip to content

Commit

Permalink
Don't zero-pad image in get_numpy_dataset() if the source array is al…
Browse files Browse the repository at this point in the history
…ready zero-padded
  • Loading branch information
grisaitis committed Oct 20, 2016
1 parent ddc6834 commit 66ca135
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion data_io/dataset_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ def get_numpy_dataset(original_dataset, input_slice, output_slice, transform):
image_slices = [slice(0, l) for l in original_dataset['data'].shape]
image_slices[-n_spatial_dimensions:] = input_slice
logger.debug("image_slices: {}".format(image_slices))
source_image = get_zero_padded_array_slice(original_dataset['data'], image_slices)
image_is_zero_padded = original_dataset.get("image_is_zero_padded", False)
if image_is_zero_padded:
source_image = original_dataset["data"][image_slices]
else:
source_image = get_zero_padded_array_slice(original_dataset['data'], image_slices)
image = np.array(source_image, dtype=np.float32)
image_scaling_factor = original_dataset.get('image_scaling_factor', None)
if image_scaling_factor is None and source_image.dtype.kind in ('i', 'u'): # integer, signed or unsigned
Expand Down

0 comments on commit 66ca135

Please sign in to comment.