#Documentation # @brief Load one or more data sets (many image, surface # and other formats) and display it in a 2D view
| 23 | //## @brief Load one or more data sets (many image, surface |
| 24 | //## and other formats) and display it in a 2D view |
| 25 | int main(int argc, char *argv[]) |
| 26 | { |
| 27 | QApplication qtapplication(argc, argv); |
| 28 | |
| 29 | if (argc < 2) |
| 30 | { |
| 31 | fprintf( |
| 32 | stderr, "Usage: %s [filename1] [filename2] ...\n\n", itksys::SystemTools::GetFilenameName(argv[0]).c_str()); |
| 33 | return 1; |
| 34 | } |
| 35 | |
| 36 | // Register Qmitk-dependent global instances |
| 37 | QmitkRegisterClasses(); |
| 38 | |
| 39 | //************************************************************************* |
| 40 | // Part I: Basic initialization |
| 41 | //************************************************************************* |
| 42 | |
| 43 | // Create a data storage object. We will use it as a singleton |
| 44 | mitk::StandaloneDataStorage::Pointer storage = mitk::StandaloneDataStorage::New(); |
| 45 | |
| 46 | //************************************************************************* |
| 47 | // Part II: Create some data by reading files |
| 48 | //************************************************************************* |
| 49 | int i; |
| 50 | for (i = 1; i < argc; ++i) |
| 51 | { |
| 52 | // For testing |
| 53 | if (strcmp(argv[i], "-testing") == 0) |
| 54 | continue; |
| 55 | |
| 56 | //********************************************************************* |
| 57 | // Part III: Put the data into the datastorage |
| 58 | //********************************************************************* |
| 59 | // Add the node to the DataStorage |
| 60 | mitk::IOUtil::Load(argv[i], *storage); |
| 61 | } |
| 62 | |
| 63 | //************************************************************************* |
| 64 | // Part IV: Create window and pass the datastorage to it |
| 65 | //************************************************************************* |
| 66 | |
| 67 | // Create a RenderWindow |
| 68 | QmitkRenderWindow renderWindow; |
| 69 | |
| 70 | // Tell the RenderWindow which (part of) the datastorage to render |
| 71 | renderWindow.GetRenderer()->SetDataStorage(storage); |
| 72 | |
| 73 | // Initialize the RenderWindow |
| 74 | auto geo = storage->ComputeBoundingGeometry3D(storage->GetAll()); |
| 75 | mitk::RenderingManager::GetInstance()->InitializeViews(geo); |
| 76 | |
| 77 | // Select a slice |
| 78 | mitk::SliceNavigationController::Pointer sliceNaviController = renderWindow.GetSliceNavigationController(); |
| 79 | if (sliceNaviController) |
| 80 | sliceNaviController->GetStepper()->SetPos(2); |
| 81 | |
| 82 | //************************************************************************* |
nothing calls this directly
no test coverage detected