class_docstr: The :obj:`Layout` class id designed for processing a list of layout elements
  on a page. It stores the layout elements in a list and the related `page_data`,
  and provides handy APIs for processing all the layout elements in batch. `
  
  Args:
      blocks (:obj:`list`):
          A list of layout element blocks
      page_data (Dict, optional):
          A dictionary storing the page (canvas) related information
          like `height`, `width`, etc. It should be passed in as a
          keyword argument to avoid any confusion.
          Defaults to None.
class_docstr_tok: ["The",":","obj",":","`","Layout","`","class","id","designed","for","processing","a","list","of","layout","elements","on","a","page",".","It","stores","the","layout","elements","in","a","list","and","the","related","`","page_data","`",",","and","provides","handy","APIs","for","processing","all","the","layout","elements","in","batch",".","`","Args",":","blocks","(",":","obj",":","`","list","`",")",":","A","list","of","layout","element","blocks","page_data","(","Dict",",","optional",")",":","A","dictionary","storing","the","page","(","canvas",")","related","information","like","`","height","`",",","`","width","`",",","etc",".","It","should","be","passed","in","as","a","keyword","argument","to","avoid","any","confusion",".","Defaults","to","None","."]
docstr: Convert all elements into blocks of the same type based
  on the type casting rule::
  
      Interval < Rectangle < Quadrilateral < TextBlock
  
  Returns:
      List[BaseLayoutElement]:
          A list of base layout elements of the maximal compatible
          type
docstr_tok: ["Convert","all","elements","into","blocks","of","the","same","type","based","on","the","type","casting","rule",":",":","Interval","<","Rectangle","<","Quadrilateral","<","TextBlock","Returns",":","List","[","BaseLayoutElement","]",":","A","list","of","base","layout","elements","of","the","maximal","compatible","type"]
code: def get_homogeneous_blocks(self) -> List[BaseLayoutElement]:
      """Convert all elements into blocks of the same type based
      on the type casting rule::
  
          Interval < Rectangle < Quadrilateral < TextBlock
  
      Returns:
          List[BaseLayoutElement]:
              A list of base layout elements of the maximal compatible
              type
      """
  
      # Detect the maximal compatible type
      has_textblock = False
      max_coord_level = -1
      for ele in self:
          if isinstance(ele, TextBlock):
              has_textblock = True
              block = ele.block
          else:
              block = ele
  
          max_coord_level = max(
              max_coord_level, BASECOORD_ELEMENT_INDEXMAP[block._name]
          )
      target_coord_name = ALL_BASECOORD_ELEMENTS[max_coord_level]._name
  
      if has_textblock:
          new_blocks = []
          for ele in self:
              if isinstance(ele, TextBlock):
                  ele = copy(ele)
                  if ele.block._name != target_coord_name:
                      ele.block = getattr(
                          ele.block, f"to_{target_coord_name}"
                      )()
              else:
                  if ele._name != target_coord_name:
                      ele = getattr(ele, f"to_{target_coord_name}")()
                  ele = TextBlock(block)
              new_blocks.append(ele)
      else:
          new_blocks = [
              getattr(ele, f"to_{target_coord_name}")()
              if ele._name != target_coord_name
              else ele
              for ele in self
          ]
  
      return new_blocks
  
imports: from typing import List, Union, Dict, Dict, Any, Optional
  from collections.abc import MutableSequence, Iterable
  from copy import copy
  import pandas
  from .base import BaseCoordElement, BaseLayoutElement
  from .layout_elements import Interval, Rectangle, Quadrilateral, TextBlock, ALL_BASECOORD_ELEMENTS, BASECOORD_ELEMENT_NAMEMAP, BASECOORD_ELEMENT_INDEXMAP
label_desc: Use image node_id 24 for calling the Layout obj's underlying member method code with example usage: obj.get_homogeneous_blocks() and returns: new_blocks