コード例 #1
0
 def _create_pil_image(self, index_range):
     """
     Create the PIL image for the new dendrogram.
     @param row_range: the begin and end indices
     """
     # create the stable subtree
     begin, end = index_range
     ordered_tips = self.root.ordered_tips()
     leaves = [ordered_tips[i] for i in range(begin, end)]
     cloned = mtree.leaves_to_subtree(self.root, leaves)
     # create the dendrogram PIL image
     self.nleaves = len(leaves)
     blocksize = self.npixels / self.nleaves
     breadth_gap = blocksize - 1
     height_gap = 3
     image_height = self.npixels
     image_width = dendro.get_dendrogram_height(cloned, height_gap)
     self.im = Image.new('RGBA', (image_width, image_height), (0, 0, 0, 0))
     dendro.draw_dendrogram(cloned, breadth_gap, height_gap, self.on_draw_line)
コード例 #2
0
 def _create_pil_image(self, index_range):
     """
     Create the PIL image for the new dendrogram.
     @param row_range: the begin and end indices
     """
     # create the stable subtree
     begin, end = index_range
     ordered_tips = self.root.ordered_tips()
     leaves = [ordered_tips[i] for i in range(begin, end)]
     cloned = mtree.leaves_to_subtree(self.root, leaves)
     # create the dendrogram PIL image
     breadth_gap = 0
     height_gap = 3
     image_height = self.npixels
     image_width = dendro.get_dendrogram_height(cloned, height_gap)
     self.im = Image.new('RGBA', (image_width, image_height), (0, 0, 0, 0))
     dendro.draw_dendrogram(cloned, breadth_gap, height_gap, self.on_draw_line)
     # it would be possible to draw this directly instead of flipping it
     self.im = self.im.transpose(Image.ROTATE_90)
     self.im = self.im.transpose(Image.FLIP_TOP_BOTTOM)