Trouble with thresholding

Operating system:
Slicer version: 4.11.20210226
Expected behavior: Segment of hummingbird bill/head
Actual behavior: Fragmented segment

Hoping for a little input on a set of .tiff files I’m working with. I have uploaded a volume that was CT scanned, and the contrast between the bird and the surrounding area is limited. I have used the Adjust window level setting and adjusted volume properties. When I try to use segment editor to extract the bird, I’m having trouble thresholding it out. I’m sure it can be done, just hoping others might be able to give tips for extracting a segment with this tricky scan.download link

Looks like you only shared the mrml file but not the volume. Without the volume we can only guess what the issues are. If the scan is of poor quality, or poorly reconstructed there is not much you can do. Perhaps you can try some of the image processing filters (median filter), or try to rescale or normalize the intensity.

1 Like

Thanks, Murat, for the response! I am adding a zipped folder of the .tiff files. The median filter helped some, but I’m still having trouble with these photos. I typically add them using image stacks then keep working on the same scene. We’re contracting someone to make these scans, so I’d be interested to know if the difficulty has to do with these files, or my processing. image folder

SO there are some really strange issues. First the tiff stacks are in float values, and they only range from 0.1 to 0.7 range. This is not very common for CT scans. What I did was to rescale to image (Simple Filters → RescaleIntensity) and set the minimum 0 and max to 65535. Then I used the Cast Image Filter to turn the rescaled image from float image to unsigned short data type. This also reduces the memory consumption quite a bit (since this is a huge dataset).

This is what I got:

Then I ran the median filter, which helped, but also lost some of the finer detail.

This is a strange scan. First the specimen is not really centered in the field of view, but sits in a corner of a huge image stack, which makes the data import challenging. Then, it appears the specimen is partial (cut during the reconstruction). Whether that’s intentional or not, no idea. There is also the strong background issue. If you are paying for these scans, they should really do a better job.

This is an interesting case. I followed muratmaga’s advice on rescaling the intensity and casting to uint16. By doing this the 49.1 GiB set of 2,129 TIFF files (17.6 GiB zipped) was able to be saved from 3D Slicer as a single 24.7 GiB file.

However I am not sure that there is any problem with the specimen or its positioning.

From the 3D rendering the scan indeed looks to me like a long bird’s beak and the front half of its head, more-or-less centred within a cylinder. Seeing a cylinder generated from a CT scan makes sense to me. What seems slightly odd to me is that the cylinder axis doesn’t quite line up with the image coordinate system (evident from the bounding box, represented as the ROI below).

10800 rescaled units & up (perspective 3D rendering)

10800 rescaled units & up (orthographic 3D rendering)

11200 rescaled units & up (perspective 3D rendering)

So I wonder whether the original CT scan data may have been resampled into a new coordinate system. (Perhaps that also explains the intensity scaling in the range of 0 to 1 for the TIFF files.)

Based on the ability to get some sensible 3D rendering, I’m not sure that the background poses such a problem. The suggestion that “the contrast between the bird and the surrounding area is limited” may be a matter of ‘perspective’. That is, if the window is judiciously chosen, then the contrast looks better. It might be easier to specify appropriate settings once the above intensity rescaling has been done.

Do you want just the beak, or the flesh and skin and feathers too?

—DIV

P.S. Here are the contents of the *.VP file containing my 3D rendering settings for the rescaled intensities.

1
1
1
0.2
0
1
8 -1000 0 11200 0 19000 0.8 83849.5625 1
4 0 1 985.12 1
20 10000 0.3 0.3 1 15000 0.3 1 0.3 22000 1 0 0 49014.53515625 1 0.912535 0.0374849 61858.734375 1 0.3 0.3

image

P.P.S. There is a kind of limitation in 3D Slicer that will prevent a user from entering an intensity value in the opacity or colour mapping that’s above some nominal ‘maximum’ by directly typing it in. (Some people might call this a bug.) The workarounds are to either drag the rightmost grey circular knob to the far right, or to manually edit the VP file. It’s not very convenient.

There’re some minor artefacts creating dull and bright streaks in the background.

Slices viewed with Manual Min/Max set to 10300 and 14100.



Note: displaying or hiding the ROI can change the 3D rendering, per Volume rendering appearance changes if ROI box is shown .

By cropping down from the original volume (2529×2278×2129) to just the region of interest (~1813×932×993) this can be reduced much further to a single 2.4 GiB NRRD file.

With the rescaled intensities in the cropped volume a first (rough) try at a segmentation, with a Threshold of 11500 intensity units, is given below.

Obviously there are some artefacts present. The beak looks like one continuous piece (with some hollows in it). The feathers(?) are little isolated ‘islands’, but I would have thought that that was essentially realistic.

I guess that the required fidelity of the segmentation would depend upon your purpose (e.g. 3D printing, mechanical analysis, …).

—DIV

The issue is not so much that the data is not workable. Given that this is a paid service, it should have been delivered in a better condition than a 48GB file whose 95% of it is just air, not the specimen. Many other dubious choices for reconstruction such as no adjustment of intensities tells me the lab did this has no to very little experience, or just doesn’t care for customer service, and either way probably should be avoided.

I will take your word for it.
As I mentioned, the thing I found most notable was the skew of the cylindrical ‘scan volume’ within the adopted coordinate system; that also contributed to adding unnecessary (useless) voxels.
(Unless the cylinder represented a block of resin that the bird was embedded in???)

Out of interest, do you know whether there is a particular name given to the ‘streak’ artefacts, and also whether there are imaging settings that could have avoided this (rather than having to try to deal with them afterwards with some sort of filtering or other post-processing)?

Beam hardening. Normally should be handled too some extend during reconstruction.

1 Like

Thank you both for the help with this! Hoping to circle back on the scan and try these methods. Really appreciate your help.