Beispiel #1
0
def scale_down_image(in_image, out_image, scale_factor):
    """Read in the data from in_image, apply the statistically valid scale factor
    to the data & write this out as out_image; retain the header as we go."""

    image, header = read_image_to_flex_array(in_image)
    scaled_image = scale_down_array(image.as_1d(), scale_factor)

    write_image_from_flex_array(out_image, scaled_image, header)
Beispiel #2
0
def scale_down_image(in_image, out_image, scale_factor):
    """Read in the data from in_image, apply the statistically valid scale factor
    to the data & write this out as out_image; retain the header as we go."""

    image, header = read_image_to_flex_array(in_image)
    scaled_image = scale_down_array(image.as_1d(), scale_factor)
    from scitbx.array_family import flex

    sum_image = flex.sum(image.as_1d().select(image.as_1d() > 0))
    sum_scaled_image = flex.sum(scaled_image.select(scaled_image > 0))
    write_image_from_flex_array(out_image, scaled_image, header)