本文整理汇总了C++中Metadata::SetTag方法的典型用法代码示例。如果您正苦于以下问题:C++ Metadata::SetTag方法的具体用法?C++ Metadata::SetTag怎么用?C++ Metadata::SetTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Metadata
的用法示例。
在下文中一共展示了Metadata::SetTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mstCount
/*
* Inserts Image and MetaData into MMCore circular Buffer
*/
int CAndorSDK3Camera::InsertImage()
{
char deviceName[MM::MaxStrLength];
GetProperty(MM::g_Keyword_Name, deviceName);
Metadata md;
MetadataSingleTag mstCount(MM::g_Keyword_Metadata_ImageNumber, deviceName, true);
mstCount.SetValue(CDeviceUtils::ConvertToString(thd_->GetImageCounter()));
md.SetTag(mstCount);
if (0 == thd_->GetImageCounter())
{
sequenceStartTime_ = timeStamp_;
}
stringstream ss;
ss << sequenceStartTime_;
MetadataSingleTag mstStartTime(MM::g_Keyword_Metadata_StartTime, deviceName, true);
mstStartTime.SetValue(ss.str().c_str());
md.SetTag(mstStartTime);
ss.str("");
ss.clear();
double d_result = (timeStamp_-sequenceStartTime_)/static_cast<double>(fpgaTSclockFrequency_);
ss << d_result*1000 << " [" << d_result << " seconds]";
MetadataSingleTag mst(MM::g_Keyword_Elapsed_Time_ms, deviceName, true);
mst.SetValue(ss.str().c_str());
md.SetTag(mst);
MMThreadGuard g(imgPixelsLock_);
const unsigned char * pData = img_.GetPixels();
unsigned int w = img_.Width();
unsigned int h = img_.Height();
unsigned int b = img_.Depth();
int ret = GetCoreCallback()->InsertImage(this, pData, w, h, b, md.Serialize().c_str(), false);
if (!stopOnOverflow_ && ret == DEVICE_BUFFER_OVERFLOW)
{
// do not stop on overflow - just reset the buffer
GetCoreCallback()->ClearImageBuffer(this);
// don't process this same image again...
ret = GetCoreCallback()->InsertImage(this, pData, w, h, b, md.Serialize().c_str(), false);
}
return ret;
}
示例2: mstStartTime
int BitFlowCamera::LiveThread::svc()
{
stopRunning_ = false;
running_ = true;
imageCounter_ = 0;
// put the hardware into a continuous acqusition state
while (true) {
if (stopRunning_)
break;
int ret = cam_->SnapImage();
if (ret != DEVICE_OK) {
char txt[1000];
sprintf(txt, "BitFlow live thread: ImageSnap() error %d", ret);
cam_->GetCoreCallback()->LogMessage(cam_, txt, false);
break;
}
char label[MM::MaxStrLength];
cam_->GetLabel(label);
MM::MMTime timestamp = cam_->GetCurrentMMTime();
Metadata md;
MetadataSingleTag mstStartTime(MM::g_Keyword_Metadata_StartTime, label, true);
mstStartTime.SetValue(CDeviceUtils::ConvertToString(cam_->startTime_.getMsec()));
md.SetTag(mstStartTime);
MetadataSingleTag mstElapsed(MM::g_Keyword_Elapsed_Time_ms, label, true);
MM::MMTime elapsed = timestamp - cam_->startTime_;
mstElapsed.SetValue(CDeviceUtils::ConvertToString(elapsed.getMsec()));
md.SetTag(mstElapsed);
MetadataSingleTag mstCount(MM::g_Keyword_Metadata_ImageNumber, label, true);
mstCount.SetValue(CDeviceUtils::ConvertToString(imageCounter_));
md.SetTag(mstCount);
// insert all channels
for (unsigned i=0; i<cam_->GetNumberOfChannels(); i++)
{
char buf[MM::MaxStrLength];
MetadataSingleTag mstChannel(MM::g_Keyword_CameraChannelIndex, label, true);
snprintf(buf, MM::MaxStrLength, "%d", i);
mstChannel.SetValue(buf);
md.SetTag(mstChannel);
MetadataSingleTag mstChannelName(MM::g_Keyword_CameraChannelName, label, true);
cam_->GetChannelName(i, buf);
mstChannelName.SetValue(buf);
md.SetTag(mstChannelName);
ret = cam_->GetCoreCallback()->InsertImage(cam_, cam_->GetImageBuffer(i),
cam_->GetImageWidth(),
cam_->GetImageHeight(),
cam_->GetImageBytesPerPixel(),
md.Serialize().c_str());
if (ret == DEVICE_BUFFER_OVERFLOW) {
cam_->GetCoreCallback()->ClearImageBuffer(cam_);
cam_->GetCoreCallback()->InsertImage(cam_, cam_->GetImageBuffer(i),
cam_->GetImageWidth(),
cam_->GetImageHeight(),
cam_->GetImageBytesPerPixel(),
md.Serialize().c_str());
}
else if (ret != DEVICE_OK) {
cam_->GetCoreCallback()->LogMessage(cam_, "BitFlow thread: error inserting image", false);
break;
}
}
imageCounter_++;
if (numImages_ >=0 && imageCounter_ >= numImages_) {
cam_->bfDev_.StopContinuousAcq();
break;
}
}
running_ = false;
return 0;
}