senikm / trpx

TERSE/PROLIX: Fast and lossless diffraction data compressor
https://senikm.github.io/trpx/
MIT License
8 stars 2 forks source link

Terse wipes tiff files #4

Open hvelab opened 2 weeks ago

hvelab commented 2 weeks ago

Dear developers,

We have been trying to use trpx unsuccessfully, executing Terse on a .tif file but terse destroys it, leaving a 104 Byte-size ASCII file withe the content:

<Terse prolix_bits="0" signed="0" block="12" memory_size="0" number_of_values="0" number_of_frames="0"/>

I have been investigating it thoroughly. I have tried with GCC 12.3.0 (latest stable release), from repos, compiling it myself and even with binaries provided by the EESSI projects. Also in different machines with different OS, in none of them worked. Also tried with GCC 13 with the same result.

Compiling trpx in debug mode and examining line per line, the program runs fine except in the core moment:

for (int i = 0; i != tif_data.image_stack_size(); ++i)
             if (tif_data.dim() == tif_data.image(i).dim())
                  Terse_pushback(compressed, tif_data.image(i)); 

Both adding a couple of lines of code and also checking from gdb, the variable tif_data.image_stack_size() seems to always be 0, resulting in not entering inside the loop and not doing the proper processing.

I am not sure about the reason on why this happens. Stepping into this function, despite calling the Terse.hpp file, the Terse class this uses the atomic functions of the std vector class of the C library to calculate the size. I attach a screenshot (sorry, copy-paste didn't work) on how those seem to be always 0.

image_2024-06-19_16-43-03

I thought it might be a problem with our .tif files, but downloading samples from the internet results in the same.

Again, I tried it with different GCC installations and versions unsuccessfully, could you kindly guide us on what might be happening?

Thank you!

senikm commented 2 weeks ago

Dear @hvelab Helena Vela Beltran,

Thank you for writing us. Could you, please, send us the tiff files you used(senik.matinyan@gmail.com).

All the best, Senik

hvelab commented 2 weeks ago

Dear @senikm ,

Thank you for your fast reply! I am afraid that if I cannot send you the main ones we used because of confidentiality terms, but I got the same results with this one from an online sample page:

https://file-examples.com/wp-content/storage/2017/10/file_example_TIFF_10MB.tiff

Also with some of the random ones here: https://people.math.sc.edu/Burkardt/data/tif/tif.html

Thanks again :)

senikm commented 2 weeks ago

Dear @hvelab,

Thank you for the provided information. I had a quick look at the files you have sent me. Could, you, please, check if it works correct with one of the following files in this link?. The current tiff library works with specific set of IFDs. TRPX will only properly compress greyscale, non-compressed, integral-valued tiff files or stacks.

hvelab commented 3 days ago

Dear @senikm, I confirmed with my user that it works for those set of files with our installation. Our files were compressed .tiff files, thank you for clearing this for us!