439 double* prevInts =
new double[
m_col ];
440 double* nowInts =
new double[
m_col ];
443 m_tmp->minIntensity = 0.0;
444 m_tmp->maxIntensity = 0.1;
447 double unitRange = (
m_tmp->maxRt -
m_tmp->minRt ) / (
double)(
m_row - 1 );
448 double rtZeroRange = DEFAULT_RT_ZERO_RANGE;
456 rtZeroRange = std::max( rtZeroRange, fabs( spec->
getRt() - prevRt ) );
457 prevRt = spec->
getRt();
462 int length = (int)spectra.size();
467 for(
unsigned int i = 0; i < spectra.size() && !progress.
isStopped() ; i++ ) {
471 progress.
setStatus( FMT(
"Getting spectrum data... [%s]", spec->
getName() ).c_str() );
476 if( spectra.size() == 1 ) {
477 prevRt = spec->
getRt();
478 memcpy( prevInts, nowInts,
sizeof(
double ) *
m_col );
482 for(
unsigned int j = 0; j <
m_col; j++ ) {
483 if( nowInts[ j ] <
m_tmp->minIntensity ) {
484 m_tmp->minIntensity = nowInts[ j ];
486 if( nowInts[ j ] >
m_tmp->maxIntensity ) {
487 m_tmp->maxIntensity = nowInts[ j ];
492 int idx = (int)
m_row - 1;
493 if( spectra.size() > 1 ) {
498 if( idx >= 0 && idx < (
int)
m_row ) {
499 if( idx == prevIdx ) {
500 for(
unsigned int j = 0; j <
m_col; j++ ) {
501 int ptIdx = idx * m_col + j;
502 double prevInt =
m_tmp->intensities[ ptIdx ];
503 double nowInt = nowInts[ j ];
505 if( fabs( nowInt ) > fabs( prevInt ) ) {
506 m_tmp->intensities[ ptIdx ] = nowInt;
511 for(
unsigned int j = 0; j <
m_col; j++ ) {
512 int ptIdx = idx * m_col + j;
513 m_tmp->intensities[ ptIdx ] = nowInts[ j ];
519 int sIdx = prevIdx + 1;
520 sIdx =
MAX( 0, sIdx );
521 if( spec->
getRt() <= prevRt + rtZeroRange ) {
522 for(
int j = sIdx; j < idx && j < (int)m_row; j++ ) {
523 double rt =
m_tmp->minRt + (double)j * unitRange;
525 double d1 = fabs( rt - prevRt );
526 double d2 = fabs( spec->
getRt() - rt );
527 if( prevRt == spec->
getRt() ) {
531 for(
int k = 0; k < (int)m_col; k++ ) {
532 int ptIdx = j * m_row + k;
533 m_tmp->intensities[ ptIdx ] = ( d2 * prevInts[ k ] + d1 * nowInts[ k ] ) / ( d1 + d2 );
538 double zeroRange = std::min( ( spec->
getRt() - prevRt ) / 2.5, rtZeroRange );
540 for(
int j = sIdx; j < idx && j < (int)m_row; j++ ) {
541 double rt =
m_tmp->minRt + (double)j * unitRange;
543 if( rt > spec->
getRt() - zeroRange ) {
544 double d = rt - ( spec->
getRt() - zeroRange );
546 for(
int k = 0; k < (int)m_col; k++ ) {
547 int ptIdx = j * m_col + k;
548 m_tmp->intensities[ ptIdx ] = ( d * nowInts[ k ] ) / zeroRange;
551 else if( rt < prevRt + zeroRange ) {
552 double d = zeroRange - fabs( rt - prevRt );
554 for(
int k = 0; k < (int)m_col; k++ ) {
555 int ptIdx = j * m_col + k;
556 m_tmp->intensities[ ptIdx ] = ( d * prevInts[ k ] ) / zeroRange;
560 for(
int k = 0; k < (int)m_col; k++ ) {
561 int ptIdx = j * m_col + k;
562 m_tmp->intensities[ ptIdx ] = 0.0;
570 prevRt = spec->
getRt();
571 memcpy( prevInts, nowInts,
sizeof(
double ) * m_row );
586 "Data Map : mz=[%.2f, %.2f] RT=[%.2f, %.2f] Int=[%.2f, %.2f]",
double getRt()
gets retention time
void fill()
sets end position
const char * getName()
gets spectrum name
unsigned int getNumberOfSpectra()
gets the number of spectra
bool isStopped()
judges whether it has to finish
int roundnum(const double v)
gets the closest integer to the argument
Spectrum * getSpectrum(const unsigned int index)
gets the number of spectra
void setPosition(const int pos, const bool bForced=false)
sets progress position
int getScanNumber()
gets scan number
void getSpecIntensities(Spectrum *spec, double *intensities, int size)
gets intensities of spectrum
spectrum information management class
void setStatus(const char *status, const bool bForced=false)
sets status