users > Can I use CMTK to register segmented/label files?
Showing 1-3 of 3 posts
Results per page:
Apr 29, 2018  05:04 PM | Alejandra Boronat
Can I use CMTK to register segmented/label files?

I've been using CMTK (Linux) to register insect brain images, and most of the times I get very good results. Thus far, I have mainly use the binary registrationx.

Because it's become important for me to use segmented brain images, I would like to know if I can use as an input, segmented brain files obtained from ImageJ/segmentation editor for registration (.label.tif files converted to .nrrd). If so, how does it work? how do I tell the binary that the file contains different labels? I've tried a couple of times though, but it seems that, because of the image format, the labels are actually not being recognized.

Hope there is a way to deal with this.
Best regards, 

Apr 30, 2018  11:04 PM | Torsten Rohlfing - Google LLC
RE: Can I use CMTK to register segmented/label files?
Hi Alejandra -

Yes, in general it is possible to use label images for registration with CMTK's tools. I am going to explain using registrationx, but almost everything should translate entirely for warpx, and to lesser degree for the older registration and warp tools.

The first thing to do is to tell CMTK that an image is a label image, not a greyscale image. For the reference image, you can do that by adding "--class-ref label" to the command line, and for the floating image by adding "--class-flt label".

The second thing to understand is that only histogram-based similarity measures can be used as registration metrics if one or both images are label images. You can select one of the supported metrics by adding one of the following to the command line: "--nmi" for normalized mutual information (this is actually the default anyway), "--mi" for plain mutual information, or "--cr" for the "Correlation Ratio". The last of these will only work if the floating image is still a greyscale image (and there's a good chance it's the other way around), so I would recommend staying with NMI.

Finally, you need to select an interpolation method that is compatible with label data. I recommend partial volume interpolation (add "--partial-volume" to the command line) for best accuracy, but nearest neighbor (add "--nearest-neighbor") is also valid and may be faster.

A word of caution - while the above technically will make CMTK handle label data properly, you may find the registration to be a lot less robust or accuracte using label than intensity data. That's because there is obviously a lot less structure in the label data to work with. That is particularly a problem with nonrigid registration (using warpx), where there is simply nothing inside each labeled object that could be used to drive the alignment. So instead, you will likely see rather weird deformations inside larger structures. TO avoid that, I would recommend keeping the B-spline grid spacing a coarse as possible, and also making the deformation "stiff" by increasing either the grid energy constraint (using "--smoothness-constraint-weight") or the Jacobian-based volume-preservation constraint (using "--jacobian-constraint-weight").

Hope this is helpful and will get you started.

Apr 30, 2018  11:04 PM | Torsten Rohlfing - Google LLC
RE: Can I use CMTK to register segmented/label files?
Quick follow-up - after registration, you will also need to make sure that label images are treated properly during reslicing (if that's what you do). Basically, you just need to tell the "reformatx" tool to use a proper interpolation method. Again, I would recommend partial volume interpolation (here, using "--pv") for the highest-quality results.

If you have very coarse moving images (large pixels) relative to the resolution of the reference grid, you might also consider "shape based interpolation", which you should be able to do using the "sbai" tool. But I'd only try that if the reformatx tool does not give you satisfactory results.