cpp-tiff 1.5.0__cp314-cp314-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cpp_tiff-1.5.0.dist-info/METADATA +18 -0
- cpp_tiff-1.5.0.dist-info/RECORD +11 -0
- cpp_tiff-1.5.0.dist-info/WHEEL +5 -0
- cpp_tiff-1.5.0.dist-info/top_level.txt +1 -0
- cpptiff/__init__.py +1 -0
- cpptiff/cpptiff.cp314-win_amd64.pyd +0 -0
- cpptiff/cpptiffwrappers.py +49 -0
- cpptiff/libcpptiff.dll +0 -0
- cpptiff/libgcc_s_seh-1.dll +0 -0
- cpptiff/libgomp-1.dll +0 -0
- cpptiff/libwinpthread-1.dll +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cpp-tiff
|
|
3
|
+
Version: 1.5.0
|
|
4
|
+
Summary: Python wrappers for cpp-tiff
|
|
5
|
+
Home-page: https://github.com/abcucberkeley/cpp-tiff
|
|
6
|
+
Author: Matthew Mueller
|
|
7
|
+
Author-email: matthewmueller@berkeley.edu
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9, <3.15
|
|
11
|
+
Requires-Dist: numpy>=1.20
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: author-email
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: home-page
|
|
16
|
+
Dynamic: requires-dist
|
|
17
|
+
Dynamic: requires-python
|
|
18
|
+
Dynamic: summary
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
cpptiff/__init__.py,sha256=hIuC1hJ0P1UjUEP3PYmGBa0y68Ov3A3-Ok07Y3pQAaQ,67
|
|
2
|
+
cpptiff/cpptiff.cp314-win_amd64.pyd,sha256=TxKc1E9Uriyy_mnfsQkkymdIpaQCfpzlilal9TPdbQo,317440
|
|
3
|
+
cpptiff/cpptiffwrappers.py,sha256=YHSXQb6yiJe9DKO7cTf96qw_6t0ywk_94YGYGyNExW8,1707
|
|
4
|
+
cpptiff/libcpptiff.dll,sha256=F1Ek4-oQ581tmpP5U1LUs7w2ZVdfwPrtS2MG-sAqiSQ,2218445
|
|
5
|
+
cpptiff/libgcc_s_seh-1.dll,sha256=1tpM-hmVu1L0DawZCrNtsdD1017zD3iDIb4NnEIWYBg,101376
|
|
6
|
+
cpptiff/libgomp-1.dll,sha256=tmxzZP1_KK79N2oKVtnp2bzXiB50EAxJhmr1yEh6Izw,258048
|
|
7
|
+
cpptiff/libwinpthread-1.dll,sha256=4BuOhf1nwrhh9k1MzH32B1m1iapBAACij6K4SiCJF1s,54784
|
|
8
|
+
cpp_tiff-1.5.0.dist-info/METADATA,sha256=gOsnGZkFL0ruqloSu7vZK1U-HwfqRMTAB_8o0FUaWTM,521
|
|
9
|
+
cpp_tiff-1.5.0.dist-info/WHEEL,sha256=jhxrRP3tdEfm7toB1X7dl5x6f0bu6Tve2cWwIdkbL8U,101
|
|
10
|
+
cpp_tiff-1.5.0.dist-info/top_level.txt,sha256=7R5B-YLztzQ_9LyzPchaFZh1g5ApvbivJrpWMud_fU4,8
|
|
11
|
+
cpp_tiff-1.5.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cpptiff
|
cpptiff/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .cpptiffwrappers import read_tiff, write_tiff, get_image_shape
|
|
Binary file
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import os
|
|
3
|
+
from .cpptiff import pybind11_read_tiff, pybind11_write_tiff, pybind11_get_image_shape
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def read_tiff(file_name, z_range=None):
|
|
7
|
+
if not os.path.isfile(file_name):
|
|
8
|
+
raise Exception(f'{file_name} does not exist!')
|
|
9
|
+
if z_range is None:
|
|
10
|
+
z_range = []
|
|
11
|
+
else:
|
|
12
|
+
if type(z_range) is not list:
|
|
13
|
+
if np.isscalar(z_range):
|
|
14
|
+
z_range = [z_range]
|
|
15
|
+
else:
|
|
16
|
+
raise Exception(f'z_range must be a number or list of two numbers!')
|
|
17
|
+
elif len(z_range) == 2:
|
|
18
|
+
if z_range[0] > z_range[1]:
|
|
19
|
+
raise Exception(f'z_range is invalid! {z_range[0]} > {z_range[1]}')
|
|
20
|
+
elif z_range[0] == z_range[1]:
|
|
21
|
+
raise Exception(f'z_range is invalid! {z_range[0]} == {z_range[1]}')
|
|
22
|
+
|
|
23
|
+
im = pybind11_read_tiff(file_name, z_range)
|
|
24
|
+
if im.ndim == 4:
|
|
25
|
+
im = np.transpose(im, (2, 1, 0, 3)) # (x,y,z,c) -> (z,y,x,c) for RGB
|
|
26
|
+
else:
|
|
27
|
+
im = np.transpose(im, (2, 1, 0)) # (x,y,z) -> (z,y,x)
|
|
28
|
+
if im.shape[0] == 1:
|
|
29
|
+
im = np.squeeze(im, axis=0)
|
|
30
|
+
return im
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def write_tiff(file_name, data, compression='lzw'):
|
|
34
|
+
ndims = data.ndim
|
|
35
|
+
transpose = False
|
|
36
|
+
if data.flags['F_CONTIGUOUS'] or not data.flags['C_CONTIGUOUS']:
|
|
37
|
+
data = np.ascontiguousarray(data)
|
|
38
|
+
if ndims == 3:
|
|
39
|
+
data = np.transpose(data, (2, 1, 0))
|
|
40
|
+
elif ndims == 2:
|
|
41
|
+
data = np.transpose(data, (1, 0))
|
|
42
|
+
else:
|
|
43
|
+
raise Exception(f'data must be 3D or 2D!')
|
|
44
|
+
pybind11_write_tiff(file_name, data, transpose, compression)
|
|
45
|
+
return
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def get_image_shape(file_name):
|
|
49
|
+
return pybind11_get_image_shape(file_name)
|
cpptiff/libcpptiff.dll
ADDED
|
Binary file
|
|
Binary file
|
cpptiff/libgomp-1.dll
ADDED
|
Binary file
|
|
Binary file
|