def test_save_image(): img1 = readsis.read('img/PIC1.sis').astype(np.int_) img2 = readsis.read('img/PIC2.sis').astype(np.int_) img3 = readsis.read('img/PIC3.sis').astype(np.int_) d = calc_img(img1, img2, img3) img_trans = d['transmission'] save_trans_img('img/test_transmission.png', d) save_trans_img('img/test_transmission.png', d) save_raw_img('img/test_PIC1.png', img1)
def convert_png_writer(sisfilename, pngfilename): import png_writer img = readsis.read(sisfilename) png_writer.PngWriter(pngfilename, img, transparent = 0, significant_bits = 13, compression = 1, metadata = {'Author': 'Gregor Thalhammer', 'Title': 'absorption image', 'Software': 'sistopng', 'Source': 'SIS285', 'image type': 'optical density', 'scale optical density': 1000, 'format version': 1}, )
def convert_PIL(sisfilename, pngfilename): img = readsis.read(sisfilename) img_pil = Image.fromstring('I', (img.shape[1], img.shape[0]), img.tostring(), 'raw', 'I;16N', 0, 1) img_pil.save(pngfilename, bits=16) print sisfilename, 'converted'