I am using ITK C++, and I have applied Otsu thresholding to derive a threshold for a particular image. Now, I want to know the quantile this threshold is set. What would be the best way to do this? Also, ultimately, I want to use this quantile value to threshold other images, which I believe I should use itk::Histogram. Any suggestions appreciated.
You could create a histogram of your image with the same number of bins as Otsu thresholding used. Then translate the Otsu-threshold to a bin index. Sum up all frequencies for bins up to the threshold bin and divide by the total frequency. That should give you the corresponding quantile.
Now that I can compute the percentile and also apply thresholds for each individual z-slices, I am having trouble of assembling that back to a 3D image.
Just to make sure I understand this correctly - I have to apply different thresholds for each slices (it maintains the percentile, but not the actual value) - I can calculate these values by extracting the slice, but would it be possible to apply this to the slicebysliceImagefilter?
Thank you everyone, just to follow up, I was able to create a custom filter which could be feed in to the slicebysliceImageFilter that @zivy pointed to! (Learned how to make a custom filter!).