LabelStatisticsImageFilter has a ValidLabelValuesContainerType where as
LabelImageToStatisticsLabelMapFilter has not. To my understanding LabelImageToStatisticsLabelMapFilter only incorporates LabelMapToLabelImageFilter in addion to LabelStatisticsImageFilter, so I’m wondering why ValidLabelValuesContainerType is missing there and whether that is critical concerning the use of any statistic values calculated by the filter.
I’m using GetNthLabelObject to iterate over the labels:
The LabelImageToStatisticsLabelMapFilter a wrapper for a composite pipeline of LabelMapToLabelImageFilter and StatisticsLabelMapFilter. These filters are from the LabelMap module, while the StatisticsImageFilter is computed directly on a pair or traditional itk::Images.
Thanks for your reply. I’m not referring to the StatisticsImageFilter but to the LabelImageToStatisticsLabelMapFilter which seems to lack the ValidLabelValuesContainerType that the LabelStatisticsImageFilter has. Since LabelImageToStatisticsLabelMapFilter is a composition (giving statistics for each label) I would expect ValidLabelValuesContainerType unless it is somehow wrapped by the GetNthLabelObject. As I understand it, both LabelImageToStatisticsLabelMapFilter and LabelStatisticsImageFilter give statistics for each label concerning the underlying scalar-image.
There was introduced a new data structure called a LabelMap which is not an array of pixels but a map of label ids to run-length-encoded labels with associated data. There an MANY filters in the module with MANY composite filters. The filter you are inquiring about LabelImageToStatisticsLabelMapFilter utilize the LabelMap which has the separate interface to determine which labels are in the LabelMap. With methods such as GeNthLabelObject and GetLabels.
Many thanks Brad for that clarification.
So to make sure I understand correctly: Using GeNthLabelObject with LabelImageToStatisticsLabelMapFilter will ensure that all statistic for any reported label will be valid?
I.e. iterating over ValidLabelValuesContainerType (as in this example) is just a (very) different name for iteration over GetNumberOfLabelObjects using GeNthLabelObject in LabelImageToStatisticsLabelMapFilter (as in my code)?