101 lines
3.0 KiB
Plaintext
101 lines
3.0 KiB
Plaintext
void CenterPart::calculateGma()
|
|
{
|
|
// first get gamma information from GUI
|
|
int dta = this->gmDLEd->text().toInt();
|
|
int dd = this->gmVLEd->text().toInt();
|
|
int thred = this->gmCLEd->text().toInt();
|
|
|
|
if (dta <= 0 || dd <= 0 || thred <= 0 ||
|
|
dta > 7 || dd > 7 || thred > 100)
|
|
{
|
|
QMessageBox::warning(this, tr("Warning"), \
|
|
tr("Load Wrong gamma parameters!"), QMessageBox::Yes);
|
|
return;
|
|
}
|
|
|
|
// load DLL
|
|
std::string autoDgDllFile = this->execPath + "/algo/GammaMapLib";
|
|
std::string postFix = ".dll";
|
|
#ifdef _DEBUG
|
|
postFix = "D.dll";
|
|
#endif
|
|
autoDgDllFile += postFix;
|
|
HINSTANCE hInst = LoadLibrary(autoDgDllFile.c_str());
|
|
|
|
// check dll file
|
|
if (hInst == nullptr)
|
|
{
|
|
QMessageBox::warning(this, tr("Warning"), \
|
|
tr("No reference GammaMapLib DLL!"), QMessageBox::Yes);
|
|
return;
|
|
}
|
|
|
|
// function
|
|
typedef float(*pGamma3D)(float * originR,
|
|
float * spacingR,
|
|
int* sizeR,
|
|
float * doseR,
|
|
float * originE,
|
|
float * spacingE,
|
|
int* sizeE,
|
|
float * doseE,
|
|
float** gammaMap,
|
|
int dta,
|
|
int dd,
|
|
int thred);
|
|
pGamma3D gamma3D = (pGamma3D)GetProcAddress(hInst, "gamma3D");
|
|
|
|
// check function
|
|
if (gamma3D == nullptr)
|
|
{
|
|
QMessageBox::warning(this, tr("Warning"), \
|
|
tr("No reference gamma3D function in DLL!"), QMessageBox::Yes);
|
|
return;
|
|
}
|
|
|
|
std::cout << "POOOKOK" << std::endl;
|
|
// load image
|
|
int ret = 0;
|
|
std::string refDoseF = this->rtdPath + "/doseRef.mhd";
|
|
std::string evaDoseF = this->rtdPath + "/doseCuMcMc.mhd";
|
|
|
|
if (this->mtdTyp == 0)
|
|
{
|
|
evaDoseF = this->rtdPath + "/doseGoMcMc.mhd";
|
|
}
|
|
else if (this->mtdTyp == 1)
|
|
{
|
|
evaDoseF = this->rtdPath + "/doseCuMcMC.mhd";
|
|
}
|
|
else if (this->mtdTyp == 2)
|
|
{
|
|
evaDoseF = this->rtdPath + "/doseVsMcMc.mhd";
|
|
}
|
|
else if (this->mtdTyp == 3)
|
|
{
|
|
evaDoseF = this->rtdPath + "/doseDcPB.mhd";
|
|
}
|
|
|
|
float originR[3];
|
|
float spacingR[3];
|
|
int sizeR[3];
|
|
float* doseR;
|
|
float originE[3];
|
|
float spacingE[3];
|
|
int sizeE[3];
|
|
float* doseE;
|
|
ret |= readMhd(refDoseF, &doseR, originR, spacingR, sizeR);
|
|
ret |= readMhd(evaDoseF, &doseE, originE, spacingE, sizeE);
|
|
|
|
if (ret < 0)
|
|
{
|
|
QMessageBox::warning(this, tr("Warning"), \
|
|
tr("No reference or result dose!"), QMessageBox::Yes);
|
|
return;
|
|
}
|
|
|
|
// call
|
|
float* gammaMap;
|
|
float gamma = gamma3D(originR, spacingR, sizeR, doseR, originE, spacingE, sizeE, doseE, &gammaMap, dta, dd, thred);
|
|
this->gmaLEd->setText(QString::number(gamma * 100, 'f', 5));
|
|
} |