cell-data-loader 0.0.32__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,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: cell_data_loader
3
+ Version: 0.0.32
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>=1.22.0
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>=2.0.0
18
+ Requires-Dist: torchvision
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
+ Quick Start
29
+ -----------
30
+
31
+ To install Cell Data Loader, simply type into a standard UNIX terminal
32
+
33
+ pip install cell-data-loader
34
+
35
+ To use a quick Jupyter Notebook example, navigate to [example/CellDataLoaderPlayground.ipynb](https://github.com/mleming/CellDataLoader/blob/main/example/CellDataLoaderPlayground.ipynb), download it, and run it in [Jupyter Notebook](https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html). On a Mac, that may be run with the following command:
36
+
37
+ python3 -m jupyterlab ~/Downloads/CellDataLoaderPlayground.ipynb
38
+
39
+
40
+ Python
41
+ ------
42
+
43
+ The simplest way to use Cell Data Loader is to instantiate a dataloader as such:
44
+
45
+ ~~~python
46
+ from cell_data_loader import CellDataloader
47
+
48
+ imfolder = '/path/to/my/images'
49
+
50
+ dataloader = CellDataloader(imfolder)
51
+
52
+ for image in dataloader:
53
+ ...
54
+ ~~~
55
+
56
+ And viola!
57
+
58
+ Lists of files are also supported:
59
+
60
+ ~~~python
61
+
62
+ imfiles = ['/path/to/image1.png','/path/to/image2.png','/path/to/image3.png']
63
+
64
+ dataloader = CellDataloader(imfiles)
65
+
66
+ for image in dataloader:
67
+ ...
68
+ ~~~
69
+
70
+ Labels
71
+ ------
72
+
73
+ 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:
74
+
75
+ ~~~python
76
+ imfolder1 = '/path/to/my/images'
77
+ imfolder2 = '/path/to/your/images'
78
+
79
+ dataloader = CellDataloader(imfolder1,imfolder2)
80
+
81
+ for label,image in dataloader:
82
+ ...
83
+ ~~~
84
+
85
+ Alternatively, if you have one folder or file list with images that have different naming conventions, a regex match is supported:
86
+
87
+ ~~~python
88
+ imfiles = ['/path/to/CANCER_image1.png',
89
+ '/path/to/CANCER_image2.png',
90
+ '/path/to/CANCER_image3.png',
91
+ '/path/to/HEALTHY_image1.png',
92
+ '/path/to/HEALTHY_image2.png',
93
+ '/path/to/HEALTHY_image3.png']
94
+
95
+ dataloader = CellDataloader(imfiles,label_regex = ["CANCER","HEALTHY"])
96
+ for label,image in dataloader:
97
+ ...
98
+ ~~~
99
+
100
+ Boxes
101
+ -----
102
+
103
+ 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:
104
+
105
+ | X | Y | W | H | Label |
106
+ | - | - | - | - | ----- |
107
+ | 14 | 13 | 5 | 6 | 0 |
108
+ | 20 | 25 | 15 | 5 | 1 |
109
+
110
+
111
+ ~~~python
112
+ dataloader = CellDataloader('/path/to/file.svs',cell_box_filelist=['/path/to/boxfile.csv'])
113
+ ~~~
114
+
115
+ Arguments
116
+ ---------
117
+
118
+ Additional arguments taken by Cell Data Loader include
119
+
120
+ ~~~python
121
+
122
+ imfolder = '/path/to/folder'
123
+
124
+ dataloader = CellDataloader(imfolder,
125
+ dim = (64,64),
126
+ batch_size = 64,
127
+ dtype = "torch", # Can also be "numpy"
128
+ label_regex = None,
129
+ verbose = True,
130
+ segment_image = "whole", # "whole" outputs the whole image, resized
131
+ # to dim; "sliced" cuts the image checkerboard pattern into
132
+ # dim-shaped outputs, so it's suitable for large images; "cell"
133
+ # segments cells from the image using CellPose, though it throws
134
+ # an error if CellPose is not installed properly. CellPose is
135
+ # not included by default in the dependencies and needs to be
136
+ # installed separately by the user.
137
+ n_channels = 3, # Detected in first image by default; re-samples all
138
+ # images to force this number of channels
139
+ augment_image = True, # Augments the output image in the standard
140
+ # ways -- rotation, color jiggling, etc.
141
+ label_balance = True, # Outputs proportional amounts of each label
142
+ # in the dataset
143
+ gpu_ids = None, # GPUs that the outputs are read to, if present.
144
+ channels_first = True # Places channels either first, before the
145
+ # batch dimension, or last
146
+ )
147
+ ~~~
148
+
@@ -0,0 +1,8 @@
1
+ cell_data_loader/.cell_data_loader.py.swp,sha256=4Tg3NezzDKp_0Kq5zr5PlsmONGs6Ycfn4GS2qkfxSj0,32768
2
+ cell_data_loader/__init__.py,sha256=Xk0VWa_-LrN8s5WQE5ofDYNnFasxkGPu0c4mbXKxEJo,56
3
+ cell_data_loader/base_dataset.py,sha256=JKo7qCLYgZmnyiJuF9wNWu1r4exPkpyngy8NumAykQg,1616
4
+ cell_data_loader/cell_data_loader.py,sha256=8ProTPvAGEOUimZKqWe0gmcwqI3i_baqq6jdiQMKcN4,20613
5
+ cell_data_loader/util.py,sha256=K9qvZZfU_gQjnspb-pXTr6UHCkhyXtKw57U7dqNZ_lw,29083
6
+ cell_data_loader-0.0.32.dist-info/METADATA,sha256=sOKg9HmovcNtPkEOd6WGtlH6BgsO6KCoeTbQ_TPICBg,4963
7
+ cell_data_loader-0.0.32.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8
+ cell_data_loader-0.0.32.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any