Reusable ImageJ and Python tools for preprocessing multi-channel DV microscopy stacks and exporting 8-bit TIFF maximum-intensity projections.
This folder contains a Python script and the original ImageJ/Fiji macro workflow on which it was based. The tools are intended for routine microscopy preprocessing, especially for DeltaVision-style .dv image stacks containing multiple fluorescence channels.
dv_stack_projection_processor.py
imagej_stack_projection_workflow.ijm
The workflow converts multi-channel Z-stacks into processed TIFF projections.
For each selected channel, the scripts can:
- Set display intensity limits.
- Convert the image stack to 8-bit.
- Apply rolling-ball background subtraction.
- Generate maximum-intensity projections.
- Optionally split the Z-stack into top and bottom projections.
- Export the resulting images as TIFF files.
The Python version automates the workflow for multiple .dv files in a folder. In contrast to the ImageJ macro, the Python script automatically saves the processed projection images as TIFF files in the output folder.
dv_stack_projection_processor.py
This script processes all files ending with:
_D3D.dv
in a selected folder.
It reads each DV file, extracts the requested number of channels, applies channel-specific intensity scaling, subtracts background using a rolling-ball algorithm, and exports maximum-intensity TIFF projections.
- Batch processing of multiple
.dvfiles. - Support for one or more fluorescence channels.
- Channel-specific minimum and maximum intensity values.
- Rolling-ball background subtraction.
- Optional top/bottom Z-stack splitting.
- TIFF output saved automatically in a
processed_tiff/folder.
The script creates an output folder:
processed_tiff/
If top/bottom splitting is enabled, output files are named:
sample_ch1_top.tif
sample_ch1_bottom.tif
sample_ch2_top.tif
sample_ch2_bottom.tif
If splitting is disabled, output files are named:
sample_ch1.tif
sample_ch2.tif
imagej_stack_projection_workflow.ijm
This macro represents the original manual ImageJ workflow.
Unlike the Python script, the ImageJ macro does not automatically save the projected images as TIFF files. After each projection is generated and displayed in a pop-up image window, the image should be copied to the clipboard and pasted manually into Photoshop for figure preparation or further handling.
The macro performs channel splitting, intensity scaling, 8-bit conversion, rolling-ball background subtraction, and maximum-intensity projection.
The macro includes two related workflows.
This part splits a multi-channel stack and generates top and bottom projections for each channel.
The Z-stack is divided approximately in half, with optional channel-specific offsets:
channel 1: nSlices / 2
channel 2: nSlices / 2 + 1
channel 3: nSlices / 2 + 2
channel 4: nSlices / 2 + 3
This was used to generate separate projections from different regions of the same Z-stack.
The macro also contains a simpler diakinesis workflow, where each channel is projected across the full Z-stack without top/bottom splitting.
The Python script requires:
python
numpy
tifffile
scikit-image
aicsimageio
Install the required packages with:
pip install numpy tifffile scikit-image "aicsimageio[all]"The ImageJ macro requires:
Fiji or ImageJ
The macro uses standard ImageJ commands including:
Stack Splitter
Subtract Background
Z Project
8-bit conversion
Place the Python script anywhere on your computer.
Run:
python dv_stack_projection_processor.pyThe script will ask for:
Folder containing *_D3D.dv files
Number of channels to process
Whether to split the stack into top/bottom projections
Minimum and maximum intensity values for each channel
Z-split offset for each channel
Example:
Folder containing *_D3D.dv files: /path/to/images
How many channels should be processed [1]: 4
Split each channel into top/bottom half projections? [Y/n]: Y
The processed TIFF files will be saved in:
/path/to/images/processed_tiff/
The Python script currently uses these default values:
Channel 1: min = 0, max = 60000, offset = 0
Channel 2: min = 0, max = 130000, offset = 1
Channel 3: min = 0, max = 110000, offset = 2
Channel 4: min = 0, max = 170000, offset = 3
These values can be changed interactively when the script is run.
The Python script reproduces the main logic of the ImageJ macro.
For each channel:
raw stack
→ intensity scaling
→ 8-bit conversion
→ rolling-ball background subtraction
→ maximum-intensity projection
→ TIFF export
When top/bottom splitting is enabled, the split slice is included in both projections, matching the ImageJ-style logic:
top projection: slice 1 to split slice
bottom projection: split slice to final slice
The Python script is designed as a general reusable preprocessing tool, not as a project-specific analysis script.
It is useful for routine conversion of DV microscopy stacks into TIFF projections before downstream analysis, figure preparation, or manual inspection.
The ImageJ macro is kept as a reference workflow and for cases where manual processing in Fiji is preferred.
- The Python script currently processes only the first timepoint of each DV file.
- Input files must end with
_D3D.dv. - The script assumes channel order is consistent across files.
- Intensity scaling values should be adjusted for each experiment.
- Rolling-ball background subtraction uses a fixed radius of 50 pixels.