MCPcopy Create free account
hub / github.com/MITK/MITK / main

Function main

Examples/Tutorial/Step3/Step3.cpp:38–150  ·  view source on GitHub ↗

#Documentation # @brief Change the type of display to 3D # # As in Step2, load one or more data sets (many image, surface # and other formats), but display it in a 3D view. # The QmitkRenderWindow is now used for displaying a 3D view, by # setting the used mapper-slot to Standard3D. # Since volume-rendering is a (rather) slow procedure, the default # is that images are not displayed in the 3D view

Source from the content-addressed store, hash-verified

36//## we want volume-rendering, thus we switch it on by setting
37//## the Boolean-property "volumerendering" to "true".
38int main(int argc, char *argv[])
39{
40 QApplication qtapplication(argc, argv);
41 if (argc < 2)
42 {
43 fprintf(
44 stderr, "Usage: %s [filename1] [filename2] ...\n\n", itksys::SystemTools::GetFilenameName(argv[0]).c_str());
45 return 1;
46 }
47
48 // Register Qmitk-dependent global instances
49 QmitkRegisterClasses();
50
51 //*************************************************************************
52 // Part I: Basic initialization
53 //*************************************************************************
54
55 // Create a DataStorage
56 mitk::StandaloneDataStorage::Pointer ds = mitk::StandaloneDataStorage::New();
57
58 //*************************************************************************
59 // Part II: Create some data by reading files
60 //*************************************************************************
61 int i;
62 for (i = 1; i < argc; ++i)
63 {
64 // For testing
65 if (strcmp(argv[i], "-testing") == 0)
66 continue;
67
68 //*********************************************************************
69 // Part III: Put the data into the datastorage
70 //*********************************************************************
71 // Load datanode (eg. many image formats, surface formats, etc.)
72 mitk::StandaloneDataStorage::SetOfObjects::Pointer dataNodes = mitk::IOUtil::Load(argv[i], *ds);
73
74 if (dataNodes->empty())
75 {
76 fprintf(stderr, "Could not open file %s \n\n", argv[i]);
77 exit(2);
78 }
79 mitk::DataNode::Pointer node = dataNodes->at(0);
80
81 // *********************************************************
82 // ********************* START OF NEW PART 1 (Step 3a) *****
83 // *********************************************************
84
85 //*********************************************************************
86 // Part IV: We want all images to be volume-rendered
87 //*********************************************************************
88
89 // Check if the data is an image by dynamic_cast-ing the data
90 // contained in the node. Warning: dynamic_cast's are rather slow,
91 // do not use it too often!
92 mitk::Image::Pointer image = dynamic_cast<mitk::Image *>(node->GetData());
93 if (image.IsNotNull())
94 {
95 // Set the property "volumerendering" to the Boolean value "true"

Callers

nothing calls this directly

Calls 15

QmitkRegisterClassesFunction · 0.85
LoadFunction · 0.85
atMethod · 0.80
IsNotNullMethod · 0.80
InitializeByMitkImageMethod · 0.80
AddRGBPointMethod · 0.80
GetPointerMethod · 0.80
showMethod · 0.80
NewFunction · 0.50
emptyMethod · 0.45
GetDataMethod · 0.45
SetPropertyMethod · 0.45

Tested by

no test coverage detected