Skip to content

antsRegistration with masks #1864

Closed
Closed
@smbailes-bu

Description

@smbailes-bu

Operating system and version

Rocky Linux 8.6 (Green Obsidian) on computing cluster

CPU architecture

x86_64 (PC, Intel Mac, other Intel/AMD)

ANTs code version

2.1.0-g78931

ANTs installation type

Other (please specify below)
I am using an installation on a shared computing cluster, so I am not positive how it was installed.

Summary of the problem

I am trying to use antsRegistration to register my functional BOLD data to my anatomical MRI data using a target ROI mask because I want to make sure that the 4th ventricle in particular is well registered. Something similar has been successfully done in my lab using the brainstem, so I just adapted the script to instead use the 4th ventricle masks. However, I consistently get this error at the first rigid registration stage:

Exception caught:
itk::ExceptionObject (0x3883af0)
Location: "unknown"
File: /home/ec2-user/ants-binaries/ITKv4-install/include/ITK-4.7/itkMattesMutualInformationImageToImageMetricv4.hxx
Line: 430
Description: itk::ERROR: MattesMutualInformationImageToImageMetricv4(0x37a4a00): Too many samples map outside moving image buffer. There are only 486 valid points out of 1045299 total points. The images do not sufficiently overlap. They need to be initialized to have more overlap before this metric will work. For instance, you can align the image centers by translation.

In the original script from my lab they didn't use the --initial-moving-transform flag so I added that thinking that would fix the issue, but it did not. I also tried doing the initial transform for all the pairs of target/moving masks, but it still didn't fix my error, it only changes the number of valid points that overlap.

I also loaded all the volumes I use into freeview and verified that they are not empty, are binary when necessary, and are very well aligned to begin with (see screenshot).

I have also played around with different interpolations and metrics for the Rigid registration (MI, CC), but again get the same error just with slightly different numbers of valid points.

Any advice on this issue would be incredibly helpful. I feel like I have tried everything I personally can think of, but I am also pretty new to using ANTs.

Commands to reproduce the problem.

#!/bin/bash
target=brainmask.nii.gz
moving=run01_meanvol_stripped.nii.gz
output=reg01toref_ants_v4
target_mask=brainmask_bin.nii.gz
moving_mask=run01_meanvol_mask.nii.gz
target_mask_v4=v4_dil.nii.gz
moving_mask_v4=run01_sbref_synthseg_v4_dil.nii.gz

antsRegistration --dimensionality 3 --float 0
--output [$output,${output}.nii.gz]
--interpolation BSpline[5]
--initial-moving-transform [ $target,$moving,1]
--transform Rigid[ 0.1 ]
--metric Mattes[ ${target},${moving},1,64,Regular, 0.8 ]
--convergence [ 75x25x25,1e-7,10 ]
--shrink-factors 2x1x1
--smoothing-sigmas 1.0x0.5x0.0mm
--masks [ ${target_mask_v4},${moving_mask_v4} ]
--transform Rigid[ 0.1 ]
--metric Mattes[ ${target},${moving},1,64,Regular, 0.8 ]
--convergence [ 75x25x25,1e-7,10 ]
--shrink-factors 2x1x1
--smoothing-sigmas 1.0x0.5x0.0mm
--masks [ ${target_mask_v4},${moving_mask_v4} ]
--transform Affine[ 0.1 ]
--metric CC[ ${target},${moving},1,7,None ]
--convergence [ 450x150x100,1e-7,10 ]
--shrink-factors 3x2x1
--smoothing-sigmas 1.2011224087864498x0.735534255037358x0.0mm
--masks [ ${target_mask_v4},${moving_mask_v4} ]
--transform SyN[ 0.1 ]
--metric CC[ ${target},${moving},1,4,None,1,1 ]
--convergence [ 500x180x60x20x20,1e-6,10 ]
--shrink-factors 4x3x2x1x1
--smoothing-sigmas 2.0x1.5x1.0x0.5x0.0mm
--masks [ NOMASK, NOMASK ]
--transform SyN[ 0.1 ]
--metric CC[ ${target},${moving},1,4,None,1,1 ]
--convergence [ 500x180x60x20x20,1e-6,10 ]
--shrink-factors 4x3x2x1x1
--smoothing-sigmas 2.0x1.5x1.0x0.5x0.0mm
--masks [ ${target_mask_v4},${moving_mask_v4} ]

Output of the command with verbose output.

log.txt

Data to reproduce the problem

data.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions