当前位置: 首页 > news >正文

东莞市锂电池网站建设HTML5怎么做自适应网站

东莞市锂电池网站建设,HTML5怎么做自适应网站,建设工程合同属于什么合同,wordpress二步验证一、OpenIGTLink OpenIGTLink#xff0c;可以简称为IGTL。它是一个专供医疗应用的网络通信库。IGTL可以应用各种传感器、手术机器人和成像仪等的数据传输。OpenIGTLink是有一系列的协议在底层支持的#xff0c;它是跨平台的#xff0c;应用也非常简单。 OpenIGTLink迭代还是…一、OpenIGTLink OpenIGTLink可以简称为IGTL。它是一个专供医疗应用的网络通信库。IGTL可以应用各种传感器、手术机器人和成像仪等的数据传输。OpenIGTLink是有一系列的协议在底层支持的它是跨平台的应用也非常简单。 OpenIGTLink迭代还是比较快的目前已经到了3.0版本。更多的对其的技术相关资料请查阅相关的资料或访问其官方地址及github。 二、IGTL的应用 IGTL在医疗行业应用还是比较多的它的优点是相对简单支持的场景也相对较多。缺点就是相对简单无法处理一些复杂的网络应用。不过话又说回来在医疗行业这种场景下一般也没有复杂的网络应用一般就是几台机器通信能复杂到哪儿。 IGTL的应用重点还是在业务上即它支持医疗行业的设备间的状态STATUS、图像IMAGE和命令COMMAND等各种消息格式。其实如果认真的向下看Message构成的情况就会发现和传统的网络通信中定义的协议没有什么不同。封装起来的目的就是为了简单好用。 三、Supra中的应用 在初步简单了解了一下IGTL后就看一下在Supra中如何使用这个库相关代码如下 1、做为服务端使用 void OpenIGTLinkOutputDevice::initializeOutput(){log_info(IGTL: server port: , m_server-GetServerPort());if (m_server-CreateServer(m_port) ! 0) {m_isReady false;}else {m_isReady true;//Wait asynchronously for the connectionwaitAsyncForConnection();}}template typename Tvoid OpenIGTLinkOutputDevice::sendImageMessageTemplated(shared_ptrconst USImage imageData){static_assert(std::is_sameT, uint8_t::value ||std::is_sameT, int16_t::value ||std::is_sameT, float::value,Image only implemented for uchar, short and float at the moment);auto properties imageData-getImageProperties();if (properties-getImageType() USImageProperties::BMode ||properties-getImageType() USImageProperties::Doppler){double resolution properties-getImageResolution();vec3s imageSize imageData-getSize();igtl::ImageMessage::Pointer pImageMsg igtl::ImageMessage::New();pImageMsg-SetDimensions((int)imageSize.x, (int)imageSize.y, (int)imageSize.z);pImageMsg-SetSpacing(resolution, resolution, resolution);if (is_sameT, uint8_t::value){pImageMsg-SetScalarTypeToUint8();}if (is_sameT, int16_t::value){pImageMsg-SetScalarTypeToInt16();}if (is_sameT, float::value){pImageMsg-SetScalarType(igtl::ImageMessage::TYPE_FLOAT32);}pImageMsg-SetEndian(igtl::ImageMessage::ENDIAN_LITTLE);igtl::Matrix4x4 m;igtl::IdentityMatrix(m);m[0][0] -1;m[1][1] -1;pImageMsg-SetMatrix(m);pImageMsg-SetNumComponents(1);pImageMsg-SetDeviceName(m_streamName.c_str());pImageMsg-AllocateScalars();igtl::TimeStamp::Pointer pTimestamp igtl::TimeStamp::New();double timestampSeconds;double timestampFrac modf(imageData-getSyncTimestamp(), timestampSeconds);pTimestamp-SetTime((uint32_t)timestampSeconds, (uint32_t)(timestampFrac*1e9));pImageMsg-SetTimeStamp(pTimestamp);auto imageContainer imageData-getDataT();if (!imageContainer-isHost()){imageContainer make_sharedContainerT (LocationHost, *imageContainer);}size_t numElements imageSize.x * imageSize.y * imageSize.z;memcpy(pImageMsg-GetScalarPointer(), imageContainer-get(), numElements * sizeof(T));pImageMsg-Pack();int sendResult m_clientConnection-Send(pImageMsg-GetPackPointer(), pImageMsg-GetPackSize());if (sendResult 0) //when it could not be sent{m_isConnected false;log_info(IGTL: Lost connection. Waiting for next connection.);waitAsyncForConnection();}}}void OpenIGTLinkOutputDevice::waitAsyncForConnection(){if (m_pConnectionThread m_pConnectionThread-joinable()){m_pConnectionThread-join();}m_pConnectionThread unique_ptrthread(new thread([this]() {log_info(IGTL: waiting for connection);m_clientConnection m_server-WaitForConnection();m_isConnected true;log_info(IGTL: got connection!);}));}代码很简单如果配合着IGTL自带的示例代码会更容易弄明白。 2、做为客户端使用 void TrackerInterfaceIGTL::startAcquisition() {m_callFrequency.setName(TrIGTL);while (getRunning()) {if (!m_connected) {lock_guardmutex lock(m_objectMutex);connectToSever();}//------------------------------------------------------------// Wait for a replyif (m_connected) {igtl::MessageHeader::Pointer headerMsg;headerMsg igtl::MessageHeader::New();headerMsg-InitPack();int rs m_socket-Receive(headerMsg-GetPackPointer(),headerMsg-GetPackSize());{lock_guardmutex lock(m_objectMutex);if (rs 0) {logging::log_warn(TrackerInterfaceIGTL: Connection closed.);closeSocket();continue;}if (rs ! headerMsg-GetPackSize()) {logging::log_warn(TrackerInterfaceIGTL: Message size information and actual data size dont match.);closeSocket();continue;}if (!m_frozen) {headerMsg-Unpack();if (strcmp(headerMsg-GetDeviceType(), TDATA) 0) {receiveTrackingData(headerMsg);} else {m_socket-Skip(headerMsg-GetBodySizeToRead(), 0);}}}} else {logging::log_warn(TrackerInterfaceIGTL: Could not reconnect to the server ,m_hostname, :, m_port, . Retrying in , m_reconnectInterval,s.);durationlong, std::milli sleepDuration milliseconds((long long)round(m_reconnectInterval * 1e3));this_thread::sleep_for(sleepDuration);}}{lock_guardmutex lock(m_objectMutex);closeSocket();} }void TrackerInterfaceIGTL::connectToSever() {if (!m_connected) {int r m_socket-ConnectToServer(m_hostname.c_str(), m_port);if (r ! 0) {m_connected false;logging::log_warn(TrackerInterfaceIGTL: Could not reconnect to the server ,m_hostname, :, m_port, );} else {m_connected true;logging::log_info(TrackerInterfaceIGTL: Connected to the server ,m_hostname, :, m_port, );}} }void TrackerInterfaceIGTL::closeSocket() {m_connected false;logging::log_warn(TrackerInterfaceIGTL: Closing socket to the server ,m_hostname, :, m_port, );m_socket-CloseSocket(); }bool TrackerInterfaceIGTL::receiveTrackingData(igtl::MessageHeader::Pointer header) {//------------------------------------------------------------// Allocate TrackingData Message Classigtl::TrackingDataMessage::Pointer trackingData;trackingData igtl::TrackingDataMessage::New();trackingData-SetMessageHeader(header);trackingData-AllocatePack();// Receive body from the socketm_socket-Receive(trackingData-GetPackBodyPointer(),trackingData-GetPackBodySize());// Deserialize the transform data// If you want to skip CRC check, call Unpack() without argument.int c trackingData-Unpack(1);bool crcFine (c igtl::MessageHeader::UNPACK_BODY) 0;if (crcFine) // if CRC check is OK{std::vectorTrackerData trackerData;// compute float timestamp format from IGTL representationuint32_t timestampSeconds;uint32_t timestampFrac;trackingData-GetTimeStamp(timestampSeconds, timestampFrac);double timestamp (double)timestampSeconds ((double)timestampFrac) / 1e9;int nElements trackingData-GetNumberOfTrackingDataElements();for (int i 0; i nElements; i) {igtl::TrackingDataElement::Pointer trackingElement;trackingData-GetTrackingDataElement(i, trackingElement);igtl::Matrix4x4 igtlMatrix;trackingElement-GetMatrix(igtlMatrix);TrackerData::Matrix matrix;matrix[0 0] igtlMatrix[0][0];matrix[0 1] igtlMatrix[0][1];matrix[0 2] igtlMatrix[0][2];matrix[0 3] igtlMatrix[0][3];matrix[4 0] igtlMatrix[1][0];matrix[4 1] igtlMatrix[1][1];matrix[4 2] igtlMatrix[1][2];matrix[4 3] igtlMatrix[1][3];matrix[8 0] igtlMatrix[2][0];matrix[8 1] igtlMatrix[2][1];matrix[8 2] igtlMatrix[2][2];matrix[8 3] igtlMatrix[2][3];matrix[12 0] igtlMatrix[3][0];matrix[12 1] igtlMatrix[3][1];matrix[12 2] igtlMatrix[3][2];matrix[12 3] igtlMatrix[3][3];trackerData.push_back(TrackerData(matrix, 100, 666, trackingElement-GetName(), timestamp));}auto pTrackingDataSet make_sharedTrackerDataSet(trackerData, timestamp, timestamp);addData0(pTrackingDataSet);m_callFrequency.measure();} else {logging::log_warn(TrackerInterfaceIGTL: IGTL message CRC error, skipping message);}return crcFine; } void TrackerInterfaceIGTL::initializeDevice() {// try to connect already here, so we are directly good to go!lock_guardmutex lock(m_objectMutex);m_socket igtl::ClientSocket::New();connectToSever(); }这段代码是接收TrackerData的代码也很容易理解。其实主要是要和IGTL中的相关格式对应此处就是TDATA所以按照其协议的说明一看就明白了。 四、总结 国外的框架库一个比较让人头疼的就是里面用了非常多的其它相关的库。这样的好处当然很明显就是完成具体的工作的效率会大幅提高。但对于学习者来说就比较麻烦了需要不断的学习这个库那个库然后才能把整个框架运行起来并初步掌握。 但真正掌握后会发现写这方面的代码会简单很多至少比自己想象的要简单很多如果做应用开发的话这确实是一个好的方法
http://www.w-s-a.com/news/554274/

