ANTsX / ANTs

Advanced Normalization Tools (ANTs)
Apache License 2.0
1.21k stars 381 forks source link

Masked thyroid Atlas generation using antsMultivariateTemplateConstruction2.sh #1180

Closed konstantlem closed 3 years ago

konstantlem commented 3 years ago

Hello,

I am using ANTs for an Atlas creation of MRI masks of organs around the thyroid. I have got a good enough result with 10 iterations using the following command:

/antsMultivariateTemplateConstruction2.sh -d 3 -i 10 -r 1 -l 1 -y 0 -f 6x4x2x1 -s 3x2x1x0 -q 100x100x70x20 -t SyN -m CC -n 1 -o ${OutputDir}/MY ${InputDir}/*.nii

My problem is that I need the intensities so that I can use the atlas for further intensity registration. Is there any way to manipulate the intensities in a way that I can have at least a range of values for each organ so that I can work with them?

I was thinking of resegment and annotate the result the way I want, but I can see that in some slices the intensities of some parts are really low compared to the ones of near parts, so I am not sure if it is accurate to segment these parts or just skip them.

I could send you the template to check, if you could help me improve it.

Thank you in advance, Lemonia

ntustison commented 3 years ago

My problem is that I need the intensities so that I can use the atlas for further intensity registration. Is there any way to manipulate the intensities in a way that I can have at least a range of values for each organ so that I can work with them?

This is very unclear. Can you elaborate?

konstantlem commented 3 years ago

My problem is that I need the intensities so that I can use the atlas for further intensity registration. Is there any way to manipulate the intensities in a way that I can have at least a range of values for each organ so that I can work with them?

This is very unclear. Can you elaborate?

We have annotated the input images of the thyroid lobes and some other veins (1, 2 and 3 respectively). The generated atlas is now having a range of different intensities for each organ, making it difficult for me to identify where the organ boundaries are.

Our next step is to register some US images to the atlas (using voxelmorph framework for deformable registration). For that reason, I would need the original or some consistency on the atlas intensities. For example, thyroid intensity range [1, 40] vein 1 range [40, 60] etc.

Thank you

cookpa commented 3 years ago

By default, the template intensities are normalized before averaging. Each input image is divided by its mean value. You can change this with the -a option. After averaging, the template is sharpened, which can also change intensities somewhat. You can control this with the -A option.

cookpa commented 3 years ago

If you want to apply your manual segmentations to the template, you might be interested in antsJointFusion (which combines labels) and antsJointLabelFusion.sh (which registers images to an unlabeled target and then combines labels).

Examples

https://github.com/ntustison/MalfLabelingExample https://github.com/qureai/Multi-Atlas-Segmentation

ntustison commented 3 years ago

In addition, you can always warp your individual images to the template space and manipulate your template intensities based on the warped individual images.

konstantlem commented 3 years ago

In addition, you can always warp your individual images to the template space and manipulate your template intensities based on the warped individual images.

I did not quite get how I can do that. Would you please explain it to me?

Thank you

cookpa commented 3 years ago

If you register all your images to the template, you will have a set of input images in the template space, with their original intensities mostly preserved (there will be differences introduced by interpolation). Then you can create a new template as any function of these input intensities at each voxel. ANTsR will let you read the images and then iterate over the voxels.

This gives you more flexibility than the template script. The script gives a few options like mean or median, but in R you can code any function you like.