pylibtiff

A Python tiff library

https://github.com/pearu/pylibtiff

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    3 of 26 committers (11.5%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.2%) to scientific vocabulary

Keywords from Contributors

closember cython sequences cpython-extensions cpython flexible binding geospatial-data distribution autograding
Last synced: 10 months ago · JSON representation

Repository

A Python tiff library

Basic Info
  • Host: GitHub
  • Owner: pearu
  • License: other
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 606 KB
Statistics
  • Stars: 135
  • Watchers: 10
  • Forks: 56
  • Open Issues: 43
  • Releases: 6
Created almost 11 years ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

Build Status

PyLibTiff is a package that provides:

  • a wrapper to the libtiff library to Python using ctypes.

  • a pure Python module for reading and writing TIFF and LSM files. The images are read as numpy.memmap objects so that it is possible to open images that otherwise would not fit to computers RAM. Both TIFF strips and tiles are supported for low-level data storage.

There exists many Python packages such as PIL, FreeImagePy that support reading and writing TIFF files. The PyLibTiff project was started to have an efficient and direct way to read and write TIFF files using the libtiff library without the need to install any unnecessary packages or libraries. The pure Python module was created for reading "broken" TIFF files such as LSM files that in some places use different interpretation of TIFF tags than what specified in the TIFF specification document. The libtiff library would just fail reading such files. In addition, the pure Python module is more memory efficient as the arrays are returned as memory maps. Support for compressed files is not implemented yet.

tifffile.py by Christoph Gohlke is an excellent module for reading TIFF as well as LSM files, it is as fast as libtiff.py by using numpy.

Usage example (libtiff wrapper)

```

from libtiff import TIFF

to open a tiff file for reading:

tif = TIFF.open('filename.tif', mode='r')

to read an image in the currect TIFF directory and return it as numpy array:

image = tif.read_image()

to read all images in a TIFF file:

for image in tif.iter_images(): # do stuff with image

to open a tiff file for writing:

tif = TIFF.open('filename.tif', mode='w')

to write a image to tiff file

tif.write_image(image) ```

Usage example (pure Python module)

```

from libtiff import TIFFfile, TIFFimage

to open a tiff file for reading

tif = TIFFfile('filename.tif')

to return memmaps of images and sample names (eg channel names, SamplesPerPixel>=1)

samples, samplenames = tiff.getsamples()

to create a tiff structure from image data

tiff = TIFFimage(data, description='')

to write tiff structure to file

tiff.write_file('filename.tif', compression='none') # or 'lzw' del tiff # flushes data to disk ```

Script usage examples

``` $ libtiff.info -i result_0.tif IFDEntry(tag=ImageWidth, value=512, count=1, offset=None) IFDEntry(tag=ImageLength, value=512, count=1, offset=None) IFDEntry(tag=BitsPerSample, value=32, count=1, offset=None) IFDEntry(tag=Compression, value=1, count=1, offset=None) IFDEntry(tag=PhotometricInterpretation, value=1, count=1, offset=None) IFDEntry(tag=StripOffsets, value=8, count=1, offset=None) IFDEntry(tag=Orientation, value=6, count=1, offset=None) IFDEntry(tag=StripByteCounts, value=1048576, count=1, offset=None) IFDEntry(tag=PlanarConfiguration, value=1, count=1, offset=None) IFDEntry(tag=SampleFormat, value=3, count=1, offset=None) Use --ifd to see the rest of 31 IFD entries data is contiguous: False memory usage is ok: True sample data shapes and names:

width : 512 length : 512 samplesperpixel : 1 planarconfig : 1 bitspersample : 32 striplength : 1048576

[('memmap', (32, 512, 512), dtype('float32'))] ['sample0'] ```

