% --------------------------------------------------------------------------- % Function grdisp() % -- Xenios Papademetris papad@noodle.med.yale.edu 5th Sep 1995 % % -- used to display images stored as matrices % -- scales graylevls to 1..64 range for display within matlab % -- check for zero image lhs 2/2000 % --------------------------------------------------------------------------- function grdisp(img) % --------------------------------------------------------------------------- % Step 1 -- Check for right number of parameters % --------------------------------------------------------------------------- if nargin ~= 1 error('Requires one input argument e.g. grdisp(img)'); end % --------------------------------------------------------------------------- % Step 2 - Scale image to make it in displayable range % --------------------------------------------------------------------------- temp=img; temp=temp-min(min(img)); imax = max(max(temp)); if imax~=0 temp=temp*64/imax; else disp('Zero image'); end % --------------------------------------------------------------------------- % Step 3 - Display Image and set colormap to grayscale % --------------------------------------------------------------------------- image(temp); colormap(gray); axis image; % ---------------------------------------------------------------------------