You have a couple of options here. One way would be to read the entire file into memory into some kind of array, and then build the quadtree top-down from there. This is probably the most straightforward way to do this, as long as the map is not extremely huge.
Another option would be to build the tree bottom-up from each individual node at the bottom, then once you have parsed enough nodes to form a parent node from what you have read, do so. In this example, you would form leaf nodes for each value read. Then on even columns on even rows, after you have formed your leaf node, form your second-level nodes from there.
You will get this kind of structure:
1 1 1 1 1 1 1 1
1 2 1 2 1 2 1 2
1 1 1 1 1 1 1 1
1 2 1 3 1 2 1 3
1 1 1 1 1 1 1 1
1 2 1 2 1 2 1 2
1 1 1 1 1 1 1 1
1 2 1 3 1 2 1 4
Each number represents the highest level of node to form once reading the number in that position. Also form all levels below each (i.e. on level 3, also form a level 2 node and a leaf (level 1) node).