function rs = normlz(data)
data = single(data);
dmin = min(min(data(:)));
dmax = max(max(data(:)));
if (dmin == dmax) && (dmax == 0)
    rs = data;
else
    if isa(data, 'double')
        rs  = double((data-dmin) / (dmax-dmin) * 255);
    elseif isa(data, 'single')
        rs  = single((data-dmin) / (dmax-dmin) * 255);
    elseif isa(data, 'uint8')
        rs  = uint8((data-dmin) / (dmax-dmin) * 255);
    else
        rs  = uint8((data-dmin) / (dmax-dmin) * 255);
    end
end