I am currently working on histology mapping onto radiology using Python. I am looking to do DSC and Hausdorff distance calculations for the mappings but encountered a few issues. I want to be able to do a Hausdorff distance calculation of the histology slide segment (with a certain threshold applied) against the original CT segment (with another threshold applied), however, Slicer’s module only does 3D calculations. I tried to pass it into a Python script to do so but learnt that I could not properly export the histology .tif file into a .nii labelmap, but I could with the CT segmentation.
Does anyone have a workaround/an idea about how I might go about this?
While we recommend using .nrrd instead of .nii due to ambiguities and other issues of .nii file format, you can and export a segmentation to a .nii file (or export the segmentation to a labelmap volume and then save that as .nii).
All Slicer features work in 3D and in some cases these don’t work for 2D images. This is the case for DSC and HD metric computations. One solution is to export the segmentation using the histology slice as reference and then compute the error metric in Python. For HD computation, make sure you use a package that takes image spacing into account (such as ITK/SimpleITK. If you use a tool that cannot deal with image spacing (such as most scipy processing functions) then you may need to resample the images.
When you say export the segmentation, you mean export only the CT scan segmentation and keep the histology slide unsegmented? One of the issues I had with exporting was also that I could not segment out the histology label (which was a yellow colour) from its background (which was white) and therefore to work around this I had to get rid of the background in Photoshop. But I believe what you are suggesting is that I keep the histology slide as it is with its original background, and then export the CT segmentation reference to the full size histology slide. Does this ensure that the alignment of the two images stays the same, and when exporting the segmentation, does it only pull out the 2D slice that is on the same plane as the histology slice?
You can use Vector to scalar volume module to get a color channel or combination of channels from a color image that makes it easy to distinguish the background.
I would not recommend to use Photoshop for processing biomedical images. It is not intended to work on such images and may change your data in unexpected ways.
Yes, you get the reformatted image slice from of the CT that exactly matches the geometry (position, orientation, spacing, extent) of the histology slice.
Hi Andras, I am exporting the bone CT segmentation out with reference to the histology slide (S9) volume. However I get two error messages - one saying that the geometry does not fit into the new one and therefore it would need a crop (which I assume is because the CT’s cross sectional image is larger than the histology slide), and this one that I have pasted suggesting my RAM is not enough. Is there a workaround to this? I would have thought my 40gb of RAM in this computer would be enough. The settings I am using to export the CT segmentation are above as well.