vtkThresholdScalar with empty intervals

Hi,

I’ve played around with the new vtkThresholdScalars class and it works nicely. However, I was surprised to see that it can’t be used when no interval is added. Of course in a static setting it doesn’t make sense to use the filter with no intervals. But in an interactive setting it would be easier to use if it would would simply return an image filled with the background label in that case.

if (this->Intervals->GetNumberOfIntervals() < 1)
{
    vtkErrorMacro(<< “No thresholding intervals defined!”);
    return 1;
}

Also I think it would be nice if one could change the data type that is used for the labels from integer to e.g. short. Although I don’t know how difficult it would be to implement.

Hello,

My two cents: if the user does not provide an interval, just add a default one varying between std::numeric_limits<[float|double]>::min() and std::numeric_limits<[float|double]>::max().

best,

PC

You’re right, it’s easy to work around by providing a dummy interval. It’s just that it means additional logic to work around a restriction that I don’t think is necessary in the first place. But maybe I am missing something here.

I ended copying the whole class anyway to switch from integer labels to short.