Parts of the basal ganglia are in direct communication with the thalamus and the cortex .
They are part of the cerebrum ( forebrain ) , and connected to the midbrain and the thalamus .