BioMedIA/dhcp-structural-pipeline

SurfaceRecon - removing_intersections - Exception: Failed to resolve self-intersections

whinds opened this issue · 5 comments

After looking in the workdir, it appears the file t2w-image.nii.gz is not the same as the original T2 which was used as input to the pipeline.
image

Original Image:
Image Dimensions (Y, Z, X): 160 x 160 x 120
Series Length: 1
Voxel Dimensions (Y, Z, X): 1 x 1 x 1 Millimeters
Size of Series Point: 3 Seconds
Byte Type: 4-Byte Float
Byte Order: Little Endian
Compression: GZIP
Data Orientation: Columns (Y-), Rows (Z-), Slices (X+)

Transformed t2w_image.nii.gz:
Image Dimensions (X, Y, Z): 96 x 114 x 99
Series Length: 1
Voxel Dimensions (X, Y, Z): 1 x 1 x 1 Millimeters
Size of Series Point: 1 Milliseconds
Byte Type: 4-Byte Float
Byte Order: Little Endian
Compression: GZIP
Data Orientation: Data order not specified.

I believe this is the step where this happens in recon-neonatal-cortex.py
neoctx.makedirs(t2w_image)
neoctx.run(
'transform-image',
args=[
input_t2w_image,
t2w_image
],
opts={
'interp': 'fast cubic bspline with padding',
'Sp': 0,
'dofin': 'Id',
'target': brain_mask,
'type': 'float'
}
)

Hi @whinds , any head way on this issue? I am running into this problem as well.

No complete solution yet I'm afraid. One trick that helped was to "use mri_convert -c" on the T2 prior to processing, which padded the volume with zeros making transformations and resizing safer.

mri_convert -c -odt float -rt cubic $T2 $T2

Also, in one instance, one of the surface reconstructions failed on a virtual machine was instead able to succeed using the docker method.

My data is 1.0 mm resolution and prone to movement artifacts, so it could also be an underlying issue.

Understood. Thanks for response @whinds. I will give that a try.

@whinds Thanks, that seems to have done the trick on some of the images that failed on the first try.

Hi, sorry for the late reply, but if the resample/cropped t2w-image.nii.gz seems to not cover the full brain region, I would expect this to be an issue with the brain extraction mask. All the above command does is to sample the original (bias corrected) T2w image at the voxels of the supplied brain extraction mask, which is expected to match this image in native space.