def windowing(im1, win):
        """scale intensity from win[0]~win[1] to float numbers in 0~255"""
        # im1 = im.astype(float)
        im1 -= win[0]
        im1 /= win[1] - win[0]
        im1[im1 > 1] = 1
        im1[im1 < 0] = 0
        im1 *= 255
        im1 -= 50
        return im1