hammerlab / cytokit

Microscopy Image Cytometry Toolkit
Apache License 2.0
115 stars 18 forks source link

UserWarning: truncating ImageJ file #16

Closed mkeays closed 4 years ago

mkeays commented 4 years ago

Hello again! I have another question, this time about montage generation -- I am getting this error (using the BALBc-1 Goltsev et al dataset):

2019-12-11 09:06:55,741:INFO:29559:root: Extraction complete (results saved to /users/keays/cytokit/Stanford/Goltsev_mouse_spleen/output/extract/segm) 2019-12-11 09:06:55,858:INFO:29559:root: Creating montage "segm" from extraction "segm" 2019-12-11 09:06:55,858:INFO:29559:cytokit.function.core: Generating montage for region 1 of 1 2019-12-11 09:07:22,057:INFO:29559:cytokit.function.core: Saving montage to file "/users/keays/cytokit/Stanford/Goltsev_mouse_spleen/output/montage/segm/R001.tif" /opt/conda/envs/cytokit/lib/python3.5/site-packages/tifffile/tifffile.py:2035: UserWarning: truncating ImageJ file warnings.warn('truncating ImageJ file') 2019-12-11 09:07:33,966:INFO:29559:cytokit.function.core: Montage generation complete; results saved to "/users/keays/cytokit/Stanford/Goltsev_mouse_spleen/output/montage/segm"

I looked a bit further into the code throwing the error and it looks like it's related to the size of the file, and that it's not generating a BigTIFF? It does look as though some tiles are missing from some planes in the final montage:

truncated_montage

eric-czech commented 4 years ago

I have seen the 4G limit kick in like that but I don't recall having it with that config. Did you change anything relating to that montage? Do the others work?

ImageJ was always annoying to use with files that big so I got into the habit of making them smaller instead, but support for a bigtiff flag should probably get added.

To workaround it not being there, you could remove some channels from the extract for the montage or you could change this to some list of z planes to include rather than all of them.

The code is also editable within the repo on the container (at /lab/repos/cytokit) so you could also find this and add a bigtiff=True argument that gets passed to create_montage and then ultimately on to cytokit_io.save_tile in that function. Then whatever argument you add in the montage section of the config will be sent to the function in that first link.

mkeays commented 4 years ago

Hi Eric, thanks, I will try selecting specific z planes and see how that goes. It was only that montage that did this, the other ones were fine (they don’t have z: all).

mkeays commented 4 years ago

Just to update, I changed z: all to z: best to just get the best focus z plane and the issue went away. Will keep the code edit in mind in case I need all planes in future -- thanks!