Closed forevertheuni closed 9 years ago
I also get good values with: pic2 = libtiff.TiffFile(file).get_tiff_array() pic2[0],etc,etc,etc
What should the bit depth be on your images?
Something funny is going on, I can not reproduce your problem:
In [7]: fname = '/home/tcaswell/Downloads/TRIMcapture_MG132_06_R3D_D3D_3.tif'
In [8]: pic_pims = pims.TiffStack(fname)
In [9]: pic_pims[0]
Out[9]:
Frame([[696, 704, 709, ..., 686, 684, 688],
[701, 708, 713, ..., 690, 688, 692],
[703, 711, 716, ..., 693, 690, 695],
...,
[695, 702, 707, ..., 686, 683, 687],
[691, 698, 703, ..., 682, 679, 683],
[692, 699, 705, ..., 682, 680, 684]], dtype=uint16)
Which version of TiffStack
are you using (pims.TiffStack.__name__
)?
ok, I can reproduce this now.
In [4]: pic_pims = pims.TiffStack(fname)
In [5]: pic_pims[0]
Out[5]:
Frame([[46082, 45826, 46850, ..., 48898, 48386, 47106],
[47874, 47618, 48642, ..., 50946, 50178, 49154],
[49410, 48898, 49922, ..., 52226, 51458, 50434],
...,
[43522, 43522, 44546, ..., 46338, 45570, 44546],
[43010, 42754, 43778, ..., 45570, 45058, 44034],
[44034, 43778, 44802, ..., 46850, 46082, 45058]], dtype=uint16)
In [6]: pic_pims = pims.TiffStack_tifffile(fname)
In [7]: pic_pims[0]
Out[7]:
Frame([[696, 704, 709, ..., 686, 684, 688],
[701, 708, 713, ..., 690, 688, 692],
[703, 711, 716, ..., 693, 690, 695],
...,
[695, 702, 707, ..., 686, 683, 687],
[691, 698, 703, ..., 682, 679, 683],
[692, 699, 705, ..., 682, 680, 684]], dtype=uint16)
In [8]: pic_pims = pims.TiffStack_pil(fname)
In [9]: pic_pims[0]
Out[9]:
Frame([[696, 704, 709, ..., 686, 684, 688],
[701, 708, 713, ..., 690, 688, 692],
[703, 711, 716, ..., 693, 690, 695],
...,
[695, 702, 707, ..., 686, 683, 687],
[691, 698, 703, ..., 682, 679, 683],
[692, 699, 705, ..., 682, 680, 684]], dtype=uint16)
In [10]:
For now, just use one of the other TiffStack implementations.
16bits.
Oh!! cool easy change in the code to for those things :) :+1: x 1e06 for the quick help!!
In [3]: pims.TiffStack.name Out[3]: 'TiffStack_libtiff'
I wonder what we are doing wrong internally as libtiff by it s self is getting you the right data..
On Tue, Mar 10, 2015, 14:59 forevertheuni notifications@github.com wrote:
In [3]: pims.TiffStack.name Out[3]: 'TiffStack_libtiff'
— Reply to this email directly or view it on GitHub https://github.com/soft-matter/pims/issues/141#issuecomment-78123305.
Possibly it is the byteswap in pims tiffstack.py
line 222.
After inspecting the source of Tiff.read_image
it appears that ReadEncodedStrip
underlies this function. According to https://bitmiracle.github.io/libtiff.net/html/2ee23e7c-3bdf-3dcf-c22e-909bf9a5cd01.htm this does the byteswapping for you, probably it is swapped one time to much right now.
I cant test today, maybe you can remove byteswap in line 222 and check?
@forevertheuni This should be fixed now. If you are willing can you checkout the master version and make sure that this has fixed the issue for you?
Hello all, Thanks for pims
So. I am having a problem with pims. When I open a TiffStack the values of the pixels of an image do not correspond to the correct values: Here's a bit of code to test it (PIL and libtiff work ok, meaning the same values as acquired by the microscope software and ImageJ): Sample file can be dled here: https://drive.google.com/file/d/0B9-erPeWaEjGdy10bFMteHdNXzQ/view?usp=sharing
Help would be much appreciated since I already wrote a bunch of functions relying on pims.
And here is the output!