bool CaptureManager::SaveVolumeData(const char* file) { std::ofstream outfile; outfile.open(file, std::ofstream::out); if (!outfile) { wxLogError(_T("Unable to open file %s"), file); return false; } int numContours = Access(0,0,false)->contourArray.size(); outfile << "#width: " << size.width << ", height: " << size.height << ", frameCount: " << frameCount << ", fps: " << fps << std::endl; outfile << "#cellCount: " << numContours << std::endl; for (int c=0; c<numContours; c++) { CvSeq *oseq = Access(0,0,false)->contourArray[c]; int np = oseq->total; float avgVolume; std::vector<double> volumes = GetVolumes(c, avgVolume); outfile << "#Cell: " << c+1 << ", pointCount: " << np << ", avgVolume: " << avgVolume << std::endl; for (int i=0; i<volumes.size(); i++) { outfile << volumes[i] << std::endl;; } } outfile.close(); return true; }
// 데이터교체 inline void SwapData(int index1, int index2) { TYPE* Data1 = Access(index1); TYPE* Data2 = Access(index2); TYPE* NoDelete = nullptr; if(!Data1 && !Data2) return; if(Data1) ModifyData(index2, Data1, &NoDelete); else RemoveData(index2, &NoDelete); if(Data2) ModifyData(index1, Data2, &NoDelete); else RemoveData(index1, &NoDelete); }
bool CaptureManager::SaveTrajectoryImage(wxBitmap &bmp) { if (!Access(0,0, false, true)->contourArray.size()) { wxLogError(_T("No objects in the first frame. Detect/draw boundaries in the first frame and apply tracking first.")); return false; } wxRealPoint scale(6,6); CvPoint lastLoc; bmp.Create(scale.x*size.width,scale.y*size.height); wxMemoryDC dc(bmp); dc.SetBackground(*wxWHITE_BRUSH); dc.Clear(); for (int c=0; c<Access(0,0,false, true)->contourArray.size(); c++) { std::vector<CvPoint> traj = GetTrajectory(c); lastLoc = traj[0]; // draw first boundary MyCanvas::DrawContour_static(&dc, Access(0,0, false, true)->contourArray[c],wxPoint(0,0),scale); // drawing trajectory lines dc.SetBrush(*wxTRANSPARENT_BRUSH); for (int i=1; i<traj.size(); i++) { if(traj[i].x<0) continue; if (i>0) { dc.SetPen(wxPen(wxColour(Preferences::GetColorContourBorderColor()), Preferences::GetColorContourBorderWidth())); dc.DrawLine(scale.x*lastLoc.x,scale.y*lastLoc.y, scale.x*traj[i].x,scale.y*traj[i].y); } lastLoc = traj[i]; } // drawing trajectory points dc.SetBrush(wxBrush(wxColour(Preferences::GetColorContourPointColor()))); dc.SetPen(wxPen(wxColour(Preferences::GetColorContourPointColor()))); for (int i=0; i<traj.size(); i++) { if(traj[i].x<0) continue; dc.DrawCircle(MyPoint(traj[i])*scale, 2*Preferences::GetColorContourBorderWidth()); } // draw last boundary dc.SetBrush(*wxRED_BRUSH); dc.SetPen(wxPen(*wxRED)); if(traj[frameCount-1].x>=0) { dc.DrawCircle(MyPoint(traj[frameCount-1])*scale, 2*Preferences::GetColorContourBorderWidth()); MyCanvas::DrawContour_static(&dc, book[(frameCount-1)*offset]->contourArray[c],wxPoint(0,0),scale, true, wxRED); } } return true; }
PileupItf * ReferenceItf :: getFilteredPileupSlice ( int64_t start, uint64_t length, uint32_t categories, uint32_t filters, int32_t mappingQuality ) const throw ( ErrorMsg ) { // the object is really from C const NGS_Reference_v1 * self = Test (); // test for conflicting filters const uint32_t conflictingMapQuality = Alignment :: minMapQuality | Alignment :: maxMapQuality; if ( ( filters & conflictingMapQuality ) == conflictingMapQuality ) throw ErrorMsg ( "mapping quality can only be used as a minimum or maximum value, not both" ); // cast vtable to our level const NGS_Reference_v1_vt * vt = Access ( self -> vt ); // test for v1.1 if ( vt -> dad . minor_version < 1 ) throw ErrorMsg ( "the Reference interface provided by this NGS engine is too old to support this message" ); // test for bad categories // this should not be possible in C++, but it is possible from other bindings if ( categories == 0 ) categories = Alignment :: primaryAlignment; // call through C vtable ErrBlock err; assert ( vt -> get_filtered_pileup_slice != 0 ); uint32_t flags = make_flags ( categories, filters ); NGS_Pileup_v1 * ret = ( * vt -> get_filtered_pileup_slice ) ( self, & err, start, length, flags, mappingQuality ); // check for errors err . Check (); return PileupItf :: Cast ( ret ); }
PileupItf * ReferenceItf :: getPileupSlice ( int64_t start, uint64_t length, uint32_t categories ) const throw ( ErrorMsg ) { // the object is really from C const NGS_Reference_v1 * self = Test (); // cast vtable to our level const NGS_Reference_v1_vt * vt = Access ( self -> vt ); // test for bad categories // this should not be possible in C++, but it is possible from other bindings if ( categories == 0 ) categories = Alignment :: primaryAlignment; // call through C vtable ErrBlock err; assert ( vt -> get_pileup_slice != 0 ); bool wants_primary = ( categories & Alignment :: primaryAlignment ) != 0; bool wants_secondary = ( categories & Alignment :: secondaryAlignment ) != 0; NGS_Pileup_v1 * ret = ( * vt -> get_pileup_slice ) ( self, & err, start, length, wants_primary, wants_secondary ); // check for errors err . Check (); return PileupItf :: Cast ( ret ); }
mizuiro::difference_type pointer_difference( mizuiro::image::format::store< Format > const &_format, mizuiro::image::types::pointer< Access, Format, Constness > const _pointer1, mizuiro::image::types::pointer< Access, Format, Constness > const _pointer2 ) { return pointer_difference_adl( mizuiro::image::access::pointer_difference_ns::tag(), mizuiro::image::format::make_tag_of< Format >(), Access(), Constness(), _format, _pointer1, _pointer2 ); }
mizuiro::image::types::reference< Access, ImageFormat, Constness > dereference( mizuiro::image::format::store< ImageFormat > const &_format, mizuiro::image::types::pointer< Access, ImageFormat, Constness > const _data ) { return dereference_adl( mizuiro::image::access::dereference_ns::tag(), Access(), mizuiro::image::format::make_tag_of< ImageFormat >(), Constness(), _format, _data ); }
uint32_t ScomRegister::ForceRead() const { #define PRDF_FUNC "[ScomRegister::ForceRead] " uint32_t o_rc = FAIL; do { // No read allowed if register access attribute is write-only or no // access. if ( ( ACCESS_NONE == iv_operationType ) && ( ACCESS_WO == iv_operationType ) ) { PRDF_ERR( PRDF_FUNC"Write-only register: 0x%08x 0x%016llx", getChip()->GetId(), iv_scomAddress ); break; } // Read hardware. o_rc = Access( readCache(), MopRegisterAccess::READ ); if ( SUCCESS != o_rc ) { // The read failed. Remove the entry from the cache so a subsequent // Read() will attempt to read from hardware again. flushCache( getChip() ); } } while (0); return o_rc; #undef PRDF_FUNC }
std::vector<double> CaptureManager::GetDeformation(int c, float &avgDef) { std::vector<CvPoint> traj = GetTrajectory(c); std::vector<double> areas = GetAreas(c,avgDef); std::vector<double> defs(frameCount-1, 0.0); float totalDef = 0; int goodSteps = 0; CvSeq *h_next; ImagePlus *img_ = new ImagePlus(img); IplImage *gray = cvCreateImage(cvGetSize(img.orig), IPL_DEPTH_8U, 1); IplImage *edge = cvCreateImage(cvGetSize(img.orig), IPL_DEPTH_8U, 1); for (int i=0; i<frameCount-1; i++) { if (!(MyPoint(-1,-1)==traj[i] || MyPoint(-1,-1)==traj[i+1])) { wxPoint *ps = ContourToPointArray(Access(i,0,false, true)->contourArray[c], MyPoint(traj[i+1])-MyPoint(traj[i]).ToWxPoint()); img_->RemoveAllContours(); img_->AddContour(ps,Access(i,0,false, true)->contourArray[c]->total); delete[] ps; CvSeq *seq = Access(i+1,0,false, true)->contourArray[c]; CvSeq *oseq = img_->contourArray[0]; //Draw both contours on the temporary image cvZero(img_->orig); h_next = seq->h_next; seq->h_next = NULL; cvDrawContours(img_->orig, seq, CV_RGB(255,255,255), CV_RGB(0,0,0), 1, CV_FILLED, CV_AA, cvPoint(0,0)); seq->h_next = h_next; cvDrawContours(img_->orig, oseq, CV_RGB(255,255,200), CV_RGB(0,0,0), 1, CV_FILLED, CV_AA, cvPoint(0,0)); //detect contours on the drawn image: FindContoursPlugin::ProcessImage_static(img_,gray,edge,150,50,3,1); float unionArea = 0; for (int j=0; j<img_->contourArray.size(); j++) { unionArea += fabs(cvContourArea(img_->contourArray[j])); } goodSteps++; totalDef += (defs[i] = 2*unionArea - areas[i] - areas[i+1]); } } cvReleaseImage(&gray); cvReleaseImage(&edge); delete img_; avgDef = (goodSteps ? totalDef/goodSteps : 0); return defs; }
/** Based on the current values of Ncols and eltWidth, calculate size * in bytes necessary to buffer Nelts. */ size_t BufferedFrame::CalcFrameSize( int Nelts ) const { int frame_lines = Nelts / Ncols_; if ((Nelts % Ncols_) > 0) ++frame_lines; bool readingFile = (Access() == CpptrajFile::READ); // If Reading and DOS, CR present for each newline if (readingFile && IsDos()) frame_lines *= 2; // Calculate total frame size size_t fsize = (((size_t)Nelts * eltWidth_) + frame_lines); return fsize; }
/* ret 0 or -err */ int AccessOp::do_op(const char *path, unsigned char isfile, IOStore *store) { if (isfile==DT_CONTAINER || isfile==DT_DIR || isfile==DT_LNK) { return store->Access(path,mask); } else if (isfile==DT_REG) { return Access(path,store,mask); } else { return -ENOSYS; // what else could it be? } }
std::vector<CvPoint> CaptureManager::GetTrajectory(int c) { std::vector<CvPoint> traj(frameCount); for (int i=0; i<frameCount; i++) { if (Access(i,0,false, true)->contourArray.size() <= c) traj[i]=cvPoint(-1,-1); else { CvMoments m; double m00,m10,m01; cvMoments(Access(i,0,false, true)->contourArray[c], &m); m00 = cvGetSpatialMoment(&m,0,0); m01 = cvGetSpatialMoment(&m,0,1); m10 = cvGetSpatialMoment(&m,1,0); traj[i] = cvPoint(cvRound(m.m10/m.m00), cvRound(m.m01/m.m00)); } } return traj; }
void ImageS::load() { imageS = QVector<Access>(0); QSqlQuery query; query.exec("SELECT * FROM Bit"); QByteArray b; int type; while(query.next()){ type = query.value("Type").toInt(); b = query.value("Texture").toByteArray(); imageS.append( Access(type,Utils::fromByteArray<QPixmap>(b)) ); } }
std::vector<double> CaptureManager::GetVolumes(int c, float &avgVolume) { std::vector<double> v(frameCount, 0.0); int goodSteps = 0; float totalVolume = 0.0; for (int i=0; i<frameCount; i++) { float frameVolume = 0.0; for (int j=0; j<slideCount-1; j++) { if (Access(i,j, false, true)->contourArray.size() > c && Access(i,j+1, false, true)->contourArray.size() > c) { float area1 = calibration*calibration*fabs(cvContourArea(Access(i,j, false, true)->contourArray[c])); float area2 = calibration*calibration*fabs(cvContourArea(Access(i,j+1, false, true)->contourArray[c])); frameVolume += deltaZ*(area1 + area2)/2.0f; } } goodSteps++; totalVolume += (v[i] = frameVolume); } avgVolume = (goodSteps ? totalVolume/goodSteps : 0); return v; }
void Shader::AddShader(const String& name, const String& filepath) { if (FAILED(D3DX11CompileEffectFromFile( filepath, NULL, NULL, 0U, 0U, Window::Device(), &Access(name).effect, NULL))) { throw std::exception("シェーダーファイルのコンパイルに失敗しました"); } }
logical MemoAccess :: RefToDir (fmcb *targfmcb, fmcb *srcefmcb, void *targfld, void *srcefld, logical replace ) { int32 indx0; logical term = NO; BEGINSEQ memcpy(&indx0,srcefld,sizeof(int32)); if ( !srcefld || !targfld || !Access(indx0,NULL,0) ) ERROR if ( targfld ) srcefmcb->fmcbsmcb->smcbacc->RefToDir(targfmcb,srcefmcb,(char *)targfld,(char *)&void_pi,replace); RECOVER term = YES; ENDSEQ return(term); }
std::vector<double> CaptureManager::GetVolumeDiff(int c, float &avgDiff) { std::vector<double> v = GetVolumes(c, avgDiff); std::vector<double> diff(frameCount-1, 0.0); double totalDiff = 0; int goodSteps = 0; for (int i=0; i<frameCount-1; i++) { if (Access(i,0, false, true)->contourArray.size() > c) { goodSteps++; totalDiff += (diff[i] = v[i+1]-v[i]); } } avgDiff = (goodSteps ? totalDiff/goodSteps : 0); return diff; }
ReadGroupItf * ReadCollectionItf :: getReadGroups () const throw ( ErrorMsg ) { // the object is really from C const NGS_ReadCollection_v1 * self = Test (); // cast vtable to our level const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> get_read_groups != 0 ); NGS_ReadGroup_v1 * ret = ( * vt -> get_read_groups ) ( self, & err ); // check for errors err . Check (); return ReadGroupItf :: Cast ( ret ); }
StringItf * ReferenceSequenceItf :: getReferenceChunk ( uint64_t offset, uint64_t length ) const throw ( ErrorMsg ) { // the object is really from C const NGS_ReferenceSequence_v1 * self = Test (); // cast vtable to our level const NGS_ReferenceSequence_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> get_ref_chunk != 0 ); NGS_String_v1 * ret = ( * vt -> get_ref_chunk ) ( self, & err, offset, length ); // check for errors err . Check (); return StringItf :: Cast ( ret ); }
ReferenceItf * ReadCollectionItf :: getReference ( const char * spec ) const throw ( ErrorMsg ) { // the object is really from C const NGS_ReadCollection_v1 * self = Test (); // cast vtable to our level const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> get_reference != 0 ); NGS_Reference_v1 * ret = ( * vt -> get_reference ) ( self, & err, spec ); // check for errors err . Check (); return ReferenceItf :: Cast ( ret ); }
ReadItf * ReadCollectionItf :: getReadRange ( uint64_t first, uint64_t count ) const throw ( ErrorMsg ) { // the object is really from C const NGS_ReadCollection_v1 * self = Test (); // cast vtable to our level const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> get_reads != 0 ); NGS_Read_v1 * ret = ( * vt -> get_read_range ) ( self, & err, first, count, true, true, true ); // check for errors err . Check (); return ReadItf :: Cast ( ret ); }
// 데이터직렬화 const byte* GetBytes() { if(!BytesUpdated) { ReleaseBytes(); if(0 < Size) { BytesData = new TYPE[Size]; for(int i = 0; i < Size; ++i) { TYPE* Data = Access(i); if(Data) BxCore::Util::MemCpy(&BytesData[i], Data, sizeof(TYPE)); else BxCore::Util::MemSet(&BytesData[i], 0, sizeof(TYPE)); } } BytesUpdated = true; } return (const byte*) BytesData; }
AlignmentItf * ReadCollectionItf :: getAlignment ( const char * alignmentId ) const throw ( ErrorMsg ) { // the object is really from C const NGS_ReadCollection_v1 * self = Test (); // cast vtable to our level const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> get_alignment != 0 ); NGS_Alignment_v1 * ret = ( * vt -> get_alignment ) ( self, & err, alignmentId ); // check for errors err . Check (); return AlignmentItf :: Cast ( ret ); }
unsigned TrapAccess( trap_elen num_in_mx, in_mx_entry_p mx_in, trap_elen num_out_mx, mx_entry_p mx_out ) { trap_retval result; if( ReqFunc == NULL ) return( (unsigned)-1 ); result = ReqFuncProxy( num_in_mx, mx_in, num_out_mx, mx_out ); if( result == REQUEST_FAILED ) { Failure(); } Access(); #if defined( __WINDOWS__ ) && !defined( SERVER ) TrapHardModeCheck(); #endif if( result == REQUEST_FAILED ) return( (unsigned)-1 ); return( result ); }
bool ReferenceSequenceItf :: getIsCircular () const throw ( ErrorMsg ) { // the object is really from C const NGS_ReferenceSequence_v1 * self = Test (); // cast vtable to our level const NGS_ReferenceSequence_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> is_circular != 0 ); bool ret = ( * vt -> is_circular ) ( self, & err ); // check for errors err . Check (); return ret; }
StringItf * ReferenceSequenceItf :: getCanonicalName () const throw ( ErrorMsg ) { // the object is really from C const NGS_ReferenceSequence_v1 * self = Test (); // cast vtable to our level const NGS_ReferenceSequence_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> get_canon_name != 0 ); NGS_String_v1 * ret = ( * vt -> get_canon_name ) ( self, & err ); // check for errors err . Check (); return StringItf :: Cast ( ret ); }
bool ReferenceItf :: nextReference () throw ( ErrorMsg ) { // the object is really from C NGS_Reference_v1 * self = Test (); // cast vtable to our level const NGS_Reference_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> next != 0 ); bool ret = ( * vt -> next ) ( self, & err ); // check for errors err . Check (); return ret; }
uint64_t ReferenceSequenceItf :: getLength () const throw ( ErrorMsg ) { // the object is really from C const NGS_ReferenceSequence_v1 * self = Test (); // cast vtable to our level const NGS_ReferenceSequence_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> get_length != 0 ); uint64_t ret = ( * vt -> get_length ) ( self, & err ); // check for errors err . Check (); return ret; }
status_t Inode::OpenDir(OpenDirCookie* cookie) { ASSERT(cookie != NULL); if (fType != NF4DIR) return B_NOT_A_DIRECTORY; status_t result = Access(R_OK); if (result != B_OK) return result; cookie->fSpecial = 0; cookie->fSnapshot = NULL; cookie->fCurrent = NULL; cookie->fEOF = false; cookie->fAttrDir = false; return B_OK; }
AlignmentItf * ReadCollectionItf :: getAlignmentRange ( uint64_t first, uint64_t count, uint32_t categories ) const throw ( ErrorMsg ) { // the object is really from C const NGS_ReadCollection_v1 * self = Test (); // cast vtable to our level const NGS_ReadCollection_v1_vt * vt = Access ( self -> vt ); // call through C vtable ErrBlock err; assert ( vt -> get_align_range != 0 ); bool wants_primary = ( categories & Alignment :: primaryAlignment ); bool wants_secondary = ( categories & Alignment :: secondaryAlignment ); NGS_Alignment_v1 * ret = ( * vt -> get_align_range ) ( self, & err, first, count, wants_primary, wants_secondary ); // check for errors err . Check (); return AlignmentItf :: Cast ( ret ); }