function Image = height2ind(Header, Height) %HEIGHT2IND Convert the height values in nm into image data. % % K = HEIGHT2IND(HEADER, HEIGHT) % % return a matrix of the same size as HEIGHT % containing the image data. % The trasformation has done on the basis of the % formulas reported on pag 85 of the STM manual. % % See also ... % % M. Young 6 Feb., 1995 % % if it is an imported image and alex added the Trasform Factor % parameter to the header. % % If the message Image data UNKNOWN appears you should add to this function % the appropriate transformation of your data. % % Copyright (c) 1995 by Claudio Rivetti and Mark Young % claudio@alice.uoregon.edu, mark@alice.uoregon.edu % fact=getparameter(Header, 'Trasform. Factor', 1); if fact ~= inf & ~isempty(fact) Image = Height / fact; return; end if getparameter(Header, 'Version',1) ~= inf %is a version 4 file format [zs, u]=zscale(Header); Image=Height*(65536/zs); return; end % Get the image type Imtype = getparameter(Header, 'Image data',1); if strcmp(Imtype, 'Height') == 1 %for Height data q = getparameter(Header, 'Z scale',1); if q==inf Zscale = getparameter(Header, 'Z scale height', 1); else i = q(1)+2; Zscale = q(i); end Zatten = getparameter(Header, 'Z atten.', 1); Zmax = getparameter(Header, 'Z max', 1); Zsens = getparameter(Header, 'Z sensitivity', 1); fact = ((Zscale*Zatten/65536) * (Zmax*2/65536*Zsens))/65536; Image = Height / fact; elseif strcmp(Imtype, 'Deflection') == 1 %for deflection data % I don't know what is Graph range Grange = getparameter(Header, 'Graph range', 1); In1max = getparameter(Header, 'In1 max', 1); % this is string Insens = getparameter(Header, 'In sensitivity', 1); Insens = sscanf(Insens, '%f'); Detectsens = getparameter(Header, 'Detect sens.', 1); fact = ((Grange*In1max*2/65536) * (Insens/Detectsens))/65536; Image = Height / fact; else message('Image data UNKNOWN.|Please check the functions:| ind2height.m and height2ind.m||Data converted between 0 32000'); Image=Height*32000; end return