Short answer
Nothing is wrong, this is how DICOM works.
Long answer
In DICOM standard, pixel value is not directly related to its color (gray level). These values should correspond to physical properties of the acquired item (e.g. in Computed Tomography pixel values are measured in Hounsfield Units. *(unless they are linearly rescaled, see below)).
Gray level of the pixel image is displayed dynamically based on arbitrary chosen minimal and maximal values, which are set by the user. Every pixel value less or equal minimum is black, every pixel greater or equal maximum is white, the others are linearly interpolated gray levels.
So it is perfectly fine that in binary image black minimum is equal to 32766 and white maximum is equal to 32767.
If you use DICOM viewer, you will have possibility to change dynamically these minimal and maximal values, so you will change total contrast and brightness of the image. It is necessary for radiologists, to diagnose e.g. lungs and bones in different ranges. And if you export DICOM to other file format, you should choose, what is the color mapping. Normally it is full range (the lowest value gets black, the brightest gets white).
There are two other values, which are often used instead of minimum and maximum: "window width" (ww) and "window level" (wl). ww = max-min
, wl=(max+min)/2
.
You should look at these questions and answers:
*you should also consider tags "rescale intercept" (0028,1052), and "rescale slope" (0028,1053), that lineary rescale value of pixel array to the final value, but normally it is implemented in dicom toolkit.
FinalPixelValue = (RawPixelValue * RescaleSlope) + RescaleIntercept