Esempio n. 1
0
void TableGet::Compile() {
    CheckTable();
    SwithTag();
    PerformGet();
    SearchForTM();
    SaveResult();
    FinishGet();
}
Esempio n. 2
0
 void Transform(const TxmlDocHolder& srcDoc, TBuffer& dest, const TXslParams& params) {
     //xmlXIncludeProcessFlags(srcDoc.Get(), XSLT_PARSE_OPTIONS);
     if (!srcDoc)
         ythrow yexception() << "source xml is not valid: " << ErrorMessage;
     TxmlDocHolder res(xsltApplyStylesheet(Stylesheet.Get(), srcDoc.Get(), ~TParamsArray(params).Array)); // no params
     ENSURE(!!res, "Failed to apply xslt!");
     SaveResult(res.Get(), Stylesheet.Get(), dest);
 }
void CEle_Power_DecomposeView::OnSaveToExcel()
{
	if(!AnalyseFinishedFlag)
	{
		AfxMessageBox("还没有完成任何功率分析计算,无法保存!");
		return;
	}
	SaveResult();
}
Esempio n. 4
0
int main()
{    
    DisplayStart(); 
    while(SystemInit() == ERROR);
    BLE_start();
    currentState = TIME_SYNC;
    
    for(;;)
    {
        switch (currentState)
        {
            case TIME_SYNC:
            {
                result = TimeSynchronize();
                if(result == TIME_SYNC_OK)
                {
                    currentState = READY;
                }
                break;
            }
            case READY:
            {
                result = CheckReady();
                if(result == NO_ERROR)
                {
                    currentState = CHECK_GATE;
                }
                else if(result == REBOOT)  
                {
                    currentState = TIME_SYNC;
                }
                break;
            }
            case CHECK_GATE:
            {
                result = CheckGate();
                if(result == GATE_OPEN)
                {
                    currentState = SAVE_RESULT;
                }
                else
                {
                    currentState = READY;
                }
                break;
            }
            case SAVE_RESULT:
            {
                SaveResult();
                currentState = READY;
                break;
            }            
        }
        MyDelay(TIMEOUT_DELAY);
    }
}
Esempio n. 5
0
/*********************************************************************\
	Function name    : CCompareTableDialog::Command
	Description      :
	Created at       : 09.10.01, @ 21:07:17
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CCompareTableDialog::Command(Int32 id,const BaseContainer &msg)
{
	switch (id)
	{
	case IDS_SAVE_BTN:
		SaveResult();
		break;
	}
	return true;
}
Esempio n. 6
0
void CBiteThroldWnd::OnNMReleasedcaptureSlidbiteradio(NMHDR *pNMHDR, LRESULT *pResult)
{
	Stringoper oper;
	char szPath[MAX_PATH];
	//保存参数
	SaveResult();
	//重新设置参数模型
	oper.CStringtoChars(m_nConfigFile, szPath);
	if (m_pBase)
		m_pBase->LoadModel(szPath);
	*pResult = 0;
}
Esempio n. 7
0
	int GradientBoostingForest::Fit(InstancePool * pInstancepool)
	{
		m_pInstancePool = pInstancepool;
		m_pInstancePool->MakeBucket();
		if(NULL == m_pInstancePool)
		{
			Comm::LogErr("GradientBoostingForest::Fit pInstancepool is NULL");
			return -1;
		}
		int ret = -1;
		for(int i=0;i<m_pconfig->TreeNum;i++)
		{
			DecisionTree * pTree = new DecisionTree(m_pconfig);
			ret = pTree->Fit(m_pInstancePool);

		//	printf("i = %d Fited pTree->FitError = %f\n",i,pTree->FitError());
			if(ret != 0)
			{
				Comm::LogErr("GradientBoostingForest::Fit fail! tree i = %d Fit fail!",i);
				return -1;
			}
			m_Forest.push_back(pTree);
			if(m_pconfig->LogLevel >= 2)printf("i = %d FitError = %f TestError = %f\n",i,FitError(),TestError());
			ret = Residual();
			printf("i = %d Residualed\n",i);
			if(ret != 0)
			{
				Comm::LogErr("GradientBoostingForest::Fit fail! Residual fail!");
				return -1;
			}
		}
		if(m_pconfig->IsLearnNewInstances)
		{
			ret = LearnNewInstance();
			if(ret != 0)
			{
				Comm::LogErr("GradientBoostingForest::Fit fail! LearnNewInstance fail!");
				return -1;
			}
		}

		ret = SaveResult();
		if(ret != 0)
		{
			Comm::LogErr("GradientBoostingForest::Fit fail ! SaveResult fail!");
			return -1;
		}
		
		if(m_pconfig->LogLevel >= 2)FeatureStat();

		return 0;
	}
Esempio n. 8
0
void CBiteThroldWnd::ProcessDoneState()
{
	UPDATACONTROLTOVAL;
	if (m_bIsOpen)								//实现完成时工作
	{
		m_nFile.Close();
		m_bIsOpen = false;
	}
	m_Ratio = m_BiteThreshold.voltvalue;
	//save the model.
	SaveResult();

	GetParent()->SendMessage(MYWM_TRAINWMD, TRAINWND_BITEDONE);		//通知父窗口,完成训练
}
int _tmain(int argc, _TCHAR* argv[])
{
	int								nRank, nTotalRank;
	double							fStartTime, fEndTime;

	MPI_Init(NULL, NULL);
	MPI_Comm_size(MPI_COMM_WORLD, &nTotalRank);
	MPI_Comm_rank(MPI_COMM_WORLD, &nRank);

	initVariables();
	LoadBalance(nTotalRank, nRank, atoi(argv[1]));
	
	if( 0 == nRank )
		fStartTime = MPI_Wtime();

	if(LoadMatrixNVectorData(g_nSize, atoi(argv[2])))
	{
		if( 0 == nRank )
		{
			fEndTime = MPI_Wtime();
			printf("File Read Time: %lf\n", fEndTime - fStartTime);
		}

		MVMul();
		
		if( 0 == nRank )
		{
			fStartTime = MPI_Wtime();
			printf("MVMul Time: %lf\n", fStartTime - fEndTime);
		}

		SaveResult(nRank, nTotalRank);

		if( 0 == nRank )
		{
			fEndTime = MPI_Wtime();
			printf("File Writing Time: %lf\n", fEndTime - fStartTime);
		}
	}
	else
	{
		if( 0 == nRank )
			printf("Can't allocate memeory!\n");
	}

	FinalVariables();

	MPI_Finalize();
	return 0;
}
Esempio n. 10
0
LRESULT CBiteThroldWnd::OnReceivMsg(WPARAM wparam, LPARAM lparam)
{
	Stringoper oper;
	char szPath[MAX_PATH];
	switch (wparam)
	{
	case THREADMSG_PROCESSFINISH:
		m_CurState = BITEDONE;
		m_Bctrl.SetWindowTextW(L"完成");
		if (m_pOutPut)
			(*m_pOutPut)(L"阈值训练模块:处理完成!");
		//保存模型
		SaveResult();
		//创建数据处理算法:
		m_pBase = new CCalcuteColor(m_Winlen);
		oper.CStringtoChars(m_nConfigFile, szPath);
		if (!m_pBase->LoadModel(szPath))
		{
			(*m_pOutPut)(L"无法加载阈值模型,无法计算咬牙!");
			delete m_pBase;
			m_pBase = NULL;
		}
		else
		{
			(*m_pOutPut)(L"加载阈值模型完成!");
			m_pAlogrithm[0] = m_pBase;
		}
		break;
	case THREADMSG_LOADFINISH:
		if (m_pOutPut)
			(*m_pOutPut)(L"阈值训练模块:导入数据完成!");
		break;
	case THREADMSG_SAVEFINISH:
		if (m_pOutPut)
			(*m_pOutPut)(L"阈值训练模块:保存数据完成!");
		break;
	default:
		break;
	}
	return 0;
}
Esempio n. 11
0
////////////////////////////////////////////////////////////////////////////////
//! Run a simple test for CUDA
////////////////////////////////////////////////////////////////////////////////
void runTest(int argc, char **argv, char *ref_file)
{
    // Register the window class
    WNDCLASSEX wc = { sizeof(WNDCLASSEX), CS_CLASSDC, MsgProc, 0L, 0L,
                      GetModuleHandle(NULL), NULL, NULL, NULL, NULL,
                      "CUDA/D3D10 simpleD3D10", NULL
                    };
    RegisterClassEx(&wc);

    // Create the application's window
    int xBorder = ::GetSystemMetrics(SM_CXSIZEFRAME);
    int yMenu = ::GetSystemMetrics(SM_CYMENU);
    int yBorder = ::GetSystemMetrics(SM_CYSIZEFRAME);
    HWND hWnd = CreateWindow(wc.lpszClassName, "CUDA/D3D10 simpleD3D10",
                             WS_OVERLAPPEDWINDOW, 0, 0, g_WindowWidth + 2*xBorder, g_WindowHeight+ 2*yBorder+yMenu,
                             NULL, NULL, wc.hInstance, NULL);

    // Initialize Direct3D
    if (SUCCEEDED(InitD3D(hWnd)))
    {
        // Create the scene geometry
        if (SUCCEEDED(InitGeometry()))
        {
            // Initialize interoperability between CUDA and Direct3D
            // Register vertex buffer with CUDA
            // DEPRECATED: cudaD3D10RegisterResource(g_pVB, cudaD3D10RegisterFlagsNone);
            cudaGraphicsD3D10RegisterResource(&cuda_VB_resource, g_pVB, cudaD3D10RegisterFlagsNone);
            getLastCudaError("cudaGraphicsD3D10RegisterResource (g_pVB) failed");

            // Initialize vertex buffer with CUDA
            runCuda();

            // Save result
            SaveResult(argc, argv);

            // Show the window
            ShowWindow(hWnd, SW_SHOWDEFAULT);
            UpdateWindow(hWnd);

            // Enter the message loop
            MSG msg;
            ZeroMemory(&msg, sizeof(msg));

            while (msg.message!=WM_QUIT)
            {
                if (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
                {
                    TranslateMessage(&msg);
                    DispatchMessage(&msg);
                }
                else
                {
                    Render();

                    if (ref_file != NULL)
                    {
                        for (int count=0; count<g_iFrameToCompare; count++)
                        {
                            Render();
                        }

                        const char *cur_image_path = "simpleD3D10.ppm";

                        // Save a reference of our current test run image
                        CheckRenderD3D10::ActiveRenderTargetToPPM(g_pd3dDevice,cur_image_path);

                        // compare to offical reference image, printing PASS or FAIL.
                        g_bPassed = CheckRenderD3D10::PPMvsPPM(cur_image_path, ref_file, argv[0],MAX_EPSILON, 0.15f);

                        Cleanup();

                        PostQuitMessage(0);
                    }
                }
            }
        }
    }

    // Release D3D Library (after message loop)
    dynlinkUnloadD3D10API();

    UnregisterClass(wc.lpszClassName, wc.hInstance);
}
SaveResult SaveResult::SaveFailed(const utf8_string& error){
  return SaveResult(false, error);
}
SaveResult SaveResult::SaveSuccessful(){
  return SaveResult(true, utf8_string(""));
}
void CEnsemble3dExt::Ensemble3Dvolume(const char* folder_name)
{
    _init_temporal();
	int k = 0, max_nodule_size = 35;
	int start = seedz, z = seedz;
	int org_x = seedx, org_y = seedy, org_z = seedz;
	for(z=start; z>=0; z--)
	{
		//printf ("%s\n", slices_name[z].c_str());
		cout<<z<<":"<<seedx<<','<<seedy<<endl;
		aslice = _dcm.getSllice(z);
//		cv::namedWindow( "Display window", cv::WINDOW_AUTOSIZE );// Create a window for display.
//        cv::imshow( "Display window", cv::Mat(aslice) );                   // Show our image inside it.
//
//        cv::waitKey(0);
		outmask = cvCreateImage(cvGetSize(aslice),8,1);
		cvZero(outmask);

		//cvShowImage("in", aslice);
		//cvWaitKey(0);

		CvPoint seed = cvPoint(seedx,seedy);
		//cvSmooth(aslice, aslice);
		CEnsemble ensemble(aslice, seed, outmask);
		ensemble.doEnsembleSegmentation();
		SaveResult(folder_name, z);

		if(!UpdateSeed(z, BACKWARD))
			break;

		k ++;
		if(k > max_nodule_size)
			break;
		cvReleaseImage(&outmask);
	}

	seedx = org_x;
	seedy = org_y;
	seedz = org_z;
	k = 0;
	for(z=start+1; z<slices_name.size(); z++)
	{
		////printf ("%s\n", slices_name[i].c_str());
		cout<<z<<":"<<seedx<<','<<seedy<<endl;

		aslice = _dcm.getSllice(z);
		outmask = cvCreateImage(cvGetSize(aslice),8,1);
		cvZero(outmask);

		CvPoint seed = cvPoint(seedx,seedy);
		//cvSmooth(aslice, aslice);
		CEnsemble ensemble(aslice, seed, outmask);
		ensemble.doEnsembleSegmentation();

		SaveResult(folder_name, z);
		if(!UpdateSeed(z, FORWARD))
			break;

		k ++;
		if(k > max_nodule_size)
			break;

		//cvWaitKey(0);
		cvReleaseImage(&outmask);
	}

	_saveToNiffty(_temporal, folder_name );

}