484 |
height = int(min(height, round(fmax[1] - fmin[1] + 1))) |
height = int(min(height, round(fmax[1] - fmin[1] + 1))) |
485 |
|
|
486 |
try: |
try: |
487 |
|
options = 0 |
488 |
|
if layer.UseMask(): options = options | 1 |
489 |
|
|
490 |
project_params = (layer.GetImageFilename(), in_proj, out_proj, |
project_params = (layer.GetImageFilename(), in_proj, out_proj, |
491 |
(xmin, ymin, xmax, ymax), "", (width, height), |
(xmin, ymin, xmax, ymax), "", (width, height), |
492 |
layer.UseMask()) |
options) |
493 |
|
|
494 |
data = (width, height, apply(ProjectRasterFile, project_params)) |
data = (width, height, apply(ProjectRasterFile, project_params)) |
495 |
|
|
496 |
except (IOError, AttributeError, ValueError): |
except (MemoryError, IOError, AttributeError, ValueError): |
497 |
# Why does this catch AttributeError and ValueError? |
# Why does this catch AttributeError and ValueError? |
498 |
# FIXME: The exception should be communicated to the user |
# FIXME: The exception should be communicated to the user |
499 |
# better. |
# better. |
510 |
(width, height, (image_data, mask_data)) |
(width, height, (image_data, mask_data)) |
511 |
|
|
512 |
holding the image width, height, image data, and mask data. |
holding the image width, height, image data, and mask data. |
513 |
mask_data may be None if a mask should not be used. Both kinds |
mask_data may be None if a mask should not be used. If |
514 |
|
format is 'RAW' the data will be RGB values and the mask |
515 |
|
will be in XMB format. Otherwise, both kinds |
516 |
of data are assumed to be in the format specified in format. |
of data are assumed to be in the format specified in format. |
517 |
|
|
518 |
The format parameter is a string with the name of the format. |
The format parameter is a string with the name of the format. |