Giter Site home page Giter Site logo

fast_tiff_write's People

Contributors

achuan-2 avatar rharkes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fast_tiff_write's Issues

In Matlab 2023b, Fast_Tiff_Write vs Tifflib

Using Fast_Tiff_Write to save large TIFF files takes approximately half the time compared to saving with the Tiff library. The time difference between the two is not more than ten times greater than stated in Readme.
only change the tags in code.

tf.setTag('Photometric',Tiff.Photometric.MinIsBlack);
tf.setTag('Compression',Tiff.Compression.None);
tf.setTag('BitsPerSample',16);
tf.setTag('SamplesPerPixel',1);
tf.setTag('SampleFormat',Tiff.SampleFormat.UInt);
tf.setTag('ImageLength',size(IM,1));
tf.setTag('ImageWidth',size(IM,2));
tf.setTag('ResolutionUnit',3);
tf.setTag('PlanarConfiguration',Tiff.PlanarConfiguration.Chunky);

image

My Computer is Thinkbook 16+ 2023,CPU is AMD R7480H, GPU is GTX 4050

The resulting tiff is not valid - cannot be opened by ImageJ nor MATLAB imread

I used MATLAB R2019a Update 6 (on macOS Sierra 10.12.6) to run the included test_fTiff.m. The resulting test.tif cannot be read by ImageJ (only the first frame is recognized). MATLAB 'imread' gives the following error:
Unable to read TIFF file "test.tif". File is corrupt or image does not contain any readable strips.

rows and columns appear switched

It's fast and mostly reliable, it helps a lot for writing large image stacks. Thanks.

However, the written images appear to be rotated and flipped (x and y axes are swapped)

Here is a bit of code to show this:

% fast Tiff test

testImg = [1,2;3,4;5,6];
testImg = im2uint16(rescale(testImg));

imwrite(testImg,'tiff-imwrite.tif');

fTIFF = Fast_Tiff_Write('tiff-fTIFF.tif',1,0);
fTIFF.WriteIMG(testImg); %% this does not work for some reason
% fTIFF.WriteIMG(permute(testImg,[2,1])); %% this does work
fTIFF.close;

subplot(1,3,1);
imagesc(testImg);
axis equal tight
title('original image')

subplot(1,3,2)
imagesc(imread('tiff-imwrite.tif'));
axis equal tight
title('read after imwrite')

subplot(1,3,3)
imagesc(imread('tiff-fTIFF.tif'));
axis equal tight
title('read after fTIFF.WriteIMG')

This produces this result:
image
In case OS and Matlab version are relevant: '9.6.0.1214997 (R2019a) Update 6' on 'PCWIN64' (Windows 10).

A simple workaround is to permute the image before writing (as in the commented-out line 10), but perhaps there is a way to not have to do this.

(Or perhaps I'm missing something obvious, that's also quite possible).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.