def dcm_scale(dcm):
    """Transform from raw pixel data to scaled one and inversing (if the case)"""

    if dcm.PhotometricInterpretation == "MONOCHROME1":
        return (dcm.scaled_px.max() - dcm.scaled_px) / (2 ** dcm.BitsStored - 1)
    else:
        return dcm.scaled_px / (2 ** dcm.BitsStored - 1)