``` $ libtiff.info -i psf1024z5airy1set1.lsm IFDEntry(tag=NewSubfileType, value=0, count=1, offset=None) IFDEntry(tag=ImageWidth, value=1024, count=1, offset=None) IFDEntry(tag=ImageLength, value=1024, count=1, offset=None) IFDEntry(tag=BitsPerSample, value=8, count=1, offset=None) IFDEntry(tag=Compression, value=1, count=1, offset=None) IFDEntry(tag=PhotometricInterpretation, value=1, count=1, offset=None) IFDEntry(tag=StripOffsets, value=97770, count=1, offset=None) IFDEntry(tag=SamplesPerPixel, value=1, count=1, offset=None) IFDEntry(tag=StripByteCounts, value=1048576, count=1, offset=None) IFDEntry(tag=PlanarConfiguration, value=2, count=1, offset=None) IFDEntry(tag=CZLSMInfo, value=CZLSMInfo276( MagicNumber=[67127628], StructureSize=[500], DimensionX=[1024], DimensionY=[1024], DimensionZ=[20], DimensionChannels=[1], DimensionTime=[1], SDataType=[1], ThumbnailX=[128], ThumbnailY=[128], VoxelSizeX=[ 2.79017865e-08], VoxelSizeY=[ 2.79017865e-08], VoxelSizeZ=[ 3.60105263e-07], OriginX=[ -2.22222228e-07], OriginY=[ 1.90476196e-07], OriginZ=[ 0.], ScanType=[0], SpectralScan=[0], DataType=[0], OffsetVectorOverlay->DrawingElement(name='OffsetVectorOverlay', size=200, offset=6560), OffsetInputLut->LookupTable(name='OffsetInputLut', size=8388, subblocks=6, channels=1, offset=7560), OffsetOutputLut->LookupTable(name='OffsetOutputLut', size=24836, subblocks=3, channels=3, offset=15948), OffsetChannelColors->ChannelColors (names=['Ch3'], colors=[(255, 0, 0, 0)]), TimeInterval=[ 0.], OffsetChannelDataTypes->None, OffsetScanInformation->recording[size=3535] name = 'psf1024z5airy1set1' description = ' ' notes = ' ' objective = 'C-Apochromat 63x/1.20 W Korr UV-VIS-IR M27' special scan mode = 'FocusStep' scan type = '' scan mode = 'Stack' number of stacks = 10 lines per plane = 1024 samples per line = 1024 planes per volume = 20 images width = 1024 images height = 1024 images number planes = 20 images number stacks = 1 images number channels = 1 linescan xy size = 512 scan direction = 0 scan directionz = 0 time series = 0 original scan data = 1 zoom x = 5.0000000000000009 zoom y = 5.0000000000000009 zoom z = 1.0 sample 0x = -0.22200000000000006 sample 0y = 0.19000000000000006 sample 0z = 6.8420000000000014 sample spacing = 0.028000000000000008 line spacing = 0.028000000000000008 plane spacing = 0.3600000000000001 rotation = 0.0 nutation = 0.0 precession = 0.0 sample 0time = 39583.598368055624 start scan trigger in = '' start scan trigger out = '' start scan event = 0 start scan time = 0.0 stop scan trigger in = '' stop scan trigger out = '' stop scan event = 0 start scan time = 0.0 use rois = 0 use reduced memory rois = 0 user = 'User Name' usebccorrection = 0 positionbccorrection1 = 0.0 positionbccorrection2 = 0.0 interpolationy = 1 camera binning = 1 camera supersampling = 0 camera frame width = 1388 camera frame height = 1040 camera offsetx = 0.0 camera offsety = 0.0 rt binning = 1 ENTRY0x10000064L = 1 rt frame width = 512 rt frame height = 512 rt region width = 512 rt region height = 512 rt offsetx = 0.0 rt offsety = 0.0 rt zoom = 1.0000000000000004 rt lineperiod = 112.43300000000002 prescan = 0 lasers[size=188] laser[size=80] name = 'HeNe633' acquire = 1 power = 5.0000000000000009 end laser laser[size=84] name = 'DPSS 532-75' acquire = 1 power = 75.000000000000014 end laser end lasers tracks[size=2071] track[size=2047] pixel time = 1.5980000000000003 time between stacks = 1.0 multiplex type = 1 multiplex order = 1 sampling mode = 2 sampling method = 1 sampling number = 8 acquire = 1 name = 'Track' collimator1 position = 16 collimator1 name = 'IR/Vis' collimator2 position = 66 collimator2 name = 'UV/Vis' is bleach track = 0 is bleach after scan number = 0 bleach scan number = 0 trigger in = '' trigger out = '' is ratio track = 0 bleach count = 0 spi center wavelength = 582.53000000000009 id condensor aperture = 'KAB1' condensor aperture = 0.55000000000000016 id condensor revolver = 'FW2' condensor filter = 'HF' id tubelens = 'Tubelens' id tubelens position = 'Lens LSM' transmitted light = 0.0 reflected light = -1.0000000000000002 detection channels[size=695] detection channel[size=671] detector gain first = 700.00000000000011 detector gain last = 700.00000000000011 amplifier gain first = 1.0000000000000002 amplifier gain last = 1.0000000000000002 amplifier offs first = 0.10000000000000002 amplifier offs last = 0.10000000000000002 pinhole diameter = 144.00000000000003 counting trigger = 5.0 acquire = 1 integration mode = 0 special mode = 0 detector name = 'Pmt3' amplifier name = 'Amplifier1' pinhole name = 'PH3' filter set name = 'EF3' filter name = 'LP 650' ENTRY0x70000011L = '' ENTRY0x70000012L = '' integrator name = 'Integrator3' detection channel name = 'Ch3' detector gain bc1 = 0.0 detector gain bc2 = 0.0 amplifier gain bc1 = 0.0 amplifier gain bc2 = 0.0 amplifier offs bc1 = 0.0 amplifier offs bc2 = 0.0 spectral scan channels = 32 spi wavelength start = 415.0 spi wavelength end = 735.0 ENTRY0x70000024L = 575.0 ENTRY0x70000025L = 575.0 dye name = '' dye folder = '' ENTRY0x70000028L = 1.0000000000000004 ENTRY0x70000029L = 0.0 end detection channel end detection channels beam splitters[size=330] beam splitter[size=82] filter set = 'HT' filter = 'HFT 405/514/633' name = 'HT' end beam splitter beam splitter[size=75] filter set = 'NT1' filter = 'Mirror' name = 'NT1' end beam splitter beam splitter[size=76] filter set = 'NT2' filter = 'NFT 565' name = 'NT2' end beam splitter beam splitter[size=73] filter set = 'FW1' filter = 'None' name = 'FW1' end beam splitter end beam splitters illumination channels[size=160] illumination channel[size=136] name = '633' power = 0.30000000000000004 wavelength = 633.0 aquire = 1 power bc1 = 0.0 power bc2 = 0.0 end illumination channel end illumination channels data channels[size=338] data channel[size=314] name = 'Ch3' acquire = 1 acquire = 0 color = 255 sampletype = 1 bitspersample = 8 ratio type = 0 ratio track1 = 0 ratio track2 = 0 ratio channel1 = '' ratio channel2 = '' ratio const1 = 0.0 ratio const2 = 0.0 ratio const3 = 1.0 ratio const4 = 0.0 ratio const5 = 0.0 ratio const6 = 0.0 end data channel end data channels end track end tracks timers[size=24] end timers markers[size=24] end markers end recording, OffsetKsData->OffsetData(name='OffsetKsData', size=8, offset=48590), OffsetTimeStamps->TimeStamps(stamps=[ 2335.75582836]), OffsetEventList->EventList(events=[]), OffsetRoi->DrawingElement(name='OffsetRoi', size=200, offset=6160), OffsetBleachRoi->DrawingElement(name='OffsetBleachRoi', size=200, offset=6360), OffsetNextRecording->None, DisplayAspectX=[ 1.], DisplayAspectY=[ 1.], DisplayAspectZ=[ 1.], DisplayAspectTime=[ 1.], OffsetMeanOfRoisOverlay->DrawingElement(name='OffsetMeanOfRoisOverlay', size=200, offset=6760), OffsetTopoIsolineOverlay->DrawingElement(name='OffsetTopoIsolineOverlay', size=200, offset=7160), OffsetTopoProfileOverlay->DrawingElement(name='OffsetTopoProfileOverlay', size=200, offset=7360), OffsetLinescanOverlay->DrawingElement(name='OffsetLinescanOverlay', size=200, offset=6960), ToolbarFlags=[0], OffsetChannelWavelength->ChannelWavelength (ranges=[(-1.0, -1.0)]), OffsetChannelFactors->ChannelFactors(size=36, offset=40836), ObjectiveSphereCorrection=[ 0.], OffsetUnmixParameters->OffsetData(name='OffsetUnmixParameters', size=124, offset=48466), Reserved=[[40896 44726 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]])) Use --ifd to see the rest of 39 IFD entries data is contiguous: False memory usage is ok: True sample data shapes and names:

width : 1024 length : 1024 samplesperpixel : 1 planarconfig : 2 bitspersample : 8 striplength : 1048576

[('memmap', (20, 1024, 1024), dtype('uint8'))] ['Ch3'] [((20, 128, 128), dtype('uint8')), ((20, 128, 128), dtype('uint8')), ((20, 128, 128), dtype('uint8'))] ['red', 'green', 'blue'] ```

