Agreed. Thank you for detecting and reporting this problem. I have already fixed it in the PCC version that will be released with the upcoming version 1.8.7 of PixInsight.
The best solution is checking for ROI validity in the CanExecuteOn member function:
bool PhotometricColorCalibrationInstance::CanExecuteOn( const View& view, pcl::String& whyNot ) const
{
if ( view.IsPreview() )
{
whyNot = "PhotometricColorCalibration cannot be executed on previews.";
return false;
}
if ( !view.IsColor() )
{
whyNot = "PhotometricColorCalibration can only be executed on color images.";
return false;
}
if ( view.Image().IsComplexSample() )
{
whyNot = "PhotometricColorCalibration cannot be executed on complex images.";
return false;
}
if ( p_neutralizeBackground )
if ( p_backgroundUseROI )
if ( !p_backgroundROI.IsRect() )
{
whyNot = "Empty background reference ROI defined.";
return false;
}
return true;
}
Other checks that don't depend exclusively on instance parameters, such as verifying that the background reference view exists and is a color image, must be done at the point where the background neutralization task is performed (because of the multitasking nature of PixInsight).