The Thymus gland
The thymus gland, despite containing glandular tissue and producing several hormones, is much more closely associated with the immune system than with the endocrine system. The thymus serves a vital role in the training and development of T-lymphocytes or T cells, an extremely important type of white blood cell. T cells defend the body from potentially deadly pathogens such as bacteria, viruses, and fungi.
The thymus is a soft, roughly triangular organ located in the mediastinum of the thoracic cavity anterior and superior to the heart and posterior to the sternum.
It has two distinct but identical lobes that are each surrounded by a tough, fibrous capsule. Within each lobe is a superficial region of tissue called the cortex and a histologically distinct deep region called the medulla. Epithelial tissues and lymphatic tissues containing dendritic cells and macrophages make up the majority of both regions of the thymus.
The function of the thymus is to receive immature T cells that are produced in the red bone marrow and train them into functional, mature T cells that attack only foreign cells. T cells first reside in the cortex of the thymus where they come in contact with epithelial cells presenting various antigens. The immature T cells that respond to the antigens corresponding to foreign cells are selected to survive, mature, and migrate to the medulla while the rest die via apoptosis and are cleaned up by macrophages. This process is known as positive selection.