Python script for threshold based Bone segmentation

Is there a python script or function to run threshold based segmentation for Bones after the DICOM file is loaded into slicer? Thanks.

I think you can make it yourself with some python scripting