> void LinearFilterWx1<PixelType>::applyTo(const Image::Image<PixelType> & srcImage,Image::Image<PixelType> & dstImage) const { typedef typename PixelType::DataType PixelDataType; typedef typename PixelType::ComputationType PixelComputationType; BaseLinearFilterParametersType<PixelDataType,PixelComputationType> parameters( getFilterData().getDataView(), getXoffset(), getYoffset(), srcImage.getWidth(), getTotalColor() ); Algorithm::AlgorithmWx1< SimpleWx1dataOperationBaseAlgorithm< BaseLinearFilterAlgorithm< PixelDataType, PixelComputationType, BaseLinearFilterParametersType<PixelDataType,PixelComputationType>, Algorithm::BaseOperationTempType<PixelDataType,PixelComputationType> >, PixelDataType, PixelComputationType, BaseLinearFilterParametersType<PixelDataType,PixelComputationType>, Algorithm::BaseOperationTempType<PixelDataType,PixelComputationType> >, PixelDataType, BaseLinearFilterParametersType<PixelDataType,PixelComputationType> >( srcImage.getDataView(), dstImage.getDataView(), parameters ); }
bool CSPhysXObject_Character::create(CSPhysXWorld* world, IPhysicsObjectData data) { if (!CSPhysXObject::create(world)) return false; #define SKINWIDTH 0.0001f PxF32 gInitialRadius = data.scale.X; PxF32 gInitialHeight = data.scale.Y; if (data.node) { gInitialRadius = data.node->getBoundingBox().getExtent().X / 2 * data.scale.X ; gInitialHeight = data.node->getBoundingBox().getExtent().Y / 2 * data.scale.Y ; } PxCapsuleControllerDesc desc; desc.position.x = data.position.X; desc.position.y = data.position.Y; desc.position.z = data.position.Z; desc.radius = gInitialRadius; desc.height = gInitialHeight; desc.upDirection = PxVec3(0,1,0); desc.slopeLimit = cosf(degToRad(45.0f)); desc.stepOffset = 0.02f; desc.callback = &gControllerHitReport; desc.userData = (void*)data.userdata; desc.scaleCoeff = 0.9f; desc.volumeGrowth = 1.2f; desc.density = 10; desc.material = getWorld()->getPhysXManager()->m_DefaultMaterial; m_Controller = world->getControllerManager()->createController(*getWorld()->getPhysXManager()->m_PhysicsSDK, getWorld()->getScene(), desc); m_Controller->setUserData((void*)data.userdata); m_Controller->getActor()->userData = (void*)data.userdata; PxShape* shapes[10]; PxU32 nShapes = m_Controller->getActor()->getShapes(shapes, 10); while (nShapes--) { shapes[nShapes]->setSimulationFilterData(getFilterData(data.objecttype)); } CS_CHECK_NULL(m_Controller, CSLOGTYPE::CSL_WARNING, "CSPhysXObject_Character::create() Controller creaation failed"); // everything went fine return true; }
static int updateSurvTable(Settings *s, SurvTable **sts, CifData *cif_data, size_t spot_num, int tile, int x, int y, int read, int *read_mismatch, char *read_seq, int *read_qual, char *read_ref, samfile_t *fp, bam1_t *bam, FILE *fp_caldata) { int cstart = s->cstart[read]; int read_length = s->read_length[read]; int iregion = -1; int c, b; assert((cstart + read_length) <= cif_data->ncycles); if (s->spatial_filter) iregion = xy2region(x, y, s->region_size, s->nregions_x, s->nregions_y); #ifdef CALDATA { int dir = BAM_FREVERSE & bam->core.flag ? 1 : 0; char *chrom = fp->header->target_name[bam->core.tid]; int pos = bam->core.pos; fprintf(fp_caldata, "%d\t%d\t%d\t%s\t%d\t", x, y, dir, chrom, pos); } #endif /* update survival table */ for (c = cstart, b = 0; b < read_length; c++, b++) { CifCycleData *cycle = cif_data->cycles + c; SurvTable *st; int channel; int bin[cycle->num_channels]; float purity = -1.0; int ibin; /* set cycle ct */ if (s->spatial_filter) { int state = (getFilterData(tile, read, b, iregion) & REGION_STATE_MISMATCH) ? 1 : 0; st = sts[state*N_READS+read] + b; }else{ st = sts[read] + b; } read_cif_chunk(cycle, spot_num); for (channel = 0; channel < cycle->num_channels; channel++) { size_t base_pos = spot_num - cycle->chunk_start; switch (cycle->data_type) { case 1: bin[channel] = cycle->chan_data[channel].i8[base_pos]; break; case 2: bin[channel] = cycle->chan_data[channel].i16[base_pos]; break; case 4: bin[channel] = cycle->chan_data[channel].i32[base_pos]; if (bin[channel] > 65535) { bin[channel] = 65535; } else if (bin[channel] < -65535) { bin[channel] = -65535; } break; default: abort(); } } purity = GetPu(cycle->num_channels, bin); ibin = st->scale * (purity - st->offset) + 0.5; if( read_mismatch[b] & BASE_KNOWN_SNP ) { // don't count these } else{ if( read_mismatch[b] & BASE_ALIGN ) st->num_bases[ibin]++; if( read_mismatch[b] & BASE_MISMATCH ) st->num_errors[ibin]++; } #ifdef CALDATA { char bases[] = "ACGTNDIS"; char base = strchr(bases, read_seq[b]); int seq_base, ref_base; if( NULL == base ){ fprintf(stderr, "Unknown base %c\n", read_seq[b]); exit(EXIT_FAILURE); } seq_base = base - bases + 1; base = strchr(bases, read_ref[b]); if( NULL == base ){ fprintf(stderr, "Unknown ref %c\n", read_ref[b]); exit(EXIT_FAILURE); } ref_base = base - bases + 1; fprintf(fp_caldata, "%d %d %d %d %d %d %d %d\t", ref_base, seq_base, read_qual[b], bin[0], bin[1], bin[2], bin[3], read_mismatch[b]); } #endif #ifdef CHECK_BASECALL { int Imax = bin[0]; int i; for (i=1; i<cycle->num_channels; i++) if(Imax <= bin[i]) Imax = bin[i]; if (Imax > 0 ){ char bases[] = "ACGTN", flags[] = " "; for (i=0; i<cycle->num_channels; i++) { flags[i] = ' '; if(bin[i] == Imax) { flags[i] = '*'; if(read_seq[b] == bases[i]) break; } } if( i == cycle->num_channels ) fprintf(stderr,"%lu %d %d %d %c %c %d %d%c %d%c %d%c %d%c %f\n", spot_num, x, y, c, read_ref[b], read_seq[b], read_qual[b], bin[0], flags[0], bin[1], flags[1], bin[2], flags[2], bin[3], flags[3], purity); } } #endif } #ifdef CALDATA fprintf(fp_caldata, "\n"); #endif return 0; }