This paper proposes a method for extracting a trabecular bone region from medical images of bones, which can be later used for diagnosing patients suffering from osteoporosis. This approach is fully automatic and does not require operator input; it can be used on two types of bones: long bones and vertebrae. The first step is segmenting the medical image, which leaves only the cortical bone, then a contour is created inside the cortical bone, which adapts to the edges of the cortical bone and ignores the holes that could appear in the cortical bone, thus extracting the trabecular bone that is located inside the cortical bone.