def merge_pile_into_mosaic(mosaic_ds,
pile_md_filename,
selected_i,
selected_img,
processing_options):
pile_parts = os.path.basename(pile_md_filename).split('_')[0:3]
assert pile_parts[0] == 'uf'
uf_i = int(pile_parts[1])
uf_j = int(pile_parts[2])
if processing_options.get('normalize_intensity',False):
pile_md = json.load(open(pile_md_filename))
selected_img = selected_img * 1000.0 \
/ pile_md['intensity_median'][selected_i]
mosaic_ds.GetRasterBand(1).WriteArray(
selected_img, uf_i * 256, uf_j * 256)
alpha_band = mosaic_ds.GetRasterBand(mosaic_ds.RasterCount)
if alpha_band.GetColorInterpretation() == gdal.GCI_AlphaBand:
if alpha_band.DataType == gdal.GDT_UInt16:
opaque = 65535
else:
opaque = 255
alpha_band.WriteArray(
numpy.ones(selected_img.shape) * opaque,
uf_i * 256, uf_j * 256)
评论列表
文章目录