Owner

  • Name: Pearu Peterson
  • Login: pearu
  • Kind: user
  • Location: Estonia
  • Company: Quansight

GitHub Events

Total
  • Watch event: 4
  • Issue comment event: 12
  • Push event: 1
  • Pull request review event: 2
  • Pull request event: 3
Last Year
  • Watch event: 4
  • Issue comment event: 12
  • Push event: 1
  • Pull request review event: 2
  • Pull request event: 3

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 264
  • Total Committers: 26
  • Avg Commits per committer: 10.154
  • Development Distribution Score (DDS): 0.636
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
pearu.peterson p****n@4****d 96
David Hoese d****e@s****u 47
Pearu Peterson p****n@g****m 38
Éric Piel p****l@d****m 18
dependabot[bot] 4****] 14
David Manthey d****y@k****m 9
Joshua Taillon j****5@g****m 6
JoostvanPinxten j****n@g****m 4
Oleksandr Pavlyk o****k@i****m 4
Kris Kvilekval k****s@c****u 3
Guilherme Stiebler g****t@g****m 3
John Kirkham k****j@j****g 3
Antonio Valentino a****o@t****t 2
Dennis Johnson d****n@g****m 2
Simon-Martin Schroeder s****s@i****e 2
joe.jordan86 j****6@g****m 2
richcarni r****i@g****m 2
Björn Grüning b****n@g****u 1
Christoph Gohlke c****e@c****m 1
Dirk Boye d****e@d****m 1
IdrisTheDragon n****k@g****m 1
maxime m****e@a****e 1
kent3737 k****7@4****d 1
OneSixth O****h 1
Robert Ancell r****l@g****m 1
ossdev07 3****7 1

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 66
  • Total pull requests: 66
  • Average time to close issues: about 1 year
  • Average time to close pull requests: 3 months
  • Total issue authors: 43
  • Total pull request authors: 22
  • Average comments per issue: 3.85
  • Average comments per pull request: 2.05
  • Merged pull requests: 53
  • Bot issues: 0
  • Bot pull requests: 16
