An algorithm for the segmentation of head contour from MR images is presented. It is a generalization of the conventional algorithm which demands background noise to be localized at the lower end of the grayscale. This requirement is a limitation of the conventional algorithm which could not determine the head contour from images acquired using our acquisition protocol. The acquisition protocol provides excellent gray-white contrast and is described here. The present algorithm does not require noise to be distributed in the lower intensity range. Identification of the noise distribution is followed by a thresholding of the histogram to produce binary mask for the foreground of the image that is the head contour. The algorithm is quite general and can be used in wide variety of image data since it is able to locate the noise distribution in any intensity level. Thus the presented algorithm is robust with respect to variation of noise distribution over the entire intensity range.