Description
Decide if the flag allowing to compute and set the histogram maximum and minimum values in the Thresholding module filters should be exposed.
The current design does not allow to set or control the range of interest of the histogram if the minimum and maximum values are not allowed to be computed automatically. Hence, when setting it to false, the thresholded images not be meaningful.
Impact Analysis
Allowing to set the histogram maximum and minimum values in the Thresholding module filter may involve a non-negligible amount of refactoring and work.
Although this would make the module more consistent with the presence of the m_AutoMinimumMaximum flag, leaving outside part of the histogram values translates this into a non-binary thresholding or classification problem. Hence, the thresholding modules may need additional refactoring to use ITK classes that are able to label accordingly images.
Expected behavior
Get meaningful, controllable results when the itk::HistogramThresholdImageFilter::m_AutoMinimumMaximum flag is set to false for the Thresholding filters.
One way to solve this would be able to set the itk::Statistics::ImageToHistogramFilter's m_Maximum and m_Minimum values manually, and be able to set such an appropriate instance to the Thresholding filter (possibly to their histogram calculator member). It should be automatically ensured that those maximum and minimum values are within the dynamic range of the input image.
This involves some sort of logic for the cases where m_AutoMinimumMaximum is set to false, or some new logic that would remove that flag to set those values by default by the histogram calculator (e.g. the m_AutoMinimumMaximum = true case) or set them to values specified by the user. And it may also involve modifying the itk::ImageToHistogramFilter API.
This would involve creating an itk::Statistics::ImageToHistogramFilter histogram generator instance, e.g. Look
if (!autoMinimumMaximum)
{
using HistogramGeneratorType = itk::Statistics::ImageToHistogramFilter<InputImageType>;
typename HistogramGeneratorType::Pointer histogramGenerator = HistogramGeneratorType::New();
// Set the maximum and minimum values to desired values
(...)
// Set the histogram generator instance to the thresholding filter
(...)
}
The itk::Statistics::ImageToHistogramFilter::InitializeOutputHistogram method and the classes involved need to be carefully looked at.
Actual behavior
The produced generated output is not meaningful because when the itk::HistogramThresholdImageFilter::m_AutoMinimumMaximum flag is set to false, the itk::Statistics::ImageToHistogramFilter does not initialize its m_Maximum and m_Minimum values to meaningful values, and thus the result of the thresholding process is not meaningful:
- Run any of the tests in the
Thresholding module where the autoMinimumMaximum flag is set to false,
e.g. itkMaximumEntropyThresholdImageFilterTestNoAutoMinMax)
- Check that produced output image is not meaningful (i.e. no anatomical structure can be distinguished).
- Check that the expected threshold value is close to the lower end of the dynamic range of the input image pixels (it is only close due to the histogram's binning effect). In this case, the concerned thresholding filters return the same threshold value (provided that the input image is the same), e.g.
-31744 for cthead1.png.
Versions
master
Additional Information
See this comment and the context in PR #511.
Related to issues #1737, #1738.
@richardbeare your thoughts and insight is highly appreciated.
Description
Decide if the flag allowing to compute and set the histogram maximum and minimum values in the
Thresholdingmodule filters should be exposed.The current design does not allow to set or control the range of interest of the histogram if the minimum and maximum values are not allowed to be computed automatically. Hence, when setting it to
false, the thresholded images not be meaningful.Impact Analysis
Allowing to set the histogram maximum and minimum values in the
Thresholdingmodule filter may involve a non-negligible amount of refactoring and work.Although this would make the module more consistent with the presence of the
m_AutoMinimumMaximumflag, leaving outside part of the histogram values translates this into a non-binary thresholding or classification problem. Hence, the thresholding modules may need additional refactoring to use ITK classes that are able to label accordingly images.Expected behavior
Get meaningful, controllable results when the
itk::HistogramThresholdImageFilter::m_AutoMinimumMaximumflag is set tofalsefor theThresholdingfilters.One way to solve this would be able to set the
itk::Statistics::ImageToHistogramFilter'sm_Maximumandm_Minimumvalues manually, and be able to set such an appropriate instance to theThresholdingfilter (possibly to their histogram calculator member). It should be automatically ensured that those maximum and minimum values are within the dynamic range of the input image.This involves some sort of logic for the cases where
m_AutoMinimumMaximumis set tofalse, or some new logic that would remove that flag to set those values by default by the histogram calculator (e.g. them_AutoMinimumMaximum = truecase) or set them to values specified by the user. And it may also involve modifying theitk::ImageToHistogramFilterAPI.This would involve creating an
itk::Statistics::ImageToHistogramFilterhistogram generator instance, e.g. LookThe
itk::Statistics::ImageToHistogramFilter::InitializeOutputHistogrammethod and the classes involved need to be carefully looked at.Actual behavior
The produced generated output is not meaningful because when the
itk::HistogramThresholdImageFilter::m_AutoMinimumMaximumflag is set tofalse, theitk::Statistics::ImageToHistogramFilterdoes not initialize itsm_Maximumandm_Minimumvalues to meaningful values, and thus the result of the thresholding process is not meaningful:Thresholdingmodule where theautoMinimumMaximumflag is set tofalse,e.g.
itkMaximumEntropyThresholdImageFilterTestNoAutoMinMax)-31744forcthead1.png.Versions
masterAdditional Information
See this comment and the context in PR #511.
Related to issues #1737, #1738.
@richardbeare your thoughts and insight is highly appreciated.