相关文章:

  • 江苏城乡建设学校网站群晖建立wordpress
  • wordpress导入网站模板seo自学网官网
  • 购物网站服务器带宽北京网站开发周期
  • 同性做视频网站网站怎么添加栏目
  • 新余网站设计seo自学网站
  • 新乡个人网站建设价格wordpress数据插件
  • 你是网站设计有限公司的项目经理网站推广的重要性
  • 网站定制开发怎么写泸州设计公司有哪些
  • 上海网站建设zj kt迅速编程做网站
  • 郑州服装 网站建设网站栏目合理性
  • 平面设计在线网站最新汽油价格调整最新消息
  • 刷单网站建设wordpress缩略图 裁剪
  • 视差 网站泰州公司做网站
  • 广州网站优化系统怎么做淘客网站
  • 类似凡科互动的网站wordpress网站下载
  • 临沂网站制作公司安卓app开发实例教程
  • 泰州做网站 泰公网络科技公司网站升级中html
  • 如何做授权网站网站设计心得
  • 网站排名快速上升wordpress自动标签页
  • 做的好的手机网站有哪些万网域名交易
  • 网站怎么做漂亮点做陶瓷的公司网站
  • 软件开发设计制作网站下载自己怎么做视频收费网站
  • 江苏省建设安全协会网站天津网站建设哪家公司好
  • 资源类网站怎么做的网站上线准备工作
  • 长沙专业网站建设怎么做企业建站公司服务
  • 肇庆市有限公司网站建设手机直接看的网站有哪些
  • 织梦修改网站后备份英语作文模板高中
  • 个人网站域名用什么好上海公司拍沪牌需要什么条件
  • 网站建设 保密做网站赚钱交税
  • 食品建设网站前的市场分析进出口网站贸易平台有哪些