(
        self,
        width,
        height,
        tilesize=256,
        tileformat='jpg',
        )
Initialization of the Zoomify tile tree
Initialization of the Zoomify tile tree
Initialization of the Zoomify tile tree
def __init__(
        self,
        width,
        height,
        tilesize=256,
        tileformat='jpg',
        ):
        """Initialization of the Zoomify tile tree"""

        self.tilesize = tilesize
        self.tileformat = tileformat
        imagesize = (width, height)
        tiles = (math.ceil(width / tilesize), math.ceil(height
                 / tilesize))

        # Size (in tiles) for each tier of pyramid.

        self.tierSizeInTiles = []
        self.tierSizeInTiles.push(tiles)

        # Image size in pixels for each pyramid tierself

        self.tierImageSize = []
        self.tierImageSize.append(imagesize)

        while imagesize[0] > tilesize or imageSize[1] > tilesize:
            imagesize = (math.floor(imagesize[0] / 2),
                         math.floor(imagesize[1] / 2))
            tiles = (math.ceil(imagesize[0] / tilesize),
                     math.ceil(imagesize[1] / tilesize))
            self.tierSizeInTiles.append(tiles)
            self.tierImageSize.append(imagesize)

        self.tierSizeInTiles.reverse()
        self.tierImageSize.reverse()

        # Depth of the Zoomify pyramid, number of tiers (zoom levels)

        self.numberOfTiers = len(self.tierSizeInTiles)

        # Number of tiles up to the given tier of pyramid.

        self.tileCountUpToTier = []
        self.tileCountUpToTier[0] = 0
        for i in range(1, self.numberOfTiers + 1):
            self.tileCountUpToTier.append(self.tierSizeInTiles[i
                    - 1][0] * self.tierSizeInTiles[i - 1][1]
                    + self.tileCountUpToTier[i - 1])
def __init__ ( self , width , height , tilesize = 256 , tileformat = 'jpg' , ) : self . tilesize = tilesize self . tileformat = tileformat imagesize = ( width , height ) tiles = ( math . ceil ( width / tilesize ) , math . ceil ( height / tilesize ) ) # Size (in tiles) for each tier of pyramid. self . tierSizeInTiles = [ ] self . tierSizeInTiles . push ( tiles ) # Image size in pixels for each pyramid tierself self . tierImageSize = [ ] self . tierImageSize . append ( imagesize ) while imagesize [ 0 ] > tilesize or imageSize [ 1 ] > tilesize : imagesize = ( math . floor ( imagesize [ 0 ] / 2 ) , math . floor ( imagesize [ 1 ] / 2 ) ) tiles = ( math . ceil ( imagesize [ 0 ] / tilesize ) , math . ceil ( imagesize [ 1 ] / tilesize ) ) self . tierSizeInTiles . append ( tiles ) self . tierImageSize . append ( imagesize ) self . tierSizeInTiles . reverse ( ) self . tierImageSize . reverse ( ) # Depth of the Zoomify pyramid, number of tiers (zoom levels) self . numberOfTiers = len ( self . tierSizeInTiles ) # Number of tiles up to the given tier of pyramid. self . tileCountUpToTier = [ ] self . tileCountUpToTier [ 0 ] = 0 for i in range ( 1 , self . numberOfTiers + 1 ) : self . tileCountUpToTier . append ( self . tierSizeInTiles [ i - 1 ] [ 0 ] * self . tierSizeInTiles [ i - 1 ] [ 1 ] + self . tileCountUpToTier [ i - 1 ] )