// #include "stdafx.h" #include #include "ResDataObject.h" #include "Helper.JSON.hpp" #include "DIOS.Dev.MECH.Mould.hpp" #include "EasyJSONEncoder.hpp" using namespace DIOS::Dev::Detail::MECH; namespace nsMECH = DIOS::Dev::Detail::MECH; string nsMECH::GetProcessDirectory() { string ret = ""; char szFilename[MAX_PATH] = { 0 }; DWORD res = GetModuleFileNameA(0, szFilename, MAX_PATH); if (res == 0) { return ret; } string fullpath = szFilename; string::size_type firstHit = fullpath.find_last_of('\\'); if (firstHit == string::npos || firstHit == 0) { return ret; } ret = fullpath.substr(0, firstHit);//kick last \ return ret; } //获取配置文件中指定模块的版本号 bool nsMECH::GetVersion(string& version, HMODULE hMyModule) { try { char filename[MAX_PATH + 1] = { 0 }; if (GetModuleFileName(hMyModule, filename, MAX_PATH) == 0) { printf("dll HMODULEis null\n"); //mLog::Error("dll HMODULEis null\n"); return false; } printf("get Generator path:%s\n", filename); //mLog::Info("get Generator path:{$}\n", filename); DWORD dummy; DWORD size = GetFileVersionInfoSize(filename, &dummy); if (size == 0) { return false; } auto data = make_unique(size); if (!GetFileVersionInfo(filename, 0, size, &data[0])) { return false; } UINT32 len = 0; VS_FIXEDFILEINFO* fixed_file_info = 0; if (!VerQueryValue(&data[0], TEXT("\\"), reinterpret_cast(&fixed_file_info), &len)) { return false; } // version 为版本号 UINT32 vBitNumber = 0; vBitNumber = HIWORD(fixed_file_info->dwProductVersionMS); version += to_string(vBitNumber); version += "."; vBitNumber = LOWORD(fixed_file_info->dwProductVersionMS); version += to_string(vBitNumber); version += "."; vBitNumber = HIWORD(fixed_file_info->dwProductVersionLS); version += to_string(vBitNumber); version += "."; vBitNumber = LOWORD(fixed_file_info->dwProductVersionLS); version += to_string(vBitNumber); return true; } catch (...) { printf("get Generator Mould version failed"); //mLog::Error("get Generator Mould version failed\n"); } return false; } bool nsMECH::GetVersion(string& version, ResDataObject& config) { try { string procdir = ""; char filename[MAX_PATH + 1] = { 0 }; procdir = nsMECH::GetProcessDirectory(); if (procdir.empty()) { if (GetModuleFileName(nullptr, filename, MAX_PATH) == 0) { return false; } } else { string oemdrvpath = (const char*)config["oemdriver"]; { string keystr = "%ROOT%"; string::size_type pos = 0; string::size_type keylen = keystr.size(); string::size_type replen = procdir.size(); while ((pos = oemdrvpath.find(keystr, pos)) != string::npos) { oemdrvpath.replace(pos, keylen, procdir); pos += replen; } } strncpy_s(filename, oemdrvpath.c_str(), MAX_PATH); } printf("get Generator path:%s\n", filename); //mLog::Info("get Generator path:{$}\n", filename); DWORD dummy; DWORD size = GetFileVersionInfoSize(filename, &dummy); if (size == 0) { return false; } auto data = make_unique(size); if (!GetFileVersionInfo(filename, 0, size, &data[0])) { return false; } UINT32 len = 0; VS_FIXEDFILEINFO* fixed_file_info = 0; if (!VerQueryValue(&data[0], TEXT("\\"), reinterpret_cast(&fixed_file_info), &len)) { return false; } // version 为版本号 UINT32 vBitNumber = 0; vBitNumber = HIWORD(fixed_file_info->dwProductVersionMS); version += to_string(vBitNumber); version += "."; vBitNumber = LOWORD(fixed_file_info->dwProductVersionMS); version += to_string(vBitNumber); version += "."; vBitNumber = HIWORD(fixed_file_info->dwProductVersionLS); version += to_string(vBitNumber); version += "."; vBitNumber = LOWORD(fixed_file_info->dwProductVersionLS); version += to_string(vBitNumber); return true; } catch (...) { printf("get Generator Mould version failed"); //mLog::Error("get Generator Mould version failed\n"); } return false; } bool nsMECH::GetVersion(string& version) { try { char filename[MAX_PATH + 1] = { 0 }; if (GetModuleFileName(nullptr, filename, MAX_PATH) == 0) { return false; } printf("get Generator path:%s \n", filename); //mLog::Info("get Generator path:{$}\n", filename); DWORD dummy; DWORD size = GetFileVersionInfoSize(filename, &dummy); if (size == 0) { return false; } auto data = make_unique(size); if (!GetFileVersionInfo(filename, 0, size, &data[0])) { return false; } UINT32 len = 0; VS_FIXEDFILEINFO* fixed_file_info = 0; if (!VerQueryValue(&data[0], TEXT("\\"), reinterpret_cast(&fixed_file_info), &len)) { return false; } // version 为版本号 UINT32 vBitNumber = 0; vBitNumber = HIWORD(fixed_file_info->dwProductVersionMS); version += to_string(vBitNumber); version += "."; vBitNumber = LOWORD(fixed_file_info->dwProductVersionMS); version += to_string(vBitNumber); version += "."; vBitNumber = HIWORD(fixed_file_info->dwProductVersionLS); version += to_string(vBitNumber); version += "."; vBitNumber = LOWORD(fixed_file_info->dwProductVersionLS); version += to_string(vBitNumber); return true; } catch (...) { printf("get Generator Mould version failed"); //mLog::Error("get Generator Mould version failed\n"); } return false; } void nsMECH::TransJsonText(ResDataObject& config) { for (int x = 0; x < config.size(); x++) { //如果有Value if (config[x].GetKeyCount("Value") > 0) { //mLog::FINFO("TRY COVERT [{$}] VALUE {$}", config.GetKey(x), config[x]["Value"].size() > 0 ? config[x]["Value"].encode() : (const char*)config[x]["Value"]); if (config[x]["Value"].size() <= 0) { string va = (const char*)config[x]["Value"]; config[x] = va.c_str(); } else { ResDataObject rest = config[x]["Value"]; config[x] = rest; //mLog::FINFO("convert object [{$}], object {$}", config.GetKey(x), rest.encode()); } } //mLog::FINFO("After Convert {$}", config.encode()); } } //----------------------------------------------------------------------------- // nsGEN::MECHMould //----------------------------------------------------------------------------- nsMECH::MECHMould::MECHMould() { //基础信息 //m_MECHUnit.m_SID.reset(new SIDMould(1, 0, 99, 1)); //其它的信息按需在子类模块自行定义 } nsMECH::MECHMould::~MECHMould() { } void nsMECH::MECHMould::RegisterExamInfo(Dispatch* Dispatch) { Dispatch->Get.Push(AttrKey::PATIENTSIZE, [this](std::string& out) { if (m_MECHUnit.m_PatientSize) out = m_MECHUnit.m_PatientSize->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::VIEWID, [this](std::string& out) { if (m_MECHUnit.m_ViewID) out = m_MECHUnit.m_ViewID->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Action.Push(ActionKey::SetStudyInfo, [this](std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); return SetStudyInfo(json); }); Dispatch->Action.Push(ActionKey::SetViewInfo, [this](std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); return SetViewInfo(json); }); Dispatch->Action.Push(ActionKey::SetPatientInfo, [this](std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); auto& R0 = json[0]; return SetPatientInfo(R0); }); } void nsMECH::MECHMould::RegisterNormalControl(Dispatch* Dispatch) { //重置 Dispatch->Action.Push(ActionKey::Reset, [this](std::string in, std::string& out) { return Reset(); }); //同步模式 Dispatch->Action.Push(ActionKey::ActiveSyncMode, [this](std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); _tSyncModeArgs t{ }; if (json.size() >= 3) { t.strWS = (string)json[0]; t.strSyncMode = (string)json[1]; t.strSyncValue = (string)json[2]; return ActiveSyncMode(t); } else { return RET_STATUS::RET_FAILED; }}); Dispatch->Action.Push(ActionKey::SetAutoTracking, [this](std::string in, std::string& out) { auto value = JSONTo(in); return SetAutoTracking(value); }); Dispatch->Get.Push(AttrKey::MACHSTATE, [this](std::string& out) { if(m_MECHUnit.m_MechState) out = m_MECHUnit.m_MechState->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Action.Push(ActionKey::SetTechParamsInfo, [this](std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); TECHPARAM_INFO info; info.SetVal(json[0].encode()); auto value = atof(info.m_SID.GetVal()); SetSID((float)value); auto pn = atoi(info.m_PositionNumber.GetVal()); SetPositionNumber(pn); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::TUBEANGLE, [this](std::string& out) { if (m_MECHUnit.m_TubeAngle) out = m_MECHUnit.m_TubeAngle->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::TUBEHEIGHT, [this](std::string& out) { if (m_MECHUnit.m_TubeHeight) out = m_MECHUnit.m_TubeHeight->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::POSITIONNUMBER, [this](std::string& out) { if (m_MECHUnit.m_PostionNumber) out = m_MECHUnit.m_PostionNumber->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Set.Push(AttrKey::POSITIONNUMBER, [this](std::string in) { auto value = JSONTo(in); return SetPositionNumber(value); }); Dispatch->Action.Push(ActionKey::SetPositionNumber, [this](std::string in, std::string& out) { auto value = JSONTo(in); return SetPositionNumber(value); }); Dispatch->Get.Push(AttrKey::TID, [this](std::string& out) { if (m_MECHUnit.m_TID) out = m_MECHUnit.m_TID->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::SID, [this](std::string& out) { if (m_MECHUnit.m_SID) out = m_MECHUnit.m_SID->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Set.Push(AttrKey::SID, [this](std::string in) { auto value = JSONTo(in); return SetSID(value); }); Dispatch->Action.Push(ActionKey::SetSID, [this](std::string in, std::string& out) { auto value = JSONTo(in); return SetSID(value); }); Dispatch->Get.Push(AttrKey::SOD, [this](std::string& out) { if (m_MECHUnit.m_SOD) out = m_MECHUnit.m_SOD->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Set.Push(AttrKey::SOD, [this](std::string in) { auto value = JSONTo(in); return SetSOD(value); }); Dispatch->Action.Push(ActionKey::SetSOD, [this](std::string in, std::string& out) { auto value = JSONTo(in); return SetSOD(value); }); Dispatch->Get.Push(AttrKey::SED, [this](std::string& out) { if (m_MECHUnit.m_SED) out = m_MECHUnit.m_SED->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::FID, [this](std::string& out) { if (m_MECHUnit.m_FID) out = m_MECHUnit.m_FID->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::GRIDSTATE, [this](std::string& out) { if (m_MECHUnit.m_GridState) out = m_MECHUnit.m_GridState->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Set.Push(AttrKey::GRIDSTATE, [this](std::string in) { AttrKey::MECH_GRIDSTATE value = (AttrKey::MECH_GRIDSTATE)JSONTo(in); return SetGrid(value); }); Dispatch->Action.Push(ActionKey::SetGrid, [this](std::string in, std::string& out) { AttrKey::MECH_GRIDSTATE value = (AttrKey::MECH_GRIDSTATE)JSONTo(in); return SetGrid(value); }); Dispatch->Action.Push(ActionKey::MoveToHome, [this](std::string in, std::string& out) { return MoveToHome(in); }); Dispatch->Action.Push(ActionKey::MoveMech, [this](std::string in, std::string& out) { return MoveMech(in); }); Dispatch->Action.Push(ActionKey::StopMech, [this](std::string in, std::string& out) { return StopMech(in); }); Dispatch->Get.Push(AttrKey::UNITINFO, [this](std::string& out) { out = m_MECHUnit.m_strInfo; return RET_STATUS::RET_SUCCEED; }); } void nsMECH::MECHMould::RegisterCollimatorControl(Dispatch* Dispatch) { Dispatch->Set.Push(AttrKey::CollimatorSize, [this](std::string in) { ResDataObject json; json.decode(in.c_str()); auto& R0 = json[0]; ECOM_COLLIMATOR_INFO curCollimator; curCollimator.fWidth = atoi(((string)R0["Width"]).c_str()); curCollimator.fHeight = atoi(((string)R0["Height"]).c_str()); return SetCollimator(curCollimator); }); Dispatch->Action.Push(ActionKey::SetCollimator, [this](std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); auto& R0 = json[0]; ECOM_COLLIMATOR_INFO curCollimator; curCollimator.fWidth = atoi(((string)R0["Width"]).c_str()); curCollimator.fHeight = atoi(((string)R0["Height"]).c_str()); return SetCollimator(curCollimator); }); Dispatch->Get.Push(AttrKey::FILTER, [this](std::string& out) { if (m_MECHUnit.m_Filter) out = m_MECHUnit.m_Filter->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Set.Push(AttrKey::FILTER, [this](std::string in) { auto value = JSONTo (in); return SetFilter(value); }); Dispatch->Action.Push(ActionKey::SetFilter, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetFilter(value); }); } void nsMECH::MECHMould::RegisterExtraScreenControl(Dispatch* Dispatch) { Dispatch->Action.Push(ActionKey::SetExpEnable, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetExpEnable(value); }); Dispatch->Set.Push(AttrKey::WORKSTATION, [this](std::string in) { auto value = JSONTo (in); return SetWS(value); }); Dispatch->Action.Push(ActionKey::SetWS, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetWS(value); }); Dispatch->Set.Push(AttrKey::KV, [this](std::string in) { auto value = JSONTo (in); return SetKV(value); }); Dispatch->Action.Push(ActionKey::SetKV, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetKV(value); }); Dispatch->Set.Push(AttrKey::MA, [this](std::string in) { auto value = JSONTo (in); return SetMA(value); }); Dispatch->Action.Push(ActionKey::SetMA, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetMA(value); }); Dispatch->Set.Push(AttrKey::MS, [this](std::string in) { auto value = JSONTo (in); return SetMS(value); }); Dispatch->Action.Push(ActionKey::SetMS, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetMS(value); }); Dispatch->Set.Push(AttrKey::MAS, [this](std::string in) { auto value = JSONTo (in); return SetMAS(value); }); Dispatch->Action.Push(ActionKey::SetMAS, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetMAS(value); }); Dispatch->Set.Push(AttrKey::FOCUS, [this](std::string in) { auto value = JSONTo (in); return SetFO(value); }); Dispatch->Action.Push(ActionKey::SetFocus, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetFO(value); }); Dispatch->Set.Push(AttrKey::TECHMODE, [this](std::string in) { auto value = JSONTo (in); return SetTechMode(value); }); Dispatch->Action.Push(ActionKey::SetTechMode, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetTechMode(value); }); Dispatch->Set.Push(AttrKey::AECFIELD, [this](std::string in) { auto value = JSONTo (in); return SetAECField(value); }); Dispatch->Action.Push(ActionKey::SetAECField, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetAECField(value); }); Dispatch->Set.Push(AttrKey::AECDENSITY, [this](std::string in) { auto value = JSONTo (in); return SetDensity(value); }); Dispatch->Action.Push(ActionKey::SetDensity, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetDensity(value); }); Dispatch->Action.Push(ActionKey::SetBodySize, [this](std::string in, std::string& out) { ResDataObject json; json.decode(in.c_str()); auto value = (string)json[0]; return SetBodySize(value); }); } void nsMECH::MECHMould::RegisterMammoControl(Dispatch* Dispatch) { Dispatch->Get.Push(AttrKey::MAMMO_AE, [this](std::string& out) { if (m_MECHUnit.m_Mammo_AE) out = m_MECHUnit.m_Mammo_AE->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::MAMMO_AGD, [this](std::string& out) { if (m_MECHUnit.m_Mammo_AGD) out = m_MECHUnit.m_Mammo_AGD->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::MAMMO_CompPressureDEC, [this](std::string& out) { if (m_MECHUnit.m_Mammo_CompPressureDEC) out = m_MECHUnit.m_Mammo_CompPressureDEC->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::MAMMO_DEPRESS, [this](std::string& out) { if (m_MECHUnit.m_Mammo_Depress) out = m_MECHUnit.m_Mammo_Depress->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::MAMMO_MAG, [this](std::string& out) { if (m_MECHUnit.m_Mammo_MAG) out = m_MECHUnit.m_Mammo_MAG->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::MAMMO_PRESSVAL, [this](std::string& out) { if (m_MECHUnit.m_Mammo_PressureValue) out = m_MECHUnit.m_Mammo_PressureValue->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::MAMMO_THICKNESS, [this](std::string& out) { if (m_MECHUnit.m_Mammo_Thickness) out = m_MECHUnit.m_Mammo_Thickness->JSGet(); return RET_STATUS::RET_SUCCEED; }); } void nsMECH::MECHMould::RegisterTOMOControl(Dispatch* Dispatch) { Dispatch->Action.Push(ActionKey::SetTomoEnable, [this](std::string in, std::string& out) { auto value = JSONTo(in); return SetTomoEnable(value); }); Dispatch->Action.Push(ActionKey::SetTomoExpMode, [this](std::string in, std::string& out) { return SetTomoExpMode(in); }); Dispatch->Action.Push(ActionKey::SetTomoTechnical, [this](std::string in, std::string& out) { return SetTomoTechnical(in); }); Dispatch->Action.Push(ActionKey::GetTomoResults, [this](std::string in, std::string& out) { return GetTomoResults(out); }); } void nsMECH::MECHMould::RegisterStitchingControl(Dispatch* Dispatch) { Dispatch->Get.Push(AttrKey::STITCHINGSTATE, [this](std::string& out) { if (m_MECHUnit.m_StitchingState) out = m_MECHUnit.m_StitchingState->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::STITCHHEIGHT, [this](std::string& out) { if (m_MECHUnit.m_StitchHeight) out = m_MECHUnit.m_StitchHeight->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::STITCHLENGTH, [this](std::string& out) { if (m_MECHUnit.m_StitchLength) out = m_MECHUnit.m_StitchLength->JSGet(); return RET_STATUS::RET_SUCCEED; });; Dispatch->Get.Push(AttrKey::STITCHOVERLAP, [this](std::string& out) { if (m_MECHUnit.m_StitchOverLap) out = m_MECHUnit.m_StitchOverLap->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::STITCHPID, [this](std::string& out) { if (m_MECHUnit.m_StitchPID) out = m_MECHUnit.m_StitchPID->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::STITCHDIRECTION, [this](std::string& out) { if (m_MECHUnit.m_StitchDirection) out = m_MECHUnit.m_StitchDirection->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::STITCHTYPE, [this](std::string& out) { if (m_MECHUnit.m_StitchType) out = m_MECHUnit.m_StitchType->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::STITCHSTEPLENGTH, [this](std::string& out) { if (m_MECHUnit.m_StitchStepLength) out = m_MECHUnit.m_StitchStepLength->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::FPDPOSITION, [this](std::string& out) { if (m_MECHUnit.m_FPDPosition) out = m_MECHUnit.m_FPDPosition->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::TOTALIMAGECOUNT, [this](std::string& out) { if (m_MECHUnit.m_TotalImageCount) out = m_MECHUnit.m_TotalImageCount->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Get.Push(AttrKey::CURRENTIMAGENUMBER, [this](std::string& out) { if (m_MECHUnit.m_CurrentImageNumber) out = m_MECHUnit.m_CurrentImageNumber->JSGet(); return RET_STATUS::RET_SUCCEED; }); Dispatch->Action.Push(ActionKey::BeginStitching, [this](std::string in, std::string& out) { return BeginStitching(); }); Dispatch->Action.Push(ActionKey::InitStitching, [this](std::string in, std::string& out) { return InitStitching(); }); Dispatch->Action.Push(ActionKey::EndStitching, [this](std::string in, std::string& out) { return EndStitching(); }); Dispatch->Action.Push(ActionKey::SetupStitching, [this](std::string in, std::string& out) { return SetupStitching(in); }); Dispatch->Action.Push(ActionKey::AcceptStitchingImage, [this](std::string in, std::string& out) { return AcceptStitchingImage(); }); Dispatch->Action.Push(ActionKey::RejectStitchingImage, [this](std::string in, std::string& out) { return RejectStitchingImage(); }); Dispatch->Action.Push(ActionKey::CancelStitching, [this](std::string in, std::string& out) { return CancelStitching(); }); Dispatch->Action.Push(ActionKey::CompleteStitching, [this](std::string in, std::string& out) { return CompleteStitching(); }); Dispatch->Action.Push(ActionKey::NewExtraView, [this](std::string in, std::string& out) { return NewExtraView(); }); Dispatch->Action.Push(ActionKey::RepeatStitching, [this](std::string in, std::string& out) { return RepeatStitching(); }); Dispatch->Action.Push(ActionKey::SetAutoPosiitonNo, [this](std::string in, std::string& out) { auto value = JSONTo (in); return SetAutoPosiitonNo(value); }); } //----------------------------------------------------------------------------- // 所有的 检查 函数 //----------------------------------------------------------------------------- RET_STATUS nsMECH::MECHMould::SetStudyInfo(ResDataObject& pParam) { STUDAY_INFO info; info.SetVal(pParam[0].encode()); return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetViewInfo(ResDataObject& pParam) //假设2个体位View { vector tempProcedureViewList; for (int i = 0; i < pParam.size(); i++) { auto& itrm = pParam[i]; ECOM_PROCEDURE_VIEW viewInfo; viewInfo.strViewDescription = (string)itrm["ViewDescription"]; viewInfo.strSOPInstanceUID = (string)itrm["SOPInstanceUID"]; viewInfo.strSOPInstanceUID = (string)itrm["SOPInstanceUID"]; tempProcedureViewList.push_back(viewInfo); } return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetPatientInfo(ResDataObject& pParam) //注册完病人信息后调用 { ECOM_PATIENT PatientInfo; PatientInfo.strPatientName = (string)pParam["PatientName"]; PatientInfo.strSex = (string)pParam["Sex"]; PatientInfo.strAge = (string)pParam["Age"]; PatientInfo.strPatientID = (string)pParam["PatientID"]; PatientInfo.strPatientSize = (string)pParam["PatientSize"]; PatientInfo.strStudyDescription = (string)pParam["StudyDescription"]; return RET_STATUS::RET_SUCCEED; } //----------------------------------------------------------------------------- // 所有的 通用 函数 //----------------------------------------------------------------------------- RET_STATUS nsMECH::MECHMould::SetTechParamsInfo(ResDataObject& pParam) { TECHPARAM_INFO info; info.SetVal(pParam.encode()); string strcollimatorwidth = info.m_CollimatorWidth; string strcollimatorheight = info.m_CollimatorHeight; string strcollimatorfilter = info.m_CollimatorFilter; DWORD Width = 0; DWORD Height = 0; DWORD dwFilter = 0; if (strcollimatorwidth.find("IN") != string::npos) { Width = (DWORD)(atof(strcollimatorwidth.substr(0, strcollimatorwidth.size() - 2).c_str()) * 2.54); } else { Width = (DWORD)(atoi(strcollimatorwidth.substr(0, strcollimatorwidth.size() - 2).c_str())); } if (strcollimatorheight.find("IN") != string::npos) { Height = (DWORD)(atof(strcollimatorheight.substr(0, strcollimatorheight.size() - 2).c_str()) * 2.54); } else { Height = (DWORD)(atoi(strcollimatorheight.substr(0, strcollimatorheight.size() - 2).c_str())); } if (Width != 0 && Height != 0) { SetCollimatorSize(Width, Height); } dwFilter = (DWORD)atoi(strcollimatorfilter.c_str()); if (dwFilter >= 0) { SetCollimatorFilter(dwFilter); } return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetPositionNumber(int pn) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetSID(float value) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetSOD(float value) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::MoveToHome(string& value) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::MoveMech(string& value) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::StopMech(string& value) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetGrid(AttrKey::MECH_GRIDSTATE GridState) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetAutoTracking(int nAutoTracking) { return RET_STATUS::RET_SUCCEED; } //----------------------------------------------------------------------------- // 所有的 乳腺 函数 //----------------------------------------------------------------------------- RET_STATUS nsMECH::MECHMould::SetCollimatorSize(int xsize, int ysize) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetCollimatorSID(int sid) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetCollimatorFilter(int pParams) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetCollimatorAngle(int pParams) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetCollimatorLight(int Param) { return RET_STATUS::RET_SUCCEED; } //----------------------------------------------------------------------------- // 所有的 TOMO 函数 //----------------------------------------------------------------------------- RET_STATUS nsMECH::MECHMould::SetTomoEnable(bool state) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetTomoExpMode(string& vakue) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetTomoTechnical(string& value) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::GetTomoResults(std::string& result) { return RET_STATUS::RET_SUCCEED; } //----------------------------------------------------------------------------- // 所有的 遮光器 函数 //----------------------------------------------------------------------------- RET_STATUS nsMECH::MECHMould::SetCollimator(ECOM_COLLIMATOR_INFO& curCollimator) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetFilter(int nFilter) { return RET_STATUS::RET_SUCCEED; } //----------------------------------------------------------------------------- // 所有的 拼接 函数 //----------------------------------------------------------------------------- RET_STATUS nsMECH::MECHMould::BeginStitching() { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::InitStitching() { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::EndStitching() { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetupStitching(string& value) { return RET_STATUS::RET_SUCCEED; } //notice the URS that the last acquired image is accepted by host. Move to the next stitching target position. RET_STATUS nsMECH::MECHMould::AcceptStitchingImage() { return RET_STATUS::RET_SUCCEED; } //notice the URS that the last acquired image is rejected by host. Keep current position. RET_STATUS nsMECH::MECHMould::RejectStitchingImage() { return RET_STATUS::RET_SUCCEED; } //Cancel stitching procedure. RET_STATUS nsMECH::MECHMould::CancelStitching() { return RET_STATUS::RET_SUCCEED; } //Note the URS that stitching is finished. RET_STATUS nsMECH::MECHMould::CompleteStitching() { return RET_STATUS::RET_SUCCEED; } //New extra view, request the positioner to move to a position to take an extra image. RET_STATUS nsMECH::MECHMould::NewExtraView() { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::RepeatStitching() { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetAutoPosiitonNo(int nPN) { return RET_STATUS::RET_SUCCEED; } //----------------------------------------------------------------------------- // 所有的 牛头 函数 //----------------------------------------------------------------------------- RET_STATUS nsMECH::MECHMould::SetExpEnable(bool nExpEnabled) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetKV(int nKV) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetMA(float fMA) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetMS(float fMS) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetMAS(float fMAS) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetWS(int nWS) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetFO(int nFO) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetTechMode(int nET) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetAECField(int nAECFieldSel) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetDensity(float fAECDensity) { return RET_STATUS::RET_SUCCEED; } RET_STATUS nsMECH::MECHMould::SetBodySize(string strSize) { return RET_STATUS::RET_SUCCEED; } //----------------------------------------------------------------------------- // nsGEN::DriverMould //----------------------------------------------------------------------------- nsMECH::DriverMould::DriverMould () { ConfigInfo Vender (ConfKey::DiosType, "string", "R", "TRUE", ""); m_ConfigInfo.push_back(Vender); ConfigInfo Model (ConfKey::DiosModel, "string", "R", "TRUE", ""); m_ConfigInfo.push_back(Model); EasyJSONEncoder synList; synList.Set ("0", "1"); synList.Set ("1", "2"); ConfigInfo GenIsConnect (ConfKey::DiosIsConnect, "int", "RW", "FALSE", ""); GenIsConnect.SetList (synList.ToString ().c_str ()); m_ConfigInfo.push_back(GenIsConnect); ConfigInfo SCFType (ConfKey::DiosSCFType, "string", "R", "TRUE", ""); m_ConfigInfo.push_back(SCFType); EasyJSONEncoder COMList; COMList.Set ("0", "COM1"); COMList.Set ("1", "COM2"); COMList.Set ("2", "COM3"); COMList.Set ("3", "COM4"); COMList.Set ("4", "COM5"); COMList.Set ("5", "COM6"); COMList.Set ("6", "COM7"); COMList.Set ("7", "COM8"); COMList.Set ("8", "COM9"); COMList.Set ("9", "COM10"); COMList.Set ("10", "COM11"); COMList.Set ("11", "COM12"); ConfigInfo SCFPort (ConfKey::DiosSCFPort, "string", "RW", "TRUE", ""); SCFPort.SetList (COMList.ToString ().c_str ()); m_ConfigInfo.push_back(SCFPort); ConfigInfo SCFBaudrate (ConfKey::DiosSCFBaudrate, "int", "R", "FALSE", ""); m_ConfigInfo.push_back(SCFBaudrate); ConfigInfo SCFBytesize (ConfKey::DiosSCFBytesize, "int", "R", "FALSE", ""); m_ConfigInfo.push_back(SCFBytesize); ConfigInfo SCFParity (ConfKey::DiosSCFParity, "int", "R", "FALSE", ""); m_ConfigInfo.push_back(SCFParity); ConfigInfo SCFStopbits (ConfKey::DiosSCFStopbits, "int", "R", "FALSE", ""); m_ConfigInfo.push_back(SCFStopbits); } nsMECH::DriverMould::~DriverMould () { } std::string nsMECH::DriverMould::GetGUID () const { return MechDriverType; } #ifdef _WIN64 #ifdef _DEBUG static const auto COM_SCFDllName = "Dios.Dev.SerialSCFX64D.dll"; static const auto TCP_SCFDllName = "Dios.Dev.TcpipSCFX64D.dll"; #else static const auto COM_SCFDllName = "Dios.Dev.SerialSCFX64.dll"; static const auto TCP_SCFDllName = "Dios.Dev.TcpipSCFX64.dll"; #endif #endif string nsMECH::DriverMould::GetConnectDLL(string& ConfigFileName) { string ConnectDLL = COM_SCFDllName; ResDataObject r_config, Connection; if (!r_config.loadFile(ConfigFileName.c_str())) return ConnectDLL; if (r_config["CONFIGURATION"]["connections"].GetKeyCount("Value") > 0) { Connection = r_config["CONFIGURATION"]["connections"]["Value"]; } else { Connection = r_config["CONFIGURATION"]["connections"][0]; } if ((string)Connection["type"] == "COM") ConnectDLL = COM_SCFDllName; else ConnectDLL = TCP_SCFDllName; return ConnectDLL; } ResDataObject nsMECH::DriverMould::GetConnectParam(string& ConfigFileName) { ResDataObject r_config, Connection; if (!r_config.loadFile(ConfigFileName.c_str())) return Connection; if (r_config["CONFIGURATION"]["connections"].GetKeyCount("Value") > 0) { Connection = r_config["CONFIGURATION"]["connections"]["Value"]; } else { Connection = r_config["CONFIGURATION"]["connections"][0]; } return Connection; }