#include <3dvis.h>
Public Methods | |
| CMy3dvisApp () | |
| void | Abort () |
| virtual BOOL | InitInstance () |
| virtual int | ExitInstance () |
| afx_msg void | OnAppAbout () |
| afx_msg void | OnFileOpen () |
| afx_msg void | OnFClose () |
| afx_msg void | OnRenderVolume () |
| afx_msg void | OnOptionsTransfer () |
| afx_msg void | OnPreset0 () |
| afx_msg void | OnPreset1 () |
| afx_msg void | OnPreset2 () |
| afx_msg void | OnPreset3 () |
| afx_msg void | OnPreset4 () |
| afx_msg void | OnPreset5 () |
| afx_msg void | OnPreset6 () |
| afx_msg void | OnPreset7 () |
| afx_msg void | OnPreset8 () |
| afx_msg void | OnPreset9 () |
| afx_msg void | OnFileInfo () |
| afx_msg void | OnMenuVolume () |
| afx_msg void | OnFileIni () |
Public Attributes | |
| bool | m_bRenderVolume |
| int | m_dNumPresets |
| Transfunc * | transferFunction |
| string | programPath |
Private Methods | |
| void | m_BuildTransferFunction (INDEXLIST &function, int num) |
| void | m_ProcessIniFile (bool store=false) |
Private Attributes | |
| int | m_dOperation |
| bool | m_bOpen |
| bool | m_bClicked |
| int | m_dFileThres |
| int | m_dPacketSize |
| transferfuncform | m_Transferdiag |
| INDEXLIST * | presetTransformFunctions |
|
|
Definition at line 54 of file 3dvis.cpp. References m_bClicked, m_bRenderVolume, m_dFileThres, m_dOperation, m_dPacketSize, programPath, and transferFunction.
00055 {
00056 // TODO: add construction code here,
00057 // Place all significant initialization in InitInstance
00058 m_bRenderVolume = false;
00059 m_bClicked = false;
00060 transferFunction = NULL;
00061
00062 m_dFileThres = 40;
00063 m_dPacketSize = 10;
00064
00065 m_dOperation = 0;
00066
00067 char path[_MAX_PATH + 1];
00068
00069 GetModuleFileName(m_hInstance, path, sizeof(path));
00070
00071 string temp = path;
00072 int pos = temp.find_last_of('\\', temp.size());
00073 programPath = temp.substr(0, pos + 1);
00074 }
|
|
|
Definition at line 536 of file 3dvis.cpp.
00536 {
00537 switch (m_dOperation) {
00538 case 0:
00539 return;
00540 case 1:
00541 if (data3D) {
00542 data3D->SetAbort();
00543 }
00544 break;
00545 case 2:
00546
00547 break;
00548 }
00549 }
|
|
|
Definition at line 196 of file 3dvis.cpp. References transferFunction.
00197 {
00198 // TODO: Add your specialized code here and/or call the base class
00199 if (data3D != NULL) {
00200 delete data3D;
00201 data3D = NULL;
00202 }
00203
00204 if (slice != NULL) {
00205 delete slice;
00206 slice = NULL;
00207 }
00208
00209 if (raycaster != NULL) {
00210 delete raycaster;
00211 raycaster = NULL;
00212 }
00213
00214 if (transferFunction != NULL) {
00215 delete transferFunction;
00216 transferFunction = NULL;
00217 }
00218
00219 return CWinApp::ExitInstance();
00220 }
|
|
|
Definition at line 84 of file 3dvis.cpp. References CTransfuncFile::LoadPresets(), m_ProcessIniFile(), and presetTransformFunctions.
00085 {
00086
00087 CTransfuncFile funcFile;
00088 presetTransformFunctions = funcFile.LoadPresets(m_dNumPresets);
00089
00090
00091 // Standard initialization
00092 // If you are not using these features and wish to reduce the size
00093 // of your final executable, you should remove from the following
00094 // the specific initialization routines you do not need.
00095
00096 #ifdef _AFXDLL
00097 Enable3dControls(); // Call this when using MFC in a shared DLL
00098 #else
00099 Enable3dControlsStatic(); // Call this when linking to MFC statically
00100 #endif
00101
00102 // Change the registry key under which our settings are stored.
00103 // TODO: You should modify this string to be something appropriate
00104 // such as the name of your company or organization.
00105 SetRegistryKey(_T("Local AppWizard-Generated Applications"));
00106
00107 LoadStdProfileSettings(); // Load standard INI file options (including MRU)
00108
00109 // Register the application's document templates. Document templates
00110 // serve as the connection between documents, frame windows and views.
00111
00112 CSingleDocTemplate* pDocTemplate;
00113 pDocTemplate = new CSingleDocTemplate(
00114 IDR_MAINFRAME,
00115 RUNTIME_CLASS(CMy3dvisDoc),
00116 RUNTIME_CLASS(CMainFrame), // main SDI frame window
00117 RUNTIME_CLASS(CMy3dvisView));
00118 AddDocTemplate(pDocTemplate);
00119
00120 // Parse command line for standard shell commands, DDE, file open
00121 CCommandLineInfo cmdInfo;
00122 ParseCommandLine(cmdInfo);
00123
00124 // Dispatch commands specified on the command line
00125 if (!ProcessShellCommand(cmdInfo))
00126 return FALSE;
00127
00128
00129 m_ProcessIniFile();
00130
00131
00132 // The one and only window has been initialized, so show and update it.
00133 m_pMainWnd->ShowWindow(SW_SHOW);
00134 m_pMainWnd->UpdateWindow();
00135 return TRUE;
00136 }
|
|
||||||||||||
|
Definition at line 397 of file 3dvis.cpp. References rgb::b, rgb::g, rgb::r, Transfunc::SetDensityColor(), Transfunc::SetOpacity(), and transferFunction. Referenced by OnOptionsTransfer(), OnPreset0(), OnPreset1(), OnPreset2(), OnPreset3(), OnPreset4(), OnPreset5(), OnPreset6(), OnPreset7(), OnPreset8(), and OnPreset9().
00397 {
00398 if (!data3D)
00399 return;
00400
00401 if (!transferFunction)
00402 transferFunction = new Transfunc();
00403
00404 rgb col;
00405
00406 for (int i = 1; i <= num; i++) {
00407 COLORREF c = function[i].m_scColor;
00408 col.r = (unsigned char)(function[i].m_scColor & 0x000000FF);
00409 col.g = (unsigned char)((function[i].m_scColor & 0x0000FF00) >> 8);
00410 col.b = (unsigned char)((function[i].m_scColor & 0x00FF0000) >> 16);
00411
00412 float test = (float)function[i].m_ucAlpha / 255;
00413 for (int j = function[i].m_sdBegin; j < function[i].m_sdEnd; j++) {
00414 transferFunction->SetDensityColor(j, col);
00415 transferFunction->SetOpacity(j, ((float)function[i].m_ucAlpha / 255));
00416 }
00417 }
00418
00419 if (slice == NULL)
00420 slice = new Slice();
00421
00422 slice->SetTransferfunction(transferFunction);
00423 slice->SetPixels(data3D, -1);
00424 }
|
|
|
Definition at line 447 of file 3dvis.cpp. References m_dFileThres, m_dPacketSize, and programPath. Referenced by InitInstance(), OnFileIni(), and OnFileOpen().
00447 {
00448 FILE *file;
00449
00450 string filename = programPath + "config.ini";
00451
00452 if (!store && (file = fopen(filename.c_str(), "r")) != NULL) {
00453 if (!data3D)
00454 return;
00455
00456 fscanf(file, "%d\n%d", &m_dFileThres, &m_dPacketSize);
00457 data3D->SetFileThreshold(m_dFileThres);
00458 data3D->SetDataPackets(m_dPacketSize);
00459
00460 fclose(file);
00461
00462 return;
00463 }
00464
00465
00466 if ((file = fopen(filename.c_str(), "w")) != NULL) {
00467 m_dFileThres = 40;
00468 m_dPacketSize = 10;
00469
00470 fprintf(file, "%d\n%d", m_dFileThres, m_dPacketSize);
00471 fclose(file);
00472 }
00473
00474
00475 }
|
|
|
Definition at line 186 of file 3dvis.cpp.
00187 {
00188 CAboutDlg aboutDlg;
00189 aboutDlg.DoModal();
00190 }
|
|
|
Definition at line 291 of file 3dvis.cpp. References m_bOpen. Referenced by OnFileOpen().
00292 {
00293 // TODO: Add your command handler code here
00294
00295 if (data3D && !m_bOpen && MessageBox(m_pMainWnd->m_hWnd, "do you really want to close the\ncurrent data-set?",
00296 "close data-set", MB_YESNO) == IDNO)
00297 return;
00298
00299
00300 AfxGetMainWnd()->SendMessage(MYWM_HIDE_BARS);
00301
00302
00303 if (slice != NULL) {
00304 delete slice;
00305 slice = NULL;
00306 }
00307
00308 if (data3D != NULL) {
00309 delete data3D;
00310 data3D = NULL;
00311 }
00312
00313 m_pMainWnd->SetWindowText("3D Visualisation");
00314 }
|
|
|
Definition at line 427 of file 3dvis.cpp. References CFileInfoDialog::SetInfo().
00428 {
00429 // TODO: Add your command handler code here
00430 if (!data3D)
00431 return;
00432
00433 CFileInfoDialog fid;
00434 fid.SetInfo(data3D->filename, data3D->GetXDim(), data3D->GetYDim(), data3D->GetZDim());
00435 fid.DoModal();
00436 }
|
|
|
Definition at line 477 of file 3dvis.cpp. References IniFile::GetData(), m_ProcessIniFile(), and IniFile::SetupData().
00478 {
00479 // TODO: Add your command handler code here
00480 IniFile inifile;
00481 inifile.SetupData(m_dFileThres, m_dPacketSize);
00482 int answer = inifile.DoModal();
00483
00484 if (answer == IDCANCEL)
00485 return;
00486
00487
00488 inifile.GetData(m_dFileThres, m_dPacketSize);
00489 m_ProcessIniFile(true);
00490 }
|
|
|
Definition at line 222 of file 3dvis.cpp. References m_bOpen, m_bRenderVolume, m_ProcessIniFile(), and OnFClose().
00223 {
00224 // TODO: Add your command handler code here
00225 CFileDialog fd(TRUE, NULL, NULL, OFN_FILEMUSTEXIST,
00226 "Dat Files (*.dat)|*.dat| AllFiles (*.*)|* *|", m_pMainWnd);
00227
00228
00229 int returnVal = fd.DoModal();
00230
00231 if(returnVal == IDOK) {
00232
00233 m_bOpen = true;
00234 this->OnFClose();
00235 m_bOpen = false;
00236
00237 if (data3D != NULL) {
00238 if (MessageBox(m_pMainWnd->m_hWnd, "Already data loaded! Unload currend data?",
00239 "load new data", MB_YESNO) == IDYES) {
00240 delete data3D;
00241 data3D = NULL;
00242 }
00243 else
00244 return;
00245 }
00246
00247
00248 CString filename = fd.GetFileName();
00249 char *fn = new char[filename.GetLength() + 1];
00250 for (int i = 0; i < filename.GetLength(); i++) {
00251 fn[i] = filename.GetAt(i);
00252 }
00253 fn[i] = '\0';
00254
00255
00256 data3D = new Data();
00257 m_ProcessIniFile();
00258
00259
00260 SetWindowText(m_pMainWnd->m_hWnd, "3D Visualisation - loading visualisation data, please wait,...");
00261
00262
00263 // AfxGetMainWnd()->SendMessage(MYWM_SHOWABORT, (WPARAM) 0, (LPARAM) 0);
00264
00265 data3D->LoadData(fn);
00266 delete[] fn;
00267
00268 // AfxGetMainWnd()->SendMessage(MYWM_HIDEABORT, (WPARAM) 0, (LPARAM) 0);
00269
00270 m_bRenderVolume = false;
00271
00272
00273 if (slice == NULL)
00274 slice = new Slice();
00275
00276 slice->SetPixels(data3D, 0);
00277 int num = slice->GetSliceNumber(data3D);
00278
00279
00280
00281 if (!m_bRenderVolume)
00282 AfxGetMainWnd()->SendMessage(MYWM_SHOW_BAR, (WPARAM) 0, (LPARAM) 0);
00283 else
00284 AfxGetMainWnd()->SendMessage(MYWM_SHOW_BAR, (WPARAM) 1, (LPARAM) 0);
00285
00286
00287 SetWindowText(m_pMainWnd->m_hWnd, CString("3D Visualisation - loaded \"" + filename + "\""));
00288 }
00289 }
|
|
|
Definition at line 438 of file 3dvis.cpp.
00439 {
00440 // TODO: Add your command handler code here
00441 AfxGetMainWnd()->SendMessage(MYWM_CHANGE_RENDERING, (WPARAM) 1, 1);
00442 }
|
|
|
Definition at line 322 of file 3dvis.cpp. References m_BuildTransferFunction(), m_Transferdiag, and transferfuncform::m_vTransferIndices.
00323 {
00324 // TODO: Add your command handler code here
00325 if (data3D == NULL)
00326 return;
00327
00328 int response = m_Transferdiag.DoModal();
00329
00330
00331 if (response == IDOK) {
00332 int num = m_Transferdiag.m_vTransferIndices.size() - 1;
00333
00334 if (num <= 0)
00335 return;
00336
00337 m_BuildTransferFunction(m_Transferdiag.m_vTransferIndices, num);
00338 }
00339
00340
00341 m_pMainWnd->Invalidate();
00342 m_pMainWnd->UpdateWindow();
00343 }
|
|
|
Definition at line 346 of file 3dvis.cpp. References m_BuildTransferFunction().
00346 {
00347 m_BuildTransferFunction(presetTransformFunctions[0],
00348 presetTransformFunctions[0].size() - 1);
00349 }
|
|
|
Definition at line 351 of file 3dvis.cpp. References m_BuildTransferFunction().
00351 {
00352 m_BuildTransferFunction(presetTransformFunctions[1],
00353 presetTransformFunctions[1].size() - 1);
00354 }
|
|
|
Definition at line 356 of file 3dvis.cpp. References m_BuildTransferFunction().
00356 {
00357 m_BuildTransferFunction(presetTransformFunctions[2],
00358 presetTransformFunctions[2].size() - 1);
00359 }
|
|
|
Definition at line 361 of file 3dvis.cpp. References m_BuildTransferFunction().
00361 {
00362 m_BuildTransferFunction(presetTransformFunctions[3],
00363 presetTransformFunctions[3].size() - 1);
00364 }
|
|
|
Definition at line 366 of file 3dvis.cpp. References m_BuildTransferFunction().
00366 {
00367 m_BuildTransferFunction(presetTransformFunctions[4],
00368 presetTransformFunctions[4].size() - 1);
00369 }
|
|
|
Definition at line 371 of file 3dvis.cpp. References m_BuildTransferFunction().
00371 {
00372 m_BuildTransferFunction(presetTransformFunctions[5],
00373 presetTransformFunctions[5].size() - 1);
00374 }
|
|
|
Definition at line 376 of file 3dvis.cpp. References m_BuildTransferFunction().
00376 {
00377 m_BuildTransferFunction(presetTransformFunctions[6],
00378 presetTransformFunctions[6].size() - 1);
00379 }
|
|
|
Definition at line 381 of file 3dvis.cpp. References m_BuildTransferFunction().
00381 {
00382 m_BuildTransferFunction(presetTransformFunctions[7],
00383 presetTransformFunctions[7].size() - 1);
00384 }
|
|
|
Definition at line 386 of file 3dvis.cpp. References m_BuildTransferFunction().
00386 {
00387 m_BuildTransferFunction(presetTransformFunctions[8],
00388 presetTransformFunctions[8].size() - 1);
00389 }
|
|
|
Definition at line 391 of file 3dvis.cpp. References m_BuildTransferFunction().
00391 {
00392 m_BuildTransferFunction(presetTransformFunctions[9],
00393 presetTransformFunctions[9].size() - 1);
00394 }
|
|
|
Definition at line 496 of file 3dvis.cpp.
00497 {
00498 // TODO: Add your command handler code here
00499 if (!data3D || !slice)
00500 return;
00501
00502 if (!((CMy3dvisApp *)AfxGetApp())->transferFunction) {
00503 MessageBox(m_pMainWnd->m_hWnd,
00504 "please select or create a transferfunction",
00505 "transferfunction missing",
00506 MB_OK);
00507 return;
00508 }
00509
00510
00511 if (((CMy3dvisApp *)AfxGetApp())->m_bRenderVolume) {
00512 ((CMy3dvisApp *)AfxGetApp())->m_bRenderVolume = false;
00513
00514 AfxGetMainWnd()->SendMessage(MYWM_CHANGE_RENDERING, (WPARAM) 0, (LPARAM) 0);
00515 }
00516 else {
00517 ((CMy3dvisApp *)AfxGetApp())->m_bRenderVolume = true;
00518
00519 AfxGetMainWnd()->SendMessage(MYWM_CHANGE_RENDERING, (WPARAM) 1, (LPARAM) 0);
00520
00521 raycaster = new Raycaster();
00522 raycaster->SetViewingCondition(VECTOR(300,300,300),Color(0.0f,1.0f,0.0f),0.2f,0.2f,0.2f,8);
00523
00524 raycaster->Initialize(VECTOR(92,-20,85),400,400,1.0f,data3D,((CMy3dvisApp *)AfxGetApp())->transferFunction);
00525 raycaster->Zoom(1.1f); // werte > 1.0 hinein zoomen <1.0 wegzoomen
00526 raycaster->SetLight(false);
00527 raycaster->SetTreshold(1500);
00528 raycaster->SetRaytype(NN);
00529 raycaster->SetRendermode(FH);
00530 raycaster->SetPreCalcGradients(true);
00531 }
00532 }
|
|
|
Definition at line 35 of file 3dvis.h. Referenced by CMy3dvisApp(). |
|
|
Definition at line 34 of file 3dvis.h. Referenced by OnFClose(), and OnFileOpen(). |
|
|
Definition at line 50 of file 3dvis.h. Referenced by CMy3dvisApp(), and OnFileOpen(). |
|
|
Definition at line 37 of file 3dvis.h. Referenced by CMy3dvisApp(), and m_ProcessIniFile(). |
|
|
|
|
|
Definition at line 32 of file 3dvis.h. Referenced by CMy3dvisApp(). |
|
|
Definition at line 38 of file 3dvis.h. Referenced by CMy3dvisApp(), and m_ProcessIniFile(). |
|
|
Definition at line 40 of file 3dvis.h. Referenced by OnOptionsTransfer(). |
|
|
Definition at line 42 of file 3dvis.h. Referenced by InitInstance(). |
|
|
Definition at line 54 of file 3dvis.h. Referenced by CMy3dvisApp(), and m_ProcessIniFile(). |
|
|
Definition at line 52 of file 3dvis.h. Referenced by CMy3dvisApp(), ExitInstance(), and m_BuildTransferFunction(). |
1.3-rc2