/** * Recalculate the detector colors based on the integrated values in m_specIntegrs and * the masking information in .... */ void InstrumentActor::resetColors() { QwtDoubleInterval qwtInterval(m_DataMinScaleValue,m_DataMaxScaleValue); m_colors.resize(m_specIntegrs.size()); auto sharedWorkspace = getWorkspace(); Instrument_const_sptr inst = getInstrument(); IMaskWorkspace_sptr mask = getMaskWorkspaceIfExists(); //PARALLEL_FOR1(m_workspace) for (int iwi=0; iwi < int(m_specIntegrs.size()); iwi++) { size_t wi = size_t(iwi); double integratedValue = m_specIntegrs[wi]; try { // Find if the detector is masked const std::set<detid_t>& dets = sharedWorkspace->getSpectrum(wi)->getDetectorIDs(); bool masked = false; if ( mask ) { masked = mask->isMasked( dets ); } else { masked = inst->isDetectorMasked(dets); } if (masked) { m_colors[wi] = m_maskedColor; } else { QRgb color = m_colorMap.rgb(qwtInterval,integratedValue); m_colors[wi] = GLColor(qRed(color), qGreen(color), qBlue(color)); } } catch(NotFoundError &) { m_colors[wi] = m_failedColor; continue; } } if (m_scene.getNumberOfActors() > 0) { if (auto actor = dynamic_cast<CompAssemblyActor*>(m_scene.getActor(0))) { actor->setColors(); invalidateDisplayLists(); } } emit colorMapChanged(); }
bool PoldiDeadWireDecorator::detectorIsNotMasked(Instrument_const_sptr instrument, detid_t detectorId) { return !instrument->isDetectorMasked(detectorId); }