Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion to other types #34

Open
osoyer opened this issue Jul 23, 2020 · 1 comment
Open

Conversion to other types #34

osoyer opened this issue Jul 23, 2020 · 1 comment
Assignees
Labels

Comments

@osoyer
Copy link

osoyer commented Jul 23, 2020

I'm trying to perform some downstream analysis on tiff stacks and would like to use other functions in MATLAB image processing toolbox. Many of those require specific data types. Hence, is it possible to convert a TIFFStack object to type double, uint8, etc.? I can do this for individual slices as follow, but would be better to do on the full stack.

example on a slice;
tsStack = TIFFStack(filename1);
im=uint8(tsStack(:, :, 100)/256)

@DylanMuir
Copy link
Owner

Hi @osoyer

This is difficult, because it requires touching the entire stack. If you want the stack as a true Matlab double tensor, then you need to load the entire stack into memory — that's precisely what TIFFStack is trying to avoid.

Doing the analysis slice-wise is the most memory-efficient way. You could also do it chunk-wise, by looping over 3D chunks of the stack:

im = uint8(tsStack(:, :, 100:200)/256)

@DylanMuir DylanMuir self-assigned this Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants