Data and code from: Temperature effects on wing vein morphology
Data files
Jul 21, 2026 version files 3.23 GB
-
image_sets.zip
820.32 MB
-
models.zip
2.41 GB
-
README.md
27.37 KB
-
scripts.zip
1.18 MB
-
SI_file_2.zip
649.85 KB
-
step_03_wing_list_core.txt
26.28 KB
Abstract
Insect wings commonly have two types of veins: primary veins have fixed positions across members of a given species, while the number, position, and connections of secondary veins vary from wing to wing even within individuals. Relative to primary veins, very little is known about the patterning and development of secondary venation, in part because they cannot be analyzed with traditional morphometric approaches, which require the identification of homologous landmarks across all wings. We present a landmark-free morphometric approach for analyzing secondary wing venation, and we use it to describe the effects of temperature on secondary vein patterns in the common cricket Acheta domesticus. Our principal components-based approach identified three major compartments to the wing within which we observed correlations among the shapes of domains formed by secondary veins.
Dataset DOI: 10.5061/dryad.z08kprrv1
Description of the data and file structure
Image files and scripts for Johnston et al., Temperature effects on wing vein
morphology revealed by landmark-free morphometrics.
Insect wings commonly have two types of veins: primary and secondary.
Primary veins have fixed positions across members of a given species, while
the number, position, and connections of secondary veins vary from wing to
wing even within individuals. Relative to primary veins, very little is
known about the patterning and development of secondary venation, in part
because they cannot be analyzed with traditional morphometric approaches,
which require the identification of homologous landmarks across wings. We
present a landmark-free morphometric approach for analyzing secondary wing
venation, and we use it to describe the effects of temperature on secondary
vein patterns in the common cricket Acheta domesticus (Linnaeus, 1758).
Our principal components-based approach identified three major compartments
to the wing within which we observed correlations among the shapes of
domains formed by secondary veins. Most interestingly, the effects of
temperature varied across these compartments: higher temperatures were
associated with larger domains in one compartment, smaller domains in
another, and had no marginal correlation with domain shape in a third. This
suggests that secondary vein development may involve multiple independent
patterning systems in different regions, or more likely, a system whose
parameters vary across the wing field.
The general workflow was: photograph each wing next to a size-calibration
sticker → detect and measure the sticker and the wing in each photo →
segment each wing image into regions (ROIs) with a trained Cellpose model →
warp every wing onto a shared reference wing so all wings share one
coordinate system → measure wing shape from the warped ROIs → analyze the
resulting measurements statistically in R. Because several steps of this
pipeline involve tunable parameters (e.g., how Cellpose calls a region
boundary), the same pipeline was also re-run many times with one parameter
at a time changed from its default value, to check how sensitive the results
are to these choices (see "Parameter-sensitivity runs" below).
File-naming conventions used throughout this submission
STEP_NNprefixes on scripts indicate their order in the pipeline
(e.g.,STEP_05runs beforeSTEP_06)._master.pyscripts are generic scripts that take command-line
arguments (file paths, parameter values, etc.) and do not have any
paths or parameters hard-coded; they are not run directly. Each is
called, with the appropriate arguments filled in, either by a.sh
wrapper script (Steps 01–02) or by a same-named.pywrapper script
without_masterin a run-specific subfolder (Steps 05–12; e.g.
STEP_05_run_cellpose.pycallsSTEP_05_run_cellpose_master.py)..shscripts are bash wrappers that run one_master.pyscript
on oneimage_batch_Nfolder of raw photographs..Rscripts are run in R (viaRscriptfrom the command line, or
interactively in RStudio/Spyder).- Folders named
image_batch_N(Steps 01–02) each hold one batch of raw
photographs and that batch's outputs; batch numbers are not
sequential/complete because some early batches were superseded or
excluded.image_batch_6rsholds wings from batch 6 that were reshot
and reprocessed (the "rs" suffix stands for "reshoot"). - Folders named
segmentation_<parameter>_10orsegmentation_<parameter>
(Steps 04.5–13) each hold a full, self-contained copy of the Steps
04.5–12 scripts, run with one parameter changed from the pipeline's
default value — see the parameter-sensitivity table below. Within
each, the sub-folder name (run_id, e.g.cp05,ft20,PNF001L)
identifies the specific parameter value used for that run. - macOS system files (
.DS_Store, the__MACOSX/folder, and its
._\*"AppleDouble" files) and the.Rhistoryfile are not data —
they are artifacts of copying files on a Mac and of using RStudio.
Files and variables
File: scripts.zip
Description: All scripts used to run the image-processing pipeline and
statistical analyses. No special software beyond what's listed in
"Code/software" below is needed to open any of these as plain text.
Top-level pipeline scripts (called by the .sh/.py wrappers described
above, or run directly for the R scripts):
Step 01
- Script(s):
STEP_01_mask_and_measure_circles_master.py(run per batch viaimage_batch_N/STEP_01_mask_and_measure_circles.sh) - Purpose: Uses Segment Anything to find the 6 mm calibration-circle sticker in each raw photo and measure its area, for later size calibration
- Key input(s): Raw images in
image_batch_N/original/; SAM model (models/sam_vit_h_4b8939.pth); approximate on-image location of the circle - Key output(s):
image_batch_N/step_01_circle_masks/(annotated images, for visual QC);image_batch_N/wing_data/step_01_areas_of_circles.txt(circle area in pixels, per image)
Step 02
- Script(s):
STEP_02_mask_and_measure_wings_master.py(run per batch viaimage_batch_N/STEP_02_mask_and_measure_wings.sh) - Purpose: Uses Segment Anything to find the wing itself in each photo, measure its area, and crop it out
- Key input(s): Raw images; SAM model; approximate on-image location of the wing
- Key output(s):
image_batch_N/step_02_wing_masks/(QC images);image_batch_N/step_02_cropped_wings/(cropped wing-only images used by all later steps); wing area added towing_data/
Step 03
- Script(s):
STEP_03_summarize_wings.py;STEP_03.1_summarize_wings_redoes.py(same logic, run on theimage_batch_6rsredo set — see note above) - Purpose: Combines the per-batch circle/wing area files from every listed
image_batch_N/wing_data/folder into one master table, dropping duplicate wing IDs (keeping the last-listed batch's copy) - Key input(s):
wing_data/step_01_areas_of_circles.txtandstep_02_areas_of_wings.txtfrom each batch folder - Key output(s): A master wing list (e.g.
step_03_wing_list.txt)
Step 04
- Script(s):
STEP_04_train_cellpose.txt(a text note, not a runnable script) - Purpose: Documents that the Cellpose segmentation model was fine-tuned manually using the Cellpose GUI, outside of these scripts
- Key input(s): Wing images, labeled manually in the Cellpose GUI
- Key output(s): Trained model file,
models/step_04_ftmodel10_1
Step 04.5
- Script(s):
STEP_04.5_set_parameters.py - Purpose: Sets/records every parameter for one pipeline "run" (file paths, Cellpose thresholds, the registration/transformation type and reference wing, the measurement grid spacing, etc.)
- Key input(s): Constants edited at the top of the script for that run
- Key output(s):
parameters.txtin that run's folder, read by every later script in the same run
Step 05
- Script(s):
STEP_05_run_cellpose_master.py(run per wing via each run'sSTEP_05_run_cellpose.py) - Purpose: Runs the trained Cellpose model on one cropped wing image, segmenting it into regions (ROIs)
- Key input(s): One cropped wing image; the trained Cellpose model; Cellpose parameters from
parameters.txt - Key output(s): A Cellpose
\*_seg.npyresult file (ROI masks) per wing, instep_05_cellpose_results/
Step 06
- Script(s):
STEP_06_visualize_cellpose_results_master.py;STEP_06.1_visualize_cellpose_results_for_figA.py(a one-off, higher-resolution version of the same idea, hard-coded for a single wing used in a manuscript figure) - Purpose: Draws the Cellpose ROI outlines on top of each wing image for visual quality-checking (Cellpose's own equivalent plotting function did not work reliably)
- Key input(s):
\*_seg.npyfiles from Step 05 - Key output(s): Annotated PNG images with ROI outlines overlaid
Step 07
- Script(s):
STEP_07_transform_wing_master.py - Purpose: Registers ("warps") each wing image onto a shared reference wing image using OpenCV's ECC image-alignment algorithm, so all wings end up in one common coordinate system
- Key input(s): A cropped wing image; the chosen reference wing image; the transformation type (e.g., affine, from
parameters.txt) - Key output(s): A transformed wing image; the fitted transformation itself (pickled), in
step_07_wing_transformations/
Step 08
- Script(s):
STEP_08_transform_rois_master.py;STEP_08.5_plot_stacked_rois.py(STEP_08_transform_and_measure_rois_master.pyis an earlier, superseded version and is not used by the pipeline);STEP_08.1_transform_rois_for_figA.py(one-off figure variant) - Purpose: Applies the Step 07 transformation to each wing's Cellpose ROIs, so the ROIs line up on the shared coordinate system;
STEP_08.5additionally overlays every transformed wing's (eroded) ROIs on top of one another, to visualize where the wing veins consistently fall - Key input(s): The Step 07 transformation; the ROIs from Step 05
- Key output(s): Transformed ROI outlines (pickled/gzipped), in
step_08_transformed_rois/; a combined "stacked ROIs" image across many wings
Step 09
- Script(s):
STEP_09_measure_wing_traits_master.py - Purpose: Lays a regular grid of points (spaced by the
measurement_grid_size parameter, in pixels) over each wing's transformed ROIs and records which ROI (if any) each grid point falls in — the core per-wing shape measurement - Key input(s): One wing's transformed image, ROIs, and transformation
- Key output(s): One measurement file per wing, in
step_09_wing_measurements/
Step 10
- Script(s):
STEP_10_measure_paired_wing_traits_master.py - Purpose: Repeats a comparable grid-based measurement, but jointly for the left and right wing of the same individual, to quantify left–right (within-individual) differences; not used in the paper.
- Key input(s): Left- and right-wing images/ROIs/transformations for one individual
- Key output(s): One paired-wing measurement file per individual
Step 11
- Script(s):
STEP_11_get_paired_wing_traits_baseline.py(wraps theSTEP_10master script) - Purpose: Runs the same paired-wing comparison as Step 10, but between wings from different individuals, to build a null/baseline expectation for how different two unrelated wings look; not used in the paper.
- Key input(s): The same cropped wing images, paired across individuals rather than within one
- Key output(s): Inter-individual "baseline" measurement files, in
step_11_interindividual_measurements/
Step 12
- Script(s):
STEP_12_do_mini_analysis.py(wrapsSTEP_11.0_mini_data_analysis.R) - Purpose: Runs the standard statistical "mini-analysis" (see below) for one parameter-variant run, using that run's own Step 09–11 outputs
- Key input(s): That run's measurement files;
parameters.txt - Key output(s):
step_12_results.RData— statistical results for that one run
Step 13
- Script(s):
STEP_13_summarizing_mini_analyses.R - Purpose: Gathers
step_12_results.RDatafrom every parameter-variant run (default, reference-wing, cell-probability, flow-threshold, grid-size, min-size, and warp-type runs) into summary tables, to see how sensitive the results are to pipeline choices - Key input(s):
step_12_results.RDatafrom each run folder - Key output(s): Summary tables comparing results across parameter choices (reported in the supplement)
Additional scripts
- Script:
STEP_11.0_maxi_data_analysis.R - Purpose: Runs the main statistical analysis reported in the manuscript: a PCA (with missMDA-based handling of missing measurements) and permutation-based tests (via the
veganpackage) relating secondary-vein domain shape to temperature treatment, using the default-parameter run's measurements - Key input(s):
step_09_wing_measurements/from the default run - Key output(s): PCA ordination, plots, and test results reported in the manuscript
- Script:
STEP_11.0_PCA_data_analysis.R - Purpose: An earlier/exploratory version of the same analysis; it did not feed into any result reported in the manuscript
- Key input(s):
step_09_wing_measurements/from the default run - Key output(s): Exploratory PCA output, not used in the manuscript
- Script:
STEP_10.5_summarize_wings_again.py - Purpose: Takes the Step 03 master wing list and adds a correction for how much a shape's area changes under the Step 07/08 image transformation (wing/circle area was measured before transformation; ROI area is measured after)
- Key input(s): The Step 03 wing list; the transformations from
step_07_wing_transformations/ - Key output(s): An adjusted wing list, e.g.,
step_10.5_wing_list.txt
Parameter-sensitivity runs. Folders named segmentation_default_10,
segmentation_cellprob_10, segmentation_flowthreshold_10,
segmentation_gridsize, segmentation_minsize_10, segmentation_refwings_10,
and segmentation_warps_10 each contain one or more complete copies of the
Steps 04.5–12 scripts described above, differing only in the parameter
value listed below (all other files/settings match the default run):
Folder (batch_id) |
Parameter varied | Values tested (run_id folder names) |
|---|---|---|
segmentation_default_10/default |
(none — baseline/default parameters) | default |
segmentation_cellprob_10 |
Cellpose cell-probability threshold | cp05=0.05, cp10=0.1, cp20=0.2, cp40=0.4, cpn05=−0.05, cpn10=−0.1, cpn20=−0.2, cpn40=−0.4 |
segmentation_flowthreshold_10 |
Cellpose flow threshold | ft20=0.20, ft30=0.30, ft35=0.35, ft45=0.45, ft50=0.50, ft70=0.70 |
segmentation_gridsize |
Measurement grid spacing, in pixels (Step 09/10) | gs10=10, gs25=25, gs40=40, gs60=60, gs100=100 |
segmentation_minsize_10 |
Cellpose minimum ROI size, in pixels | ms05=5, ms10=10, ms20=20, ms40=40, ms80=80 |
segmentation_refwings_10 |
Which wing was used as the shared registration reference (Step 07/08) | 13 runs, one per candidate reference wing (folder name = wing ID, e.g. PNF001L, PNF002L, …, PNF053L) |
segmentation_warps_10 |
Type of image transformation used for registration (Step 07/08), in place of the default affine transformation | euclidean, homography, translation |
File: image_sets.zip
Description: wing_log.tsv provides information on all wings used in
the analysis. image_batch directories contain the raw images inputted
into the pipeline (in the "original" subdirectories), as well as the
parameters used to segment them (in the "wing_data" subdirectories.
Wings used as possible reference wings can be seen in the reference_wings
subdirectory.
wing_log.tsv is a running lab log covering every wing ever photographed
for this line of work — it includes many entries (reference wings, other
cricket populations, pilot manipulation trials, and test photos) that were
not part of the analysis reported in the manuscript. The wings actually
used in the published analysis are the subset listed in
step_03_wing_list_core.txt (IDs beginning LIF/LIM/LNF/LNM; see
that file's entry below for what the ID encodes).
Columns:
| Column | Description | Units / category key |
|---|---|---|
ID |
Unique identifier for one wing, using the same ID scheme(s) described under step_03_wing_list_core.txt above, plus additional ID formats for wings outside that core analysis set (e.g. ADF01-F01L, P Gen-F001L, TM03R) |
— |
Physical wing location |
Where the physical (mounted/dried) wing specimen is kept. Binder (723 rows) = filed in the lab's physical wing binder. Not existant, Missing, and the literal text None all mean the physical specimen is not available. |
Categorical |
Cricket source |
Where the individual came from: Lab-reared, Bismarck Petco, Bismarck KT Pet Store, or not recorded (?, 10 rows) |
Categorical |
Wing manipulation |
For the temperature-effect wings analyzed in the manuscript, 35 Degree (68 rows) marks the higher-temperature rearing group; the lower-temperature (~28°C) group is not separately labeled in this column (temperature treatment for these wings is instead read from the second letter of the ID — see step_03_wing_list_core.txt below). The remaining values (poke, clip, slit, PBS injection, Heparin .1µg/mL, Heparin 1µg/mL, DMSO injection — 155 rows combined) are from other, unrelated pilot work and are not part of the manuscript's analysis. |
Categorical |
Image location |
Which raw-image batch/archive the wing's photo is filed under (image_batch_N, reference_wings, or trial_images.zip), or NA (78 rows) when no photo is on file. See "Missing data" below. |
Categorical (folder/archive name) |
Image location 2, Image location 3, Image location 4 |
Same as Image location, used when a wing was photographed more than once (e.g. in an original batch and again later) — additional batch names go in these columns instead of overwriting the first. Blank when there is no additional photo. |
Categorical |
hind wing location |
Where the same individual's hind wing is filed, on the same Binder/none basis as Physical wing location |
Categorical |
notes |
Free-text notes; none when there is nothing to note. A handful of rows note things like "lacked hind wings" or "unsure if from the same individual." |
Free text |
File: models.zip
Description: sam_vit_h_4b8939.pth is the model used by SegmentAnything.
step_04_ftmodel10_1 is the model used by Cellpose.
File: step_03_wing_list_core.txt
Description: The specific list of wings selected for the analyses
reported in the manuscript (a filtered version of the master wing list
produced by Step 03 above — see the pipeline table for how it's built).
Tab-delimited text with one header row and one row per wing. Columns:
| Column | Description | Units / key |
|---|---|---|
wing_id |
Unique identifier for one wing, formatted as \[culture]\[treatment]\[sex]\[individual number]\[side] — e.g. LIF001L: 1st letter = culture the crickets came from (L, the only culture used in this analyzed subset); 2nd letter = experimental treatment (I = increased/35°C rearing temperature, N = normal/~28°C rearing temperature); 3rd letter = sex (F/M); digits = individual number; final letter = wing side (L/R) |
See note |
circle_area |
Pixel area of the 6 mm calibration-circle sticker in that wing's photo (from Step 01). This file's values are in raw pixels; the corresponding real-world (mm²) measurements used in the manuscript are computed downstream in the R analysis scripts from this pixel area and the sticker's known 6 mm size. | pixels |
wing_area |
Pixel area of the wing itself (from Step 02) | pixels |
location |
Path to the image_batch_N folder the wing's original photo came from |
file path (folder name only carries information; the leading /Users/... portion is a local path from the researchers' own computer and won't resolve on another machine) |
File: SI_file_2.zip
Description: Supplementary figures showing how wing regions (ROIs) map
onto the first four PCA axes (see STEP_11.0_mini_data_analysis.R /
STEP_13_summarizing_mini_analyses.R above), one figure per
parameter-sensitivity run. File names follow the pattern
<batch_id>_<run_id>_figC_PCA_correlations_mini.pdf, where <batch_id> and
<run_id> match the parameter-sensitivity table above (e.g.
cellprob_10_cp05_figC_PCA_correlations_mini.pdf is the figure for the
Cellpose cell-probability-threshold run set to 0.05).
Code/software
No special software is needed to view the plain-text/tab-delimited files.
To re-run the scripts, you will need:
- Python 3, with the packages:
numpy,opencv-python(cv2),torch,
matplotlib,pandas,scipy,imageio,segment-anything(Meta AI's
SAM package), andcellpose. - R, with the packages:
data.table,dplyr,tidyr,ggplot2,
FactoMineR,factoextra,vegan,missMDA,viridis,gridExtra,
png,optparse,lme4, andMuMIn. - A bash shell to run the
.shwrapper scripts (these were run on
macOS/Linux; Windows users can use WSL or adapt them to PowerShell).
.sh files were run in bash; .py files in Python; .R files in R.
