ChannelEditor::ChannelEditor( QStringList src, bool m, ChannelDesc *chan, QPtrList<ChannelDesc> *cdesc, QWidget *parent ) : ChannelEditorUI( parent ) { int i; channel = chan; mode = m; chandesc = cdesc; orgName = channel->name; sourceComb->insertStringList( src ); for ( i=0; i<(int)sourceComb->count(); i++ ) { if ( sourceComb->text(i)==channel->tp.source ) { sourceComb->setCurrentItem(i); break; } } if ( channel->tp.type==FE_QAM ) initC(); else if ( channel->tp.type==FE_OFDM ) initT(); else if ( channel->tp.type==FE_QPSK ) initS(); else initA(); if ( mode ) { ftaCb->setEnabled( false ); pidsGroup->setEnabled( false ); numSpin->setEnabled( false ); setCaption( i18n("Initial Transponder Settings") ); } else { numSpin->setMinValue( 1 ); numSpin->setMaxValue( chandesc->count() ); chanNum = channel->num; numSpin->setValue( channel->num ); sidSpin->setValue( channel->sid ); vpidSpin->setValue( channel->vpid ); ttpidSpin->setValue( channel->ttpid ); tsidSpin->setValue( channel->tp.tsid ); nidSpin->setValue( channel->tp.nid ); ftaCb->setChecked( channel->fta ); } nameLe->setText( channel->name ); connect( apidBtn, SIGNAL(clicked()), this, SLOT(editAudio()) ); connect( subpidBtn, SIGNAL(clicked()), this, SLOT(editSubtitle()) ); }
void downSample(VolumeDataSource *ori, GridData &s) { int channels = ori->getChannels(); Vector3i originRes = ori->getResolution(); Vector3i res; res.x = originRes.x / scale.x; res.y = originRes.y / scale.y; res.z = originRes.z / scale.z; initS(s, res); originRes.x -= originRes.x % scale.x; originRes.y -= originRes.y % scale.y; originRes.z -= originRes.z % scale.z; for (int i = 0; i < originRes.x; i += scale.x) { for (int j = 0; j < originRes.y; j += scale.y) { for (int k = 0; k < originRes.z; k += scale.z) { Vector sumValue(0.f); Float cnt = 0.f; for (int dx = 0; dx < scale.x; dx++) { for (int dy = 0; dy < scale.y; dy++) { for (int dz = 0; dz < scale.z; dz++) { if (channels == 1) { float v = ori->lookupFloat(i + dx, j + dy, k + dz, 0); sumValue += Vector(v); cnt += 1.f; } else { Vector v(ori->lookupFloat(i + dx, j + dy, k + dz, 0), ori->lookupFloat(i + dx, j + dy, k + dz, 1), ori->lookupFloat(i + dx, j + dy, k + dz, 2)); sumValue += v; cnt += 1.f; } } } } s[i / scale.x][j / scale.y][k / scale.z] = sumValue / cnt; } } } }
int main(int argc, char *argv[]){ int *val; S *s = initS(10); for(int i=0;i<15;i++){ push(s,(void *)&i); } for(int i=0;i<15;i++){ val =(int *)pop(s); if(val){ printf("%d ",*val); } } }