Skip to content

Commit 7d76edb

Browse files
d33bsgwaybio
andauthored
Add small real-world data and tests (#46)
* add cp 3d tutorial test input and output data * remove csv data * add tests * image loading tests * linting config * add docs throughout Co-Authored-By: Gregory Way <gregory.way@gmail.com> --------- Co-authored-by: Gregory Way <gregory.way@gmail.com>
1 parent 3bde1f4 commit 7d76edb

15 files changed

Lines changed: 847 additions & 1 deletion

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@ repos:
5757
rev: v0.11.0
5858
hooks:
5959
- id: shellcheck
60+
exclude: ^tests/data/CP_tutorial_3D_noise_nuclei_segmentation/run\.sh$
6061
# args: ["--severity=warning"] # Optionally only show errors and warnings

‎CITATION.cff‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,13 @@ references:
4343
family-names: Bunten
4444
- given-names: Gregory P.
4545
family-names: Way
46+
- type: data
47+
title: "3D Noise Nuclei Segmentation Tutorial"
48+
authors:
49+
- name: "CellProfiler Tutorials Team"
50+
url: "https://tutorials.cellprofiler.org/#3d-noise-nuclei-segmentation"
51+
publisher:
52+
name: "CellProfiler Organization"
53+
notes: >-
54+
This work uses data that were slightly modified from the CellProfiler 3D
55+
Noise Nuclei Segmentation tutorial.

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ lint.per-file-ignores."*.ipynb" = [ "C408", "E402", "E501" ]
106106
lint.per-file-ignores."src/**/__init__.py" = [ "F401" ]
107107

108108
[tool.codespell]
109-
ignore-words-list = "inout"
109+
ignore-words-list = "doesnot,inout"
110110

111111
[tool.vulture]
112112
paths = [ "src/zedprofiler", "tests" ]
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
CellProfiler Pipeline: http://www.cellprofiler.org
2+
Version:5
3+
DateRevision:421
4+
GitHash:
5+
ModuleCount:17
6+
HasImagePlaneDetails:False
7+
8+
Images:[module_num:1|svn_version:'Unknown'|variable_revision_number:2|show_window:False|notes:['To begin creating your project, use the Images module to compile a list of files and/or folders that you want to analyze. You can also specify a set of rules to include only the desired files in your selected folders.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
9+
:
10+
Filter images?:Images only
11+
Select the rule criteria:and (extension does isimage) (directory doesnot containregexp "[\\\\/]\\.")
12+
13+
Metadata:[module_num:2|svn_version:'Unknown'|variable_revision_number:6|show_window:False|notes:['The Metadata module optionally allows you to extract information describing your images (i.e, metadata) which will be stored along with your measurements. This information can be contained in the file name and/or location, or in an external file.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
14+
Extract metadata?:Yes
15+
Metadata data type:Text
16+
Metadata types:{}
17+
Extraction method count:1
18+
Metadata extraction method:Extract from file/folder names
19+
Metadata source:File name
20+
Regular expression to extract from file name:^(?P<Plate>.*)_(?P<Well>[A-P][0-9]{2})_s(?P<Site>[0-9])_w(?P<ChannelNumber>[0-9])
21+
Regular expression to extract from folder name:(?P<Date>[0-9]{4}_[0-9]{2}_[0-9]{2})$
22+
Extract metadata from:All images
23+
Select the filtering criteria:and (file does contain "")
24+
Metadata file location:Elsewhere...|
25+
Match file and image metadata:[]
26+
Use case insensitive matching?:No
27+
Metadata file name:None
28+
Does cached metadata exist?:Yes
29+
30+
NamesAndTypes:[module_num:3|svn_version:'Unknown'|variable_revision_number:8|show_window:False|notes:['The NamesAndTypes module allows you to assign a meaningful name to each image by which other modules will refer to it.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
31+
Assign a name to:All images
32+
Select the image type:Grayscale image
33+
Name to assign these images:Nuclei
34+
Match metadata:[]
35+
Image set matching method:Order
36+
Set intensity range from:Image metadata
37+
Assignments count:1
38+
Single images count:0
39+
Maximum intensity:255.0
40+
Process as 3D?:Yes
41+
Relative pixel spacing in X:0.129
42+
Relative pixel spacing in Y:0.129
43+
Relative pixel spacing in Z:0.2
44+
Select the rule criteria:and (file does contain "c00")
45+
Name to assign these images:c00
46+
Name to assign these objects:Cell
47+
Select the image type:Grayscale image
48+
Set intensity range from:Image metadata
49+
Maximum intensity:255.0
50+
51+
Groups:[module_num:4|svn_version:'Unknown'|variable_revision_number:2|show_window:False|notes:['The Groups module optionally allows you to split your list of images into image subsets (groups) which will be processed independently of each other. Examples of groupings include screening batches, microtiter plates, time-lapse movies, etc.']|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
52+
Do you want to group your images?:No
53+
grouping metadata count:1
54+
Metadata category:FileLocation
55+
56+
GaussianFilter:[module_num:5|svn_version:'Unknown'|variable_revision_number:1|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
57+
Select the input image:Nuclei
58+
Name the output image:GaussianFilter
59+
Sigma:1
60+
61+
ReduceNoise:[module_num:6|svn_version:'Unknown'|variable_revision_number:1|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
62+
Select the input image:GaussianFilter
63+
Name the output image:ReduceNoise
64+
Size:5
65+
Distance:2
66+
Cut-off distance:0.2
67+
68+
Threshold:[module_num:7|svn_version:'Unknown'|variable_revision_number:12|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
69+
Select the input image:ReduceNoise
70+
Name the output image:Threshold
71+
Threshold strategy:Global
72+
Thresholding method:Otsu
73+
Threshold smoothing scale:1.5
74+
Threshold correction factor:1
75+
Lower and upper bounds on threshold:0,1.0
76+
Manual threshold:0.0
77+
Select the measurement to threshold with:None
78+
Two-class or three-class thresholding?:Three classes
79+
Log transform before thresholding?:No
80+
Assign pixels in the middle intensity class to the foreground or the background?:Background
81+
Size of adaptive window:50
82+
Lower outlier fraction:0.05
83+
Upper outlier fraction:0.05
84+
Averaging method:Mean
85+
Variance method:Standard deviation
86+
# of deviations:2.0
87+
Thresholding method:Otsu
88+
89+
Watershed:[module_num:8|svn_version:'Unknown'|variable_revision_number:3|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
90+
Select the input image:Threshold
91+
Name the output object:Watershed
92+
Use advanced settings?:No
93+
Generate from:Distance
94+
Markers:None
95+
Mask:Leave blank
96+
Connectivity:1
97+
Compactness:0.0
98+
Footprint:10
99+
Downsample:3
100+
Separate watershed labels:No
101+
Declump method:Intensity
102+
Reference Image:GaussianFilter
103+
Segmentation distance transform smoothing factor:0
104+
Minimum distance between seeds:1
105+
Minimum absolute internal distance:0.0
106+
Pixels from border to exclude:0
107+
Maximum number of seeds:-1
108+
Structuring element for seed dilation:ball,3
109+
110+
DilateObjects:[module_num:9|svn_version:'Unknown'|variable_revision_number:1|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
111+
Select the input object:Watershed
112+
Name the output object:RealsizeNuclei
113+
Structuring element:octahedron,1
114+
115+
MeasureObjectIntensity:[module_num:10|svn_version:'Unknown'|variable_revision_number:4|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
116+
Select images to measure:Nuclei
117+
Select objects to measure:RealsizeNuclei
118+
119+
MeasureObjectSizeShape:[module_num:11|svn_version:'Unknown'|variable_revision_number:3|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
120+
Select object sets to measure:RealsizeNuclei
121+
Calculate the Zernike features?:No
122+
Calculate the advanced features?:Yes
123+
124+
RescaleIntensity:[module_num:12|svn_version:'Unknown'|variable_revision_number:3|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:False|wants_pause:False]
125+
Select the input image:Nuclei
126+
Name the output image:RescaleIntensityNuclei
127+
Rescaling method:Stretch each image to use the full intensity range
128+
Method to calculate the minimum intensity:Custom
129+
Method to calculate the maximum intensity:Custom
130+
Lower intensity limit for the input image:0.0
131+
Upper intensity limit for the input image:1.0
132+
Intensity range for the input image:0.0,1.0
133+
Intensity range for the output image:0.0,1.0
134+
Select image to match in maximum intensity:None
135+
Divisor value:1.0
136+
Divisor measurement:None
137+
138+
OverlayObjects:[module_num:13|svn_version:'Unknown'|variable_revision_number:1|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:False|wants_pause:False]
139+
Input:RescaleIntensityNuclei
140+
Name the output image:OverlayObjects
141+
Objects:RealsizeNuclei
142+
Opacity:0.3
143+
144+
SaveImages:[module_num:14|svn_version:'Unknown'|variable_revision_number:16|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:False|wants_pause:True]
145+
Select the type of image to save:Image
146+
Select the image to save:OverlayObjects
147+
Select method for constructing file names:From image filename
148+
Select image name for file prefix:Nuclei
149+
Enter single file name:OrigBlue
150+
Number of digits:4
151+
Append a suffix to the image file name?:Yes
152+
Text to append to the image name:Overlay
153+
Saved file format:tiff
154+
Output file location:Default Output Folder|
155+
Image bit depth:8-bit integer
156+
Overwrite existing files without warning?:Yes
157+
When to save:Every cycle
158+
Record the file and path information to the saved image?:No
159+
Create subfolders in the output folder?:No
160+
Base image folder:Elsewhere...|
161+
How to save the series:T (Time)
162+
Save with lossless compression?:Yes
163+
164+
ConvertObjectsToImage:[module_num:15|svn_version:'Unknown'|variable_revision_number:1|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
165+
Select the input objects:RealsizeNuclei
166+
Name the output image:NucleiSegmentationMask
167+
Select the color format:Grayscale
168+
Select the colormap:Default
169+
170+
SaveImages:[module_num:16|svn_version:'Unknown'|variable_revision_number:16|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
171+
Select the type of image to save:Image
172+
Select the image to save:NucleiSegmentationMask
173+
Select method for constructing file names:From image filename
174+
Select image name for file prefix:Nuclei
175+
Enter single file name:OrigBlue
176+
Number of digits:4
177+
Append a suffix to the image file name?:Yes
178+
Text to append to the image name:SegmentationMask
179+
Saved file format:tiff
180+
Output file location:Elsewhere...|/app/output/masks
181+
Image bit depth:16-bit integer
182+
Overwrite existing files without warning?:Yes
183+
When to save:Every cycle
184+
Record the file and path information to the saved image?:No
185+
Create subfolders in the output folder?:No
186+
Base image folder:Elsewhere...|
187+
How to save the series:T (Time)
188+
Save with lossless compression?:Yes
189+
190+
ExportToSpreadsheet:[module_num:17|svn_version:'Unknown'|variable_revision_number:13|show_window:True|notes:[]|batch_state:array([], dtype=uint8)|enabled:True|wants_pause:False]
191+
Select the column delimiter:Comma (",")
192+
Add image metadata columns to your object data file?:Yes
193+
Add image file and folder names to your object data file?:Yes
194+
Select the measurements to export:Yes
195+
Calculate the per-image mean values for object measurements?:No
196+
Calculate the per-image median values for object measurements?:No
197+
Calculate the per-image standard deviation values for object measurements?:No
198+
Output file location:Default Output Folder|
199+
Create a GenePattern GCT file?:No
200+
Select source of sample row name:Metadata
201+
Select the image to use as the identifier:None
202+
Select the metadata to use as the identifier:None
203+
Export all measurement types?:Yes
204+
Press button to select measurements:RealsizeNuclei|AreaShape_Center_Y,RealsizeNuclei|AreaShape_Center_Z,RealsizeNuclei|AreaShape_Center_X,RealsizeNuclei|AreaShape_Volume,RealsizeNuclei|AreaShape_BoundingBoxMinimum_X,RealsizeNuclei|AreaShape_BoundingBoxMinimum_Y,RealsizeNuclei|AreaShape_BoundingBoxMinimum_Z,RealsizeNuclei|AreaShape_BoundingBoxMaximum_X,RealsizeNuclei|AreaShape_BoundingBoxMaximum_Y,RealsizeNuclei|AreaShape_BoundingBoxMaximum_Z,RealsizeNuclei|Intensity_IntegratedIntensity_Nuclei
205+
Representation of Nan/Inf:NaN
206+
Add a prefix to file names?:Yes
207+
Filename prefix:MyExpt_
208+
Overwrite existing files without warning?:Yes
209+
Data to export:Do not use
210+
Combine these object measurements with those of the previous object?:No
211+
File name:DATA.csv
212+
Use the object name for the file name?:Yes
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# modified from: https://github.com/CellProfiler/CellProfiler/blob/main/distribution/docker/Dockerfile
2+
# must be amd64, wxPython wheel for arm64 is not available
3+
FROM ubuntu:20.04
4+
5+
# bypass apt installation frontend interaction
6+
ARG DEBIAN_FRONTEND=noninteractive
7+
8+
ARG cp_version=4.2.8
9+
10+
# hadolint ignore=DL3008
11+
RUN apt-get update && \
12+
apt-get -y upgrade && \
13+
apt-get install --no-install-recommends -y \
14+
make \
15+
gcc \
16+
build-essential \
17+
libgtk-3-dev \
18+
wget \
19+
git \
20+
sqlite3 \
21+
python3.9-dev \
22+
python3.9-venv \
23+
python3-pip \
24+
openjdk-11-jdk-headless \
25+
default-libmysqlclient-dev \
26+
libnotify-dev \
27+
libsdl2-dev \
28+
libwebkit2gtk-4.0-dev && \
29+
apt-get clean \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
# set environment variables
33+
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
34+
ENV VIRTUAL_ENV=/opt/venv
35+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
36+
37+
# hadolint ignore=DL3013
38+
RUN python3.9 -m venv $VIRTUAL_ENV && \
39+
pip install --no-cache-dir --upgrade pip && \
40+
pip install --no-cache-dir \
41+
wheel \
42+
cython \
43+
numpy \
44+
https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04/wxPython-4.2.1-cp39-cp39-linux_x86_64.whl \
45+
cellprofiler==$cp_version
46+
47+
RUN groupadd --gid 10001 cpuser && \
48+
useradd --uid 10001 --gid cpuser --create-home --shell /bin/bash cpuser && \
49+
mkdir -p /usr/local/src && \
50+
chown -R cpuser:cpuser /usr/local/src
51+
52+
WORKDIR /usr/local/src
53+
USER cpuser
54+
ENTRYPOINT ["cellprofiler"]
55+
56+
CMD ["--run", "--run-headless", "--help"]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)