cell-data-loader 0.0.8__py3-none-any.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.
@@ -0,0 +1,163 @@
1
+ Metadata-Version: 2.3
2
+ Name: cell_data_loader
3
+ Version: 0.0.8
4
+ Summary: Converts general images of cells into formats and labels for deep learning pipelines
5
+ Project-URL: Homepage, https://github.com/mleming/CellDataLoader
6
+ Author-email: Matt Leming <mleming@mgh.harvard.edu>
7
+ Maintainer-email: Matt Leming <mleming@mgh.harvard.edu>
8
+ License: MIT License
9
+ Keywords: biomedical,cell,cell image,cellpose,csz,dataloader
10
+ Requires-Python: >=3.8
11
+ Requires-Dist: numpy
12
+ Requires-Dist: opencv-python>=4.5.4
13
+ Requires-Dist: pillow
14
+ Requires-Dist: scikit-image
15
+ Requires-Dist: scipy
16
+ Requires-Dist: slideio==2.4.1
17
+ Requires-Dist: torch
18
+ Requires-Dist: torchvision<=0.15.0
19
+ Description-Content-Type: text/markdown
20
+
21
+ Cell Data Loader
22
+ ================
23
+
24
+ Cell Data Loader is a simple AI support tool in Python that can take in images of cells (or other image types) and output them with minimal effort to formats that can be read by Pytorch (Tensor) or Tensorflow (Numpy) format. With Cell Data Loader, users have the option to output their cell images as whole images, sliced images, or, with the support of [CellPose](https://github.com/MouseLand/cellpose), segment their images by cell and output those individually.
25
+
26
+ It can also be used for normal computer vision research, which is why CellPose is not a strict dependency.
27
+
28
+ To install Cell Data Loader, simply type into a standard UNIX terminal
29
+
30
+ pip install cell-data-loader
31
+
32
+ The simplest way to use Cell Data Loader is to instantiate a dataloader as such:
33
+
34
+ ~~~python
35
+ from cell_data_loader import CellDataloader
36
+
37
+ imfolder = '/path/to/my/images'
38
+
39
+ dataloader = CellDataloader(imfolder)
40
+
41
+ for image in dataloader:
42
+ ...
43
+ ~~~
44
+
45
+ And viola!
46
+
47
+ Lists of files are also supported:
48
+
49
+ ~~~python
50
+
51
+ imfiles = ['/path/to/image1.png','/path/to/image2.png','/path/to/image3.png']
52
+
53
+ dataloader = CellDataloader(imfiles)
54
+
55
+ for image in dataloader:
56
+ ...
57
+ ~~~
58
+
59
+ Labels
60
+ ------
61
+
62
+ Cell Data Loader has a few ways to support image labels. The simplest is whole images that are located in different folders, with each folder representing a label. This can be supported via the following:
63
+
64
+ ~~~python
65
+ imfolder1 = '/path/to/my/images'
66
+ imfolder2 = '/path/to/your/images'
67
+
68
+ dataloader = CellDataloader(imfolder1,imfolder2)
69
+
70
+ for label,image in dataloader:
71
+ ...
72
+ ~~~
73
+
74
+ Alternatively, if you have one folder or file list with images that have different naming conventions, a regex match is supported:
75
+
76
+ ~~~python
77
+ imfiles = ['/path/to/CANCER_image1.png',
78
+ '/path/to/CANCER_image2.png',
79
+ '/path/to/CANCER_image3.png',
80
+ '/path/to/HEALTHY_image1.png',
81
+ '/path/to/HEALTHY_image2.png',
82
+ '/path/to/HEALTHY_image3.png']
83
+
84
+ dataloader = CellDataloader(imfiles,label_regex = ["CANCER","HEALTHY"])
85
+ for label,image in dataloader:
86
+ ...
87
+ ~~~
88
+
89
+ Boxes
90
+ -----
91
+
92
+ In cases where you need to cut out individual cells from an image and have the coordinates file, cell_data_loader.py accepts an argument, cell_box_filelist, which is a list of files corresponding to the inputs that mark out the coordinates of labels on the cells. The format of the csv is as follows:
93
+
94
+ | X | Y | W | H | Label |
95
+ | - | - | - | - | ----- |
96
+ | 14 | 13 | 5 | 6 | 0 |
97
+ | 20 | 25 | 15 | 5 | 1 |
98
+
99
+
100
+ ~~~python
101
+ dataloader = CellDataloader('/path/to/file.svs',cell_box_filelist=['/path/to/boxfile.csv'])
102
+ ~~~
103
+
104
+ Arguments
105
+ ---------
106
+
107
+ Additional arguments taken by Cell Data Loader include
108
+
109
+ ~~~python
110
+
111
+ imfolder = '/path/to/folder'
112
+
113
+ dataloader = CellDataloader(imfolder,
114
+ dim = (64,64),
115
+ batch_size = 64,
116
+ dtype = "torch", # Can also be "numpy"
117
+ label_regex = None,
118
+ verbose = True,
119
+ segment_image = "whole", # "whole" outputs the whole image, resized
120
+ # to dim; "sliced" cuts the image checkerboard pattern into
121
+ # dim-shaped outputs, so it's suitable for large images; "cell"
122
+ # segments cells from the image using CellPose, though it throws
123
+ # an error if CellPose is not installed properly. CellPose is
124
+ # not included by default in the dependencies and needs to be
125
+ # installed separately by the user.
126
+ n_channels = 3, # Detected in first image by default; re-samples all
127
+ # images to force this number of channels
128
+ augment_image = True, # Augments the output image in the standard
129
+ # ways -- rotation, color jiggling, etc.
130
+ label_balance = True, # Outputs proportional amounts of each label
131
+ # in the dataset
132
+ gpu_ids = None, # GPUs that the outputs are read to, if present.
133
+ channels_first = True # Places channels either first, before the
134
+ # batch dimension, or last
135
+ )
136
+ ~~~
137
+
138
+
139
+ Dependencies
140
+ ------------
141
+
142
+ Note that the strict dependencies are automatically downloaded just with
143
+
144
+ pip install cell-data-loader
145
+
146
+ However, to get support with cell-segmentation-specific images (i.e., segment="cell"), [CellPose](https://github.com/MouseLand/cellpose) needs to be installed. GPU integration with CellPose would also need to be handled separately.
147
+
148
+ Strict dependencies:
149
+
150
+ numpy
151
+ torch
152
+ torchvision
153
+ opencv-python>=4.5.4
154
+ slideio==2.4.1
155
+ scipy
156
+ scikit-image
157
+ pillow
158
+
159
+ Soft dependencies:
160
+
161
+ CellPose # For cell segmentation support
162
+ Tensorflow
163
+
@@ -0,0 +1,7 @@
1
+ cell_data_loader/__init__.py,sha256=ejZYQSfsvBTQ5JjQzo1ds64CZS3K831H3BkpLQn5sTc,55
2
+ cell_data_loader/base_dataset.py,sha256=JKo7qCLYgZmnyiJuF9wNWu1r4exPkpyngy8NumAykQg,1616
3
+ cell_data_loader/cell_data_loader.py,sha256=7nzwGyOTwoay0g_of_HsGtxF4K0fKli7rfShlqc0gUc,18233
4
+ cell_data_loader/util.py,sha256=K9qvZZfU_gQjnspb-pXTr6UHCkhyXtKw57U7dqNZ_lw,29083
5
+ cell_data_loader-0.0.8.dist-info/METADATA,sha256=GfxdExL4kqlY5i4B7NaZ4XhykVDI44IErnOvpo5wqxY,5037
6
+ cell_data_loader-0.0.8.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
7
+ cell_data_loader-0.0.8.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.24.2
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any