SimpleGVXR 1.0.1
Welcome to SimpleGVXR, a simplified layer built on top of gVirtualXRay -- the open-source cross-platform library for the simulation of X-ray images from polygon meshes on the GPU. SimpleGVXR: i) is a C++ library, ii) provides a simplified, easy-to-use, and procedural interface to gVirtualXRay without templates, and iii) provides binders for other programming languages (Python 2 and 3, Ruby, R, TCL, Java, GNU Octave, Perl, and C#, and soon Matlab).
SimpleGVXR.h
Go to the documentation of this file.
1/*
2
3Copyright (c) 2019, Dr Franck P. Vidal (franck.p.vidal@fpvidal.net),
4http://www.fpvidal.net/
5All rights reserved.
6
7Redistribution and use in source and binary forms, with or without modification,
8are permitted provided that the following conditions are met:
9
101. Redistributions of source code must retain the above copyright notice,
11this list of conditions and the following disclaimer.
12
132. Redistributions in binary form must reproduce the above copyright notice,
14this list of conditions and the following disclaimer in the documentation and/or
15other materials provided with the distribution.
16
173. Neither the name of the Bangor University nor the names of its contributors
18may be used to endorse or promote products derived from this software without
19specific prior written permission.
20
21THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32*/
33
34
35#ifndef __SimpleGVXR_h
36#define __SimpleGVXR_h
37
38
68//******************************************************************************
69// Include
70//******************************************************************************
71#include <vector>
72#include <string>
73
74
75//------------------------------------------------------------------------------
78
81//------------------------------------------------------------------------------
83
84
85//------------------------------------------------------------------------------
89
92//------------------------------------------------------------------------------
94
95
96//------------------------------------------------------------------------------
100
103//------------------------------------------------------------------------------
105
106
107//------------------------------------------------------------------------------
109
112//------------------------------------------------------------------------------
114
115
116//------------------------------------------------------------------------------
119
122//------------------------------------------------------------------------------
124
125
126//------------------------------------------------------------------------------
129
132//------------------------------------------------------------------------------
134
135
136//------------------------------------------------------------------------------
139
142//------------------------------------------------------------------------------
144
145
146//------------------------------------------------------------------------------
148
151//------------------------------------------------------------------------------
153
154
155//------------------------------------------------------------------------------
157
160//------------------------------------------------------------------------------
161std::string getOpenGlRenderer();
162
163
164//------------------------------------------------------------------------------
166
169//------------------------------------------------------------------------------
170std::string getOpenGlVersion();
171
172
173//------------------------------------------------------------------------------
175
178//------------------------------------------------------------------------------
179std::string getOpenGlVenror();
180
181
182void useLogFile(const char* aFileName = "gvxr.log");
183
184void displayBeam(bool aState = true);
185void displayDetector(bool aState = true);
186void displayNormalVectors(bool aState = true);
187void useWireframe(bool aState = true);
188void useLighing(bool aState = true);
189void useNegative(bool aState = true);
190
191
192//------------------------------------------------------------------------------
195
208//------------------------------------------------------------------------------
209void orthographic(double left,
210 double right,
211 double bottom,
212 double top,
213 double zNear,
214 double zFar);
215
216
217//------------------------------------------------------------------------------
220
231//------------------------------------------------------------------------------
232void perspective(double fovy, double aspect, double zNear, double zFar);
233
234
235//------------------------------------------------------------------------------
238
255//------------------------------------------------------------------------------
256void lookAt(double eyeX,
257 double eyeY,
258 double eyeZ,
259 double lookAtX,
260 double lookAtY,
261 double lookAtZ,
262 double upX,
263 double upY,
264 double upZ);
265
266
267//------------------------------------------------------------------------------
271//------------------------------------------------------------------------------
273
274
275//------------------------------------------------------------------------------
279//------------------------------------------------------------------------------
281
282
283//------------------------------------------------------------------------------
287
293//------------------------------------------------------------------------------
294void rotateModelView(double anAngle, double x, double y, double z);
295
296
297//------------------------------------------------------------------------------
299
303//------------------------------------------------------------------------------
304void autoCreateOpenGLContext(bool aFlag = true);
305
306
307//------------------------------------------------------------------------------
309
324//------------------------------------------------------------------------------
325void setSourcePosition(double x,
326 double y,
327 double z,
328 const std::string& aUnitOfLength);
329
330
331//------------------------------------------------------------------------------
333
346//------------------------------------------------------------------------------
347std::vector<double> getSourcePosition(const std::string& aUnitOfLength);
348
349
350//------------------------------------------------------------------------------
352
367//------------------------------------------------------------------------------
369 double y,
370 double z,
371 const std::string& aUnitOfLength);
372
373
374//------------------------------------------------------------------------------
376
389//------------------------------------------------------------------------------
390std::vector<double> getDetectorPosition(const std::string& aUnitOfLength);
391
392
393//------------------------------------------------------------------------------
395
400//------------------------------------------------------------------------------
401void setDetectorUpVector(double x, double y, double z);
402
403
404//------------------------------------------------------------------------------
406
409//------------------------------------------------------------------------------
410std::vector<double> getDetectorUpVector();
411
412
413//------------------------------------------------------------------------------
415
418//------------------------------------------------------------------------------
419std::vector<double> getDetectorRightVector();
420
421
422//------------------------------------------------------------------------------
424
428//------------------------------------------------------------------------------
429void setDetectorNumberOfPixels(int aWidth, int aHeight);
430
431
432//------------------------------------------------------------------------------
434
437//------------------------------------------------------------------------------
438std::vector<int> getDetectorNumberOfPixels();
439
440
441//--------------------------------------------------------------------------
443
446//--------------------------------------------------------------------------
447void setOversamplingFactor(int aFactor = 1);
448
449
450//--------------------------------------------------------------------------
452
455//--------------------------------------------------------------------------
457
458
459//------------------------------------------------------------------------------
461
475//------------------------------------------------------------------------------
476void setDetectorPixelSize(double aWidth,
477 double aHeight,
478 const std::string& aUnitOfLength);
479
480
481//------------------------------------------------------------------------------
483
496//------------------------------------------------------------------------------
497std::vector<double> getDetectorSize(const std::string& aUnitOfLength);
498
499
500//------------------------------------------------------------------------------
502//------------------------------------------------------------------------------
504
505
506//------------------------------------------------------------------------------
508
513//------------------------------------------------------------------------------
514void loadDetectorEnergyResponse(const std::string& aFileName,
515 const std::string& aUnitOfEnergy);
516
517
518//------------------------------------------------------------------------------
521
536//------------------------------------------------------------------------------
537void loadMeshFile(const std::string& aLabel,
538 const std::string& aFileName,
539 const std::string& aUnitOfLength,
540 bool addToRendererAsInnerSurface = true);
541
542
543//------------------------------------------------------------------------------
546
559//------------------------------------------------------------------------------
560void loadSceneGraph(const std::string& aFileName,
561 const std::string& aUnitOfLength);
562
563
564//------------------------------------------------------------------------------
566
570//------------------------------------------------------------------------------
571unsigned int getNumberOfPrimitives(const std::string& aLabel);
572
573
574//------------------------------------------------------------------------------
577
581//------------------------------------------------------------------------------
582void emptyMesh(const std::string& aLabel,
583 const std::string& aParent = "root");
584
585
586//------------------------------------------------------------------------------
589
605//------------------------------------------------------------------------------
606void makeCube(const std::string& aLabel,
607 double aLength = 1.0,
608 const std::string& aUnitOfLength = "cm",
609 const std::string& aParent = "root");
610
611
612//------------------------------------------------------------------------------
615
633//------------------------------------------------------------------------------
634void makeCylinder(const std::string& aLabel,
635 unsigned int aNumberOfSectors = 10,
636 double aHeight = 1.0,
637 double aRadius = 0.5,
638 const std::string& aUnitOfLength = "cm",
639 const std::string& aParent = "root");
640
641
642//------------------------------------------------------------------------------
645
668//------------------------------------------------------------------------------
669void makeIsoSurface(const std::string& aLabel,
670 short anIsoValue,
671 const std::vector<short>& aVoxelDataSet,
672 unsigned int aWidth,
673 unsigned int aHeight,
674 unsigned int aDepth,
675 double aSpacingX,
676 double aSpacingY,
677 double aSpacingZ,
678 const std::string& aUnitOfLength = "cm",
679 const std::string& aParent = "root");
680
681
682void makeTriangularMesh(const std::string& aLabel,
683 const std::vector<float>& aVertexSet,
684 const std::string& aUnitOfLength = "cm",
685 const std::string& aParent = "root");
686
687
688void makeTriangularMesh(const std::string& aLabel,
689 const std::vector<float>& aVertexSet,
690 const std::vector<int>& aTriangleIndexSet,
691 const std::string& aUnitOfLength = "cm",
692 const std::string& aParent = "root");
693
694
695//------------------------------------------------------------------------------
699
704//------------------------------------------------------------------------------
705void addMesh(const std::string& aDestination, const std::string& aSource);
706
707
708//------------------------------------------------------------------------------
712
717//------------------------------------------------------------------------------
718void subtractMesh(const std::string& aDestination, const std::string& aSource);
719
720
721//------------------------------------------------------------------------------
723
727//------------------------------------------------------------------------------
728unsigned int getNumberOfChildren(const std::string& aLabel);
729
730
731//------------------------------------------------------------------------------
734
739//------------------------------------------------------------------------------
740std::string getChildLabel(const std::string& aLabel, unsigned int i);
741
742
743//------------------------------------------------------------------------------
746
750//------------------------------------------------------------------------------
751std::vector<double> getLocalTransformationMatrix(const std::string& aLabel);
752
753
754//------------------------------------------------------------------------------
756
760//------------------------------------------------------------------------------
761void setLocalTransformationMatrix(const std::string& aLabel,
762 const std::vector<double>& aMatrix);
763
764
765//------------------------------------------------------------------------------
768
771//------------------------------------------------------------------------------
772void applyCurrentLocalTransformation(const std::string& aLabel);
773
774
775//------------------------------------------------------------------------------
778
793//------------------------------------------------------------------------------
794std::vector<double> getNodeAndChildrenBoundingBox(const std::string& aLabel,
795 const std::string& aUnitOfLength = "cm");
796
797
798//------------------------------------------------------------------------------
801
816//------------------------------------------------------------------------------
817std::vector<double> getNodeOnlyBoundingBox(const std::string& aLabel,
818 const std::string& aUnitOfLength = "cm");
819
820
821//------------------------------------------------------------------------------
823
826//------------------------------------------------------------------------------
827void displayNode(const std::string& aLabel);
828
829
830//------------------------------------------------------------------------------
832
835//------------------------------------------------------------------------------
836void invertNormalVectors(const std::string& aLabel);
837
838
839//------------------------------------------------------------------------------
841
848//------------------------------------------------------------------------------
849void setColor(const std::string& aLabel, float R, float G, float B, float A);
850
851
852//------------------------------------------------------------------------------
854
861//------------------------------------------------------------------------------
862void setColour(const std::string& aLabel, float R, float G, float B, float A);
863
864
865//------------------------------------------------------------------------------
867
870//------------------------------------------------------------------------------
871std::vector<float> getAmbientColour(const std::string& aLabel);
872
873
874//------------------------------------------------------------------------------
876
879//------------------------------------------------------------------------------
880std::vector<float> getDiffuseColour(const std::string& aLabel);
881
882
883//------------------------------------------------------------------------------
885
888//------------------------------------------------------------------------------
889std::vector<float> getSpecularColour(const std::string& aLabel);
890
891
892//------------------------------------------------------------------------------
894
897//------------------------------------------------------------------------------
898float getShininess(const std::string& aLabel);
899
900
901//------------------------------------------------------------------------------
904
907//------------------------------------------------------------------------------
908void addPolygonMeshAsInnerSurface(const std::string& aLabel);
909
910
911//------------------------------------------------------------------------------
914
917//------------------------------------------------------------------------------
918void addPolygonMeshAsOuterSurface(const std::string& aLabel);
919
920
921//------------------------------------------------------------------------------
924//------------------------------------------------------------------------------
926
927
928//------------------------------------------------------------------------------
931//------------------------------------------------------------------------------
933
934
935//------------------------------------------------------------------------------
937//------------------------------------------------------------------------------
939
940
941//------------------------------------------------------------------------------
943//------------------------------------------------------------------------------
945
946
947//------------------------------------------------------------------------------
949
952//------------------------------------------------------------------------------
953void moveToCenter(const std::string& aLabel);
954
955
956//------------------------------------------------------------------------------
958
961//------------------------------------------------------------------------------
962void moveToCentre(const std::string& aLabel);
963
964
965//------------------------------------------------------------------------------
967
973//------------------------------------------------------------------------------
974void scaleNode(const std::string& aLabel,
975 double x,
976 double y,
977 double z);
978
979
980//------------------------------------------------------------------------------
982
989//------------------------------------------------------------------------------
990void rotateNode(const std::string& aLabel,
991 double anAngle,
992 double x,
993 double y,
994 double z);
995
996
997//------------------------------------------------------------------------------
999
1015//------------------------------------------------------------------------------
1016void translateNode(const std::string& aLabel,
1017 double x,
1018 double y,
1019 double z,
1020 const std::string& aUnitOfLength);
1021
1022
1023//------------------------------------------------------------------------------
1025
1034//------------------------------------------------------------------------------
1035void shearNode(const std::string& aLabel,
1036 double yx,
1037 double zx,
1038 double xy,
1039 double zy,
1040 double xz,
1041 double yz);
1042
1043
1044//------------------------------------------------------------------------------
1047//------------------------------------------------------------------------------
1049
1050
1051//------------------------------------------------------------------------------
1054
1059//------------------------------------------------------------------------------
1060void scaleScene(double x, double y, double z);
1061
1062
1063//------------------------------------------------------------------------------
1066
1081//------------------------------------------------------------------------------
1082void scaleScene(double x, double y, double z, const std::string& aUnitOfLength);
1083
1084
1085//------------------------------------------------------------------------------
1088
1094//------------------------------------------------------------------------------
1095void rotateScene(double anAngle, double x, double y, double z);
1096
1097
1098//------------------------------------------------------------------------------
1101
1116//------------------------------------------------------------------------------
1117void translateScene(double x,
1118 double y,
1119 double z,
1120 const std::string& aUnitOfLength);
1121
1122
1123//------------------------------------------------------------------------------
1125
1128//------------------------------------------------------------------------------
1129std::vector<std::vector<float> > getSceneTransformationMatrix();
1130
1131
1132//------------------------------------------------------------------------------
1134
1137//------------------------------------------------------------------------------
1138std::vector<std::vector<float> > getRootTransformationMatrix();
1139
1140
1141//------------------------------------------------------------------------------
1143
1147//------------------------------------------------------------------------------
1148std::vector<std::vector<float> > getNodeLocalTransformationMatrix(
1149 const std::string& aLabel);
1150
1151
1152//------------------------------------------------------------------------------
1154
1158//------------------------------------------------------------------------------
1159std::vector<std::vector<float> > getNodeWorldTransformationMatrix(
1160 const std::string& aLabel);
1161
1162
1163//------------------------------------------------------------------------------
1165
1168//------------------------------------------------------------------------------
1170 const std::vector<std::vector<float> >& aMatrix);
1171
1172
1173//------------------------------------------------------------------------------
1175
1178//------------------------------------------------------------------------------
1180 const std::vector<std::vector<float> >& aMatrix);
1181
1182
1183//------------------------------------------------------------------------------
1185
1189//------------------------------------------------------------------------------
1191 const std::string& aLabel,
1192 const std::vector<std::vector<float> >& aMatrix);
1193
1194
1195//------------------------------------------------------------------------------
1198
1202//------------------------------------------------------------------------------
1203void setHU(const std::string& aLabel, short HU);
1204
1205
1206//------------------------------------------------------------------------------
1209
1213//------------------------------------------------------------------------------
1214void setHounsfieldUnit(const std::string& aLabel, short HU);
1215
1216
1217//------------------------------------------------------------------------------
1220
1224//------------------------------------------------------------------------------
1225void setHounsfieldValue(const std::string& aLabel, short HU);
1226
1227
1228//------------------------------------------------------------------------------
1231
1235//------------------------------------------------------------------------------
1236void setElement(const std::string& aLabel, unsigned short Z);
1237
1238
1239//------------------------------------------------------------------------------
1242
1246//------------------------------------------------------------------------------
1247void setElement(const std::string& aLabel, const std::string& aName);
1248
1249
1250//------------------------------------------------------------------------------
1253
1259//------------------------------------------------------------------------------
1260void setMixture(const std::string& aLabel, const std::string& aMixture);
1261
1262
1263//------------------------------------------------------------------------------
1266
1271//------------------------------------------------------------------------------
1272void setMixture(const std::string& aLabel,
1273 const std::vector<int>& aZNumberSet,
1274 const std::vector<double>& aWeightSet);
1275
1276
1277//------------------------------------------------------------------------------
1280
1286//------------------------------------------------------------------------------
1287void setCompound(const std::string& aLabel, const std::string& aCompound);
1288
1289
1290//------------------------------------------------------------------------------
1294
1301//------------------------------------------------------------------------------
1302void setMassAttenuationCoefficient(const std::string& aLabel,
1303 double aCoefficient,
1304 const std::string& aUnit);
1305
1306
1307//------------------------------------------------------------------------------
1310
1317//------------------------------------------------------------------------------
1318void setLinearAttenuationCoefficient(const std::string& aLabel,
1319 double aCoefficient,
1320 const std::string& aUnit);
1321
1322
1323//------------------------------------------------------------------------------
1326
1333//------------------------------------------------------------------------------
1334void setMu(const std::string& aLabel,
1335 double aCoefficient,
1336 const std::string& aUnit);
1337
1338
1339//------------------------------------------------------------------------------
1341
1348//------------------------------------------------------------------------------
1349void setDensity(const std::string& aLabel,
1350 double aDensity,
1351 const std::string& aUnit);
1352
1353
1354//------------------------------------------------------------------------------
1357
1361//------------------------------------------------------------------------------
1362double getDensity(const std::string& aLabel);
1363
1364
1365//------------------------------------------------------------------------------
1368
1379//------------------------------------------------------------------------------
1380double getMassAttenuationCoefficient(const std::string& aLabel,
1381 double anEnergy,
1382 const std::string& aUnitOfEnergy);
1383
1384
1385//------------------------------------------------------------------------------
1388
1399//------------------------------------------------------------------------------
1400double getLinearAttenuationCoefficient(const std::string& aLabel,
1401 double anEnergy,
1402 const std::string& aUnitOfEnergy);
1403
1404
1405//------------------------------------------------------------------------------
1407
1411//------------------------------------------------------------------------------
1412std::string getMaterialLabel(const std::string& aLabel);
1413
1414
1415//------------------------------------------------------------------------------
1417
1426//------------------------------------------------------------------------------
1427void createOpenGLContext(int aWindowID = -1,
1428 int aRendererMajorVersion = 3,
1429 int aRendererMinorVersion = 2);
1430
1431
1432//------------------------------------------------------------------------------
1434
1447//------------------------------------------------------------------------------
1448void createWindow(int aWindowID = -1,
1449 int aVisibilityFlag = 0,
1450 const std::string& aRenderer = "OPENGL",
1451 int aRendererMajorVersion = 3,
1452 int aRendererMinorVersion = 2);
1453
1454
1455//------------------------------------------------------------------------------
1457
1464//------------------------------------------------------------------------------
1465void setWindowSize(int aWidth, int aHeight, int aWindowID = -1);
1466
1467
1468//------------------------------------------------------------------------------
1471
1479//------------------------------------------------------------------------------
1480void displayScene(bool aSceneRotationFlag = true, int aWindowID = -1);
1481
1482
1483//------------------------------------------------------------------------------
1494
1499//------------------------------------------------------------------------------
1500void renderLoop(int aWindowID = -1);
1501
1502
1503//------------------------------------------------------------------------------
1506
1510//------------------------------------------------------------------------------
1511void startArcBallRotation(double x, double y);
1512
1513
1514//------------------------------------------------------------------------------
1517//------------------------------------------------------------------------------
1519
1520
1521//------------------------------------------------------------------------------
1523
1526//------------------------------------------------------------------------------
1528
1529
1530//------------------------------------------------------------------------------
1532
1538//------------------------------------------------------------------------------
1540 double y,
1541 int aViewportWidth,
1542 int aViewportHeight);
1543
1544
1545//------------------------------------------------------------------------------
1547
1552//------------------------------------------------------------------------------
1553void scrollCallback(double xoffset, double yoffset);
1554
1555
1556void setZoom(float aZoomValue);
1557
1558
1559float getZoom();
1560
1561
1562void setSceneRotationMatrix(const std::vector<double>& aRotationMatrix);
1563
1564
1565std::vector<double> getSceneRotationMatrix();
1566
1567
1568//------------------------------------------------------------------------------
1570
1575//------------------------------------------------------------------------------
1576void showWindow(int aWindowID = -1);
1577
1578
1579//------------------------------------------------------------------------------
1581
1586//------------------------------------------------------------------------------
1587void hideWindow(int aWindowID = -1);
1588
1589
1590//------------------------------------------------------------------------------
1592
1600//------------------------------------------------------------------------------
1601void setWindowBackGroundColour(float R, float G, float B, int aWindowID = -1);
1602
1603
1604//------------------------------------------------------------------------------
1606
1614//------------------------------------------------------------------------------
1615void setWindowBackGroundColor(float R, float G, float B, int aWindowID = -1);
1616
1617
1618//------------------------------------------------------------------------------
1620
1626//------------------------------------------------------------------------------
1627const std::vector<std::vector<std::vector< float> > >& takeScreenshot(int aWindowID = -1);
1628
1629
1630//------------------------------------------------------------------------------
1632
1635//------------------------------------------------------------------------------
1636const std::vector<std::vector<std::vector< float> > >& getLatestScreenshot();
1637
1638
1639//------------------------------------------------------------------------------
1641//------------------------------------------------------------------------------
1642void destroyWindow(int aWindowID = -1);
1643
1644
1645//------------------------------------------------------------------------------
1647//------------------------------------------------------------------------------
1649
1650
1651//------------------------------------------------------------------------------
1653//------------------------------------------------------------------------------
1655
1656
1657//------------------------------------------------------------------------------
1660//------------------------------------------------------------------------------
1662
1663
1664//------------------------------------------------------------------------------
1667//------------------------------------------------------------------------------
1669
1670
1671//------------------------------------------------------------------------------
1673
1688//------------------------------------------------------------------------------
1689//void setFocalSpot(x, y, z, aUnitOfLength);
1690
1691
1692//------------------------------------------------------------------------------
1694//------------------------------------------------------------------------------
1696
1697
1698//------------------------------------------------------------------------------
1700
1709//------------------------------------------------------------------------------
1710void setMonoChromatic(double anEnergy,
1711 const std::string& aUnitOfEnergy,
1712 double aNumberOfPhotons);
1713
1714
1715//------------------------------------------------------------------------------
1717
1726//------------------------------------------------------------------------------
1727void addEnergyBinToSpectrum(double anEnergy,
1728 const std::string& aUnitOfEnergy,
1729 double aNumberOfPhotons);
1730
1731
1732//------------------------------------------------------------------------------
1734
1744//------------------------------------------------------------------------------
1745void loadSpectrumFromTSV(const std::string& aFileName,
1746 const std::string& aUnitOfEnergy,
1747 bool aNormalisationFlag);
1748
1749
1750//------------------------------------------------------------------------------
1752
1760//------------------------------------------------------------------------------
1761std::vector<double> getEnergyBins(const std::string& aUnitOfEnergy);
1762
1763
1764//------------------------------------------------------------------------------
1766
1769//------------------------------------------------------------------------------
1770std::vector<double> getPhotonCountEnergyBins();
1771
1772
1773//--------------------------------------------------------------------------
1775
1778//--------------------------------------------------------------------------
1780
1781
1782//------------------------------------------------------------------------------
1784
1791//------------------------------------------------------------------------------
1792void saveSTLfile(const std::string& aLabel,
1793 const std::string& aFileName = std::string());
1794
1795
1796//------------------------------------------------------------------------------
1798
1805//------------------------------------------------------------------------------
1806void saveLastXRayImage(const std::string& aFileName = std::string(),
1807 bool useCompression = true);
1808
1809
1810//------------------------------------------------------------------------------
1812
1819//------------------------------------------------------------------------------
1820void saveLastLBuffer(const std::string& aFileName = std::string(),
1821 bool useCompression = true);
1822
1823
1824//------------------------------------------------------------------------------
1826
1833//------------------------------------------------------------------------------
1834void saveLastCumulatedLBuffer(const std::string& aFileName = std::string(),
1835 bool useCompression = true);
1836
1837
1838 //------------------------------------------------------------------------------
1840
1847 //------------------------------------------------------------------------------
1848 void saveLastSinogram(const std::string& aFileName = std::string(),
1849 bool useCompression = true);
1850
1851
1852//------------------------------------------------------------------------------
1854
1861//------------------------------------------------------------------------------
1862void saveLastProjectionSet(const std::string& aFileName = std::string(),
1863 bool useCompression = true);
1864
1865
1866//------------------------------------------------------------------------------
1868//------------------------------------------------------------------------------
1870
1871
1872//------------------------------------------------------------------------------
1874//------------------------------------------------------------------------------
1876
1877
1878//------------------------------------------------------------------------------
1881//------------------------------------------------------------------------------
1883
1884
1885//------------------------------------------------------------------------------
1888//------------------------------------------------------------------------------
1890
1891
1892//------------------------------------------------------------------------------
1894//------------------------------------------------------------------------------
1896
1897
1898//------------------------------------------------------------------------------
1900//------------------------------------------------------------------------------
1902
1903
1904//------------------------------------------------------------------------------
1906
1914//------------------------------------------------------------------------------
1915double getUnitOfEnergy(const std::string& aUnitOfEnergy);
1916
1917
1918//------------------------------------------------------------------------------
1920
1932//------------------------------------------------------------------------------
1933double getUnitOfLength(const std::string& aUnitOfLength);
1934
1935
1936//------------------------------------------------------------------------------
1947
1953//------------------------------------------------------------------------------
1954std::vector<std::vector<float> > computeXRayImage(bool anIntegrateEnergyFlag = true);
1955
1956
1957//------------------------------------------------------------------------------
1966
1970//------------------------------------------------------------------------------
1971std::vector<std::vector<float> > computeLBuffer(const std::string& aLabel);
1972
1973
1974//------------------------------------------------------------------------------
1986
2005//------------------------------------------------------------------------------
2006std::vector<std::vector<std::vector<float> > > computeSinogram(
2007 double x,
2008 double y,
2009 double z,
2010 const std::string& aUnitOfLength,
2011 unsigned int aNumberOfAngle,
2012 double anAngleOffset);
2013
2014
2015//------------------------------------------------------------------------------
2027
2046//------------------------------------------------------------------------------
2047std::vector<std::vector<std::vector<float> > > computeProjectionSet(
2048 double x,
2049 double y,
2050 double z,
2051 const std::string& aUnitOfLength,
2052 unsigned int aNumberOfAngle,
2053 double anAngleOffset);
2054
2055
2056//------------------------------------------------------------------------------
2058
2061//------------------------------------------------------------------------------
2062std::vector<std::vector<float> > getLastXRayImage();
2063
2064
2065//------------------------------------------------------------------------------
2067
2070//------------------------------------------------------------------------------
2071std::vector<std::vector<float> > getLastLBuffer();
2072
2073
2074//------------------------------------------------------------------------------
2076
2079//------------------------------------------------------------------------------
2080std::vector<std::vector<std::vector<float> > > getLastSinogram();
2081
2082
2083//------------------------------------------------------------------------------
2085
2088//------------------------------------------------------------------------------
2089std::vector<std::vector<std::vector<float> > > getLastProjectionSet();
2090
2091
2092//------------------------------------------------------------------------------
2094
2098//------------------------------------------------------------------------------
2099int getImageWidth(const std::vector<std::vector<float> >& anImage);
2100
2101
2102//------------------------------------------------------------------------------
2104
2108//------------------------------------------------------------------------------
2109int getImageHeght(const std::vector<std::vector<float> >& anImage);
2110
2111
2112//------------------------------------------------------------------------------
2114
2119//------------------------------------------------------------------------------
2120std::vector<float> getImageRow(const std::vector<std::vector<float> >& anImage,
2121 int j);
2122
2123
2124//------------------------------------------------------------------------------
2126
2130//------------------------------------------------------------------------------
2131std::string getElementName(unsigned short Z);
2132
2133
2134//------------------------------------------------------------------------------
2136
2140//------------------------------------------------------------------------------
2141std::string getElementSymbol(unsigned short Z);
2142
2143
2144//------------------------------------------------------------------------------
2146
2150//------------------------------------------------------------------------------
2151unsigned short getElementAtomicNumber(const std::string& anElement);
2152
2153
2154//------------------------------------------------------------------------------
2156
2160//------------------------------------------------------------------------------
2161double getDensityFromElement(const std::string& anElement);
2162
2163
2164//------------------------------------------------------------------------------
2166
2170//------------------------------------------------------------------------------
2171double getDensityFromElement(unsigned short Z);
2172
2173
2174//------------------------------------------------------------------------------
2176
2180//------------------------------------------------------------------------------
2181double getDensityFromHU(double HU);
2182
2183
2184//------------------------------------------------------------------------------
2186
2196//------------------------------------------------------------------------------
2197double getMassAttenuationFromElement(const std::string& anElement,
2198 double anEnergy,
2199 const std::string& aUnitOfEnergy);
2200
2201
2202//------------------------------------------------------------------------------
2204
2214//------------------------------------------------------------------------------
2215double getMassAttenuationFromElement(unsigned short Z,
2216 double anEnergy,
2217 const std::string& aUnitOfEnergy);
2218
2219
2221
2231//------------------------------------------------------------------------------
2233 double anEnergy,
2234 const std::string& aUnitOfEnergy);
2235
2236
2237//------------------------------------------------------------------------------
2239
2251//------------------------------------------------------------------------------
2252double getMassAttenuationFromMixture(const std::string& aMixture,
2253 double anEnergy,
2254 const std::string& aUnitOfEnergy);
2255
2256
2257//------------------------------------------------------------------------------
2259
2271//------------------------------------------------------------------------------
2272double getMassAttenuationFromCompound(const std::string& aCompound,
2273 double anEnergy,
2274 const std::string& aUnitOfEnergy);
2275
2276
2278
2288double getMuFromHU(double HU,
2289 double anEnergy,
2290 const std::string& aUnitOfEnergy);
2291
2292std::vector<std::vector<std::vector< float> > > convertHU2mu(const std::vector<std::vector<std::vector< float> > >& anImage,
2293 double anEnergy,
2294 const std::string& aUnitOfEnergy);
2295
2303std::vector<float> rayIntersect(const std::string& aLabel,
2304 double aRayOriginX, double aRayOriginY, double aRayOriginZ,
2305 double aRayDirectionX, double aRayDirectionY, double aRayDirectionZ);
2306
2307
2308std::vector<std::vector<float> > loadImage2D(const std::string& aFileName);
2309
2310std::vector<std::vector<std::vector<float> > > loadImage3D(const std::string& aFileName);
2311
2312double computeZNCC(const std::vector<std::vector<std::vector<float> > >& aReferenceImage, const std::vector<std::vector<std::vector<float> > >& aTestImage);
2313double computeRMSE(const std::vector<std::vector<std::vector<float> > >& aReferenceImage, const std::vector<std::vector<std::vector<float> > >& aTestImage);
2314
2315double getMean(const std::vector<float>& anImage);
2316double getStddev(const std::vector<float>& anImage);
2317
2318double computeZNCC(const std::vector<float>& aReferenceImage, const std::vector<float>& aTestImage);
2319double computeRMSE(const std::vector<float>& aReferenceImage, const std::vector<float>& aTestImage, bool normalise = false);
2320
2321double computeRMSE(bool normalise = false);
2322double computeZNCC();
2323void loadReference(const std::vector<float>& aReferenceImage);
2324void loadTest(const std::vector<float>& aTestImage);
2325void lineariseTest(float aThreshold, float aScalingFactor);
2326
2327float getMinValue(const std::vector<std::vector<std::vector<float> > >& aImage);
2328float getMaxValue(const std::vector<std::vector<std::vector<float> > >& aImage);
2329
2330//void FBO2Thrust(unsigned int aFBO, void* aThrustVector, int anOffset = 0);
2331
2332
2333#endif
void clearDetectorEnergyResponse()
Clear the energy response of the detector.
void useParallelBeam()
Use a parallel source (e.g. to mimic a source that is extremely far from the scanned object and detec...
void setDensity(const std::string &aLabel, double aDensity, const std::string &aUnit)
Set the density corresponding to the material properties of a polygon mesh.
void popModelViewMatrix()
Restore the matrix from the model/view matrix stack, and remove the last matrix of the stack....
void setNodeTransformationMatrix(const std::string &aLabel, const std::vector< std::vector< float > > &aMatrix)
Set the transformation matrix of a given node.
void saveLastProjectionSet(const std::string &aFileName=std::string(), bool useCompression=true)
Save the last projection set that has been computed.
void createOpenGLContext(int aWindowID=-1, int aRendererMajorVersion=3, int aRendererMinorVersion=2)
Create an OpenGL context (the window won't be shown).
void displayNode(const std::string &aLabel)
Display the scenegraph node using OpenGL.
std::vector< double > getNodeOnlyBoundingBox(const std::string &aLabel, const std::string &aUnitOfLength="cm")
Access the bounding box of a given node (without its children). The bounding box is given in the worl...
std::string getOpenGlVersion()
Accessor on the OpenGL version.
int getMajorVersionOfSimpleGVXR()
Accessor on the major version of SimpleGVXR. This number is changed when incompatible API changes hav...
double getMassAttenuationFromElement(const std::string &anElement, double anEnergy, const std::string &aUnitOfEnergy)
Accessor on the chemical element's mass attenuation.
void addPolygonMeshAsInnerSurface(const std::string &aLabel)
Add a polygon mesh, given its label, to the X-ray renderer as an inner surface.
std::vector< double > getSourcePosition(const std::string &aUnitOfLength)
Accessor on the position of the X-ray source.
void shearNode(const std::string &aLabel, double yx, double zx, double xy, double zy, double xz, double yz)
Use a shear matrix to transform the node.
void setMonoChromatic(double anEnergy, const std::string &aUnitOfEnergy, double aNumberOfPhotons)
Use a monochromatic beam spectrum (i.e. one single energy).
std::string getElementSymbol(unsigned short Z)
Accessor on the chemical element' symbol depending on its Z number.
void loadSpectrumFromTSV(const std::string &aFileName, const std::string &aUnitOfEnergy, bool aNormalisationFlag)
Load the incident beam energy spectrum from a TSV file.
std::vector< std::vector< std::vector< float > > > getLastProjectionSet()
Accessor on the last projection set that has been computed.
std::string getChildLabel(const std::string &aLabel, unsigned int i)
Accessor on the i-th child's label in the list of children of a given node in the scenegraph.
void setRootTransformationMatrix(const std::vector< std::vector< float > > &aMatrix)
Set the transformation matrix of the scengraph's root node.
void setWindowBackGroundColour(float R, float G, float B, int aWindowID=-1)
Set window background colour.
void translateNode(const std::string &aLabel, double x, double y, double z, const std::string &aUnitOfLength)
Translate a polygon mesh.
double getUnitOfEnergy(const std::string &aUnitOfEnergy)
Accessor on the numerical value corresponding to a unit of energy.
void loadMeshFile(const std::string &aLabel, const std::string &aFileName, const std::string &aUnitOfLength, bool addToRendererAsInnerSurface=true)
Load a polygon mesh from a file, set its label in the scenegraph (i.e. identifier) and add it to the ...
int getImageWidth(const std::vector< std::vector< float > > &anImage)
Accessor on the width of a given image.
void saveLastLBuffer(const std::string &aFileName=std::string(), bool useCompression=true)
Save the last L-buffer that has been computed.
std::vector< std::vector< std::vector< float > > > computeProjectionSet(double x, double y, double z, const std::string &aUnitOfLength, unsigned int aNumberOfAngle, double anAngleOffset)
Compute the projection set corresponding to the environment that has previously been set,...
void startArcBallRotation(double x, double y)
Call this function when the user starts an arc-ball rotation (e.g. left-mouse button click in the 3-D...
std::vector< double > getDetectorSize(const std::string &aUnitOfLength)
Accessor on the size of the X-ray detector.
std::vector< float > getAmbientColour(const std::string &aLabel)
Accessor on the ambient colour of the material of a given polygon mesh.
void saveLastXRayImage(const std::string &aFileName=std::string(), bool useCompression=true)
Save the last X-ray image that has been computed.
std::string getOpenGlRenderer()
Accessor on the OpenGL renderer.
std::vector< std::vector< float > > getLastXRayImage()
Accessor on the last X-ray image that has been computed.
void destroyWindow(int aWindowID=-1)
Close and destroy a given window or OpenGL context.
void rotateNode(const std::string &aLabel, double anAngle, double x, double y, double z)
Rotate a polygon mesh.
double getMuFromHU(double HU, double anEnergy, const std::string &aUnitOfEnergy)
Accessor on the HU's linear attenuation coefficient.
double getDensity(const std::string &aLabel)
Accessor on the density corresponding to the material properties of a polygon mesh.
std::vector< double > getDetectorUpVector()
Accessor on the up-vector defining the orientation of the X-ray detector.
void hideWindow(int aWindowID=-1)
Hide a window.
int getImageHeght(const std::vector< std::vector< float > > &anImage)
Accessor on the height of a given image.
void setLinearAttenuationCoefficient(const std::string &aLabel, double aCoefficient, const std::string &aUnit)
Set the linear attenuation coefficient corresponding to the material properties of a polygon mesh.
void rotateModelView(double anAngle, double x, double y, double z)
Restore the matrix from the model/view matrix stack, and remove the last matrix of the stack....
int getPatchVersionOfSimpleGVXR()
Accessor on the minor version of SimpleGVXR. This number is changed when bug fixes have been added in...
void setWindowSize(int aWidth, int aHeight, int aWindowID=-1)
Create an OpenGL context and display it in a window.
void translateScene(double x, double y, double z, const std::string &aUnitOfLength)
Translate the 3-D scene (all the polygon meshes will be affected but not modified).
int getOversamplingFactor()
Accessor on the multiplicative factor to oversample the L-buffers.
double getMassAttenuationFromCompound(const std::string &aCompound, double anEnergy, const std::string &aUnitOfEnergy)
Accessor on the compound's mass attenuation.
std::vector< double > getEnergyBins(const std::string &aUnitOfEnergy)
Accessor on the energy bins of the beam spectrum.
std::vector< double > getPhotonCountEnergyBins()
Accessor on the number of photons per energy bin of the beam spectrum.
std::string getElementName(unsigned short Z)
Accessor on the chemical element's name depending on its Z number.
std::vector< double > getDetectorRightVector()
Accessor on the right-vector defining the orientation of the X-ray detector.
void enableArtifactFilteringOnGPU(void)
Enable artefact filtering on GPU (it is fast but can be inaccurate).
void saveLastCumulatedLBuffer(const std::string &aFileName=std::string(), bool useCompression=true)
Save the last cumulated L-buffer that has been computed.
void makeCube(const std::string &aLabel, double aLength=1.0, const std::string &aUnitOfLength="cm", const std::string &aParent="root")
Create a cube, centred on (0, 0, 0) and set its label in the scenegraph (i.e. identifier)....
void setDetectorUpVector(double x, double y, double z)
Set the up-vector defining the orientation of the X-ray detector.
double getMassAttenuationFromHU(double HU, double anEnergy, const std::string &aUnitOfEnergy)
Accessor on the HU's mass attenuation.
double getLinearAttenuationCoefficient(const std::string &aLabel, double anEnergy, const std::string &aUnitOfEnergy)
Accessor on the linear attenuation coefficient at a given energy corresponding to the material proper...
void setMassAttenuationCoefficient(const std::string &aLabel, double aCoefficient, const std::string &aUnit)
Set the mass attenuation coefficient corresponding to the material properties of a polygon mesh....
double getUnitOfLength(const std::string &aUnitOfLength)
Accessor on the numerical value corresponding to a unit of length.
std::string getOpenGlVenror()
Accessor on the OpenGL vendor.
void cursorPositionCallback(double x, double y, int aViewportWidth, int aViewportHeight)
Call this function when the user moves the mouse.
double getTotalEnergyWithDetectorResponse()
Accessor on a total energy of the beam when the detector response is applied.
double getDensityFromElement(const std::string &anElement)
Accessor on the chemical element's density.
void setHU(const std::string &aLabel, short HU)
Set the Hounsfield value corresponding to the material properties of a polygon mesh.
void setMixture(const std::string &aLabel, const std::string &aMixture)
Set the mixture corresponding to the material properties of a polygon mesh. Don't forget to set the d...
void displayScene(bool aSceneRotationFlag=true, int aWindowID=-1)
3-D visualisation of the 3-D scene (source, detector, and scanned objects). Note that there is no int...
void addPolygonMeshAsOuterSurface(const std::string &aLabel)
Add a polygon mesh, given its label, to the X-ray renderer as an outer surface.
void moveToCentre()
Move the scenegraph to the centre.
void disableArtifactFiltering(void)
Disable artefact filtering altogether.
void createWindow(int aWindowID=-1, int aVisibilityFlag=0, const std::string &aRenderer="OPENGL", int aRendererMajorVersion=3, int aRendererMinorVersion=2)
Create an OpenGL context and display it in a window.
void addMesh(const std::string &aDestination, const std::string &aSource)
Add a polygon mesh (aSource) to another one (aDestination). It corresponds to the operation as follow...
void setHounsfieldValue(const std::string &aLabel, short HU)
Set the Hounsfield value corresponding to the material properties of a polygon mesh.
void loadDetectorEnergyResponse(const std::string &aFileName, const std::string &aUnitOfEnergy)
Load the energy response of the detector from a TSV file.
void applyCurrentLocalTransformation(const std::string &aLabel)
Apply the current local transformation to all the vertices of a given node in the scenegraph....
void setCompound(const std::string &aLabel, const std::string &aCompound)
Set the compound corresponding to the material properties of a polygon mesh. Don't forget to set the ...
void makeCylinder(const std::string &aLabel, unsigned int aNumberOfSectors=10, double aHeight=1.0, double aRadius=0.5, const std::string &aUnitOfLength="cm", const std::string &aParent="root")
Create a cylinder and set its label in the scenegraph (i.e. identifier). Note that it is not added to...
int getMajorVersionOfCoreGVXR()
Accessor on the major version of the core gVirtualXRay library (gvxr). This number is changed when in...
std::vector< float > getDiffuseColour(const std::string &aLabel)
Accessor on the diffuse colour of the material of a given polygon mesh.
void invertNormalVectors(const std::string &aLabel)
Invert the normal vectors of a given polygon mesh.
void enableArtifactFilteringOnCPU(void)
Enable artefact filtering on CPU (can be extremely slow as it makes use of ray-tracing).
void usePointSource()
Use a point source.
void rotateScene(double anAngle, double x, double y, double z)
Rotate the 3-D scene (all the polygon meshes will be affected but not modified).
std::vector< float > rayIntersect(const std::string &aLabel, double aRayOriginX, double aRayOriginY, double aRayOriginZ, double aRayDirectionX, double aRayDirectionY, double aRayDirectionZ)
int getMinorVersionOfCoreGVXR()
Accessor on the minor version of the core gVirtualXRay library (gvxr). This number is changed when ne...
void resetBeamSpectrum()
Set the size of the focal spot of the X-ray generator.
void addEnergyBinToSpectrum(double anEnergy, const std::string &aUnitOfEnergy, double aNumberOfPhotons)
Add an energy bin to the beam spectrum (useful to generate polychromatism).
void setDetectorNumberOfPixels(int aWidth, int aHeight)
Set the number of pixels of the X-ray detector.
float getShininess(const std::string &aLabel)
Accessor on the shininess of the material of a given polygon mesh.
void setDetectorPixelSize(double aWidth, double aHeight, const std::string &aUnitOfLength)
Set the pixel size.
void setDetectorPosition(double x, double y, double z, const std::string &aUnitOfLength)
Set the position of the X-ray detector.
void disableArtefactFiltering(void)
Disable artefact filtering altogether.
void scaleScene(double x, double y, double z)
Scale the 3-D scene (all the polygon meshes will be affected but not modified).
int getMinorVersionOfSimpleGVXR()
Accessor on the minor version of SimpleGVXR. This number is changed when new functionalities have bee...
void moveToCenter()
Move the scenegraph to the centre.
void setLocalTransformationMatrix(const std::string &aLabel, const std::vector< double > &aMatrix)
Set the local transformation matrix of a given node in the scenegraph.
void stopArcBallRotation()
Call this function when the user stops an arc-ball rotation (e.g. release the left-mouse button click...
void subtractMesh(const std::string &aDestination, const std::string &aSource)
Subtract a polygon mesh (aSource) from another one (aDestination). It corresponds to the operation as...
std::string getMaterialLabel(const std::string &aLabel)
Accessor on the material label of a polygon mesh.
std::vector< std::vector< float > > getNodeWorldTransformationMatrix(const std::string &aLabel)
Accessor on the transformation matrix of a given node.
void setColour(const std::string &aLabel, float R, float G, float B, float A)
Set the colour of a given polygon mesh.
void setMu(const std::string &aLabel, double aCoefficient, const std::string &aUnit)
Set the linear attenuation coefficient corresponding to the material properties of a polygon mesh.
void setSceneTransformationMatrix(const std::vector< std::vector< float > > &aMatrix)
Set the 3-D scene transformation matrix.
void lookAt(double eyeX, double eyeY, double eyeZ, double lookAtX, double lookAtY, double lookAtZ, double upX, double upY, double upZ)
Replace the modelling-viewing matrix by a viewing transformation matrix. It behaves as the old gluLoo...
std::string getVersionOfSimpleGVXR()
Accessor on the full string version of SimpleGVXR.
std::vector< float > getSpecularColour(const std::string &aLabel)
Accessor on the specular colour of the material of a given polygon mesh.
std::string getVersionOfCoreGVXR()
Accessor on the full string version of the core gVirtualXRay library (gvxr).
std::vector< std::vector< float > > getSceneTransformationMatrix()
Accessor on the 3-D scene transformation matrix.
void setHounsfieldUnit(const std::string &aLabel, short HU)
Set the Hounsfield value corresponding to the material properties of a polygon mesh.
const std::vector< std::vector< std::vector< float > > > & getLatestScreenshot()
Get the latest screenshot.
std::vector< double > getNodeAndChildrenBoundingBox(const std::string &aLabel, const std::string &aUnitOfLength="cm")
Access the bounding box of a given node and all its children (if any). The bounding box is given in t...
std::vector< std::vector< float > > getNodeLocalTransformationMatrix(const std::string &aLabel)
Accessor on the transformation matrix of a given node.
void saveSTLfile(const std::string &aLabel, const std::string &aFileName=std::string())
Save the polygon mesh of a given node.
void removePolygonMeshesFromXRayRenderer()
Empty the X-ray renderer from all its meshes. Note that the meshes are kept in the scenegraph.
std::vector< std::vector< float > > getRootTransformationMatrix()
Accessor on the transformation matrix of the scengraph's root node.
void saveLastSinogram(const std::string &aFileName=std::string(), bool useCompression=true)
Save the last sinogram that has been computed.
std::vector< std::vector< std::vector< float > > > getLastSinogram()
Accessor on the last sinogram that has been computed.
void setSourcePosition(double x, double y, double z, const std::string &aUnitOfLength)
Set the position of the X-ray source.
unsigned int getNumberOfChildren(const std::string &aLabel)
Get the number of children of a node in the scenegraph.
double getMassAttenuationCoefficient(const std::string &aLabel, double anEnergy, const std::string &aUnitOfEnergy)
Accessor on the mass attenuation coefficient at a given energy corresponding to the material properti...
void destroyAllWindows(void)
Close and destroy all the windows and OpenGL contexts that have been created.
void enableArtefactFilteringOnGPU(void)
Enable artefact filtering on GPU (it is fast but can be inaccurate).
void autoCreateOpenGLContext(bool aFlag=true)
Create an OpenGL context automatically.
void orthographic(double left, double right, double bottom, double top, double zNear, double zFar)
Replace the projection matrix by a orthographic projection matrix. It behaves as the old glOrtho func...
double getDensityFromHU(double HU)
Accessor on the HU's density.
std::vector< std::vector< float > > getLastLBuffer()
Accessor on the last L-buffer that has been computed.
std::vector< std::vector< std::vector< float > > > computeSinogram(double x, double y, double z, const std::string &aUnitOfLength, unsigned int aNumberOfAngle, double anAngleOffset)
Compute the sinogram corresponding to the environment that has previously been set,...
void loadSceneGraph(const std::string &aFileName, const std::string &aUnitOfLength)
Load a scenegraph from a file and add its polygon meshes to the X-ray renderer.
void renderLoop(int aWindowID=-1)
3-D visualisation of the 3-D scene (source, detector, and scanned objects). Note that there is intera...
const std::vector< std::vector< std::vector< float > > > & takeScreenshot(int aWindowID=-1)
Take screenshot.
void showWindow(int aWindowID=-1)
Make an OpenGL context visible and display a window.
std::vector< double > getDetectorPosition(const std::string &aUnitOfLength)
Accessor on the position of the X-ray detector.
unsigned short getElementAtomicNumber(const std::string &anElement)
Accessor on the chemical element's Z number.
void makeIsoSurface(const std::string &aLabel, short anIsoValue, const std::vector< short > &aVoxelDataSet, unsigned int aWidth, unsigned int aHeight, unsigned int aDepth, double aSpacingX, double aSpacingY, double aSpacingZ, const std::string &aUnitOfLength="cm", const std::string &aParent="root")
Create an iso-surface from a 3D image and set its label in the scenegraph (i.e. identifier)....
double getMassAttenuationFromMixture(const std::string &aMixture, double anEnergy, const std::string &aUnitOfEnergy)
Accessor on the mixture's mass attenuation.
void setWindowBackGroundColor(float R, float G, float B, int aWindowID=-1)
Set window background colour.
unsigned int getNumberOfPrimitives(const std::string &aLabel)
Accessor on the number of primitives of a given node.
std::vector< std::vector< float > > computeLBuffer(const std::string &aLabel)
Compute the L-buffer of a polygon mesh corresponding to the environment that has previously been set,...
std::vector< float > getImageRow(const std::vector< std::vector< float > > &anImage, int j)
Accessor on the j-th row of pixels of a given image.
void perspective(double fovy, double aspect, double zNear, double zFar)
Replace the projection matrix by a perspective projection matrix. It behaves as the old gluPerspectiv...
void scrollCallback(double xoffset, double yoffset)
Call this function when the user scrolls.
int getPatchVersionOfCoreGVXR()
Accessor on the minor version of the core gVirtualXRay library (gvxr). This number is changed when bu...
void emptyMesh(const std::string &aLabel, const std::string &aParent="root")
Create an empty polygon mesh and set its label in the scenegraph (i.e. identifier)....
std::vector< std::vector< float > > computeXRayImage(bool anIntegrateEnergyFlag=true)
Compute the X-ray projection corresponding to the environment that has previously been set,...
void resetSceneTransformation()
Replace the 3-D transformation matrix of the overall 3-D scene by an identity matrix.
void enableArtefactFilteringOnCPU(void)
Enable artefact filtering on CPU (can be extremely slow as it makes use of ray-tracing).
void setColor(const std::string &aLabel, float R, float G, float B, float A)
Set the color of a given polygon mesh.
void useParallelSource()
Use a parallel source (e.g. to mimic a source that is extremely far from the scanned object and detec...
void setOversamplingFactor(int aFactor=1)
Set the multiplicative factor to oversample the L-buffers.
void scaleNode(const std::string &aLabel, double x, double y, double z)
Scale a polygon mesh.
void removePolygonMeshesFromSceneGraph()
Empty the scenegraph. Note that it also empties the X-ray renderer from all its meshes.
void pushModelViewMatrix()
Add the current matrix to the model/view matrix stack. It behaves as the combination of the old glMat...
bool usingArcBallRotation()
Check if arc-ball rotation is currently in use.
std::vector< double > getLocalTransformationMatrix(const std::string &aLabel)
Accessor on the local transformation matrix of a given node in the scenegraph. If the node does not e...
std::vector< int > getDetectorNumberOfPixels()
Accessor on the number of pixels of the X-ray detector.
void setElement(const std::string &aLabel, unsigned short Z)
Set the chemical element (or element) corresponding to the material properties of a polygon mesh.