-
Notifications
You must be signed in to change notification settings - Fork 1
/
temp-test-read-tiff.py
46 lines (37 loc) · 1.1 KB
/
temp-test-read-tiff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from imaxt_image.image import TiffImage
import cv2
import numpy as np
from PIL import Image
from typing import List
# find number of channels
def get_frames(cube: Image) -> List[np.ndarray]:
"""Extract all channels in an Image data cube
Parameters
----------
cube
data cube
Returns
-------
list of images
"""
# all_frames = [*map(np.array, ImageSequence.Iterator(cube))]
all_frames = TiffImage(cube).asarray()
return all_frames
# find number of channels
from skimage.external import tifffile
def get_frames_NEW(cube: Image) -> List[np.ndarray]:
"""Extract all channels in an Image data cube
Parameters
----------
cube
data cube
Returns
-------
list of images
"""
# all_frames = [*map(np.array, ImageSequence.Iterator(cube))]
all_frames = TiffImage(cube).asarray()
return all_frames
img = '/home/darius01/myDisk1/myProjects/medical/imaxt/imc/OUTPUT_temp/tiff-single-ome-large-ref45_Q001_CUBE.tiff'
# get_frames(img_small) <-- IS EQUAL TO --> tifffile.imread(img_small)
# above does not work for large tiff files