本文整理汇总了C++中adcontrols::MassSpectrum::setAcquisitionMassRange方法的典型用法代码示例。如果您正苦于以下问题:C++ MassSpectrum::setAcquisitionMassRange方法的具体用法?C++ MassSpectrum::setAcquisitionMassRange怎么用?C++ MassSpectrum::setAcquisitionMassRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类adcontrols::MassSpectrum
的用法示例。
在下文中一共展示了MassSpectrum::setAcquisitionMassRange方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//virtual
bool
datafile::getSpectrum( int fcn, size_t pos, adcontrols::MassSpectrum& ms, uint32_t objId ) const
{
(void)fcn;
try {
EDAL::IMSSpectrumCollectionPtr pSpectra = pAnalysis_->GetMSSpectrumCollection();
EDAL::IMSSpectrumPtr pSpectrum = pSpectra->GetItem( long(pos) + 1 ); // 1-origin
if ( pSpectrum->Polarity == EDAL::SpectrumPolarity::IonPolarity_Negative )
ms.setPolarity( adcontrols::MS_POLARITY::PolarityNegative );
else if ( pSpectrum->Polarity == EDAL::SpectrumPolarity::IonPolarity_Positive )
ms.setPolarity( adcontrols::MS_POLARITY::PolarityPositive );
else
ms.setPolarity( adcontrols::MS_POLARITY::PolarityIndeterminate );
adcontrols::MSProperty prop = ms.getMSProperty();
prop.setTimeSinceInjection( static_cast< unsigned long >( pSpectrum->RetentionTime /* sec */ * 1.0e6 ) ); // usec
ms.setMSProperty( prop ); // <- end of prop set
_variant_t vMasses, vIntens;
if ( objId <= 1 ) {
pSpectrum->GetMassIntensityValues( EDAL::SpectrumType_Profile, &vMasses, &vIntens );
ms.setCentroid( adcontrols::CentroidNone ); // profile
} else { // objId should be 2
pSpectrum->GetMassIntensityValues( EDAL::SpectrumType_Line, &vMasses, &vIntens );
ms.setCentroid( adcontrols::CentroidNative );
}
SafeArray sa_masses( vMasses );
ms.resize( sa_masses.size() );
ms.setMassArray( reinterpret_cast< const double *>( sa_masses.p() ) );
SafeArray sa_intensities( vIntens );
ms.setIntensityArray( reinterpret_cast< const double *>( sa_intensities.p() ) );
ms.setAcquisitionMassRange( ms.getMass( 0 ), ms.getMass( ms.size() - 1 ) );
return true;
} catch(_com_error& ex ) {
ADERROR() << std::wstring( ex.ErrorMessage() );
return false;
}
return false;
}
示例2:
bool
TimeDigitalHistogram::translate( adcontrols::MassSpectrum& sp
, const TimeDigitalHistogram& hgrm
, mass_assignor_t mass_assignee )
{
if ( translate( sp, hgrm ) ) {
const adcontrols::MSProperty& prop = sp.getMSProperty();
const auto& sinfo = prop.samplingInfo();
double lMass = mass_assignee( sinfo.fSampDelay(), prop.mode() );
double hMass = mass_assignee( sinfo.fSampDelay() + sinfo.fSampInterval() * sinfo.nSamples(), prop.mode() );
sp.setAcquisitionMassRange( lMass, hMass );
return sp.assign_masses( mass_assignee );
}
return false;
}
示例3: int
//virtual
bool
datafile::getSpectrum( int /* fcn*/, size_t idx, adcontrols::MassSpectrum& ms, uint32_t /* objid */) const
{
if ( unsigned( idx ) < spcfile_->number_of_subfiles() ) {
const galactic::spchdr& hdr = *spcfile_->spchdr();
const galactic::subhdr& sub = *spcfile_->subhdr( idx );
std::pair< double, double > range = std::make_pair( hdr.ffirst(), hdr.flast() );
const size_t npts = hdr.fnpts();
ms.resize( npts );
ms.setAcquisitionMassRange( range.first, range.second );
for ( size_t i = 0; i < npts; ++i ) {
ms.setMass( int(i), i * double(( range.second - range.first )) / ( npts - 1 ) + range.first );
ms.setIntensity( int(i), sub[i] );
}
return true;
}
return false;
}
示例4:
//virtual
bool
datafile::getSpectrum( int /* fcn*/, size_t idx, adcontrols::MassSpectrum& ms, uint32_t /* objid */) const
{
if ( lrpfile_ && unsigned( idx ) < lrpfile_->number_of_spectra() ) {
if ( auto msdata = (*lrpfile_)[ idx ] ) {
std::vector< double > time, intens;
if ( lrpfile_->getMS( *msdata, time, intens ) ) {
ms.resize( time.size() );
ms.setMassArray( time.data() );
ms.setIntensityArray( intens.data() );
ms.setAcquisitionMassRange( time.front(), time.back() );
return true;
}
}
}
return false;
}