Added spatial dimension template to the LeafNode

For now, everything is set to 3 except for some tests of the NodeMask.
Here though, two are failing when spatial dimension is reduced to 2.