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

Parallelised LIF-to-TIFF file conversion #282

Merged
merged 5 commits into from
May 23, 2024
Merged

Conversation

tieneupin
Copy link
Contributor

@tieneupin tieneupin commented May 21, 2024

Helps with resolving #280. Part of continued work on #288.

  • Added option to define number of worker threads when converting LIF files to TIFF files
  • Updated logic when creating directory structure to store processed files in
  • Saved metadata of LIF sub-stacks as their own XML files under each sub-stack's metadata folder

@tieneupin tieneupin added enhancement New feature or request server Relates to the server component labels May 21, 2024
@tieneupin tieneupin requested a review from d-j-hatton May 21, 2024 18:04
@tieneupin tieneupin self-assigned this May 21, 2024
"cyan",
"green",
"magenta",
"red",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does yellow need to be included here?

Copy link
Contributor Author

@tieneupin tieneupin May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed it, oops. Will add yellow in new commit

import numpy as np
from readlif.reader import LifFile
from readlif.reader import LifFile # , LifImage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can drop commented out import

imwrite(
save_name,
arr,
imagej=True, # ImageJ comppatible
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo on compatible, trivial but may as well catch it


# Extract image data to array
logger.info("Loading image stack")
arr: np.ndarray = [] # Array to store frames in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't an np.ndarray yet, it's a list

Copy link
Contributor Author

@tieneupin tieneupin May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hinting needs to be specified here, as this variable is very quickly converted into an array and used as such for the remainder of the function. MyPy throws a hissy fit when I remove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised mypy doesn't complain about it because np.ndarray has no append method. You could make it a numpy array at initialisation and use np.append inside the for loop

@tieneupin
Copy link
Contributor Author

tieneupin commented May 22, 2024

Will add fixes for issue #283 and #285 to this PR.

@tieneupin tieneupin linked an issue May 23, 2024 that may be closed by this pull request
@tieneupin tieneupin merged commit 06e4bcf into main May 23, 2024
9 checks passed
@tieneupin tieneupin deleted the lif-to-tiff-upgrade branch May 23, 2024 13:47
@tieneupin tieneupin added the cryo-clem Part of the cryo-CLEM pipeline extension label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cryo-clem Part of the cryo-CLEM pipeline extension enhancement New feature or request server Relates to the server component
Projects
None yet
2 participants