TomoImageStitcher

Troubleshooting

Common pitfalls and how to recover from them.

GPU is not detected

cupy.cuda.runtime.CUDARuntimeError: cudaErrorNoDevice: no CUDA-capable device is detected

“All the stacks must have the same number of slices in z.”

get_image_space_coordinates enforces that all input volumes have the same depth. Pad the shorter ones with zeros (and update the motor coordinates accordingly) before running the pipeline.

“The image must be a 3D numpy array!” / H5 layout not recognised

The Utilities.H5MaxIV.reader tries a list of common layouts:

If your data uses a different layout, either:

  1. Edit Utilities.H5MaxIV.reader to add your path, or
  2. Pre-process your data to one of the supported layouts.

ZNCC never exceeds the exclude_NCC threshold

Possible causes:

Out-of-memory during registration

Lower the per-pair data volume sent to the GPU:

Stitched volume has hard edges

Try:

TomoImageStitcher hangs at stitch_volumes_blend_equalize_parallel

multiprocessing.Pool is not compatible with CuPy on some setups — the code uses a ThreadPool instead, but you may still hit the global interpreter lock. Lower n_cores or use a single process.

Rotation-stage stitching: angles are off

Verify that the motor coordinates you pass to Stitcher are in millimetres and degrees (or both, in a consistent unit). The pipeline does not auto-detect; you control the x_y_z_correspondance mapping.

I see “float16 not supported on this device”

Force float32 everywhere by setting:

os.environ["CUPY_DTYPE_POLICY"] = "strict"

before importing CuPy.