speeding up tiff writing

I'm trying to write a large (~18,000) frame image stack to a tiff file. See code below :
imgname=[SubDataFolder,...
'/_BG_',num2str(0),'_BGstd_',num2str(0),'_kappa',num2str(kappa),'_run_',num2str(runNum),'.tiff']; % 0 just sets the image name
imwrite(uint16(BgIm160(:, :,1)),imgname); % - writes the first image
disp(['Starting Image Writing Loop for ',imgname]) % - for trouble shooting
for(k=2:num_images) % - writes the rest of the images
imwrite(uint16(BgIm160(:, :, k)),imgname,'WriteMode','append');
fracdone=round((k./num_images)*100) % - shows hoe much is done
%
end
This is taking a REALLY long time, is it just becuase 18k slices is a lot to write in a file (each slice is 200x500), and I just need to be patient, or is there a better/faster way to write this to a .tif file (for later analysis in ImageJ)
thanks

5 comentarios

Walter Roberson
Walter Roberson el 30 de Jul. de 2019
Did you experiment with using Tiff() class?
Jan
Jan el 31 de Jul. de 2019
With some test data I need 10 seconds to write 900 frames with 200x500 pixels on a SSD, and 26 for 1800 frames.
Jeff Spector
Jeff Spector el 31 de Jul. de 2019
I haven't tried the Tiff() class. Will look into that. It may just be that it takes a long time to write that many images. If your SSD took 26 seconds for 1800 frames and I've got 18,000 that could make sense, but I still think it is taking longer than it should, maybe I need to invest in some SSD's :)
Jeff Spector
Jeff Spector el 31 de Jul. de 2019
I've looked but can't find a good example of using TIff to write a multipage tiff file. I've got several CPUs on this machine, could I do this with the parallel computing toolbox's parfor loop to speed it up, or will it write the images in the wrong order?
Walter Roberson
Walter Roberson el 31 de Jul. de 2019
https://www.mathworks.com/help/matlab/ref/tiff.writedirectory.html

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Convert Image Type en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 30 de Jul. de 2019

Comentada:

el 31 de Jul. de 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by