crop-zarr: keep one object's area of a zarr
crop-zarr makes a copy of a series' zarr that keeps only the area around one object and turns everything else black. It uses PyReconstruct's own cropping script.
📐 Same size, same place
The images keep their full size, so the crop lines up with your series. Anything you trace on the crop lines up with the full zarr too.
🪶 Much smaller
Black areas are not even stored, so a crop is a small fraction of the original. Easy to copy to a laptop or share.
🔒 Original untouched
crop-zarr only reads the original zarr. The crop is a new folder.
New here? Start with Zarr tools on khlabgpu1: connecting, the job list, copying, and troubleshooting.
Save your series in PyReconstruct first. crop-zarr reads the saved .jser file. Changes you have not saved are not included.
1. Start it
On khlabgpu1, type:
crop-zarrIf you already have jobs, it shows your job list first; type c to crop. It asks four questions, then shows a summary before anything starts.
Step | What to give it | Good to know |
|---|---|---|
STEP 1 the series | The series file ( | It shows how many sections and objects the series has. A big series takes a few seconds to read. |
STEP 2 the object | The name of the object to keep, for example | Press Tab to finish a name, or type |
STEP 3 the space around it | How far past the object's outer edges to keep, in microns (µm). | The screen shows how many pixels 1 µm is in your series. |
STEP 4 the zarr, and where the crop goes | It finds the zarr your series uses; press Enter to accept the suggested folder or type another. | The crop is named after the zarr and object, for example |
Zarr on khlabfiles? crop-zarr then suggests your folder on khlabgpu1, /data/data6/<your username>, instead of next to the zarr. Writing a crop onto khlabfiles can take hours; on khlabgpu1 a 276-section crop took about 2 minutes. If you need the crop on khlabfiles, copy its one-file .tar there afterwards.
2. While it runs
Crop the zarr, section by section.
Make the one-file .tar copy, written beside the crop.
Close the window whenever you like. Type crop-zarr again to see your jobs.
3. When it is done
Look at it: open the series in PyReconstruct, then Series > Images > Find/change image directory, and pick the crop. Switch back the same way to the original zarr.
Copy it: press
cfor step-by-step help, or see Copying a zarr somewhere else.In the folder: the crop, its
.tar, aHOW-TO-COPY.txt, and aRUN-LOG.txt(which object, how much space, from which zarr, who ran it and when). Inside the crop: acrop_log.txtthat lists every section that was filled in, made gray, or kept whole.
How long it takes
Real numbers from one series on khlabgpu1: 276 sections, the object on 232 of them, 2.5 µm kept around it, the zarr read from khlabfiles.
Where the crop is written | Crop time | Files written |
|---|---|---|
NOW khlabgpu1 ( | about 2 min | about 10,000 |
UNTIL OCT 6, 2026 khlabgpu1, when crops still stored the black areas | about 12 min | about 120,000 |
AVOID onto khlabfiles, with the old crop | about 2.5 h (estimated) | about 466 per section |
The newer crop simply does not store the all-black pieces, which read back as black anyway. Old and new crops of this series were compared image by image (864 images, no differences): same pixels, same image size, same coordinates, so work traced on a crop still lines up with the full zarr.