DMSGBOX("<nobr>The range of channels is larger than the ROI.</nobr>");
return;
}
int startChannelIndex = -1;
int stopChannelIndex = -1;
int cnt = 0;
for ( QPointF p : dataStructure->getDataSetPtr()->getLifeTimeData() )
{
if ( qFuzzyCompare(p.x(), channelMin) )
startChannelIndex = cnt;
if ( qFuzzyCompare(p.x(), channelMax) )
stopChannelIndex = cnt;
cnt ++;
if ( startChannelIndex != -1 && stopChannelIndex != -1 )
break;
}
if ( startChannelIndex == -1 || stopChannelIndex == -1 )
{
DMSGBOX("<nobr>Sorry, an unknown error occurred while calculating the background.</nobr>");
}
double average = 0.0f;
int channelDiff = dataStructure->getDataSetPtr()->getLifeTimeData().last().x() -dataStructure->getDataSetPtr()->getLifeTimeData().at(stopChannelIndex).x();
int indexOffset = dataStructure->getDataSetPtr()->getLifeTimeData().size()-channels-channelDiff-1;
if ( PALSProjectSettingsManager::sharedInstance()->getBackgroundCalculationFromFirstChannels() )
indexOffset = 0;
for ( int i = 0 ; i < channels ; ++ i )
{
constint index = indexOffset+i;
average += dataStructure->getDataSetPtr()->getLifeTimeData().at(index).y();