Created
September 20, 2019 07:51
-
-
Save pammacdotnet/b0262adbb7d90732aaa5dcc45df116b6 to your computer and use it in GitHub Desktop.
Revisions
-
pammacdotnet created this gist
Sep 20, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ #include <cstdlib> #include <string> #include <iostream> #include <exception> #include "SimpleGVXR.h" int main(){ // Create an OpenGL context createWindow(); setWindowSize(512, 512); // Set the position of the X-ray source setSourcePosition(-40.0,0,0, "cm"); // Set the shape of the X-ray source usePointSource(); // The spectrum of the X-ray beam setMonoChromatic(0.08, "MeV", 1000); // Set the position of the detector setDetectorPosition(10.0,0, 0,"cm"); // Set the orientation of the detector setDetectorUpVector(0, 0, -1); // Set the number of pixels of the detector setDetectorNumberOfPixels(640, 320); // Set the distance between two pixels setDetectorPixelSize(0.5, 0.5, "mm"); // Load a polygon mesh from a STL file loadSceneGraph("dragon.stl", "mm"); // Set the material properties for (unsigned int i = 0; i < getNumberOfChildren("root"); ++i) { std::string label = getChildLabel("root", i); moveToCentre(label); setHU(label, 1000); } // Compute an X-ray image computeXRayImage(); // Save the image into a image file saveLastXRayImage("welsh-dragon-xray_cpp.tif"); return EXIT_SUCCESS; }