Past Year
  • Issues: 0
  • Pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: about 4 hours
  • Issue authors: 0
  • Pull request authors: 3
  • Average comments per issue: 0
  • Average comments per pull request: 2.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • GoogleCodeExporter (8)
  • djhoese (4)
  • rleigh-codelibre (4)
  • JoostvanPinxten (3)
  • pearu (3)
  • nimrodV81 (2)
  • yangyunlv (2)
  • markemus (2)
  • avalentino (2)
  • jakirkham (2)
  • yasohasakii (2)
  • ilykos (1)
  • PasaOpasen (1)
  • Steve8650 (1)
  • DManowitz (1)
Pull Request Authors
  • dependabot[bot] (21)
  • djhoese (10)
  • pieleric (9)
  • manthey (5)
  • pearu (5)
  • avalentino (4)
  • jakirkham (2)
  • moi90 (2)
  • rayg-ssec (2)
  • ossdev07 (1)
  • One-sixth (1)
  • nlhepler (1)
  • markemus (1)
  • brianhelba (1)
  • IdrisTheDragon (1)
Top Labels
Issue Labels
help wanted (10) enhancement (9) code quality (7) bug (7) Priority-Medium (5) Type-Defect (5) auto-migrated (5) support-question (3) waiting-feedback (2) question (1) duplicate (1) bigendian (1) invalid (1)
Pull Request Labels
dependencies (24) bug (9) enhancement (7) code quality (2) help wanted (1) wontfix (1)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 13,328 last-month
  • Total docker downloads: 6,889
  • Total dependent packages: 13
    (may contain duplicates)
  • Total dependent repositories: 1,064
    (may contain duplicates)
  • Total versions: 10
  • Total maintainers: 1
pypi.org: libtiff

PyLibTiff: a Python tiff library.

  • Versions: 3
  • Dependent Packages: 7
  • Dependent Repositories: 1,052
  • Downloads: 3,536 Last month
  • Docker Downloads: 997
Rankings
Dependent repos count: 0.4%
Docker downloads count: 1.6%
Dependent packages count: 1.6%
Downloads: 2.9%
Average: 3.2%
Forks count: 5.8%
Stargazers count: 6.7%
Maintainers (1)
Last synced: 10 months ago
pypi.org: pylibtiff

PyLibTiff: a Python tiff library.

  • Versions: 6
  • Dependent Packages: 5
  • Dependent Repositories: 11
  • Downloads: 9,792 Last month
  • Docker Downloads: 5,892
Rankings
Dependent packages count: 1.6%
Docker downloads count: 3.0%
Dependent repos count: 4.4%
Average: 4.6%
Forks count: 5.7%
Downloads: 6.3%
Stargazers count: 6.7%
Maintainers (1)
Last synced: 10 months ago
conda-forge.org: pylibtiff
  • Versions: 1
  • Dependent Packages: 1
  • Dependent Repositories: 1
Rankings
Dependent repos count: 24.1%
Forks count: 25.9%
Average: 27.9%
Dependent packages count: 28.9%
Stargazers count: 32.6%
Last synced: 10 months ago

Dependencies

.github/workflows/ci.yaml actions
  • AndreMiras/coveralls-python-action develop composite
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • conda-incubator/setup-miniconda v2 composite
.github/workflows/deploy-sdist.yaml actions
  • actions/checkout v3 composite
  • pypa/gh-action-pypi-publish v1.6.4 composite
setup.py pypi
  • numpy >=1.13.3
.conda/environment.yml pypi
pyproject.toml pypi