io - Multipage Tiff write in MATLAB doesn't work -


i'm reading in tiff using below function, works fine, when try use write function write same tiff different file, it's 255's. know how fix this? thanks, alex.

function y = tiff_read(name) % tiff reader works  info = imfinfo(name); t = numel(info);  d1 = info(1).height; d2 = info(1).width;  y = zeros(d1,d2,t); t = 1:t     temp = imread(name, t, 'info',info);     y(:,:,t) = temp(1:end,1:end); end  % tiff writer doesn't work function tiff_write(y,name) % y should 3d, name should end in .tif t = size(y,3); imwrite(y(:,:,1),name); t = 2:t     imwrite(y(:,:,t),name,'writemode','append'); end 

try using line :

y = zeros(d1,d2,t,'uint16'); 

instead of one:

y = zeros(d1,d2,t); 

your data in uint16 format , when export clip maximum value 255 (uint8), makes pixel values greater 255 (a lot of them if data in uint16) appear white.

otherwise might want use line:

function tiff_write(y,name)    % y should 3d, name should end in .tif    t = 2:t      imwrite(y(:,:,t)/255,name,'writemode','append');    end 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -