Align

We will produce two alignment versions, one using conventional block matching image pair alignment, and another using SEAMLeSS ConvNet based approach. Both alignments will be performed at MIP7, the resulting alignment field will be saved at MIP7 resolution to {dst_folder}/field/field_aligned.

Block Matching

First, let’s align the stack using conventional block matching image pair alignment method. This is done by providing an alignment processor that implements block matching to the corgie align-block command:

corgie align-block \
--src_layer_spec '{"path": "'${CORGIE_WALKTHROUGH_PATH}'/img/img_norm"}' \
--dst_folder ${CORGIE_WALKTHROUGH_PATH}/aligned_blockmatch \
--start_coord "100000, 100000, 17000" \
--end_coord "150000, 150000, 17010" \
--chunk_xy 2048 \
--render_chunk_xy 2048 \
--suffix run_x0 \
--processor_spec '{"ApplyModel": {
   "params": {
      "path": "https://storage.googleapis.com/corgie_package/models/aligners/blockmatch",
      "tile_size": 128,
      "tile_step": 64,
      "max_disp": 48,
      "r_delta": 1.3
  }}}' \
--processor_mip 7

The --processor_spec specifies an image pair alignment method, and --processor_mip specifies what resolution to apply it to. You can can change the tile_size, tile_step, max_disp and r_delta parameters and see how it affects your result. To avoid rewriting data from previous runs, use different --dst_folder and/or --suffix.

To learn more about the meaning of tile_size, tile_step, max_disp and r_delta parameters, please refer to this link.

Reference expected output can be visualized in the Blockmatch Aligned Cutout Normalized Image the following Neuroglancer Link. Alignment in the resulting stack is generally improved, but the discontinuous defects are not corrected. Note that the alignment quality can be improved by finding more optimal hyperparameters.

SEAMLeSS

To correct discontinuous defects, let’s retry the alignment, but this time using SEAMLeSS image pair alignment method:

    corgie align-block \
    --src_layer_spec '{"path": "'${CORGIE_WALKTHROUGH_PATH}'/img/img_norm"}' \
    --dst_folder ${CORGIE_WALKTHROUGH_PATH}/aligned_seamless \
    --start_coord "100000, 100000, 17000" \
    --end_coord "150000, 150000, 17010" \
    --render_chunk_xy 2048 \
    --chunk_xy 1024 \
    --processor_spec '{"ApplyModel": {
    "params": {"path": "https://storage.googleapis.com/corgie_package/models/aligners/MICrONS_aligner_512_1024nm"}
}}' \
    --processor_mip 7 \
    --device cuda \
--suffix aligned

Note

The command specifies usage of GPU accelerator through --device cuda. If your environment does not have cuda-enabled GPU, please use --device cpu instead.

Reference expected output can be visualized in the SEAMLeSS Aligned Cutout Normalized Image the following Neuroglancer Link. The numerous discontinuous defects present in the stack are now corrected when viewed at MIP7 resolution.

To learn more about align-block command, please refer to align-block command documentation.