├── .codedocs ├── .gitattributes ├── .gitignore ├── .gitmodules ├── BUILDING.md ├── Doxyfile ├── INSTALLATION.md ├── LICENSE.txt ├── Makefile ├── PyInstaller.spec ├── README.md ├── TODO.md ├── config.ini ├── eidolon ├── Application.py ├── Camera2DView.py ├── Concurrency.py ├── ImageAlgorithms.py ├── ImageObject.py ├── MathDef.py ├── MeshAlgorithms.cp36-win_amd64.pyd ├── MeshAlgorithms.cp37-win_amd64.pyd ├── MeshAlgorithms.cpython-36m-darwin.so ├── MeshAlgorithms.cpython-36m-x86_64-linux-gnu.so ├── MeshAlgorithms.cpython-37m-x86_64-linux-gnu.so ├── MeshAlgorithms.pyx ├── SceneComponents.py ├── SceneManager.py ├── SceneObject.py ├── ScenePlugin.py ├── SceneUtils.cp36-win_amd64.pyd ├── SceneUtils.cp37-win_amd64.pyd ├── SceneUtils.cpython-36m-darwin.so ├── SceneUtils.cpython-36m-x86_64-linux-gnu.so ├── SceneUtils.cpython-37m-x86_64-linux-gnu.so ├── SceneUtils.pyx ├── Utils.py ├── VisualizerUI.py ├── __init__.py ├── plugins │ ├── CTMotionTrackPlugin.py │ ├── CardiacMotionPlugin.py │ ├── CheartPlugin.py │ ├── DeformPlugin.py │ ├── DicomPlugin.py │ ├── IRTKPlugin.py │ ├── ImageAlignPlugin.py │ ├── ImageStackPlugin.py │ ├── MeasurementPlugin.py │ ├── MeditPlugin.py │ ├── MetaImagePlugin.py │ ├── NRRDPlugin.py │ ├── NiftiPlugin.py │ ├── ParRecPlugin.py │ ├── PlotPlugin.py │ ├── ReportCardPlugin.py │ ├── STLPlugin.py │ ├── SegmentPlugin.py │ ├── SlicePlugin.py │ ├── VTKPlugin.py │ ├── X4DFPlugin.py │ └── __init__.py ├── renderer │ ├── ColorMatrix.pyx │ ├── IndexMatrix.pyx │ ├── MatrixT.pyxT │ ├── OgreRenderTypes.cpp │ ├── OgreRenderTypes.h │ ├── RealMatrix.pyx │ ├── RenderTypes.cpp │ ├── RenderTypes.h │ ├── RenderTypes.pxd │ ├── Renderer.cp36-win_amd64.pyd │ ├── Renderer.cp37-win_amd64.pyd │ ├── Renderer.cpython-36m-darwin.so │ ├── Renderer.cpython-36m-x86_64-linux-gnu.so │ ├── Renderer.cpython-37m-x86_64-linux-gnu.so │ ├── Renderer.pyx │ ├── Vec3Matrix.pyx │ ├── __init__.py │ └── setup.py ├── setup.py └── ui │ ├── CTMotionProp.ui │ ├── CardiacMotionProp.ui │ ├── ChooseImgStack.ui │ ├── ChooseSeries.ui │ ├── DeformObjProp.ui │ ├── Dicom2DView.ui │ ├── Draw2DView.ui │ ├── GPUProp.ui │ ├── LightProp.ui │ ├── MainWindow.ui │ ├── MatProp.ui │ ├── Measure2DView.ui │ ├── MeasureObjProp.ui │ ├── ObjProp.ui │ ├── ObjReprProp.ui │ ├── ProjProp.ui │ ├── RegionGraphWidget.ui │ ├── Resources_rc4.py │ ├── Resources_rc5.py │ ├── ScreenshotForm.ui │ ├── Seg2DView.ui │ ├── SegObjProp.ui │ ├── SeriesProp.ui │ ├── ShowMsg.ui │ ├── SliceObjProp.ui │ ├── UI_rc4.py │ ├── UI_rc5.py │ ├── __init__.py │ ├── cheartdataload.ui │ ├── cheartload.ui │ ├── chearttdload.ui │ ├── loadGPUScript.ui │ ├── mtServerForm.ui │ └── setup.py ├── environment-py37.yml ├── main.py ├── requirements.txt ├── res ├── ArchivoBlack.otf ├── BaseImage.cg ├── BaseImage2D.cg ├── DefaultUIStyle.css ├── Resources.qrc ├── UtilRoutines.cg ├── Vegur-Regular.otf ├── arrow.tif ├── arrow4.png ├── basicTex.cg ├── camera.png ├── checkbox.png ├── chevron-left.png ├── chevron-right.png ├── clipboard.png ├── clone.png ├── close-circled.png ├── close.png ├── cube.png ├── depthtransfer.cg ├── document.png ├── down.png ├── eye-disabled.png ├── eye.png ├── fonts.fontdef ├── gear-b.png ├── help-circled.png ├── hijackVP.cg ├── image.png ├── minus-round.png ├── nametag.png ├── play.png ├── plus-round.png ├── scissors.png ├── seg.png ├── skip-backward.png ├── skip-forward.png ├── stats-bars.png ├── stop.png ├── trash-a.png ├── uncheckbox.png ├── up.png └── wrench.png ├── run.bat ├── run.sh ├── tests ├── .coveragerc ├── README.md ├── TestUtils.py ├── imagetests │ ├── 2dmeshtest.py │ ├── 2dtest.py │ ├── 2dvolumetest.py │ ├── arrayimagetest.py │ ├── basicimagetest.py │ ├── dicomloadtest.py │ ├── extendtest.py │ ├── orienttest.py │ ├── realloctest.py │ ├── sliceboxtest.py │ ├── sliceplaneboxtest.py │ ├── sliceplanetest.py │ ├── sphereimagetest.py │ └── timeimagetest.py ├── meshtests │ ├── billboardtest.py │ ├── catmullromtest.py │ ├── cylindertest.py │ ├── deformtest.py │ ├── deletetest.py │ ├── draghandletest.py │ ├── elemfieldtest.py │ ├── glyphtest.py │ ├── handletest.py │ ├── hextest.py │ ├── highordertest.py │ ├── isotest.py │ ├── linetest.py │ ├── multitopofieldtest.py │ ├── pointtest.py │ ├── ribbontest.py │ ├── selecthandletest.py │ ├── sliceplanetest.py │ ├── spheretest.py │ ├── tettest.py │ ├── texttest.py │ ├── timetest.py │ └── tritest.py ├── othertests │ ├── ImportTest.ipynb │ └── testenv.py ├── run_coverage.sh ├── rununittests.py └── unittests │ ├── __init__.py │ ├── testconcurrency.py │ ├── testimage.py │ ├── testmath.py │ ├── testrotator.py │ └── testvec3.py └── tutorial ├── DicomData ├── SA_00000.dcm ├── SA_00001.dcm ├── SA_00002.dcm ├── SA_00003.dcm ├── SA_00004.dcm ├── SA_00005.dcm ├── SA_00006.dcm ├── SA_00007.dcm ├── SA_00008.dcm ├── SA_00009.dcm ├── SA_00010.dcm ├── SA_00011.dcm ├── SA_00012.dcm ├── SA_00013.dcm ├── SA_00014.dcm ├── SA_00015.dcm ├── SA_00016.dcm ├── SA_00017.dcm ├── SA_00018.dcm ├── SA_00019.dcm ├── SA_00020.dcm ├── SA_00021.dcm ├── SA_00022.dcm ├── SA_00023.dcm ├── SA_00024.dcm ├── SA_00025.dcm ├── SA_00026.dcm └── SA_00027.dcm ├── MeshData ├── 1d_FE.T ├── 1d_FE.X ├── 1d_rad_avg_FE.D ├── BORE_FE.T ├── BORE_FE.X ├── LinBox.T ├── LinBox0000.X ├── LinBox0001.X ├── LinBox0002.X ├── LinBox0003.X ├── LinBox0004.X ├── LinBox0005.X ├── LinBox0006.X ├── LinBox0007.X ├── LinBox0008.X ├── LinBox0009.X ├── LinBox_LenSq0000.D ├── LinBox_LenSq0001.D ├── LinBox_LenSq0002.D ├── LinBox_LenSq0003.D ├── LinBox_LenSq0004.D ├── LinBox_LenSq0005.D ├── LinBox_LenSq0006.D ├── LinBox_LenSq0007.D ├── LinBox_LenSq0008.D ├── LinBox_LenSq0009.D ├── VBORE_FE.T ├── Vel-1.D ├── linmesh_FE.T ├── linmesh_FE.X └── linmesh_dist.D ├── tutorial1.py ├── tutorial2.py ├── tutorial3.py ├── tutorial4.py ├── tutorial5.py ├── tutorial5a.py ├── tutorial6.py └── tutorial7.py /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * -text 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | #* 3 | *.pyc 4 | *.pickle 5 | **/.ipynb_checkpoints 6 | **/build/** 7 | .DS_Store 8 | .idea 9 | screen.png 10 | eidolon.log 11 | src/renderer/Renderer.cpp 12 | src/renderer/Renderer.so 13 | src/eidolon/*.cpp 14 | src/eidolon/*.so 15 | dist 16 | tutorial/DicomData/dicomdataset.ini 17 | tests/meshtests/isotest.png 18 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "EidolonLibs"] 2 | path = eidolon/EidolonLibs 3 | url = https://github.com/ericspod/EidolonLibs.git 4 | -------------------------------------------------------------------------------- /BUILDING.md: -------------------------------------------------------------------------------- 1 | # Building Instructions 2 | 3 | Eidolon needs Python to run as well as build so first follow the instructions for running it in INSTALLATION.md. 4 | Various additional components are needed to build for each platform. 5 | This assumes that the pre-built libraries are included. 6 | For all platforms the following are required either separately, as included with the source, or as part of Anaconda: 7 | 8 | * Ogre3D Development Files (included) 9 | * Cython 10 | * g++/clang 11 | * make 12 | * git 13 | 14 | The following are instructions for building with Anaconda/Miniconda as the base Python environment as setup in INSTALLATION.md. 15 | 16 | ## Anaconda Setup 17 | 18 | Install the necessary extra libraries using pip in a bash window (or Anaconda Prompt on Windows): 19 | 20 | conda install cython 21 | 22 | #### Windows 23 | 24 | Building Eidolon requires the use of a makefile which expects POSIX command line tools. The easiest way to get this is 25 | to install Cygwin 64-bit (https://www.cygwin.com/) and then run commands from its bash console. 26 | 27 | With Cygwin installed the **PATH** variable has to be set to include your Anaconda installed, for example: 28 | 29 | export PATH="$HOME/Miniconda3:$HOME/Miniconda3/Scripts:$HOME/Miniconda3/Library/mingw-w64/bin:$PATH" 30 | 31 | This assumes you installed Miniconda in your home directory, change the `$HOME/Miniconda3` if not. 32 | 33 | Install MinGW with the following in an Cygwin console: 34 | 35 | conda install libpython m2w64-toolchain 36 | 37 | This will install the needed development tools with the **make** command in this setup is called **mingw32-make**. 38 | 39 | #### Linux (Ubuntu 14 and other Debians, other distros) 40 | 41 | Install **g++** and **make** (Debian-based): 42 | 43 | sudo apt-get install g++ make 44 | 45 | #### OS X 46 | 47 | OS X must be setup with Xcode and the necessary Python frameworks, follow the instructions for installing this from the App Store or wherever else. 48 | 49 | ## Building 50 | 51 | To build in any platform, simply use the **make** command without any arguments (or **mingw32-make** on Windows). 52 | This will first generate resource files from the Qt UI definition files, then builds with Cython to create the Python/C++ binding objects. 53 | This can be done with separate commands as follows: 54 | 55 | make ui 56 | make renderer 57 | make pyxlibs 58 | 59 | ## Generating Applications With Pyinstaller 60 | 61 | This program is used to generate standalone applications for Eidolon. On Windows this command must be run from a Cygwin terminal since it relies on 62 | command line programs. 63 | 64 | First install it with pip: 65 | 66 | pip install pyinstaller 67 | 68 | From a command line use **make** to generate the application: 69 | 70 | make app 71 | 72 | On Windows or Linux this will create a .zip file containing the app, on OSX it will be a .dmg mountable filesystem. 73 | -------------------------------------------------------------------------------- /INSTALLATION.md: -------------------------------------------------------------------------------- 1 | # Installation Requirements 2 | 3 | These are the instructions for installing the necessary components to run Eidolon from a git checkout or zip package. 4 | Eidolon works currently in Windows (7 definitely, 8 and 10 seem fine) and Linux (14.\*, Mint 18+, etc., and up), and OS X 10.8+. 5 | For these platforms you should not need to compile since shared objects are included in the repository. 6 | 7 | For all platforms it requires: 8 | * Python 3.6 or 3.7 9 | * PyQt 5.* 10 | * Numpy 1.8.0+ 11 | * SciPy 0.13.3+ 12 | * Imageio (optional) 13 | * Pandas (optional) 14 | * Jupyter QtConsole (optional) 15 | * coverage (optional for testing) 16 | * six (if not already present) 17 | 18 | The following will explain how to setup a Python environment with Anaconda/Miniconda. 19 | To install using another Python distribution involves following the installation instructions for the base Python interpreter 20 | and then for the above libraries. These can be acquired from: 21 | 22 | * Python 3.6+ 64bit: http://www.python.org/download/ 23 | * Numpy/SciPy: http://www.scipy.org/install.html 24 | * PyQt: http://www.riverbankcomputing.com/software/pyqt/download 25 | * Imageio: https://imageio.github.io/ 26 | * Pandas: https://pandas.pydata.org/ 27 | * Jupyter QtConsole: https://github.com/jupyter/qtconsole 28 | 29 | or using the package manager of your system (apt-get or port). 30 | It is however strongly advised to use Anaconda for running Eidolon, it's simply easier to use, install or uninstall, and not 31 | prone to installation or versioning issues that arise with a built-in Python interpreter. 32 | 33 | ---- 34 | 35 | ## Anaconda 36 | 37 | **The easiest way to get all these for any platform is through Anaconda: https://www.anaconda.com/download** 38 | The following instructions are for setting up Anaconda for any platform. 39 | Miniconda (https://conda.io/miniconda.html) can alternatively be installed which includes fewer libraries but is much smaller to download and install. 40 | 41 | #### Windows 42 | 43 | Download the 64-bit Anaconda/Miniconda executable and install by running it. Once installed this should become the default Python. 44 | 45 | From the Start Menu open an **Anaconda Prompt** window and run the following: 46 | 47 | conda install python=3.6 numpy scipy pyqt six 48 | 49 | This will install the bare necessities for Anaconda or Miniconda, the extras can be installed by including `imageio pandas` 50 | in the command. 51 | 52 | Once this is installed Eidolon can be run by double-clicking `run.bat` or running it from a terminal window. 53 | In a Cygwin terminal, either `run.bat` or `run.sh` can be use to run Eidolon. 54 | 55 | #### Linux and OSX 56 | 57 | Download the 64-bit .sh file for Anaconda/Miniconda for your platform. Follow instructions for running the .sh file to install. 58 | 59 | Both Linux and OSX versions of Anaconda will include a version of Numpy which uses Intel's Math Kernel Library (MKL). 60 | Unfortunately this is not compatible with multi-process concurrency for some reason and so the non-MKL versions of libraries 61 | must be used instead. The easiest way to do this is to create a new environment called **nomkl** and run Eidolon from that. 62 | Open a terminal and with the new installation in your PATH run the following: 63 | 64 | conda create -n nomkl python=3.6 nomkl numpy scipy pyqt six 65 | 66 | Adding `imageio pandas` will install the optional libraries. 67 | Once this is done the command `source activate nomkl` will activate this environment, then Eidolon can be run by executing `run.sh`. 68 | 69 | ## Jupyter/IPython 70 | 71 | Eidolon has support for the IPython console in place of the built-in console. There is a known issue with the recent version of the 72 | ipykernel package, thus installing an earlier version is needed. The conda command to do this (in the nomkl environment 73 | if you're using that) is the following: 74 | 75 | conda install ipython qtconsole ipykernel=4.10 76 | -------------------------------------------------------------------------------- /PyInstaller.spec: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | from PyInstaller import compat 19 | from glob import glob 20 | import platform 21 | 22 | exename='Eidolon.bin' if compat.is_darwin else 'Eidolon' 23 | outname='Eidolon' 24 | 25 | pathex=['.'] 26 | binaries=[] 27 | hiddenimports=[ 28 | 'numpy', 'scipy','PyQt4.uic','PyQt5.uic','_struct','eidolon','eidolon.renderer', 29 | 'eidolon.plugins','eidolon.ui','ipykernel.datapub' 30 | ] 31 | block_cipher = None 32 | 33 | datas=[ 34 | ('res','res'), 35 | ('config.ini','.'), 36 | ('tests','tests'), 37 | ('tutorial','tutorial'), 38 | ('eidolon/EidolonLibs/IRTK','eidolon/EidolonLibs/IRTK'), 39 | ('eidolon/EidolonLibs/python','eidolon/EidolonLibs/python'), 40 | ('eidolon/EidolonLibs/MIRTK/ffd_motion.cfg','eidolon/EidolonLibs/MIRTK') 41 | ] 42 | 43 | if compat.is_win: 44 | binaries=[ 45 | ('eidolon/EidolonLibs/win64_mingw/bin/cg.dll','.'), 46 | ('eidolon/EidolonLibs/win64_mingw/bin/Plugin_CgProgramManager.dll','.'), 47 | ('eidolon/EidolonLibs/win64_mingw/bin/RenderSystem_GL.dll','.') 48 | ] 49 | 50 | datas.append(('eidolon/EidolonLibs/MIRTK/Win64','eidolon/EidolonLibs/MIRTK/Win64')) 51 | 52 | elif compat.is_darwin: 53 | outname+='.app' 54 | hiddenimports+=['appdirs','packaging','packaging.version','packaging.specifiers','packaging.requirements','packaging.utils','cProfile'] 55 | datas+=[ 56 | ('eidolon/EidolonLibs/osx/bin/Ogre.framework','Contents/Frameworks/Ogre.framework'), 57 | ('eidolon/EidolonLibs/osx/bin/OgreOverlay.framework','Contents/Frameworks/OgreOverlay.framework'), 58 | ('eidolon/EidolonLibs/osx/bin/Cg.framework','Contents/Frameworks/Cg.framework'), 59 | ('eidolon/EidolonLibs/osx/bin/Plugin_CgProgramManager.framework','Contents/Frameworks/Plugin_CgProgramManager.framework'), 60 | ('eidolon/EidolonLibs/osx/bin/RenderSystem_GL.framework','Contents/Frameworks/RenderSystem_GL.framework'), 61 | ('eidolon/EidolonLibs/MIRTK/OSX','EidolonLibs/MIRTK/OSX') 62 | ] 63 | elif compat.is_linux: 64 | hiddenimports+=['scipy._lib.messagestream'] 65 | binaries+=[(f,'.') for f in glob('eidolon/EidolonLibs/linux/bin/*')] 66 | datas.append(('eidolon/EidolonLibs/MIRTK/Linux','eidolon/EidolonLibs/MIRTK/Linux')) 67 | 68 | a = Analysis( 69 | ['main.py'], 70 | pathex=pathex, 71 | binaries=binaries, 72 | datas=datas, 73 | hiddenimports=hiddenimports, 74 | hookspath=[], 75 | runtime_hooks=[], 76 | excludes=[], 77 | win_no_prefer_redirects=False, 78 | win_private_assemblies=False, 79 | cipher=block_cipher 80 | ) 81 | 82 | pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) 83 | 84 | exe = EXE(pyz, a.scripts, exclude_binaries=True, name=exename, debug=False, strip=False, upx=True, console=True ) 85 | 86 | coll = COLLECT(exe,a.binaries, a.zipfiles, a.datas, strip=False, upx=True, name=outname) 87 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | # TODO List of Tasks 2 | 3 | ### 19 Oct 2018 4 | * .mesh file sequence 5 | 6 | ### 2 Feb 2017 7 | * Multi 2D view 8 | * 2D flow/deformation visualization 9 | * 2D glyph visualization 10 | * Streamlines representation type 11 | * ~~PyQt5 compatibility~~ 12 | * PACS access 13 | 14 | ### 12 Dec 2016 15 | * ~~Replace IRTK with MIRTK~~ (mostly) 16 | * ~~Change how tracking directories are chosen so that the source image doesn't need to be selected anymore~~ 17 | * ~~Finish tracking code for measurements~~ 18 | * ~~Torsion calculation~~ 19 | 20 | ### 17 Oct 2016 21 | * ~~Fill in wiki information (porting content from internal trac)~~ 22 | * ~~Add cleaned-up tutorials~~ 23 | * ~~Clean up included library data~~ 24 | * ~~Add IRTK components~~ 25 | -------------------------------------------------------------------------------- /config.ini: -------------------------------------------------------------------------------- 1 | 2 | [All] 3 | # States which rendering system to use, only meaningful in Windows since elsewhere only OpenGL is available. 4 | # Possible values: OpenGL (default), D3D9, D3D10, D3D11 5 | RenderSystem=OpenGL 6 | # RTT Preferred Mode configures which OpenGL extension to use when rendering to textures 7 | # Possible values: FBO (default), PBuffer, Copy 8 | RTT_Preferred_Mode=FBO 9 | # Vertical screen sync, possible values: true (default), false 10 | VSync=true 11 | # Log file name in Eidolon's users data directory, default is eidolon.log 12 | Logfile=eidolon.log 13 | # Maximum number of processors to use when computing datasets/representations 14 | maxprocs=8 15 | # Default window size at start-up (actual size may be larger if necesary to fit UI components) 16 | winsize=1200 800 17 | # Comma-separated list of Ogre plugins to load, the shared object must be in the /Libs//bin directory 18 | plugins=Plugin_CgProgramManager 19 | # Qt style to base the UI look-and-feel on 20 | uistyle=plastique 21 | # Stylesheet used to define the interface look-and-feel, must be an absolute path or relative to the directory 22 | stylesheet=res/DefaultUIStyle.css 23 | # Sets the initial state of the camera's Z-axis locking: true (default), false 24 | camerazlock=true 25 | # Comma-separated list of scripts to load at runtime before any others specified on the command line (prefix with ./ to be relative to config file) 26 | preloadscripts= 27 | # render high quality for every frame by default 28 | renderhighquality=true 29 | # location of the per-user application data directory to create at startup if it doesn't exist, This file will be copied there and can be modified for per-user configuration 30 | userappdir=~/.eidolon 31 | # console log filename, to be stored in userappdir 32 | consolelogfile=console.log 33 | # how many lines of console logs to store in the log file 34 | consoleloglen=10000 35 | # try to use the Jupyter Qt console widget instead of the built-in console widget: true (default), false 36 | usejupyter=true 37 | 38 | [Windows] 39 | # Windows specific config values 40 | 41 | [Linux] 42 | # Linux specific config values 43 | 44 | [OSX] 45 | # OSX specific config values 46 | 47 | [Shaders] 48 | # List of shaders/fragment programs to load, key is filename and value specifies type (fragment or vertex) and optionally list of profiles 49 | BaseImage.cg=fragment 50 | #BaseImage2D.cg=fragment 51 | hijackVP.cg=vertex,arbvp1 vs_2_x 52 | basicTex.cg=fragment 53 | -------------------------------------------------------------------------------- /eidolon/MeshAlgorithms.cp36-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/MeshAlgorithms.cp36-win_amd64.pyd -------------------------------------------------------------------------------- /eidolon/MeshAlgorithms.cp37-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/MeshAlgorithms.cp37-win_amd64.pyd -------------------------------------------------------------------------------- /eidolon/MeshAlgorithms.cpython-36m-darwin.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/MeshAlgorithms.cpython-36m-darwin.so -------------------------------------------------------------------------------- /eidolon/MeshAlgorithms.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/MeshAlgorithms.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /eidolon/MeshAlgorithms.cpython-37m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/MeshAlgorithms.cpython-37m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /eidolon/SceneUtils.cp36-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/SceneUtils.cp36-win_amd64.pyd -------------------------------------------------------------------------------- /eidolon/SceneUtils.cp37-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/SceneUtils.cp37-win_amd64.pyd -------------------------------------------------------------------------------- /eidolon/SceneUtils.cpython-36m-darwin.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/SceneUtils.cpython-36m-darwin.so -------------------------------------------------------------------------------- /eidolon/SceneUtils.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/SceneUtils.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /eidolon/SceneUtils.cpython-37m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/SceneUtils.cpython-37m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /eidolon/__init__.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | ''' 19 | Eidolon is the experimental medical imaging visualization framework. 20 | ''' 21 | 22 | __appname__='Eidolon Biomedical Framework' 23 | __version_info__=(0,5,99) # global application version, major/minor/patch, patch value 99 means development code directly from the repo 24 | __version__='%i.%i.%i'%__version_info__ 25 | __author__='Eric Kerfoot' 26 | __copyright__="Copyright (c) 2016-8 Eric Kerfoot, King's College London, all rights reserved. Licensed under the GPL (see LICENSE.txt)." 27 | __website__="https://ericspod.github.io/Eidolon" 28 | __verurl__="https://api.github.com/repos/ericspod/Eidolon/releases" 29 | 30 | # top-level constants, these are hard-coded environment variable or file names 31 | APPDIRVAR='APPDIR' # environment variable defining the application's directory, set by the start up script and is needed at init time 32 | LIBSDIR='EidolonLibs' # directory name containing the application's libraries 33 | CONFIGFILE='config.ini' # config file name 34 | 35 | from eidolon.Utils import isWindows, isLinux, addPathVariable 36 | 37 | import os, sys 38 | _scriptdir=os.path.dirname(os.path.abspath(__file__)) 39 | 40 | # the application directory is given by pyinstaller in _MEIPASS, if not present use the directory one level up 41 | __appdir__=getattr(sys,'_MEIPASS',os.path.abspath(_scriptdir+'/..')) 42 | 43 | # library directory 44 | __libdir__=os.path.join(__appdir__,'eidolon',LIBSDIR) 45 | 46 | if isWindows: 47 | # add the library directory to PATH so that DLLs can be loaded when the renderer is imported 48 | addPathVariable('PATH',os.path.abspath(os.path.join(__libdir__,'win64_mingw','bin'))) 49 | elif isLinux: 50 | import glob,ctypes 51 | 52 | # load all linux libraries so that LD_LIBRARY_PATH doesn't need to be set 53 | for lib in glob.glob(os.path.join(__libdir__,'linux','lib','*.so*')): # will attempt to load libraries twice 54 | try: 55 | _=ctypes.cdll.LoadLibrary(lib) 56 | except OSError: 57 | pass 58 | 59 | 60 | from eidolon.renderer import * 61 | from eidolon.VisualizerUI import * 62 | from eidolon.Concurrency import * 63 | from eidolon.SceneUtils import * 64 | from eidolon.MeshAlgorithms import * 65 | from eidolon.ImageAlgorithms import * 66 | from eidolon.ImageObject import * 67 | from eidolon.MathDef import * 68 | from eidolon.Camera2DView import * 69 | from eidolon.SceneManager import * 70 | from eidolon.SceneObject import * 71 | from eidolon.ScenePlugin import * 72 | from eidolon.SceneComponents import * 73 | from eidolon.Application import * 74 | 75 | 76 | #def defaultMain(): 77 | # print(repr(__appdir__),repr(__libdir__),repr(_scriptdir)) 78 | # print(vec3()) 79 | 80 | -------------------------------------------------------------------------------- /eidolon/plugins/ImageAlignPlugin.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import * 20 | 21 | 22 | class ImageAlignPlugin(ScenePlugin): 23 | '''Legacy plugin to ensure old projects continue to work.''' 24 | def __init__(self): 25 | ScenePlugin.__init__(self,'ImgAlign') 26 | 27 | def init(self,plugid,win,mgr): 28 | ScenePlugin.init(self,plugid,win,mgr) 29 | self.CardiacMotion=mgr.getPlugin('CardiacMotion') 30 | 31 | def createAlignProject(self,name,parentdir): 32 | self.CardiacMotion.createProject(name,parentdir) 33 | 34 | 35 | addPlugin(ImageAlignPlugin()) 36 | -------------------------------------------------------------------------------- /eidolon/plugins/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | -------------------------------------------------------------------------------- /eidolon/renderer/Renderer.cp36-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/renderer/Renderer.cp36-win_amd64.pyd -------------------------------------------------------------------------------- /eidolon/renderer/Renderer.cp37-win_amd64.pyd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/renderer/Renderer.cp37-win_amd64.pyd -------------------------------------------------------------------------------- /eidolon/renderer/Renderer.cpython-36m-darwin.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/renderer/Renderer.cpython-36m-darwin.so -------------------------------------------------------------------------------- /eidolon/renderer/Renderer.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/renderer/Renderer.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /eidolon/renderer/Renderer.cpython-37m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/eidolon/renderer/Renderer.cpython-37m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /eidolon/renderer/__init__.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from .Renderer import * 20 | -------------------------------------------------------------------------------- /eidolon/setup.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | 20 | import Cython.Compiler.Options 21 | Cython.Compiler.Options.cimport_from_pyx = True 22 | 23 | from Cython.Build.Dependencies import cythonize 24 | 25 | from distutils.core import setup 26 | from distutils.extension import Extension 27 | from distutils import sysconfig 28 | 29 | import platform,sys,os,shutil,glob 30 | import numpy as np 31 | 32 | 33 | scriptdir= os.path.dirname(os.path.abspath(__file__)) # path of the current file 34 | libraries=[] 35 | extra_compile_args=['-w','-O3'] 36 | extra_link_args=[] 37 | #compiledirs={} 38 | 39 | #if sys.version_info.major == 3: 40 | # compiledirs['c_string_type']='unicode' 41 | # compiledirs['c_string_encoding']='ascii' 42 | 43 | 44 | # platform identifiers, exactly 1 should be true 45 | isDarwin=platform.system().lower()=='darwin' 46 | isWindows=platform.system().lower()=='windows' 47 | isLinux=platform.system().lower()=='linux' 48 | 49 | # ensure there's a value for CC, this is omitted sometimes but gcc is a valid substitute 50 | sysconfig._config_vars['CC']=sysconfig.get_config_var('CC') or 'gcc' 51 | 52 | 53 | if isDarwin: 54 | platdir='osx' 55 | extra_link_args+=['-stdlib=libc++', '-mmacosx-version-min=10.9'] 56 | extra_compile_args+=['-std=c++11','-mmacosx-version-min=10.9'] # Ogre was compiled with an older version of OSX for compatibility reasons 57 | elif isWindows: 58 | platdir='win64_mingw' 59 | sys.argv.append('--compiler=mingw32') # force the use of mingw, there must be a proper programmatic way 60 | else: 61 | assert isLinux 62 | libraries+=['m'] 63 | platdir='linux' 64 | 65 | # force the use of GCC 4.9 for now 66 | #os.environ["CC"] = "gcc-4.9" 67 | #os.environ["CXX"] = "g++-4.9" 68 | 69 | libdir=os.path.abspath(os.path.join(scriptdir,'EidolonLibs',platdir)) 70 | assert os.path.isdir(libdir),'%r not found'%libdir 71 | 72 | # include file directories 73 | includedirs=[scriptdir+'/renderer',libdir+'/include',libdir+'/include/boost',libdir+'/include/OGRE',np.get_include()] 74 | 75 | extensions=[] 76 | for i in glob.glob('./*.pyx'): 77 | e=Extension( 78 | os.path.basename(i)[:-4], 79 | [i], 80 | define_macros=[('BOOST_SYSTEM_NO_DEPRECATED',None)], 81 | include_dirs=includedirs, 82 | libraries=libraries, 83 | extra_compile_args=extra_compile_args, 84 | extra_link_args=extra_link_args, 85 | # compiler_directives=compiledirs, 86 | language='c++' 87 | ) 88 | extensions.append(e) 89 | 90 | ext=cythonize(extensions,include_path=[scriptdir,scriptdir+'/renderer']) 91 | 92 | # HORRIBLE KLUDGE: need to get around problem of Cython generating code which relies on CPython having been compiled with --with-fpectl 93 | # The macros PyFTE_*_PROTECT invoke symbols which don't exist with Anaconda builds so they need to be removed which appears to be safe. 94 | # See https://github.com/numpy/numpy/issues/8415 http://www.psf.upfronthosting.co.za/issue29137 95 | for cppfile in glob.glob('*.cpp'): 96 | sys.stdout.write('Processing %s\n'%cppfile) 97 | sys.stdout.flush() 98 | cpplines=open(cppfile).readlines() 99 | with open(cppfile,'w') as o: 100 | for line in cpplines: 101 | if 'PyFPE_START_PROTECT' not in line and 'PyFPE_END_PROTECT' not in line: # remove the symbol lines from the source 102 | o.write(line) 103 | 104 | setup(ext_modules=ext) 105 | 106 | shutil.rmtree('build') 107 | 108 | ## copy the created .so file to the temporary filename in Eidolon directory, this will be symlinked by run.sh 109 | #if not isWindows: 110 | # for i in glob.glob('./*.pyx'): 111 | # i=os.path.splitext(i)[0] 112 | # dest='%s.so.%s'%(i,platdir) 113 | # sobj=glob.glob(i+'.*.so') # .so files get weird names so find the first one that matches 114 | # sobj=sobj[0] if sobj else i+'.so' 115 | # shutil.move(sobj,dest) 116 | -------------------------------------------------------------------------------- /eidolon/ui/ChooseImgStack.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | OpenImgStackDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 594 10 | 742 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Choose Directory 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | &Choose... 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | Filename Regex 44 | 45 | 46 | 47 | 48 | 49 | 50 | *.png 51 | 52 | 53 | 54 | 55 | 56 | 57 | Sort Column 58 | 59 | 60 | 61 | 62 | 63 | 64 | -10 65 | 66 | 67 | 10 68 | 69 | 70 | 71 | 72 | 73 | 74 | Reverse 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | Object Name 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | Qt::Horizontal 101 | 102 | 103 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | buttonBox 113 | accepted() 114 | OpenImgStackDialog 115 | accept() 116 | 117 | 118 | 248 119 | 254 120 | 121 | 122 | 157 123 | 274 124 | 125 | 126 | 127 | 128 | buttonBox 129 | rejected() 130 | OpenImgStackDialog 131 | reject() 132 | 133 | 134 | 316 135 | 260 136 | 137 | 138 | 286 139 | 274 140 | 141 | 142 | 143 | 144 | 145 | -------------------------------------------------------------------------------- /eidolon/ui/ChooseSeries.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ChooseSeriesDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 348 10 | 446 11 | 12 | 13 | 14 | Choose DICOM Series 15 | 16 | 17 | 18 | 19 | 20 | Choose Directory 21 | 22 | 23 | 24 | 9 25 | 26 | 27 | 28 | 29 | true 30 | 31 | 32 | 33 | 34 | 35 | 36 | &Choose... 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Select Series to Import 47 | 48 | 49 | 50 | 51 | 52 | QAbstractItemView::MultiSelection 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | Parameters 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | Qt::Horizontal 71 | 72 | 73 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | buttonBox 83 | accepted() 84 | ChooseSeriesDialog 85 | accept() 86 | 87 | 88 | 248 89 | 254 90 | 91 | 92 | 157 93 | 274 94 | 95 | 96 | 97 | 98 | buttonBox 99 | rejected() 100 | ChooseSeriesDialog 101 | reject() 102 | 103 | 104 | 316 105 | 260 106 | 107 | 108 | 286 109 | 274 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /eidolon/ui/GPUProp.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpuProp 4 | 5 | 6 | 7 | 0 8 | 0 9 | 364 10 | 682 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | 27 | 0 28 | 0 29 | 30 | 31 | 32 | Source Code 33 | 34 | 35 | 36 | 37 | 38 | 39 | 0 40 | 0 41 | 42 | 43 | 44 | 45 | 0 46 | 300 47 | 48 | 49 | 50 | 51 | Courier 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Set Source 60 | 61 | 62 | 63 | 64 | 65 | 66 | Undo All Changes 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 0 78 | 0 79 | 80 | 81 | 82 | 83 | 30 84 | 0 85 | 86 | 87 | 88 | Settings 89 | 90 | 91 | 92 | 93 | 94 | Type 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | Vertex 103 | 104 | 105 | 106 | 107 | Fragment 108 | 109 | 110 | 111 | 112 | Geometry 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Language 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | Entry Point 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | Profiles 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | Apply Changes 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /eidolon/ui/RegionGraphWidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | RegionGraphWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 773 10 | 564 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | Qt::ScrollBarAlwaysOff 24 | 25 | 26 | true 27 | 28 | 29 | 30 | 31 | 0 32 | 0 33 | 753 34 | 544 35 | 36 | 37 | 38 | 39 | 0 40 | 41 | 42 | 43 | 44 | 45 | 0 46 | 0 47 | 48 | 49 | 50 | Plot Regions 51 | 52 | 53 | 54 | 0 55 | 56 | 57 | 3 58 | 59 | 60 | 0 61 | 62 | 63 | 0 64 | 65 | 66 | 0 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /eidolon/ui/ShowMsg.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ShowMsg 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | Msg 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 0 31 | 32 | 33 | 34 | 35 | 36 | 20 37 | 16777215 38 | 39 | 40 | 41 | < 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 100 50 | 0 51 | 52 | 53 | 54 | Message 0/0 55 | 56 | 57 | Qt::AlignCenter 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 20 66 | 16777215 67 | 68 | 69 | 70 | > 71 | 72 | 73 | 74 | 75 | 76 | 77 | Qt::Horizontal 78 | 79 | 80 | 81 | 40 82 | 20 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | Close 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /eidolon/ui/__init__.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | ''' 19 | This module imports the PyQt modules in a version-compatible manner, defines a QtVersion variable set to 4 or 5, and loads 20 | the UI class definitions from the .ui files or from resource modules containing them. By loading .ui files directly the 21 | application doesn't have to rely on source files generated by pyuic4/5 which are specific to their version of PyQt, thus 22 | with the uniform importing allows cross-version compatibility. This will also try to import the resource module meant 23 | for the loaded PyQt version. 24 | 25 | If the .ui files are not present then there should be a resource file containing them as resource items, and this is 26 | loaded instead. This is the case when packaged as an application using pyinstaller which will include the resource file 27 | but not .ui files. These resource files are version dependent and generated by setup.py. 28 | 29 | The defined modules are QtGui, QtCore, Qt, QtWidgets (which is QtGui for PyQt4), and uic. These should be loaded by 30 | modules requiring PyQt types rather than from PyQt4/5 directly. Modules requiring PyQt should use the following import: 31 | 32 | from .ui import Qt, QtCore, QtGui, QtWidgets, QtVersion 33 | ''' 34 | import sys 35 | import os 36 | import glob 37 | import re 38 | import contextlib 39 | 40 | # attempt to import PyQt5 first then default to PyQt4 41 | try: 42 | from PyQt5 import QtGui, QtCore, QtWidgets, uic 43 | from PyQt5.QtCore import Qt 44 | from . import Resources_rc5 45 | QtVersion=5 46 | except ImportError: 47 | from PyQt4 import QtCore, QtGui, uic 48 | from PyQt4.QtCore import Qt 49 | from . import Resources_rc4 50 | QtWidgets=QtGui 51 | QtVersion=4 52 | 53 | # Python 2 and 3 support 54 | try: 55 | from StringIO import StringIO 56 | except ImportError: 57 | from io import StringIO 58 | 59 | 60 | module=sys.modules[__name__] # this module 61 | restag=re.compile('.*',flags=re.DOTALL) # matches the resource tags in the ui files 62 | # list all .ui files, if there are none then attempt to load from a resource script file 63 | uifiles=glob.glob(os.path.join(os.path.dirname(__file__),'*.ui')) 64 | 65 | 66 | def loadUI(xmlstr): 67 | '''Load the given XML ui file data and store the created type as a member of this module.''' 68 | s=re.sub(restag,'',xmlstr) # get rid of the resources section in the XML 69 | uiclass,_=uic.loadUiType(StringIO(s)) # create a local type definition 70 | setattr(module,uiclass.__name__,uiclass) # store as module member 71 | 72 | 73 | if len(uifiles)!=0: 74 | # load the class from each ui file and store it as a member of this module 75 | for ui in uifiles: 76 | loadUI(open(ui).read()) 77 | else: 78 | # load the resource module containing the .ui files appropriate to which version of PyQt is being used 79 | if QtVersion==5: 80 | from . import UI_rc5 81 | else: 82 | from . import UI_rc4 83 | 84 | # iterate over every file in the layout section of the resources and load them into this module 85 | it=QtCore.QDirIterator(':/layout') 86 | while it.hasNext(): 87 | with contextlib.closing(QtCore.QFile(it.next())) as layout: 88 | if layout.open(QtCore.QFile.ReadOnly): 89 | xfile=layout.readAll() 90 | loadUI(bytes(xfile).decode('utf-8')) 91 | -------------------------------------------------------------------------------- /eidolon/ui/loadGPUScript.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | gpuDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 526 10 | 202 11 | 12 | 13 | 14 | Choose GPU Script File 15 | 16 | 17 | 18 | 19 | 20 | Qt::Horizontal 21 | 22 | 23 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 24 | 25 | 26 | 27 | 28 | 29 | 30 | 0 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Choose... 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | Script File: 48 | 49 | 50 | 51 | 52 | 53 | 54 | Program Name: 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | Type: 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Entry Point: 81 | 82 | 83 | 84 | 85 | 86 | 87 | Profiles 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | Language: 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | buttonBox 107 | accepted() 108 | gpuDialog 109 | accept() 110 | 111 | 112 | 248 113 | 254 114 | 115 | 116 | 157 117 | 274 118 | 119 | 120 | 121 | 122 | buttonBox 123 | rejected() 124 | gpuDialog 125 | reject() 126 | 127 | 128 | 316 129 | 260 130 | 131 | 132 | 286 133 | 274 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /eidolon/ui/mtServerForm.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | mtServerForm 4 | 5 | 6 | 7 | 0 8 | 0 9 | 548 10 | 398 11 | 12 | 13 | 14 | MotionTrackServer 15 | 16 | 17 | 18 | 19 | 20 | Active Jobs 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Commands 33 | 34 | 35 | 36 | 37 | 38 | Kills a running motion track job 39 | 40 | 41 | Kill Job 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /eidolon/ui/setup.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | 20 | import subprocess 21 | import glob 22 | import os 23 | 24 | try: 25 | import PyQt5 26 | QtVersion=5 27 | except ImportError: 28 | import PyQt4 29 | QtVersion=4 30 | 31 | def generateResFile(): 32 | '''Generates the resource file from the resources in ../../res and stores it in a PyQt version specific file.''' 33 | cmd='pyrcc%(ver)i ../../res/Resources.qrc > Resources_rc%(ver)i.py' 34 | subprocess.check_call(cmd%{'ver':QtVersion}, shell=True) 35 | 36 | 37 | def generateUIFile(): 38 | '''Generate a PyQt version specific resource file containing the .ui layout files with section prefix "layout".''' 39 | uifiles=glob.glob(os.path.join(os.path.dirname(__file__),'*.ui')) 40 | if uifiles: 41 | # write out a temporary resource spec file 42 | with open('ui.qrc','w') as o: 43 | o.write('\n\n') 44 | for ui in uifiles: 45 | o.write('%s'%os.path.basename(ui)) 46 | o.write('\n\n') 47 | 48 | cmd='pyrcc%(ver)i ui.qrc > UI_rc%(ver)i.py' 49 | subprocess.check_call(cmd%{'ver':QtVersion}, shell=True) 50 | os.remove('ui.qrc') 51 | 52 | 53 | if __name__=='__main__': 54 | print('Generating Resource Module') 55 | generateResFile() 56 | print('Generating UI Module') 57 | generateUIFile() 58 | -------------------------------------------------------------------------------- /environment-py37.yml: -------------------------------------------------------------------------------- 1 | name: eidolon_py37 2 | channels: 3 | - defaults 4 | dependencies: 5 | - pip 6 | - python<3.8 7 | - numpy 8 | - numba 9 | - scipy 10 | - pyqt<5.15 11 | - ipython 12 | - qtconsole 13 | - ipykernel 14 | - imageio 15 | - pyyaml 16 | - pandas 17 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | 20 | import eidolon 21 | import multiprocessing 22 | 23 | #eidolon.configEnviron() # configure environment variables before attempting to load plugins 24 | 25 | # necessary for now to include plugins here for multiprocessing 26 | import eidolon.plugins.X4DFPlugin 27 | import eidolon.plugins.CheartPlugin 28 | import eidolon.plugins.DicomPlugin 29 | import eidolon.plugins.NiftiPlugin 30 | import eidolon.plugins.MetaImagePlugin 31 | import eidolon.plugins.VTKPlugin 32 | import eidolon.plugins.MeditPlugin 33 | import eidolon.plugins.STLPlugin 34 | import eidolon.plugins.NRRDPlugin 35 | import eidolon.plugins.ParRecPlugin 36 | import eidolon.plugins.ImageStackPlugin 37 | import eidolon.plugins.SlicePlugin 38 | import eidolon.plugins.PlotPlugin 39 | import eidolon.plugins.SegmentPlugin 40 | import eidolon.plugins.ReportCardPlugin 41 | import eidolon.plugins.MeasurementPlugin 42 | import eidolon.plugins.CardiacMotionPlugin 43 | import eidolon.plugins.ImageAlignPlugin 44 | #import eidolon.plugins.CTMotionTrackPlugin 45 | import eidolon.plugins.DeformPlugin 46 | 47 | if __name__ == '__main__': # needed for Windows multiprocessing (unless you want fork bombs) 48 | multiprocessing.freeze_support() 49 | eidolon.defaultMain() 50 | 51 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy>=1.8 2 | scipy>=0.13 3 | six 4 | pyqt5 5 | ipython 6 | qtconsole 7 | ipykernel==4.10 8 | imageio 9 | pandas 10 | coverage -------------------------------------------------------------------------------- /res/ArchivoBlack.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/ArchivoBlack.otf -------------------------------------------------------------------------------- /res/BaseImage.cg: -------------------------------------------------------------------------------- 1 | 2 | #include "UtilRoutines.cg" 3 | float4 main 4 | ( 5 | uniform sampler3D dataTex, 6 | uniform sampler2D specTex, 7 | //uniform float4 texSize, 8 | uniform float3 v0, 9 | uniform float3 v1, 10 | uniform float3 v2, 11 | uniform float3 v3, 12 | uniform float3 v4, 13 | uniform float3 v7, 14 | uniform float3 planept, 15 | uniform float3 planenorm, 16 | uniform float3 planeright, 17 | uniform float planemode, 18 | uniform float boxmode, 19 | in float3 texCoord : TEXCOORD0 20 | ) : COLOR0 21 | { 22 | float4 res=float4(0,0,0,0); 23 | 24 | if(inOBBVerts(texCoord,v0,v1,v2,v3,v4,v7,boxmode) && inPlane(texCoord,planept,planenorm,planeright,planemode)){ 25 | res=tex3D(dataTex,texCoord); 26 | float a=res.a; 27 | res=tex2D(specTex,res.rr); 28 | res.a*=a; 29 | } 30 | return res; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /res/BaseImage2D.cg: -------------------------------------------------------------------------------- 1 | 2 | #include "UtilRoutines.cg" 3 | float4 main 4 | ( 5 | uniform sampler2D dataTex, 6 | uniform sampler2D specTex, 7 | in float3 texCoord : TEXCOORD0 8 | ) : COLOR 9 | { 10 | float4 res=tex2D(dataTex,texCoord.xy); 11 | float a=res.a; 12 | res=tex2D(specTex,res.rr); 13 | res.a*=a; 14 | return res; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /res/DefaultUIStyle.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | http://doc.qt.io/qt-5/stylesheet-reference.html 4 | http://doc.qt.io/qt-5/stylesheet-examples.html 5 | 6 | change stylesheet in console: mgr.callThreadSafe(getUIApp().setStyleSheet,open('res/DefaultUIStyle.css').read()) 7 | */ 8 | 9 | QWidget { 10 | background-color: rgb(100, 100, 100); 11 | alternate-background-color: rgb(120, 120, 120); 12 | color:rgb(240, 240, 240); 13 | } 14 | 15 | QWidget::item:selected, QWidget::tab:selected, QWidget::section { 16 | background-color: rgb(120, 120, 120); 17 | } 18 | 19 | QWidget::tab:!selected{ 20 | background-color: rgb(100, 100, 100); 21 | } 22 | 23 | QToolTip { 24 | background-color: rgb(120, 120, 120); 25 | border: 0px; 26 | color:rgb(240, 240, 240); 27 | } 28 | 29 | QAbstractItemView { 30 | background-color: rgb(100, 100, 100); 31 | color:rgb(240, 240, 240); 32 | padding:0; 33 | } 34 | 35 | QMenuBar::item { 36 | background-color: rgb(0, 0, 0,0); 37 | } 38 | 39 | QTextEdit,QLineEdit,QPlainTextEdit { 40 | color: #000; 41 | background-color: rgb(200, 200, 200); 42 | } 43 | 44 | QPushButton, QSpinBox, QDoubleSpinBox,QComboBox { 45 | border-radius: 6; 46 | padding: 1px 1px 1px 1px; 47 | border : 1px solid rgb(215, 128, 26); /*rgb(140,140,140);*/ 48 | } 49 | 50 | .QPushButton { 51 | padding: 1px 10px 1px 10px; 52 | } 53 | 54 | QPushButton:pressed { 55 | background-color: rgb(120, 120, 120); 56 | } 57 | 58 | QComboBox { 59 | padding-left: 3px; 60 | } 61 | 62 | QComboBox QAbstractItemView { 63 | selection-background-color: rgb(120, 120, 120); 64 | } 65 | 66 | QComboBox::drop-down { 67 | width: 16px; 68 | border: 0px; 69 | } 70 | 71 | QComboBox::down-arrow { 72 | image: url(:/icons/down.png); 73 | width:16px; 74 | height: 10px; 75 | } 76 | 77 | QComboBox::down-arrow:on { /* shift the arrow when popup is open */ 78 | top: 1px; 79 | left: 1px; 80 | } 81 | 82 | QGroupBox { 83 | padding: 0px; 84 | padding-top: 10px; 85 | padding-left:5px; 86 | border-radius:6; 87 | border: 1px solid rgb(150, 90, 18); /*rgb(75, 75, 75);*/ 88 | } 89 | 90 | QFrame[frameShape="4"], QFrame[frameShape="5"]{ 91 | color:rgb(150, 90, 18); 92 | } 93 | 94 | QStatusBar::item { 95 | border-color: None; 96 | } 97 | 98 | QCheckBox,QGroupBox, QRadioButton { 99 | background-color: rgb(95, 95, 95); 100 | } 101 | 102 | QGroupBox::title { 103 | subcontrol-origin: padding; 104 | subcontrol-position: top left; 105 | padding-top: -1px; 106 | padding-left:1px; 107 | background: transparent; 108 | color: white; 109 | } 110 | 111 | QLabel { 112 | color: rgb(200, 200, 200); 113 | background-color: None; 114 | } 115 | 116 | QToolBox::tab::selected { 117 | color:white; 118 | font:italic bold; 119 | } 120 | 121 | QGroupBox::indicator 122 | { 123 | border: 1px solid rgb(150, 90, 18); 124 | background-color: rgb(95, 95, 95); 125 | } 126 | 127 | QCheckBox::indicator, QRadioButton::indicator 128 | { 129 | border: 1px solid rgb(95,95,95); /*rgb(215, 128, 26);*/ 130 | background-color: rgb(95, 95, 95); 131 | } 132 | 133 | QCheckBox::indicator:checked, QGroupBox::indicator:checked, QRadioButton::indicator:checked 134 | { 135 | image:url(:/icons/checkbox.png); 136 | padding: 1px; 137 | } 138 | 139 | QCheckBox::indicator:!checked, QGroupBox::indicator:!checked, QRadioButton::indicator:!checked 140 | { 141 | image:url(:/icons/uncheckbox.png); 142 | padding: 1px; 143 | } 144 | 145 | QGroupBox::indicator:disabled, QCheckBox::indicator:disabled, QRadioButton::indicator:disabled 146 | { 147 | border: 1px solid rgb(50, 50, 50); 148 | background-color: rgb(50, 50, 50); 149 | } 150 | 151 | QDockWidget 152 | { 153 | titlebar-close-icon: url(:/icons/close.png); 154 | titlebar-normal-icon: url(:/icons/down.png); 155 | } 156 | 157 | QDockWidget::title { 158 | background-color: rgb(100,100,100); 159 | text-align: left; 160 | } 161 | 162 | QDockWidget::close-button, QDockWidget::float-button 163 | { 164 | background-color: rgb(255,255,255,0); 165 | } 166 | 167 | QSpinBox::up-button, QDoubleSpinBox::up-button, QSpinBox::down-button, QDoubleSpinBox::down-button 168 | { 169 | height: 10px; 170 | border: 0px solid black; 171 | } 172 | 173 | QSpinBox::up-arrow,QDoubleSpinBox::up-arrow 174 | { 175 | image: url(:/icons/up.png); 176 | width: 8px; 177 | height: 8px; 178 | } 179 | 180 | QSpinBox::down-arrow,QDoubleSpinBox::down-arrow 181 | { 182 | image: url(:/icons/down.png); 183 | width: 8px; 184 | height: 8px; 185 | } 186 | -------------------------------------------------------------------------------- /res/Resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | cube.png 4 | eye.png 5 | eye-disabled.png 6 | image.png 7 | stats-bars.png 8 | document.png 9 | help-circled.png 10 | scissors.png 11 | stop.png 12 | play.png 13 | plus-round.png 14 | minus-round.png 15 | camera.png 16 | gear-b.png 17 | wrench.png 18 | close.png 19 | trash-a.png 20 | nametag.png 21 | clone.png 22 | seg.png 23 | checkbox.png 24 | uncheckbox.png 25 | down.png 26 | up.png 27 | close-circled.png 28 | clipboard.png 29 | skip-forward.png 30 | skip-backward.png 31 | chevron-left.png 32 | chevron-right.png 33 | 34 | 35 | -------------------------------------------------------------------------------- /res/Vegur-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/Vegur-Regular.otf -------------------------------------------------------------------------------- /res/arrow.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/arrow.tif -------------------------------------------------------------------------------- /res/arrow4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/arrow4.png -------------------------------------------------------------------------------- /res/basicTex.cg: -------------------------------------------------------------------------------- 1 | 2 | void main 3 | ( 4 | uniform sampler3D dataTex, 5 | uniform float4 texSize, 6 | in float3 texCoord : TEXCOORD0, 7 | in float3 pos : POSITION, 8 | out float4 color : COLOR 9 | ) 10 | { 11 | color=tex3D(dataTex,texCoord); 12 | color.a=color.a*0.1; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /res/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/camera.png -------------------------------------------------------------------------------- /res/checkbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/checkbox.png -------------------------------------------------------------------------------- /res/chevron-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/chevron-left.png -------------------------------------------------------------------------------- /res/chevron-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/chevron-right.png -------------------------------------------------------------------------------- /res/clipboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/clipboard.png -------------------------------------------------------------------------------- /res/clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/clone.png -------------------------------------------------------------------------------- /res/close-circled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/close-circled.png -------------------------------------------------------------------------------- /res/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/close.png -------------------------------------------------------------------------------- /res/cube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/cube.png -------------------------------------------------------------------------------- /res/depthtransfer.cg: -------------------------------------------------------------------------------- 1 | 2 | void main 3 | ( 4 | uniform sampler3D dataTex, 5 | uniform float4 texSize, 6 | in float3 texCoord : TEXCOORD0, 7 | in float4 camPos : TEXCOORD3, 8 | in float4 pos : TEXCOORD5, 9 | out float4 color : COLOR 10 | ) 11 | { 12 | //color=tex3D(dataTex,texCoord); 13 | //color.a=color.a*0.1; 14 | //color.rgb=pos.www; 15 | color.rgb=1-length(camPos-pos); 16 | color.a=1.0; 17 | } -------------------------------------------------------------------------------- /res/document.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/document.png -------------------------------------------------------------------------------- /res/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/down.png -------------------------------------------------------------------------------- /res/eye-disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/eye-disabled.png -------------------------------------------------------------------------------- /res/eye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/eye.png -------------------------------------------------------------------------------- /res/fonts.fontdef: -------------------------------------------------------------------------------- 1 | Archivo-8 2 | { 3 | type truetype 4 | source ArchivoBlack.otf 5 | size 8 6 | resolution 96 7 | } 8 | 9 | Archivo-12 10 | { 11 | type truetype 12 | source ArchivoBlack.otf 13 | size 12 14 | resolution 96 15 | } 16 | 17 | Archivo-16 18 | { 19 | type truetype 20 | source ArchivoBlack.otf 21 | size 16 22 | resolution 96 23 | } 24 | 25 | Archivo-24 26 | { 27 | type truetype 28 | source ArchivoBlack.otf 29 | size 24 30 | resolution 96 31 | } 32 | 33 | DefaultFont 34 | { 35 | type truetype 36 | source Vegur-Regular.otf 37 | size 24 38 | resolution 96 39 | } 40 | -------------------------------------------------------------------------------- /res/gear-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/gear-b.png -------------------------------------------------------------------------------- /res/help-circled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/help-circled.png -------------------------------------------------------------------------------- /res/hijackVP.cg: -------------------------------------------------------------------------------- 1 | struct VertIn { 2 | float4 pos : POSITION; 3 | float4 tex : TEXCOORD0; 4 | float4 color : COLOR0; 5 | }; 6 | 7 | struct VertOut { 8 | float4 pos : POSITION; 9 | float4 tex : TEXCOORD0; 10 | float4 coord1 : TEXCOORD1; 11 | float4 coord2 : TEXCOORD2; 12 | float4 coord3 : TEXCOORD3; 13 | float4 coord4 : TEXCOORD4; 14 | float4 coord5 : TEXCOORD5; 15 | float4 color : COLOR0; 16 | }; 17 | 18 | VertOut main(VertIn IN, uniform float2 depthRange, uniform float4x4 worldView,uniform float4x4 worldViewProj, uniform float4x4 world,uniform float4 camPos,uniform float4 lightPos,uniform float4 lightDir) { 19 | VertOut OUT; 20 | OUT.pos = mul(worldViewProj, IN.pos); // transform the position to screen coordinates 21 | OUT.coord1 = lightPos; 22 | OUT.coord2 = lightDir; 23 | OUT.coord3 = camPos; 24 | OUT.coord4 = mul(world,IN.pos); // transform the position to world coordinates and store in the hijacked tex coord 25 | OUT.coord5 = OUT.pos; 26 | OUT.coord5.w = (mul(worldViewProj, IN.pos).z-depthRange.x)/(depthRange.y-depthRange.x); 27 | OUT.tex = IN.tex; // copy over texture coord 28 | OUT.color = IN.color; // copy over color 29 | return OUT; 30 | } 31 | -------------------------------------------------------------------------------- /res/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/image.png -------------------------------------------------------------------------------- /res/minus-round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/minus-round.png -------------------------------------------------------------------------------- /res/nametag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/nametag.png -------------------------------------------------------------------------------- /res/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/play.png -------------------------------------------------------------------------------- /res/plus-round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/plus-round.png -------------------------------------------------------------------------------- /res/scissors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/scissors.png -------------------------------------------------------------------------------- /res/seg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/seg.png -------------------------------------------------------------------------------- /res/skip-backward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/skip-backward.png -------------------------------------------------------------------------------- /res/skip-forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/skip-forward.png -------------------------------------------------------------------------------- /res/stats-bars.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/stats-bars.png -------------------------------------------------------------------------------- /res/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/stop.png -------------------------------------------------------------------------------- /res/trash-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/trash-a.png -------------------------------------------------------------------------------- /res/uncheckbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/uncheckbox.png -------------------------------------------------------------------------------- /res/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/up.png -------------------------------------------------------------------------------- /res/wrench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/res/wrench.png -------------------------------------------------------------------------------- /run.bat: -------------------------------------------------------------------------------- 1 | @ECHO off 2 | 3 | SET APPDIR=%~dp0 4 | 5 | :: Pull out the Python install path we're using from the registry, looking first in the current user settings then in the local machine 6 | :: If this gets the wrong value when there's multiple Python installs, you'll have to set InstallPath manually 7 | 8 | FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY HKCU\Software\Python\PythonCore\3.7\InstallPath 2^>NUL') DO SET InstallPath=%%B 9 | 10 | IF "%InstallPath%" == "" FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY HKLM\SOFTWARE\Python\PythonCore\3.7\InstallPath 2^>nul') DO SET InstallPath=%%B 11 | 12 | IF "%InstallPath%" == "" FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY HKCU\Software\Python\PythonCore\3.6\InstallPath 2^>NUL') DO SET InstallPath=%%B 13 | 14 | IF "%InstallPath%" == "" FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY HKLM\SOFTWARE\Python\PythonCore\3.6\InstallPath 2^>nul') DO SET InstallPath=%%B 15 | 16 | :: Choose a default value if no registry key is present 17 | IF [%InstallPath%] == [] SET InstallPath=C:\Python37\ 18 | 19 | :: PATH is needed for the DLL the render links to and the renderer plugin DLLs 20 | SET PATH=%APPDIR%\eidolon\EidolonLibs\win64_mingw\bin;%PATH% 21 | 22 | :: set the Anaconda paths, if the PATH variable isn't set this is needed, if using other distributions you'll have to change this to include your DLLs 23 | SET PATH=%PATH%;%InstallPath%;%InstallPath%\Library\mingw-w64\bin;%InstallPath%\Library\usr\bin;%InstallPath%\Library\bin;%InstallPath%\Scripts;%InstallPath%\bin;%InstallPath%\condabin 24 | 25 | %InstallPath%\python.exe "%APPDIR%main.py" %* 26 | 27 | :: Alternative way of starting Eidolon without a script window hanging around 28 | :: START %InstallPath%\pythonw.exe %APPDIR%main.py %* 29 | :: EXIT 30 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # Determine file directory (http://stackoverflow.com/a/246128) 4 | function getFileDir() { 5 | src=$1 6 | while [ -h "$src" ]; do # resolve $src until the file is no longer a symlink 7 | dir="$( cd -P "$( dirname "$src" )" && pwd )" 8 | src="$(readlink "$src")" 9 | # if $src was a relative symlink, we need to resolve it relative to the path where the symlink file was located 10 | [[ $src != "/*" ]] && src="$dir/$src" 11 | done 12 | dir="$( cd -P "$( dirname "$src" )" && pwd )" 13 | 14 | echo $dir 15 | } 16 | 17 | # directory of this script 18 | export APPDIR=$(getFileDir "${BASH_SOURCE[0]}") 19 | 20 | export LIBSDIR="$APPDIR/eidolon/EidolonLibs" 21 | export DYLD_FRAMEWORK_PATH=$LIBSDIR/osx/bin 22 | 23 | export PYTHONPATH=$([ -z "$PYTHONPATH" ] && echo "$APPDIR" || echo "$PYTHONPATH:$APPDIR") 24 | #export LD_LIBRARY_PATH=$LIBSDIR/linux/bin:$LIBSDIR/IRTK:$LD_LIBRARY_PATH 25 | 26 | # generated executable, run this instead of the script 27 | if [ -f "$APPDIR/Eidolon" ] 28 | then 29 | LD_LIBRARY_PATH="$APPDIR:$LD_LIBRARY_PATH" "$APPDIR/Eidolon" "$@" 30 | exit $? 31 | fi 32 | 33 | # Windows Cygwin or Msys shell 34 | if [ "$(uname -o 2>/dev/null)" == "Cygwin" ] || [ "$(uname -o 2>/dev/null)" == "Msys" ] 35 | then 36 | "$APPDIR/run.bat" $@ 37 | exit $? 38 | fi 39 | 40 | python "$APPDIR/main.py" "$@" 41 | 42 | -------------------------------------------------------------------------------- /tests/.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | 3 | source= 4 | ../src 5 | 6 | omit= 7 | *_rc4.py 8 | *_rc5.py 9 | */__init__.py 10 | */setup.py -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | # Eidolon Tests 2 | 3 | This directory contains tests for Eidolon, both interactive tests run manually and Nose run unit tests. 4 | To run an interactive test, start Eidolon with one of the script files in **imagetests** or **meshtests**. 5 | For example: 6 | 7 | ../run.sh meshtests/tritest.py 8 | 9 | To run the unit tests with unittest execute the **rununittests.py** script in Eidolon: 10 | 11 | ../run.sh rununittests.py 12 | 13 | The script **run_coverage.sh** starts Eidolon with code coverage enabled through Coverage.py. 14 | This can be run with the included tests to measure line coverage: 15 | 16 | ./run_coverage.sh /meshtests/*.py 17 | 18 | The script will create the **.coverage** file and update it thereafter everytime it's run. This file will have to be 19 | deleted to start a new coverage testing series. 20 | 21 | -------------------------------------------------------------------------------- /tests/TestUtils.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | '''Test utility routines used by scripts in the included test subdirectories.''' 20 | 21 | import math 22 | import random 23 | import eidolon 24 | from eidolon import vec3,timing, ElemType, GeomType, frange, listToMatrix 25 | 26 | 27 | epsilon=1e-10 # separate value that can be tweaked for tests only 28 | halfpi=math.pi/2 29 | quartpi=math.pi/4 30 | 31 | 32 | def eq_(a,b,msg=None): 33 | assert a==b, msg or '%r != %r' % (a, b) 34 | 35 | def neq_(a,b,msg=None): 36 | assert a!=b, msg or '%r == %r' % (a, b) 37 | 38 | 39 | def eqa_(a,b,msg=None): 40 | assert abs(a-b)<=epsilon, msg or '%r != %r' % (a, b) 41 | 42 | 43 | def eqas_(a,b,msg=None): 44 | assert all(abs(i-j)<=epsilon for i,j in zip(a,b)), msg or '%r != %r' % (a, b) 45 | 46 | 47 | def randnums(num,minv,maxv): 48 | return tuple(random.triangular(minv,maxv) for _ in range(num)) 49 | 50 | 51 | def randangle(): 52 | return random.triangular(-math.pi*2,math.pi*2) 53 | 54 | 55 | @timing 56 | def generateTestMeshDS(etname,refine,pt=vec3(0.25)): 57 | et=ElemType[etname] 58 | 59 | if et.geom in (GeomType._Hex, GeomType._Tet): 60 | dividefunc=eidolon.divideHextoTet if et.geom==GeomType._Tet else eidolon.divideHextoHex 61 | nodes=eidolon.listSum(dividefunc(et.order,refine)) 62 | inds=list(eidolon.group(list(range(len(nodes))),len(et.xis))) 63 | 64 | nodes,ninds,_=eidolon.reduceMesh(listToMatrix([vec3(*n) for n in nodes],'nodes'),[listToMatrix(inds,'inds',etname)]) 65 | dist=[nodes.getAt(n).distTo(pt) for n in range(len(nodes))] 66 | diff=[tuple(nodes.getAt(n)-pt) for n in range(len(nodes))] 67 | 68 | elif et.geom == GeomType._Tri: 69 | nodes,inds=eidolon.generateSphere(refine) 70 | dist=[n.distTo(pt) for n in nodes] 71 | diff=[tuple(n-pt) for n in nodes] 72 | ninds=[('inds',ElemType._Tri1NL,inds)] 73 | 74 | ds=eidolon.PyDataSet('TestDS',nodes,ninds,[('dist',dist,'inds'),('diff',diff,'inds')]) 75 | ds.validateDataSet() 76 | return ds 77 | 78 | 79 | def generateArrowDS(refine): 80 | nodes,inds=eidolon.generateArrow(refine) 81 | ds=eidolon.PyDataSet('TestDS',nodes,[('inds',ElemType._Tri1NL,inds)]) 82 | ds.validateDataSet() 83 | return ds 84 | 85 | 86 | def generateTimeSphereImages(step,dim=50): 87 | images=[] 88 | steps=frange(0,1.0+step,step) 89 | for i in steps: 90 | ii=math.sin(i*math.pi*2) 91 | stepimgs=eidolon.generateSphereImageStack(dim,dim,dim,vec3(0.5,0.5,0.5),vec3(0.25+0.2*ii,0.25,0.25)) 92 | for s in stepimgs: 93 | s.timestep=i*500 94 | 95 | images+=stepimgs 96 | 97 | return images 98 | 99 | 100 | def generateTimeSphereMeshes(step,dim=50): 101 | dds=[] 102 | steps=list(frange(0,1.0+step,step)) 103 | for i in steps: 104 | i=math.sin(i*math.pi*2) 105 | ds=generateTestMeshDS(ElemType._Tri1NL,5) 106 | nodes=ds.getNodes() 107 | nodes.mul(vec3(0.25+0.2*i,0.25,0.25)) 108 | nodes.mul(dim) 109 | nodes.add(vec3(dim+1)*vec3(0.5,-0.5,0.5)) 110 | 111 | dist=ds.getDataField('dist') 112 | for n in range(dist.n()): 113 | dist.setAt(nodes.getAt(n).distTo(vec3(0.25)*dim),n) 114 | 115 | dds.append(ds) 116 | 117 | return dds,[s*500 for s in steps] 118 | -------------------------------------------------------------------------------- /tests/imagetests/2dmeshtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ImageSceneObject,ElemType,ReprType 23 | from TestUtils import generateTimeSphereImages,generateTimeSphereMeshes 24 | 25 | step=0.1 26 | 27 | images=generateTimeSphereImages(step) 28 | obj=ImageSceneObject('Sphere',[],images) 29 | mgr.addSceneObject(obj) 30 | 31 | rep=obj.createRepr(ReprType._imgtimestack) 32 | mgr.addSceneObjectRepr(rep) 33 | 34 | dds,steps=generateTimeSphereMeshes(step) 35 | obj1=MeshSceneObject('Sphere',dds) 36 | obj1.setTimestepList(steps) 37 | mgr.addSceneObject(obj1) 38 | 39 | rep1=obj1.createRepr(ReprType._volume,0) 40 | mgr.addSceneObjectRepr(rep1) 41 | rep1.applyMaterial('Rainbow',field='dist') 42 | 43 | d=mgr.create2DView() 44 | 45 | @mgr.callThreadSafe 46 | def _set(): 47 | d.setSecondary(rep1.getName(),True) 48 | d.setImageStackPosition(24) 49 | 50 | mgr.setCameraSeeAll() 51 | -------------------------------------------------------------------------------- /tests/imagetests/2dtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ImageSceneObject, generateSphereImageStack, ReprType,delayedcall 20 | 21 | images=generateSphereImageStack(50,50,50) 22 | obj=ImageSceneObject('Sphere',[],images) 23 | mgr.addSceneObject(obj) 24 | 25 | rep=obj.createRepr(ReprType._imgstack) 26 | mgr.addSceneObjectRepr(rep) 27 | 28 | mgr.setCameraSeeAll() 29 | 30 | d1=mgr.create2DView() 31 | mgr.callThreadSafe(d1.setImageStackPosition,25) 32 | 33 | d2=mgr.create2DView() 34 | mgr.callThreadSafe(d2.setImageStackPosition,25) 35 | 36 | # TODO: fix the crash problem this is causing 37 | ## wait for 1 second, remove the second 2d window and then add a third 38 | #@mgr.addFuncTask 39 | #@delayedcall(1.0) 40 | #def _remove(): 41 | # d2.parentWidget().close() 42 | # d3=mgr.create2DView() 43 | # d3.setImageStackPosition(25) 44 | -------------------------------------------------------------------------------- /tests/imagetests/2dvolumetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ImageSceneObject, generateSphereImageStack, ReprType,vec3 20 | 21 | images=generateSphereImageStack(50,50,50) 22 | obj=ImageSceneObject('Sphere',[],images) 23 | mgr.addSceneObject(obj) 24 | 25 | rep1=obj.createRepr(ReprType._imgvolume) 26 | mgr.addSceneObjectRepr(rep1) 27 | 28 | mgr.callThreadSafe(rep1.applySpectrum,mgr.getSpectrum('BW')) 29 | 30 | rep1.setPosition(vec3(5,-10,-4)) 31 | rep1.setRotation(0.1,0.2,-0.12) 32 | 33 | #rep2=obj.createRepr(ReprType._imgstack) 34 | #mgr.addSceneObjectRepr(rep2) 35 | # 36 | #rep2.setPosition(vec3(5,-10,-4)) 37 | #rep2.setRotation(0.1,0.2,-0.12) 38 | 39 | mgr.setCameraSeeAll() 40 | 41 | d1=mgr.create2DView() 42 | mgr.callThreadSafe(d1.setImageStackPosition,250) 43 | -------------------------------------------------------------------------------- /tests/imagetests/arrayimagetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import * 20 | import numpy as np 21 | 22 | w=11 23 | h=13 24 | d=17 25 | t=5 26 | 27 | # construct an array with unique incrementing values in incrementing indices 28 | arr=np.fromfunction(lambda i,j,k,l:i+(j*w)+(k*w*h)+(l*w*h*d),(w,h,d,t)) 29 | 30 | assert arr[0,0,0,0]==0 31 | assert arr[w-1,0,0,0]==w-1 32 | assert arr[w-1,1,0,0]==w-1+w 33 | 34 | o=ImgPlugin.createObjectFromArray('arraytest',arr) 35 | mgr.addSceneObject(o) 36 | 37 | assert o.images[0].img[0,0]==0 38 | assert o.images[0].img[0,w-1]==w-1 39 | assert o.images[0].img[1,w-1]==w-1+w 40 | 41 | with processImageNp(o) as mat: # check the original and reproduced arrays are identical 42 | assert arr.ndim==mat.ndim 43 | assert all(s1==s2 for s1,s2 in zip(mat.shape,arr.shape)) 44 | assert np.all(arr==mat) 45 | 46 | 47 | rep=o.createRepr(ReprType._imgtimestack) 48 | mgr.addSceneObjectRepr(rep) 49 | 50 | mgr.setCameraSeeAll() 51 | -------------------------------------------------------------------------------- /tests/imagetests/basicimagetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ReprType 20 | 21 | obj=ImgPlugin.createTestImage(51,52,53) 22 | mgr.addSceneObject(obj) 23 | 24 | rep=obj.createRepr(ReprType._imgstack) 25 | mgr.addSceneObjectRepr(rep) 26 | 27 | rep.useTexFiltering(False) 28 | 29 | mgr.setCameraSeeAll() 30 | -------------------------------------------------------------------------------- /tests/imagetests/dicomloadtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ReprType,AxesType 20 | 21 | dds=Dicom.loadDirDataset(scriptdir+'/../../tutorial/DicomData') # load the Dicom files from this directory, returns a DicomDataset object 22 | 23 | series='1.3.6.1.4.1.9590.100.1.1.2375764972290531328210423958986997132495' # series UID values are stored in the Dicom files 24 | 25 | obj=Dicom.loadSeries(series) # load the series, this produces a ImageSceneObject object 26 | -------------------------------------------------------------------------------- /tests/imagetests/extendtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | from eidolon import ReprType,ImageSceneObject,extendImage 22 | from TestUtils import generateTimeSphereImages 23 | 24 | step=0.1 25 | dim=30 26 | mx=2 27 | my=3 28 | mz=4 29 | fillVal=3.0 30 | 31 | images=generateTimeSphereImages(step,dim) 32 | obj=ImageSceneObject('Sphere',[],images) 33 | mgr.addSceneObject(obj) 34 | 35 | obj1=extendImage(obj,'ext',mx,my,mz,fillVal) 36 | mgr.addSceneObject(obj1) 37 | 38 | rep=obj1.createRepr(ReprType._imgtimestack) 39 | mgr.addSceneObjectRepr(rep) 40 | 41 | mgr.setCameraSeeAll() 42 | -------------------------------------------------------------------------------- /tests/imagetests/orienttest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ReprType,vec3, rotator,generateArrow,halfpi, MeshSceneObject,TriDataSet,AxesType 20 | 21 | pos=vec3(-10,20,-15) 22 | rot=rotator(0.1,-0.2,0.13) 23 | w,h,d=31,42,53 24 | 25 | nodesz,indsz=generateArrow(5) 26 | nodesz=[(n+vec3.Z())*vec3(w,d,h)*vec3(0.1,0.1,0.5) for n in nodesz] 27 | nodesx=[rotator(vec3(0,1,0),halfpi)*n for n in nodesz] 28 | nodesy=[rotator(vec3(1,0,0),-halfpi)*n for n in nodesz] 29 | 30 | nodes=[(rot*n)+pos for n in (nodesx+nodesy+nodesz)] 31 | nlen=len(nodesz) 32 | indices=indsz+[(i+nlen,j+nlen,k+nlen) for i,j,k in indsz]+[(i+nlen*2,j+nlen*2,k+nlen*2) for i,j,k in indsz] 33 | field=[2.0]*nlen+[1.0]*nlen+[0.0]*nlen 34 | 35 | axes=MeshSceneObject('Axes',TriDataSet('tris',nodes,indices,[('col',field)])) 36 | mgr.addSceneObject(axes) 37 | 38 | arep=axes.createRepr(ReprType._volume) 39 | mgr.addSceneObjectRepr(arep) 40 | arep.applyMaterial('Rainbow',field='col') 41 | 42 | 43 | obj=ImgPlugin.createTestImage(w,d,h,1,pos,rot) 44 | mgr.addSceneObject(obj) 45 | 46 | rep=obj.createRepr(ReprType._imgstack) 47 | mgr.addSceneObjectRepr(rep) 48 | 49 | rep.useTexFiltering(False) 50 | 51 | mgr.setCameraSeeAll() 52 | mgr.setAxesType(AxesType._cornerTL) 53 | 54 | d=mgr.create2DView() 55 | 56 | @mgr.callThreadSafe 57 | def _set(): 58 | d.setSecondary(arep.getName(),True) 59 | d.setImageStackPosition(1) 60 | -------------------------------------------------------------------------------- /tests/imagetests/realloctest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | from eidolon import ReprType,ImageSceneObject,extendImage 22 | from TestUtils import generateTimeSphereImages 23 | 24 | step=0.1 25 | dim=50 26 | 27 | # create an object and repr with a particular name 28 | 29 | images=generateTimeSphereImages(step,dim) 30 | obj=ImageSceneObject('Sphere',[],images) 31 | mgr.addSceneObject(obj) 32 | 33 | rep=obj.createRepr(ReprType._imgtimevolume) 34 | mgr.addSceneObjectRepr(rep) 35 | 36 | del obj 37 | del rep 38 | 39 | mgr.clearScene() # this should free up existing objects 40 | 41 | # attempt to create an object and repr with the same name as the above, this will crash if the repr doesn't choose unique names for materials, textures, etc. 42 | 43 | images=generateTimeSphereImages(step,dim) 44 | obj=ImageSceneObject('Sphere',[],images) 45 | mgr.addSceneObject(obj) 46 | 47 | rep=obj.createRepr(ReprType._imgtimevolume) 48 | mgr.addSceneObjectRepr(rep) 49 | 50 | mgr.setCameraSeeAll() 51 | -------------------------------------------------------------------------------- /tests/imagetests/sliceboxtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | from eidolon import ReprType,ImageSceneObject,vec3,rotator,PT_FRAGMENT 22 | from TestUtils import generateTimeSphereImages 23 | 24 | step=0.1 25 | 26 | images=generateTimeSphereImages(step) 27 | obj=ImageSceneObject('Sphere',[],images) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._imgtimestack) 31 | mgr.addSceneObjectRepr(rep) 32 | rep.setPosition(vec3(5,-10,-4)) 33 | rep.setRotation(0.1,0.2,-0.12) 34 | 35 | rep1=obj.createRepr(ReprType._imgtimevolume) 36 | mgr.addSceneObjectRepr(rep1) 37 | rep1.setPosition(vec3(61,6,8)) 38 | rep1.setRotation(-0.1,-0.13,0.22) 39 | 40 | obj1 = SlicePlugin.createSliceBox(vec3(55.5,-25.0,24.5),vec3(25.0),(0, 0.33495133768504726, 0.22227234443175778)) 41 | mgr.addSceneObject(obj1) 42 | 43 | rep2 = obj1.createRepr(ReprType._line) 44 | mgr.addSceneObjectRepr(rep2) 45 | mgr.showHandle(rep2,True) 46 | 47 | obj1.setApplyToRepr(rep) 48 | obj1.setApplyToRepr(rep1) 49 | 50 | mgr.setCameraSeeAll() 51 | -------------------------------------------------------------------------------- /tests/imagetests/sliceplaneboxtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | from eidolon import ReprType,ImageSceneObject,vec3 22 | from TestUtils import generateTimeSphereImages 23 | 24 | step=0.1 25 | 26 | images=generateTimeSphereImages(step) 27 | obj=ImageSceneObject('Sphere',[],images) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._imgtimestack) 31 | mgr.addSceneObjectRepr(rep) 32 | rep.setPosition(vec3(5,-10,-4)) 33 | rep.setRotation(0.1,0.2,-0.12) 34 | 35 | rep1=obj.createRepr(ReprType._imgtimevolume) 36 | mgr.addSceneObjectRepr(rep1) 37 | rep1.setPosition(vec3(61,6,8)) 38 | rep1.setRotation(-0.1,-0.13,0.22) 39 | 40 | obj1 = SlicePlugin.createSlicePlane(vec3(49.5,-25.0,24.5),vec3(-0.128762689557,-0.782178248535,0.60960426286)) 41 | mgr.addSceneObject(obj1) 42 | 43 | rep2 = obj1.createRepr(ReprType._line) 44 | mgr.addSceneObjectRepr(rep2) 45 | mgr.showHandle(rep2,True) 46 | 47 | obj1.setApplyToRepr(rep) 48 | obj1.setApplyToRepr(rep1) 49 | 50 | obj2 = SlicePlugin.createSliceBox(vec3(55.5,-25.0,24.5),vec3(25.0),(0, 0.33495133768504726, 0.22227234443175778)) 51 | mgr.addSceneObject(obj2) 52 | 53 | rep3 = obj2.createRepr(ReprType._line) 54 | mgr.addSceneObjectRepr(rep3) 55 | mgr.showHandle(rep3,True) 56 | 57 | obj2.setApplyToRepr(rep) 58 | obj2.setApplyToRepr(rep1) 59 | 60 | 61 | mgr.setCameraSeeAll() 62 | -------------------------------------------------------------------------------- /tests/imagetests/sliceplanetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | from eidolon import ReprType,ImageSceneObject,vec3 22 | from TestUtils import generateTimeSphereImages 23 | 24 | step=0.1 25 | 26 | images=generateTimeSphereImages(step) 27 | obj=ImageSceneObject('Sphere',[],images) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._imgtimestack) 31 | mgr.addSceneObjectRepr(rep) 32 | rep.setPosition(vec3(5,-10,-4)) 33 | rep.setRotation(0.1,0.2,-0.12) 34 | 35 | rep1=obj.createRepr(ReprType._imgtimevolume) 36 | mgr.addSceneObjectRepr(rep1) 37 | rep1.setPosition(vec3(61,6,8)) 38 | rep1.setRotation(-0.1,-0.13,0.22) 39 | 40 | obj1 = SlicePlugin.createSlicePlane(vec3(49.5,-25.0,24.5),vec3(-0.128762689557,-0.782178248535,0.60960426286)) 41 | mgr.addSceneObject(obj1) 42 | 43 | rep2 = obj1.createRepr(ReprType._line) 44 | mgr.addSceneObjectRepr(rep2) 45 | mgr.showHandle(rep2,True) 46 | 47 | obj1.setApplyToRepr(rep) 48 | obj1.setApplyToRepr(rep1) 49 | 50 | mgr.setCameraSeeAll() 51 | -------------------------------------------------------------------------------- /tests/imagetests/sphereimagetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ReprType,generateSphereImageStack,ImageSceneObject,vec3 20 | 21 | images=generateSphereImageStack(50,50,50,vec3(0.5,0.5,1),vec3(0.45,0.45,0.9)) 22 | obj=ImageSceneObject('Sphere',[],images) 23 | mgr.addSceneObject(obj) 24 | 25 | rep=obj.createRepr(ReprType._imgvolume) 26 | mgr.addSceneObjectRepr(rep) 27 | 28 | mgr.setCameraSeeAll() 29 | -------------------------------------------------------------------------------- /tests/imagetests/timeimagetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | from eidolon import MeshSceneObject,ReprType,ImageSceneObject 22 | from TestUtils import generateTimeSphereImages,generateTimeSphereMeshes 23 | 24 | step=0.1 25 | 26 | images=generateTimeSphereImages(step) 27 | obj=ImageSceneObject('Sphere',[],images) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._imgtimestack) 31 | mgr.addSceneObjectRepr(rep) 32 | 33 | d=mgr.create2DView() 34 | 35 | mgr.callThreadSafe(d.setImageStackPosition,24) 36 | 37 | mgr.setCameraSeeAll() 38 | -------------------------------------------------------------------------------- /tests/meshtests/billboardtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import vec3, FT_BB_POINT, BoundBox, PyVertexBuffer 20 | 21 | nodes=[vec3(0,0,0),vec3(10.0/3,0,0),vec3(20.0/3,0,0),vec3(10,0,0)] 22 | fig=mgr.callThreadSafe(mgr.scene.createFigure,"testBB","Default",FT_BB_POINT) 23 | vb=PyVertexBuffer(nodes) 24 | fig.fillData(vb,None,True) 25 | mgr.controller.setSeeAllBoundBox(BoundBox(nodes)) 26 | mgr.repaint() 27 | -------------------------------------------------------------------------------- /tests/meshtests/catmullromtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import MeshSceneObject, ElemType, vec3, PyDataSet,ReprType,frange,successive 20 | 21 | 22 | et=ElemType.Line1PCR 23 | step=0.05 24 | limits=[(0,1)] 25 | 26 | ctrlnodes=[vec3(-1,0,1),vec3(0,0,0.5),vec3(0.75,0,0.75),vec3(1.2,0,-0.15)] 27 | 28 | nodeobj=MeshSceneObject('ctrlnodes',PyDataSet('ds',ctrlnodes)) 29 | mgr.addSceneObject(nodeobj) 30 | 31 | rep=nodeobj.createRepr(ReprType._glyph,glyphname='sphere',glyphscale=(0.5,0.5,0.5)) 32 | mgr.addSceneObjectRepr(rep) 33 | 34 | mgr.setCameraSeeAll() 35 | 36 | 37 | nodes=[et.applyBasis(ctrlnodes,xi,0,0,ul=len(ctrlnodes),limits=limits) for xi in frange(0,1+step,step)] 38 | inds=list(successive(range(len(nodes)))) 39 | 40 | lineobj=MeshSceneObject('line',PyDataSet('ds',nodes,[('lines',ElemType._Line1NL,inds)])) 41 | mgr.addSceneObject(lineobj) 42 | 43 | rep=lineobj.createRepr(ReprType._cylinder,0,radrefine=5,radius=0.01) 44 | mgr.addSceneObjectRepr(rep) 45 | -------------------------------------------------------------------------------- /tests/meshtests/cylindertest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import * 20 | 21 | m1=mgr.getMaterial('Default') 22 | 23 | nodes=[vec3(0.1,0.2,0.3),vec3(0.5,0.2,1),vec3(1,0.4,2)] 24 | inds=[(0,1,2)] 25 | field=[0.5,0.7,1.0] 26 | 27 | ds=PyDataSet('lineDS',nodes,[('lines',ElemType._Line2NL,inds)],[('field',field,'lines')]) 28 | 29 | obj=MeshSceneObject('line',ds) 30 | mgr.addSceneObject(obj) 31 | 32 | rep=obj.createRepr(ReprType._cylinder,30,radrefine=30,field='field') 33 | mgr.addSceneObjectRepr(rep) 34 | 35 | mgr.showBoundBox(rep) # draw a bound box around the vessels 36 | 37 | # apply material, the alpha function is a linear function on the field, ie. the field's value 38 | rep.applyMaterial(m1,field='field',alphafunc=UnitFunc.Linear) 39 | 40 | mgr.setCameraSeeAll() -------------------------------------------------------------------------------- /tests/meshtests/deformtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | 23 | from eidolon import MeshSceneObject,ElemType,ReprType 24 | from TestUtils import generateTestMeshDS 25 | 26 | ds=generateTestMeshDS(ElemType._Hex1NL,5) 27 | 28 | obj=MeshSceneObject('Hexes',ds) 29 | mgr.addSceneObject(obj) 30 | 31 | #rep=obj.createRepr(ReprType._volume) 32 | #mgr.addSceneObjectRepr(rep) 33 | #rep.applyMaterial('Rainbow',field='dist') 34 | 35 | de=Deform.createDeformObject() 36 | mgr.addSceneObject(de) 37 | 38 | de.setSourceObj(obj,3,3,3) 39 | 40 | 41 | 42 | #rep=de.createRepr(ReprType._line) 43 | #mgr.addSceneObjectRepr(rep) 44 | 45 | 46 | mgr.setCameraSeeAll() 47 | -------------------------------------------------------------------------------- /tests/meshtests/deletetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys,time 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType 23 | from TestUtils import generateTestMeshDS 24 | 25 | ds=generateTestMeshDS(ElemType._Tri1NL,5) 26 | 27 | obj=MeshSceneObject('Sphere',ds) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._volume,0) 31 | mgr.addSceneObjectRepr(rep) 32 | rep.applyMaterial('Rainbow',field='dist') 33 | 34 | mgr.setCameraSeeAll() 35 | 36 | time.sleep(1) 37 | 38 | mgr.removeSceneObjectRepr(rep) 39 | 40 | rep=obj.createRepr(ReprType._volume,0) 41 | mgr.addSceneObjectRepr(rep) 42 | rep.applyMaterial('Rainbow',field='dist') 43 | -------------------------------------------------------------------------------- /tests/meshtests/draghandletest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import( 20 | vec3, color, ElemType, PyDataSet, ReprType, MeshSceneObject,NodeDragHandle,setmethod, 21 | FT_LINELIST,PyVertexBuffer,PyIndexBuffer 22 | ) 23 | 24 | # construct a dataset with a single triangle by defining 3 vertices, an index matrix with 1 element, and a field assigning a value to each vertex 25 | nodes=[vec3(0,0,0),vec3(1,0,0),vec3(0.5,0,0.866)] # 3 vertices of triangle 26 | inds=[(0,1,2)] # single element in index matrix 27 | field=[0.0,1.0,2.0] 28 | ds=PyDataSet('TriDS',nodes,[('triind',ElemType._Tri1NL,inds)],[('vals',field,'triind')]) 29 | 30 | # create the scene object which contains the dataset 31 | obj=MeshSceneObject('Tri',ds) 32 | mgr.addSceneObject(obj) 33 | 34 | # create a visual representation of the triangle, "volume" in this value referring to a 3D representation 35 | rep=obj.createRepr(ReprType._volume,0) 36 | mgr.addSceneObjectRepr(rep) 37 | rep.applyMaterial('Rainbow',field='vals') 38 | 39 | # adjust the camera to get the triangle in frame 40 | mgr.setCameraSeeAll() 41 | 42 | 43 | #create the figure for the triangle line, this object will be called linefig 44 | @mgr.callThreadSafe 45 | def linefig(): 46 | vbuf=PyVertexBuffer(nodes,[vec3()]*len(nodes),[color(0,1,1,1)]*len(nodes)) 47 | ibuf=PyIndexBuffer([(0,1),(1,2),(2,0)]) 48 | 49 | fig=mgr.scene.createFigure('line','Default',FT_LINELIST) 50 | fig.fillData(vbuf,ibuf) 51 | fig.setOverlay(True) 52 | fig.setVisible(True) 53 | return fig 54 | 55 | 56 | def dragCallback(handle,isReleased): 57 | nodes[handle.value]=handle.getAbsolutePosition() 58 | print(handle,handle.value,isReleased) 59 | vbuf=PyVertexBuffer(nodes,[vec3()]*len(nodes),[color(0,1,1,1)]*len(nodes)) 60 | ibuf=PyIndexBuffer([(0,1),(1,2),(2,0)]) 61 | linefig.fillData(vbuf,ibuf) 62 | 63 | 64 | # replace the method for creating handles for rep to return the transform handle plus the drag handles 65 | @setmethod(rep) 66 | def createHandles(): 67 | h= rep.__old__createHandles() 68 | 69 | for i,n in enumerate(nodes): 70 | h.append(NodeDragHandle(n,i,dragCallback)) 71 | 72 | return h 73 | 74 | mgr.showHandle(rep,True) 75 | -------------------------------------------------------------------------------- /tests/meshtests/elemfieldtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType, RealMatrix, StdProps, vec3,avg 23 | from TestUtils import generateTestMeshDS 24 | 25 | ds=generateTestMeshDS(ElemType._Tet1NL,2) # try Hex or higher order 26 | 27 | nodes=ds.getNodes() 28 | inds=ds.getIndexSet('inds') 29 | 30 | field=RealMatrix('field',inds.n(),3) 31 | field.meta(StdProps._elemdata,'True') 32 | ds.setDataField(field) 33 | 34 | for i in range(inds.n()): 35 | mid=avg(nodes[n] for n in inds[i]) 36 | field[i]=tuple(mid-vec3(0.5)) 37 | 38 | obj=MeshSceneObject('Hexes',ds) 39 | mgr.addSceneObject(obj) 40 | 41 | rep01=obj.createRepr(ReprType._line,0,drawInternal=True,externalOnly=False) 42 | mgr.addSceneObjectRepr(rep01) 43 | 44 | rep=obj.createRepr(ReprType._glyph,0,perelem=True,externalOnly=False,drawInternal=True,glyphname='arrow', 45 | dfield='field',sfield='field',scalefunc='ZAxis',glyphscale=(0.02,0.02,0.1)) 46 | mgr.addSceneObjectRepr(rep) 47 | 48 | rep.applyMaterial('Rainbow',field='field',valfunc='Magnitude') 49 | 50 | mgr.setCameraSeeAll() 51 | -------------------------------------------------------------------------------- /tests/meshtests/glyphtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import vec3, PyDataSet, MeshSceneObject, ReprType 20 | 21 | nodes=[vec3(0,0,0),vec3(2,0,0),vec3(5,0,0),vec3(10,0,0)] 22 | field=[0.0,1.0,2.0,3.0] 23 | ds=PyDataSet('PtDS',nodes,[],[('vals',field)]) 24 | 25 | obj=MeshSceneObject('Pts',ds) 26 | mgr.addSceneObject(obj) 27 | 28 | rep=obj.createRepr(ReprType._glyph,glyphname='sphere', sfield= 'vals',glyphscale=(1,1,1)) 29 | mgr.addSceneObjectRepr(rep) 30 | rep.applyMaterial('Rainbow',field='vals') 31 | 32 | mgr.setCameraSeeAll() 33 | -------------------------------------------------------------------------------- /tests/meshtests/handletest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys,time 20 | sys.path.append(scriptdir+'..') 21 | 22 | import eidolon 23 | from eidolon import MeshSceneObject,ElemType,ReprType, generateArrow, vec3, rotator, color, halfpi 24 | from TestUtils import generateTestMeshDS 25 | 26 | ds=generateTestMeshDS(ElemType._Hex1NL,5) 27 | ds.getNodes().mul(1000) 28 | 29 | obj=MeshSceneObject('Hexes',ds) 30 | mgr.addSceneObject(obj) 31 | 32 | rep=obj.createRepr(ReprType._volume) 33 | mgr.addSceneObjectRepr(rep) 34 | mgr.showBoundBox(rep,True) 35 | mgr.showHandle(rep,True) 36 | rep.applyMaterial('Rainbow',field='dist') 37 | 38 | mgr.setCameraSeeAll() 39 | mgr.setAxesType(eidolon.AxesType._originarrows) 40 | 41 | -------------------------------------------------------------------------------- /tests/meshtests/hextest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys,time 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType 23 | from TestUtils import generateTestMeshDS 24 | 25 | ds=generateTestMeshDS(ElemType._Hex1NL,15) 26 | 27 | obj=MeshSceneObject('Hexes',ds) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._volume) 31 | mgr.addSceneObjectRepr(rep) 32 | rep.applyMaterial('Rainbow',field='dist') 33 | 34 | mgr.setCameraSeeAll() 35 | -------------------------------------------------------------------------------- /tests/meshtests/highordertest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType, vec3 23 | from TestUtils import generateTestMeshDS 24 | 25 | 26 | ds=generateTestMeshDS(ElemType._Tet2NL,7) 27 | 28 | obj=MeshSceneObject('Tets',ds) 29 | mgr.addSceneObject(obj) 30 | 31 | rep=obj.createRepr(ReprType._node) 32 | mgr.addSceneObjectRepr(rep) 33 | rep.applyMaterial('Rainbow',field='dist') 34 | 35 | rep=obj.createRepr(ReprType._point,2,drawInternal=True,externalOnly=False) 36 | mgr.addSceneObjectRepr(rep) 37 | rep.applyMaterial('Rainbow',field='dist') 38 | rep.setPosition(vec3(1.1,0,0)) 39 | 40 | rep=obj.createRepr(ReprType._line,2,drawInternal=True,externalOnly=False) 41 | mgr.addSceneObjectRepr(rep) 42 | rep.applyMaterial('Rainbow',field='dist') 43 | rep.setPosition(vec3(0,0,-1.1)) 44 | 45 | rep=obj.createRepr(ReprType._volume,2,drawInternal=True,externalOnly=False) 46 | mgr.addSceneObjectRepr(rep) 47 | rep.applyMaterial('Rainbow',field='dist') 48 | rep.setPosition(vec3(1.1,0,-1.1)) 49 | 50 | mgr.setCameraSeeAll() 51 | 52 | 53 | -------------------------------------------------------------------------------- /tests/meshtests/isotest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType, ValueFunc 23 | from TestUtils import generateTestMeshDS 24 | 25 | ds=generateTestMeshDS(ElemType._Tet2NL,7) 26 | 27 | obj=MeshSceneObject('Tets',ds) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._line,0) 31 | mgr.addSceneObjectRepr(rep) 32 | 33 | mgr.setCameraSeeAll() 34 | 35 | rep=obj.createRepr(ReprType._isosurf,5,field='dist',numitervals=5,minv=0.0,maxv=0.75,valfunc=ValueFunc.Magnitude) 36 | mgr.addSceneObjectRepr(rep) 37 | rep.applyMaterial('Rainbow',field='dist') 38 | 39 | rep=obj.createRepr(ReprType._isoline,5,field='dist',numitervals=5,minv=0.0,maxv=0.75,radius=0.005,valfunc=ValueFunc.Magnitude) 40 | mgr.addSceneObjectRepr(rep) 41 | rep.applyMaterial('Rainbow',field='dist') 42 | 43 | mgr.saveScreenshot(scriptdir+'isotest.png',width=500,height=500) 44 | -------------------------------------------------------------------------------- /tests/meshtests/linetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType, vec3 23 | from TestUtils import generateTestMeshDS 24 | 25 | materials=['Red','Green','Blue','Magenta','Cyan'] 26 | 27 | for i in range(5): 28 | ds=generateTestMeshDS(ElemType._Tri1NL,i) 29 | 30 | obj=MeshSceneObject('Sphere'+str(i),ds) 31 | mgr.addSceneObject(obj) 32 | 33 | rep=obj.createRepr(ReprType._line,0) 34 | mgr.addSceneObjectRepr(rep) 35 | rep.setPosition(vec3(2.2*i,0,0)) 36 | rep.applyMaterial(materials[i]) 37 | 38 | rep=obj.createRepr(ReprType._cylinder,0,radrefine=5,radius=0.005) 39 | mgr.addSceneObjectRepr(rep) 40 | rep.setPosition(vec3(2.2*i,0,2.2)) 41 | rep.applyMaterial(materials[i]) 42 | 43 | mgr.setCameraSeeAll() 44 | 45 | -------------------------------------------------------------------------------- /tests/meshtests/multitopofieldtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | from eidolon import MeshSceneObject,ElemType,vec3,color,ReprType,frange,PyDataSet 22 | 23 | mat=mgr.getMaterial('Rainbow') 24 | mat.setSpectrumValue(1,0.005,color(0.0,1.0,1.0,1.0)) 25 | 26 | trinodes=[vec3(0,0,0),vec3(1,0,0),vec3(0.5,0,1),vec3(1.1,0,0),vec3(2.1,0,0),vec3(1.6,0,1)] 27 | triinds=[(0,1,2),(3,4,5)] 28 | trifield=[1,2,3,4,5,6] 29 | trielemfield=[-1,2] 30 | 31 | quadnodes=[vec3(2.2,0,0),vec3(3.2,0,0),vec3(2.2,0,1),vec3(3.2,0,1),vec3(3.3,0,0),vec3(4.3,0,0),vec3(3.3,0,1),vec3(4.3,0,1)] 32 | quadinds=[(6,7,8,9),(10,11,12,13)] 33 | quadfield=[1,2,3,4,5,6,7,8] 34 | quadelemfield=[-1,2] 35 | quadfieldtopo=[(0,1,2,3),(4,5,6,7)] # need a separate topology for quad field since the quad topo doesn't start indexing from 0 36 | 37 | nodes=trinodes+quadnodes 38 | 39 | nodefield=list(frange(len(nodes))) 40 | 41 | inds=[ 42 | ('tris',ElemType._Tri1NL,triinds), 43 | ('quads',ElemType._Quad1NL,quadinds), 44 | ('quadfieldtopo',ElemType._Quad1NL,quadfieldtopo,False) 45 | ] 46 | 47 | fields=[ 48 | ('trifield',trifield,'tris'), # per-vertex field for triangles 49 | ('trielemfield',trielemfield,'tris'), # per-element field for triangles 50 | ('quadfield',quadfield,'quads','quadfieldtopo'), # per-vertex field for quads 51 | ('quadelemfield',quadelemfield,'quads'), # per-element field for quads 52 | ('nodefield',nodefield) # per-node field for whole mesh 53 | ] 54 | 55 | ds=PyDataSet('MeshTest',nodes,inds,fields) 56 | 57 | obj=MeshSceneObject('Test',ds) 58 | mgr.addSceneObject(obj) 59 | 60 | # render the triangle field 61 | rep=obj.createRepr(ReprType._volume,0) 62 | mgr.addSceneObjectRepr(rep) 63 | rep.applyMaterial(mat,field='trifield') 64 | 65 | # render the quad field 66 | rep=obj.createRepr(ReprType._volume,10) 67 | mgr.addSceneObjectRepr(rep) 68 | rep.setPosition(vec3(0,0,-1.1)) 69 | rep.applyMaterial(mat,field='quadfield') 70 | 71 | # render the per-elem triangle field 72 | rep=obj.createRepr(ReprType._volume,10) 73 | mgr.addSceneObjectRepr(rep) 74 | rep.setPosition(vec3(0,0,-2.2)) 75 | rep.applyMaterial(mat,field='trielemfield') 76 | 77 | # render the per-elem quad field 78 | rep=obj.createRepr(ReprType._volume,10) 79 | mgr.addSceneObjectRepr(rep) 80 | rep.setPosition(vec3(0,0,-3.3)) 81 | rep.applyMaterial(mat,field='quadelemfield') 82 | 83 | # render the per-node field 84 | rep=obj.createRepr(ReprType._volume,10) 85 | mgr.addSceneObjectRepr(rep) 86 | rep.setPosition(vec3(0,0,-4.4)) 87 | rep.applyMaterial(mat,field='nodefield') 88 | 89 | mgr.setCameraSeeAll() 90 | -------------------------------------------------------------------------------- /tests/meshtests/pointtest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,vec3,listToMatrix,ReprType 23 | from TestUtils import generateTestMeshDS 24 | 25 | ds=generateTestMeshDS(ElemType._Tri1NL,4) 26 | nodes=ds.getNodes() 27 | dirs=listToMatrix([tuple(nodes.getAt(i)) for i in range(nodes.n())],'dirs' ) 28 | ds.setDataField(dirs) 29 | 30 | obj=MeshSceneObject('Sphere',ds) 31 | mgr.addSceneObject(obj) 32 | 33 | rep=obj.createRepr(ReprType._point) 34 | mgr.addSceneObjectRepr(rep) 35 | rep.applyMaterial('Rainbow',field='dist') 36 | rep.setScale(vec3(1.5)) 37 | 38 | rep1=obj.createRepr(ReprType._glyph,glyphname='sphere', sfield= 'dist',glyphscale=(0.015, 0.015, 0.015)) 39 | mgr.addSceneObjectRepr(rep1) 40 | rep1.applyMaterial('Rainbow',field='dist') 41 | 42 | rep2=obj.createRepr(ReprType._glyph,dfield='dirs',glyphname='arrow', glyphscale=(0.025, 0.025, 0.035)) 43 | mgr.addSceneObjectRepr(rep2) 44 | rep2.setScale(vec3(0.75)) 45 | rep2.applyMaterial('Rainbow',field='dirs',valfunc='Average') 46 | 47 | mgr.setCameraSeeAll() 48 | 49 | -------------------------------------------------------------------------------- /tests/meshtests/ribbontest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import vec3, PyVertexBuffer, PyIndexBuffer, BoundBox, FT_RIBBON 20 | 21 | nodes=[vec3(0,0,0),vec3(10.0/3,0,0),vec3(20.0/3,0,0),vec3(10,0,0)] 22 | inds=[(0,2),(2,4)] 23 | 24 | fig=mgr.callThreadSafe(mgr.scene.createFigure,"testribbon","Default",FT_RIBBON) 25 | vb=PyVertexBuffer(nodes) 26 | ib=PyIndexBuffer(inds) 27 | fig.fillData(vb,ib,True) 28 | 29 | mgr.controller.setSeeAllBoundBox(BoundBox(nodes)) 30 | mgr.repaint() 31 | -------------------------------------------------------------------------------- /tests/meshtests/selecthandletest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import vec3, rotator, MeshSceneObject, PyDataSet, NodeSelectHandle, ReprType, halfpi, generatePlane, setmethod 20 | 21 | import numpy as np 22 | from scipy.spatial import cKDTree 23 | 24 | 25 | nodes,_,_=generatePlane(4) 26 | 27 | r=rotator(vec3.X(),halfpi) 28 | nodes=[r*n for n in nodes] 29 | 30 | obj=MeshSceneObject('nodes',PyDataSet('ds',nodes,[],[])) 31 | mgr.addSceneObject(obj) 32 | 33 | rep=obj.createRepr(ReprType._glyph,0,externalOnly=False,drawInternal=True,glyphname='sphere',glyphscale=(0.1,0.1,0.1)) 34 | mgr.addSceneObjectRepr(rep) 35 | 36 | mgr.setCameraSeeAll() 37 | 38 | tree=cKDTree(np.asarray(list(map(tuple,nodes)))) 39 | 40 | def radiusQuery(pos,radius): 41 | return tree.query_ball_point(tuple(pos),radius),tree.data 42 | 43 | 44 | @setmethod(rep) 45 | def createHandles(): 46 | h= rep.__old__createHandles() 47 | 48 | ind=15 49 | h.append(NodeSelectHandle(nodes[ind],(ind,nodes),radiusQuery,print,'Select Handle')) 50 | 51 | return h 52 | 53 | mgr.showHandle(rep,True) 54 | 55 | -------------------------------------------------------------------------------- /tests/meshtests/sliceplanetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType,vec3 23 | from TestUtils import generateTestMeshDS 24 | 25 | ds=generateTestMeshDS(ElemType._Hex1NL,10) 26 | 27 | obj=MeshSceneObject('Hexes',ds) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._volume) 31 | mgr.addSceneObjectRepr(rep) 32 | rep.applyMaterial('Rainbow',field='dist') 33 | 34 | mgr.setCameraSeeAll() 35 | 36 | obj1 = SlicePlugin.createSlicePlane(vec3(0.5,0.5,0.5),vec3(0.475528094146,-0.587784822933,0.65450900193)) 37 | mgr.addSceneObject(obj1) 38 | obj1.setApplyToRepr(rep) 39 | 40 | rep1 = obj1.createRepr(ReprType._line) 41 | mgr.addSceneObjectRepr(rep1) 42 | 43 | -------------------------------------------------------------------------------- /tests/meshtests/spheretest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType 23 | from TestUtils import generateTestMeshDS 24 | 25 | ds=generateTestMeshDS(ElemType._Tri1NL,5) 26 | 27 | obj=MeshSceneObject('Sphere',ds) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._volume,0) 31 | mgr.addSceneObjectRepr(rep) 32 | rep.applyMaterial('Rainbow',field='dist') 33 | 34 | mgr.setCameraSeeAll() 35 | 36 | -------------------------------------------------------------------------------- /tests/meshtests/tettest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType 23 | from TestUtils import generateTestMeshDS 24 | 25 | ds=generateTestMeshDS(ElemType._Tet1NL,8) 26 | 27 | obj=MeshSceneObject('Tets',ds) 28 | mgr.addSceneObject(obj) 29 | 30 | rep=obj.createRepr(ReprType._volume,2) 31 | mgr.addSceneObjectRepr(rep) 32 | rep.applyMaterial('Rainbow',field='dist') 33 | 34 | mgr.setCameraSeeAll() 35 | -------------------------------------------------------------------------------- /tests/meshtests/texttest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import FT_TEXT, H_LEFT, V_CENTER, MeshSceneObject, ReprType, rotator, vec3, halfpi 23 | from TestUtils import generateArrowDS 24 | 25 | ds=generateArrowDS(12) # create arrow, resize and move away from origin 26 | nodes=ds.getNodes() 27 | nodes.mul(5) 28 | nodes.mul(rotator(vec3.Y(),halfpi)) 29 | nodes.add(vec3(1,2,3)) 30 | 31 | obj=MeshSceneObject('Arrow',ds) 32 | mgr.addSceneObject(obj) 33 | 34 | rep=obj.createRepr(ReprType._volume) 35 | mgr.addSceneObjectRepr(rep) 36 | 37 | 38 | @mgr.callThreadSafe 39 | def fig(): 40 | tfig=mgr.scene.createFigure('text','Default',FT_TEXT) 41 | tfig.setText('If you can read this,\nthe test passes') 42 | tfig.setHAlign(H_LEFT) 43 | tfig.setVAlign(V_CENTER) 44 | tfig.setOverlay(False) 45 | tfig.setCameraAlign(True) 46 | tfig.setVisible(True) 47 | tfig.setPosition(ds.getNodes()[-1]) 48 | return tfig # need to return tfig so that it's stored as the variable fig, otherwise it will get collected 49 | 50 | 51 | mgr.setCameraSeeAll() 52 | mgr.controller.setZoom(15) 53 | mgr.repaint() 54 | -------------------------------------------------------------------------------- /tests/meshtests/timetest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import sys,math 20 | sys.path.append(scriptdir+'..') 21 | 22 | from eidolon import MeshSceneObject,ElemType,ReprType,vec3,frange 23 | from TestUtils import generateTestMeshDS 24 | 25 | dds=[] 26 | for i in frange(0,1,0.05): 27 | i=math.sin(i*math.pi*2) 28 | ds=generateTestMeshDS(ElemType._Tri1NL,5) 29 | nodes=ds.getNodes() 30 | nodes.mul(vec3(2.0+i,1.0,2.0-i)) 31 | 32 | dist=ds.getDataField('dist') 33 | for n in range(dist.n()): 34 | dist.setAt(nodes.getAt(n).distTo(vec3(0.25)),n) 35 | 36 | dds.append(ds) 37 | 38 | obj=MeshSceneObject('Sphere',dds) 39 | mgr.addSceneObject(obj) 40 | obj.setTimestepList(list(frange(0,1,0.05))) 41 | 42 | rep=obj.createRepr(ReprType._volume,0) 43 | mgr.addSceneObjectRepr(rep) 44 | 45 | mgr.setCameraSeeAll() 46 | 47 | rep.applyMaterial('Rainbow',field='dist') 48 | 49 | mgr.setTimeStepsPerSec(1) 50 | mgr.setTimeFPS(60) 51 | mgr.play() 52 | -------------------------------------------------------------------------------- /tests/meshtests/tritest.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import vec3, ElemType, PyDataSet, ReprType, MeshSceneObject 20 | 21 | # construct a dataset with a single triangle by defining 3 vertices, an index matrix with 1 element, and a field assigning a value to each vertex 22 | nodes=[vec3(0,0,0),vec3(1,0,0),vec3(0.5,0,0.866)] # 3 vertices of triangle 23 | inds=[(0,1,2)] # single element in index matrix 24 | field=[0.0,1.0,2.0] 25 | ds=PyDataSet('TriDS',nodes,[('triind',ElemType._Tri1NL,inds)],[('vals',field,'triind')]) 26 | 27 | # create the scene object which contains the dataset 28 | obj=MeshSceneObject('Tri',ds) 29 | mgr.addSceneObject(obj) 30 | 31 | # create a visual representation of the triangle, "volume" in this value referring to a 3D representation 32 | rep=obj.createRepr(ReprType._volume) 33 | mgr.addSceneObjectRepr(rep) 34 | rep.applyMaterial('Rainbow',field='vals') 35 | 36 | # adjust the camera to get the triangle in frame 37 | mgr.setCameraSeeAll() 38 | -------------------------------------------------------------------------------- /tests/othertests/ImportTest.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 7, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "name": "stdout", 10 | "output_type": "stream", 11 | "text": [ 12 | "/home/localek10/workspace/Eidolon\n" 13 | ] 14 | } 15 | ], 16 | "source": [ 17 | "import sys,os,glob,ctypes\n", 18 | "\n", 19 | "sys.path.append('../..')\n", 20 | "\n", 21 | "import eidolon\n", 22 | "print(eidolon.getAppDir())" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": 4, 28 | "metadata": {}, 29 | "outputs": [], 30 | "source": [ 31 | "import eidolon.plugins.NiftiPlugin\n", 32 | "conf=eidolon.Config()\n", 33 | "mgr=eidolon.SceneManager(None,conf)\n", 34 | "nib=eidolon.plugins.NiftiPlugin.NiftiPlugin()\n", 35 | "nib.init(1,None,mgr)" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": 5, 41 | "metadata": {}, 42 | "outputs": [ 43 | { 44 | "name": "stdout", 45 | "output_type": "stream", 46 | "text": [ 47 | "_loadNiftiFile\n", 48 | "createObjectFromArray\n", 49 | "createObjectFromArray dT (s) = 0.04525566101074219\n", 50 | "_loadNiftiFile dT (s) = 0.06585264205932617\n" 51 | ] 52 | } 53 | ], 54 | "source": [ 55 | "nii=nib.loadObject('test.nii')\n", 56 | "nii=nii()" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": 6, 62 | "metadata": {}, 63 | "outputs": [ 64 | { 65 | "data": { 66 | "text/plain": [ 67 | "ImageSceneObject<'rt4_frame15' @ 0x00007f383f005198>" 68 | ] 69 | }, 70 | "execution_count": 6, 71 | "metadata": {}, 72 | "output_type": "execute_result" 73 | } 74 | ], 75 | "source": [ 76 | "nii" 77 | ] 78 | } 79 | ], 80 | "metadata": { 81 | "kernelspec": { 82 | "display_name": "Python 3", 83 | "language": "python", 84 | "name": "python3" 85 | }, 86 | "language_info": { 87 | "codemirror_mode": { 88 | "name": "ipython", 89 | "version": 3 90 | }, 91 | "file_extension": ".py", 92 | "mimetype": "text/x-python", 93 | "name": "python", 94 | "nbconvert_exporter": "python", 95 | "pygments_lexer": "ipython3", 96 | "version": "3.6.7" 97 | } 98 | }, 99 | "nbformat": 4, 100 | "nbformat_minor": 2 101 | } 102 | -------------------------------------------------------------------------------- /tests/othertests/testenv.py: -------------------------------------------------------------------------------- 1 | 2 | print('Name:',__name__) 3 | 4 | if __name__=='builtins': 5 | print('Builtins namespace') 6 | elif __name__=='__main__': 7 | print('Script') 8 | else: 9 | print('Imported') 10 | 11 | #print(dir()) -------------------------------------------------------------------------------- /tests/run_coverage.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # This file is used to run Eidolon with code coverage enabled with Coverage.py. This must already be installed and 4 | # present on the command line. 5 | 6 | 7 | # Determine file directory (http://stackoverflow.com/a/246128) 8 | function getFileDir() { 9 | src=$1 10 | while [ -h "$src" ]; do # resolve $src until the file is no longer a symlink 11 | dir="$( cd -P "$( dirname "$src" )" && pwd )" 12 | src="$(readlink "$src")" 13 | # if $src was a relative symlink, we need to resolve it relative to the path where the symlink file was located 14 | [[ $src != "/*" ]] && src="$dir/$src" 15 | done 16 | dir="$( cd -P "$( dirname "$src" )" && pwd )" 17 | 18 | echo $dir 19 | } 20 | 21 | # parent directory of this script, assuming this is in the directory tests 22 | export APPDIR=$(getFileDir "${BASH_SOURCE[0]}")/../ 23 | 24 | export LIBSDIR=$APPDIR/EidolonLibs 25 | export PYTHONPATH=$APPDIR/src 26 | export DYLD_FRAMEWORK_PATH=$LIBSDIR/osx/bin 27 | export LD_LIBRARY_PATH=$LIBSDIR/linux/bin:$LIBSDIR/IRTK:$LD_LIBRARY_PATH 28 | 29 | if [ "$(uname -o 2>/dev/null)" == "Cygwin" ] 30 | then 31 | APPDIR=$(cygpath -w $APPDIR) 32 | export PATH="$APPDIR\\EidolonLibs\\win64_mingw\\bin;$PATH" 33 | export PYTHONPATH="$APPDIR\\src" 34 | fi 35 | 36 | # if the coverage file isn't present create it with a simple run of the program 37 | if [ ! -f .coverage ] 38 | then 39 | coverage run --branch $APPDIR/main.py --help 40 | fi 41 | 42 | # contribute to a current .coverage file, delete this file to start fresh 43 | coverage run -a --branch $APPDIR/main.py "$@" 44 | coverage report 45 | 46 | -------------------------------------------------------------------------------- /tests/rununittests.py: -------------------------------------------------------------------------------- 1 | 2 | # pylint cleanup stuff 3 | mgr=mgr # pylint:disable=invalid-name,used-before-assignment 4 | scriptdir=scriptdir # pylint:disable=invalid-name,used-before-assignment 5 | 6 | import os 7 | import sys 8 | import unittest 9 | import glob 10 | 11 | try: 12 | from StringIO import StringIO 13 | except: 14 | from io import StringIO 15 | 16 | sys.path.append(scriptdir) 17 | 18 | # collect unit test script files and plugin source files which may contain unit tests 19 | srcfiles=glob.glob(os.path.join(scriptdir,'unittests','test*.py'))+glob.glob(os.path.join(scriptdir,'..','src','plugins','*.py')) 20 | 21 | totalruns=0 22 | failures=0 23 | errors=0 24 | try: 25 | out=StringIO() 26 | sys.stdout=sys.stderr=out # redirect stdout/stderr to the StringIO object out 27 | 28 | for src in sorted(srcfiles): 29 | pdir=os.path.basename(os.path.dirname(src)) 30 | name=os.path.basename(src[:-3]) 31 | suites=unittest.defaultTestLoader.loadTestsFromName('%s.%s'%(pdir,name)) 32 | 33 | if suites.countTestCases()>0: 34 | out.write('==================== '+name+' ====================\n\n') 35 | result=unittest.TextTestRunner(stream=out,verbosity=2).run(suites) 36 | totalruns+=result.testsRun 37 | failures+=len(result.failures) 38 | errors+=len(result.errors) 39 | out.write('\n\n') 40 | 41 | finally: 42 | # restore streams 43 | sys.stdout=sys.__stdout__ 44 | sys.stderr=sys.__stderr__ 45 | 46 | resultstr='Unittest results: %i tests run, %i failures, %i errors'%(totalruns,failures,errors) 47 | output=out.getvalue() 48 | print('%s:\n%s'%(resultstr,output)) 49 | 50 | mgr.showTextBox(resultstr,'Results',output,height=600,width=800) 51 | -------------------------------------------------------------------------------- /tests/unittests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tests/unittests/__init__.py -------------------------------------------------------------------------------- /tests/unittests/testconcurrency.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | 20 | import threading 21 | import multiprocessing 22 | import unittest 23 | 24 | from TestUtils import eqas_ 25 | import eidolon 26 | from eidolon import ProcessServer, listResults, checkResultMap, listSum, concurrentExec 27 | 28 | 29 | class TestConcurrency(unittest.TestCase): 30 | def testServer(self): 31 | '''Test the global ProcessServer instance was created.''' 32 | serv=ProcessServer.globalServer 33 | assert serv is not None 34 | assert serv.realnumprocs>0 35 | 36 | def testConcurrency(self,values=list(range(100)),numprocs=0,task=None): 37 | '''Test concurrent processing on input and returning values.''' 38 | result=eidolon.concurrencyTestRange(len(values),numprocs,task,values) 39 | checkResultMap(result) 40 | eqas_(values,listSum(listResults(result))) 41 | 42 | def testProcessValues(self,numvals=100,numprocs=0,task=None): 43 | '''Test calling the ProcessServer directly with a routine that prints per-process info.''' 44 | result=ProcessServer.globalServer.callProcessFunc(numvals,numprocs,task,eidolon.concurrencyTestProcessValues) 45 | checkResultMap(result()) 46 | 47 | def testReturnArg(self,values=list(range(20)),numprocs=0,task=None): 48 | '''Test returned values from processes.''' 49 | result=eidolon.concurrencyTestReturnArg(len(values),numprocs,task,values,partitionArgs=(values,)) 50 | checkResultMap(result) 51 | 52 | def testShareObject(self,numprocs=0,task=None): 53 | '''Test sharing values between processes.''' 54 | result=eidolon.concurrencyTestShareObjects(100,numprocs,task) 55 | checkResultMap(result) 56 | 57 | def testPipe(self): 58 | '''Test the asynchronous creation of a Pipe object, this fails with Nose and indicated a thread-unsafe configuration.''' 59 | result=[] 60 | def createPipe(): 61 | result.append(multiprocessing.Pipe()) 62 | 63 | t=threading.Thread(target=createPipe) 64 | t.start() 65 | t.join() 66 | assert len(result)==1 67 | 68 | def testExec(self,rangeval=100,task=None): 69 | '''Test concurrentExec() by calculating and returning a list of numbers in the sequence (0,rangeval).''' 70 | result=concurrentExec(rangeval,0,task,'x=list(process.nrange())',returnName='x') 71 | checkResultMap(result) 72 | eqas_(list(range(rangeval)),listSum(listResults(result))) 73 | 74 | -------------------------------------------------------------------------------- /tests/unittests/testimage.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | import unittest 20 | from TestUtils import randnums 21 | from eidolon import vec3,rotator, SharedImage, getPlaneXi 22 | 23 | 24 | class TestImage(unittest.TestCase): 25 | def testXis1(self): 26 | '''Test the xi values of points on the plane of a SharedImage, calls SharedImage.getPlaneXi().''' 27 | si=SharedImage('',vec3(),rotator(),(10,10)) 28 | self.assertEqual(vec3(),si.getPlaneXi(vec3())) 29 | self.assertEqual(vec3(1,1),si.getPlaneXi(vec3(10,-10))) 30 | self.assertEqual(vec3(0.5,0.5),si.getPlaneXi(vec3(5,-5))) 31 | self.assertEqual(vec3(0.5,0.5),si.getPlaneXi(vec3(5,-5))) 32 | 33 | def testXis2(self): 34 | '''Test the xi values of corners of a SharedImage, calls getPlaneXi().''' 35 | si=SharedImage('',vec3(1,-2,3),rotator(0.1,-0.2,0.3),(10,10),(0.678,0.789)) 36 | corners=si.getCorners() 37 | self.assertEqual(vec3(),si.getPlaneXi(corners[0])) 38 | self.assertEqual(vec3(1,1),si.getPlaneXi(corners[-1])) 39 | self.assertEqual(vec3(0.5,0.5),si.getPlaneXi(si.center)) 40 | 41 | def testXis3(self): 42 | '''Test the xi values of points on the plane of a SharedImage, calls SharedImage.getPlaneXi().''' 43 | pos=vec3(5,-6,7) 44 | si=SharedImage('',pos,rotator(),(10,10)) 45 | self.assertEqual(vec3(),si.getPlaneXi(pos)) 46 | self.assertEqual(vec3(1,1),si.getPlaneXi(pos+vec3(10,-10))) 47 | self.assertEqual(vec3(0.5,0.5,5),si.getPlaneXi(pos+vec3(5,-5,5))) 48 | 49 | def testXis4(self): 50 | '''Test the xi values of points on the plane of a SharedImage, calls SharedImage.getPlaneXi().''' 51 | pos=vec3(5,-6,7) 52 | dim=(0.678,0.789) 53 | si=SharedImage('',pos,rotator(),(10,10),dim) 54 | self.assertEqual(vec3(),si.getPlaneXi(pos)) 55 | self.assertEqual(vec3(1,1),si.getPlaneXi(pos+vec3(10*dim[0],-10*dim[1]))) 56 | self.assertEqual(vec3(0.5,0.5,5),si.getPlaneXi(pos+vec3(5*dim[0],-5*dim[1],5))) 57 | 58 | def testRot1(self): 59 | '''Tests the creation of a SharedImage with the default vec3 and rotator value, calls SharedImage.getPlaneXi().''' 60 | si=SharedImage('',vec3(),rotator(),(1,1)) 61 | 62 | self.assertEqual(vec3(1),si.getPlaneXi(vec3(1,-1,1))) 63 | 64 | def testPlaneXiFunc(self): 65 | '''Tests the getPlaneXi function directly.''' 66 | v=vec3(*randnums(3,-5,5)) 67 | r=rotator(*randnums(4,-1,1)) 68 | self.assertEqual(vec3(0),getPlaneXi(v,v,r,vec3(1))) 69 | 70 | -------------------------------------------------------------------------------- /tests/unittests/testmath.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | 20 | import unittest 21 | from TestUtils import eq_,eqa_ 22 | from eidolon import ElemType, GeomType 23 | 24 | 25 | class TestMath(unittest.TestCase): 26 | def testLine1NL(self): 27 | '''Test linear line element type.''' 28 | et=ElemType.Line1NL 29 | eqa_(0,et.xis[0][0]) 30 | eqa_(1,et.xis[1][0]) 31 | self.assertEqual(et.geom,GeomType._Line) 32 | 33 | -------------------------------------------------------------------------------- /tests/unittests/testrotator.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | 20 | import math 21 | import unittest 22 | from TestUtils import eqas_, randnums, randangle 23 | from eidolon import vec3, rotator, listSum, halfpi 24 | import numpy as np 25 | 26 | 27 | class TestRotator(unittest.TestCase): 28 | def testIdent1(self): 29 | '''Test the default rotator which should represent the identity transformation.''' 30 | for i in range(100): 31 | x,y,z=randnums(3,-5,5) 32 | v=vec3(x,y,z) 33 | r=rotator() 34 | self.assertEqual(r*v,v) 35 | self.assertEqual(r/v,v) 36 | 37 | def testIdent2(self): 38 | '''Test a rotator specified as the angle around the zero vector is an identity transformation.''' 39 | r=rotator(vec3(),randangle()) 40 | self.assertEqual(r,rotator()) 41 | 42 | def testPlaneDef1(self): 43 | r=rotator(vec3(1,0,0),vec3(0,1,0),vec3(1,0,0),vec3(0,1,0)) 44 | eqas_(r.getEulers(),(0,0,0)) 45 | 46 | def testPlaneDef2(self): 47 | r=rotator(vec3(0,1,0),vec3(-1,0,0),vec3(1,0,0),vec3(0,1,0)) 48 | eqas_(r.getEulers(),(halfpi,0,0)) 49 | 50 | def testPlaneDef3(self): 51 | r=rotator(vec3(1,0,0),vec3(0,0,1),vec3(1,0,0),vec3(0,1,0)) 52 | eqas_(r.getEulers(),(0,halfpi,0)) 53 | 54 | def testAxis1(self): 55 | r=rotator(vec3(0,0,1),halfpi) 56 | eqas_(r.getEulers(),(halfpi,0,0)) 57 | 58 | def testAxis2(self): 59 | r=rotator(vec3(0,0,-1),halfpi) 60 | eqas_(r.getEulers(),(-halfpi,0,0)) 61 | 62 | def testFromTo1(self): 63 | r=rotator(vec3(1,0,0),vec3(0,1,0)) 64 | self.assertEqual(r,rotator(vec3(0,0,1),halfpi)) 65 | 66 | def testFromTo2(self): 67 | for i in range(100): 68 | x,y,z=randnums(3,-5,5) 69 | v=vec3(x,y,z) 70 | r=rotator(v,-v) 71 | self.assertEqual(r,rotator(vec3(1,0,0).cross(v),0)) # TODO: wanted to actually test 180 degree rotators 72 | #self.assertEqual(r,rotator(vec3(1,0,0).cross(v),math.pi)) 73 | #self.assertEqual(r*v,-v) 74 | 75 | def testEulers1(self): 76 | for i in range(100): 77 | y,p,r=randnums(3,-math.pi*2,math.pi*2) 78 | r1=rotator(y,p,r) 79 | self.assertEqual(r1,rotator(*r1.getEulers())) 80 | 81 | def testEulers2(self): 82 | for i in range(100): 83 | y,p,r=randnums(3,-math.pi*2,math.pi*2) 84 | r1=rotator(y,p,r) 85 | self.assertEqual(r1,rotator(0,0,r)*rotator(y,0,0)*rotator(0,p,0)) 86 | 87 | def testEulers3(self): 88 | for i in range(100): 89 | a=randangle() 90 | self.assertEqual(rotator(a,0,0),rotator(vec3(0,0,1),a)) 91 | 92 | def testEulers4(self): 93 | for i in range(100): 94 | a=randangle() 95 | self.assertEqual(rotator(0,a,0),rotator(vec3(1,0,0),a)) 96 | 97 | def testEulers5(self): 98 | for i in range(100): 99 | a=randangle() 100 | self.assertEqual(rotator(0,0,a),rotator(vec3(0,1,0),a)) 101 | 102 | def testFullCircle1(self): 103 | r=rotator(vec3(1,0,0),math.pi*2) 104 | self.assertEqual(r,rotator()) 105 | 106 | def testMatrix1(self): 107 | for i in range(100): 108 | a=randangle() 109 | m=[math.cos(a),0,math.sin(a),0,1,0,-math.sin(a),0,math.cos(a)] 110 | r=rotator(*m) 111 | self.assertEqual(r,rotator(vec3(0,1,0),a)) 112 | 113 | def testMatrix2(self): 114 | for i in range(100): 115 | a=randangle() 116 | r=rotator(vec3(1,0,0),a) 117 | eqas_(listSum(r.toMatrix()),(1,0,0,0,0,math.cos(a),-math.sin(a),0,0,math.sin(a),math.cos(a),0,0,0,0,1)) 118 | 119 | def testMatrix3(self): 120 | for i in range(100): 121 | y,p,r=randnums(3,-math.pi*2,math.pi*2) 122 | r1=rotator(y,p,r) 123 | y,p,r=randnums(3,-math.pi*2,math.pi*2) 124 | r2=rotator(y,p,r) 125 | m1=r1.toMatrix() 126 | m2=r2.toMatrix() 127 | m=np.asarray(m1).dot(np.asarray(m2)).flat 128 | eqas_(listSum((r1*r2).toMatrix()),m) 129 | 130 | def testInv1(self): 131 | for i in range(100): 132 | x,y,z=randnums(3,-5,5) 133 | v=vec3(x,y,z) 134 | y,p,r=randnums(3,-math.pi*2,math.pi*2) 135 | r1=rotator(y,p,r) 136 | self.assertEqual(r1*(r1/v),v) 137 | 138 | -------------------------------------------------------------------------------- /tests/unittests/testvec3.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | 20 | import unittest 21 | import math 22 | from eidolon import vec3, halfpi 23 | from TestUtils import epsilon, randnums 24 | 25 | 26 | class TestVec3(unittest.TestCase): 27 | def assertAlmostEqual(self,first, second, places=7, msg=None,delta=None): 28 | return unittest.TestCase.assertAlmostEqual(self,first, second, places, msg, epsilon or delta) 29 | 30 | def testMembers(self): 31 | '''Test members assigned to a vec3 are returned correctly.''' 32 | x,y,z=randnums(3,-5,5) 33 | v=vec3(x,y,z) 34 | 35 | self.assertEqual(v.x(),x) 36 | self.assertEqual(v.y(),y) 37 | self.assertEqual(v.z(),z) 38 | self.assertAlmostEqual(v.len(),math.sqrt(x*x+y*y+z*z)) 39 | 40 | def testNan(self): 41 | '''Test NaN as a vector component value.''' 42 | v=vec3(float('nan')) 43 | self.assertNotEqual(v.len(), v.len()) # NaN is never equal to itself 44 | 45 | def testInf(self): 46 | '''Test +inf and -inf as vector component values.''' 47 | v=vec3(float('+inf'),float('-inf')) 48 | 49 | self.assertEqual(v.x(),float('+inf')) 50 | self.assertEqual(v.y(),float('-inf')) 51 | self.assertEqual(-v.x(),float('-inf')) 52 | self.assertEqual(-v.y(),float('+inf')) 53 | self.assertEqual(v.x(),1e400) 54 | self.assertEqual(v.y(),-1e400) 55 | self.assertEqual(v.len(),float('+inf')) 56 | 57 | def testAngle1(self): 58 | self.assertAlmostEqual(vec3.X().angleTo(vec3.Y()),halfpi) 59 | 60 | def testAngle2(self): 61 | self.assertAlmostEqual(vec3.X().angleTo(vec3.X()),0) 62 | 63 | def testPolar(self): 64 | x,y,z=randnums(3,-5,5) 65 | v=vec3(x,y,z) 66 | self.assertEqual(v.toPolar().fromPolar(),v) 67 | 68 | def testCylindrical(self): 69 | x,y,z=randnums(3,-5,5) 70 | v=vec3(x,y,z) 71 | self.assertEqual(v.toCylindrical().fromCylindrical(),v) 72 | 73 | def testArea(self): 74 | self.assertAlmostEqual(vec3().triArea(vec3.X(),vec3.Y()),0.5) 75 | 76 | def testLineDist(self): 77 | x,y=randnums(2,-5,5) 78 | v=vec3(x,y,0.5) 79 | self.assertAlmostEqual(v.lineDist(vec3(),vec3.Z()),(v*vec3(1,1,0)).len()) 80 | -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00000.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00000.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00001.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00001.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00002.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00002.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00003.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00003.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00004.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00004.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00005.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00005.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00006.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00006.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00007.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00007.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00008.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00008.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00009.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00009.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00010.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00010.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00011.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00011.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00012.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00012.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00013.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00013.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00014.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00014.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00015.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00015.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00016.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00016.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00017.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00017.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00018.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00018.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00019.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00019.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00020.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00020.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00021.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00021.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00022.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00022.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00023.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00023.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00024.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00024.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00025.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00025.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00026.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00026.dcm -------------------------------------------------------------------------------- /tutorial/DicomData/SA_00027.dcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ericspod/Eidolon/61728ba6be6af5ac7d8119465a81e88833545688/tutorial/DicomData/SA_00027.dcm -------------------------------------------------------------------------------- /tutorial/MeshData/1d_FE.T: -------------------------------------------------------------------------------- 1 | 176 528 2 | 1 2 3 3 | 4 5 6 4 | 7 8 9 5 | 10 11 12 6 | 13 14 15 7 | 16 17 18 8 | 19 20 21 9 | 22 23 24 10 | 25 26 27 11 | 28 29 30 12 | 31 32 33 13 | 34 35 36 14 | 37 38 39 15 | 40 41 42 16 | 43 44 45 17 | 46 47 48 18 | 49 50 51 19 | 52 53 54 20 | 55 56 57 21 | 58 59 60 22 | 61 62 63 23 | 64 65 66 24 | 67 68 69 25 | 70 71 72 26 | 73 74 75 27 | 76 77 78 28 | 79 80 81 29 | 82 83 84 30 | 85 86 87 31 | 88 89 90 32 | 91 92 93 33 | 94 95 96 34 | 97 98 99 35 | 100 101 102 36 | 103 104 105 37 | 106 107 108 38 | 109 110 111 39 | 112 113 114 40 | 115 116 117 41 | 118 119 120 42 | 121 122 123 43 | 124 125 126 44 | 127 128 129 45 | 130 131 132 46 | 133 134 135 47 | 136 137 138 48 | 139 140 141 49 | 142 143 144 50 | 145 146 147 51 | 148 149 150 52 | 151 152 153 53 | 154 155 156 54 | 157 158 159 55 | 160 161 162 56 | 163 164 165 57 | 166 167 168 58 | 169 170 171 59 | 172 173 174 60 | 175 176 177 61 | 178 179 180 62 | 181 182 183 63 | 184 185 186 64 | 187 188 189 65 | 190 191 192 66 | 193 194 195 67 | 196 197 198 68 | 199 200 201 69 | 202 203 204 70 | 205 206 207 71 | 208 209 210 72 | 211 212 213 73 | 214 215 216 74 | 217 218 219 75 | 220 221 222 76 | 223 224 225 77 | 226 227 228 78 | 229 230 231 79 | 232 233 234 80 | 235 236 237 81 | 238 239 240 82 | 241 242 243 83 | 244 245 246 84 | 247 248 249 85 | 250 251 252 86 | 253 254 255 87 | 256 257 258 88 | 259 260 261 89 | 262 263 264 90 | 265 266 267 91 | 268 269 270 92 | 271 272 273 93 | 274 275 276 94 | 277 278 279 95 | 280 281 282 96 | 283 284 285 97 | 286 287 288 98 | 289 290 291 99 | 292 293 294 100 | 295 296 297 101 | 298 299 300 102 | 301 302 303 103 | 304 305 306 104 | 307 308 309 105 | 310 311 312 106 | 313 314 315 107 | 316 317 318 108 | 319 320 321 109 | 322 323 324 110 | 325 326 327 111 | 328 329 330 112 | 331 332 333 113 | 334 335 336 114 | 337 338 339 115 | 340 341 342 116 | 343 344 345 117 | 346 347 348 118 | 349 350 351 119 | 352 353 354 120 | 355 356 357 121 | 358 359 360 122 | 361 362 363 123 | 364 365 366 124 | 367 368 369 125 | 370 371 372 126 | 373 374 375 127 | 376 377 378 128 | 379 380 381 129 | 382 383 384 130 | 385 386 387 131 | 388 389 390 132 | 391 392 393 133 | 394 395 396 134 | 397 398 399 135 | 400 401 402 136 | 403 404 405 137 | 406 407 408 138 | 409 410 411 139 | 412 413 414 140 | 415 416 417 141 | 418 419 420 142 | 421 422 423 143 | 424 425 426 144 | 427 428 429 145 | 430 431 432 146 | 433 434 435 147 | 436 437 438 148 | 439 440 441 149 | 442 443 444 150 | 445 446 447 151 | 448 449 450 152 | 451 452 453 153 | 454 455 456 154 | 457 458 459 155 | 460 461 462 156 | 463 464 465 157 | 466 467 468 158 | 469 470 471 159 | 472 473 474 160 | 475 476 477 161 | 478 479 480 162 | 481 482 483 163 | 484 485 486 164 | 487 488 489 165 | 490 491 492 166 | 493 494 495 167 | 496 497 498 168 | 499 500 501 169 | 502 503 504 170 | 505 506 507 171 | 508 509 510 172 | 511 512 513 173 | 514 515 516 174 | 517 518 519 175 | 520 521 522 176 | 523 524 525 177 | 526 527 528 178 | 179 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox.T: -------------------------------------------------------------------------------- 1 | 8 27 2 | 1 2 4 5 10 11 13 14 3 | 2 3 5 6 11 12 14 15 4 | 4 5 7 8 13 14 16 17 5 | 5 6 8 9 14 15 17 18 6 | 10 11 13 14 19 20 22 23 7 | 11 12 14 15 20 21 23 24 8 | 13 14 16 17 22 23 25 26 9 | 14 15 17 18 23 24 26 27 10 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0000.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.5 0.0 0.0 4 | 1.0 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.5 0.5 0.0 7 | 1.0 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.5 1.0 0.0 10 | 1.0 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.5 0.0 0.5 13 | 1.0 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.5 0.5 0.5 16 | 1.0 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.5 1.0 0.5 19 | 1.0 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.5 0.0 1.0 22 | 1.0 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.5 0.5 1.0 25 | 1.0 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.5 1.0 1.0 28 | 1.0 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0001.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.55 0.0 0.0 4 | 1.1 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.55 0.5 0.0 7 | 1.1 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.55 1.0 0.0 10 | 1.1 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.55 0.0 0.5 13 | 1.1 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.55 0.5 0.5 16 | 1.1 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.55 1.0 0.5 19 | 1.1 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.55 0.0 1.0 22 | 1.1 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.55 0.5 1.0 25 | 1.1 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.55 1.0 1.0 28 | 1.1 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0002.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.6 0.0 0.0 4 | 1.2 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.6 0.5 0.0 7 | 1.2 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.6 1.0 0.0 10 | 1.2 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.6 0.0 0.5 13 | 1.2 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.6 0.5 0.5 16 | 1.2 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.6 1.0 0.5 19 | 1.2 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.6 0.0 1.0 22 | 1.2 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.6 0.5 1.0 25 | 1.2 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.6 1.0 1.0 28 | 1.2 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0003.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.65 0.0 0.0 4 | 1.3 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.65 0.5 0.0 7 | 1.3 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.65 1.0 0.0 10 | 1.3 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.65 0.0 0.5 13 | 1.3 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.65 0.5 0.5 16 | 1.3 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.65 1.0 0.5 19 | 1.3 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.65 0.0 1.0 22 | 1.3 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.65 0.5 1.0 25 | 1.3 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.65 1.0 1.0 28 | 1.3 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0004.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.7 0.0 0.0 4 | 1.4 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.7 0.5 0.0 7 | 1.4 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.7 1.0 0.0 10 | 1.4 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.7 0.0 0.5 13 | 1.4 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.7 0.5 0.5 16 | 1.4 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.7 1.0 0.5 19 | 1.4 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.7 0.0 1.0 22 | 1.4 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.7 0.5 1.0 25 | 1.4 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.7 1.0 1.0 28 | 1.4 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0005.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.75 0.0 0.0 4 | 1.5 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.75 0.5 0.0 7 | 1.5 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.75 1.0 0.0 10 | 1.5 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.75 0.0 0.5 13 | 1.5 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.75 0.5 0.5 16 | 1.5 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.75 1.0 0.5 19 | 1.5 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.75 0.0 1.0 22 | 1.5 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.75 0.5 1.0 25 | 1.5 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.75 1.0 1.0 28 | 1.5 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0006.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.8 0.0 0.0 4 | 1.6 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.8 0.5 0.0 7 | 1.6 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.8 1.0 0.0 10 | 1.6 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.8 0.0 0.5 13 | 1.6 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.8 0.5 0.5 16 | 1.6 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.8 1.0 0.5 19 | 1.6 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.8 0.0 1.0 22 | 1.6 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.8 0.5 1.0 25 | 1.6 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.8 1.0 1.0 28 | 1.6 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0007.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.85 0.0 0.0 4 | 1.7 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.85 0.5 0.0 7 | 1.7 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.85 1.0 0.0 10 | 1.7 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.85 0.0 0.5 13 | 1.7 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.85 0.5 0.5 16 | 1.7 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.85 1.0 0.5 19 | 1.7 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.85 0.0 1.0 22 | 1.7 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.85 0.5 1.0 25 | 1.7 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.85 1.0 1.0 28 | 1.7 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0008.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.9 0.0 0.0 4 | 1.8 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.9 0.5 0.0 7 | 1.8 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.9 1.0 0.0 10 | 1.8 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.9 0.0 0.5 13 | 1.8 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.9 0.5 0.5 16 | 1.8 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.9 1.0 0.5 19 | 1.8 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.9 0.0 1.0 22 | 1.8 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.9 0.5 1.0 25 | 1.8 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.9 1.0 1.0 28 | 1.8 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox0009.X: -------------------------------------------------------------------------------- 1 | 27 3 2 | 0.0 0.0 0.0 3 | 0.95 0.0 0.0 4 | 1.9 0.0 0.0 5 | 0.0 0.5 0.0 6 | 0.95 0.5 0.0 7 | 1.9 0.5 0.0 8 | 0.0 1.0 0.0 9 | 0.95 1.0 0.0 10 | 1.9 1.0 0.0 11 | 0.0 0.0 0.5 12 | 0.95 0.0 0.5 13 | 1.9 0.0 0.5 14 | 0.0 0.5 0.5 15 | 0.95 0.5 0.5 16 | 1.9 0.5 0.5 17 | 0.0 1.0 0.5 18 | 0.95 1.0 0.5 19 | 1.9 1.0 0.5 20 | 0.0 0.0 1.0 21 | 0.95 0.0 1.0 22 | 1.9 0.0 1.0 23 | 0.0 0.5 1.0 24 | 0.95 0.5 1.0 25 | 1.9 0.5 1.0 26 | 0.0 1.0 1.0 27 | 0.95 1.0 1.0 28 | 1.9 1.0 1.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0000.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.25 4 | 1.0 5 | 0.25 6 | 0.5 7 | 1.25 8 | 1.0 9 | 1.25 10 | 2.0 11 | 0.25 12 | 0.5 13 | 1.25 14 | 0.5 15 | 0.75 16 | 1.5 17 | 1.25 18 | 1.5 19 | 2.25 20 | 1.0 21 | 1.25 22 | 2.0 23 | 1.25 24 | 1.5 25 | 2.25 26 | 2.0 27 | 2.25 28 | 3.0 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0001.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.3025 4 | 1.21 5 | 0.25 6 | 0.5525 7 | 1.46 8 | 1.0 9 | 1.3025 10 | 2.21 11 | 0.25 12 | 0.5525 13 | 1.46 14 | 0.5 15 | 0.8025 16 | 1.71 17 | 1.25 18 | 1.5525 19 | 2.46 20 | 1.0 21 | 1.3025 22 | 2.21 23 | 1.25 24 | 1.5525 25 | 2.46 26 | 2.0 27 | 2.3025 28 | 3.21 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0002.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.36 4 | 1.44 5 | 0.25 6 | 0.61 7 | 1.69 8 | 1.0 9 | 1.36 10 | 2.44 11 | 0.25 12 | 0.61 13 | 1.69 14 | 0.5 15 | 0.86 16 | 1.94 17 | 1.25 18 | 1.61 19 | 2.69 20 | 1.0 21 | 1.36 22 | 2.44 23 | 1.25 24 | 1.61 25 | 2.69 26 | 2.0 27 | 2.36 28 | 3.44 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0003.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.4225 4 | 1.69 5 | 0.25 6 | 0.6725 7 | 1.94 8 | 1.0 9 | 1.4225 10 | 2.69 11 | 0.25 12 | 0.6725 13 | 1.94 14 | 0.5 15 | 0.9225 16 | 2.19 17 | 1.25 18 | 1.6725 19 | 2.94 20 | 1.0 21 | 1.4225 22 | 2.69 23 | 1.25 24 | 1.6725 25 | 2.94 26 | 2.0 27 | 2.4225 28 | 3.69 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0004.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.49 4 | 1.96 5 | 0.25 6 | 0.74 7 | 2.21 8 | 1.0 9 | 1.49 10 | 2.96 11 | 0.25 12 | 0.74 13 | 2.21 14 | 0.5 15 | 0.99 16 | 2.46 17 | 1.25 18 | 1.74 19 | 3.21 20 | 1.0 21 | 1.49 22 | 2.96 23 | 1.25 24 | 1.74 25 | 3.21 26 | 2.0 27 | 2.49 28 | 3.96 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0005.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.5625 4 | 2.25 5 | 0.25 6 | 0.8125 7 | 2.5 8 | 1.0 9 | 1.5625 10 | 3.25 11 | 0.25 12 | 0.8125 13 | 2.5 14 | 0.5 15 | 1.0625 16 | 2.75 17 | 1.25 18 | 1.8125 19 | 3.5 20 | 1.0 21 | 1.5625 22 | 3.25 23 | 1.25 24 | 1.8125 25 | 3.5 26 | 2.0 27 | 2.5625 28 | 4.25 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0006.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.64 4 | 2.56 5 | 0.25 6 | 0.89 7 | 2.81 8 | 1.0 9 | 1.64 10 | 3.56 11 | 0.25 12 | 0.89 13 | 2.81 14 | 0.5 15 | 1.14 16 | 3.06 17 | 1.25 18 | 1.89 19 | 3.81 20 | 1.0 21 | 1.64 22 | 3.56 23 | 1.25 24 | 1.89 25 | 3.81 26 | 2.0 27 | 2.64 28 | 4.56 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0007.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.7225 4 | 2.89 5 | 0.25 6 | 0.9725 7 | 3.14 8 | 1.0 9 | 1.7225 10 | 3.89 11 | 0.25 12 | 0.9725 13 | 3.14 14 | 0.5 15 | 1.2225 16 | 3.39 17 | 1.25 18 | 1.9725 19 | 4.14 20 | 1.0 21 | 1.7225 22 | 3.89 23 | 1.25 24 | 1.9725 25 | 4.14 26 | 2.0 27 | 2.7225 28 | 4.89 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0008.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.81 4 | 3.24 5 | 0.25 6 | 1.06 7 | 3.49 8 | 1.0 9 | 1.81 10 | 4.24 11 | 0.25 12 | 1.06 13 | 3.49 14 | 0.5 15 | 1.31 16 | 3.74 17 | 1.25 18 | 2.06 19 | 4.49 20 | 1.0 21 | 1.81 22 | 4.24 23 | 1.25 24 | 2.06 25 | 4.49 26 | 2.0 27 | 2.81 28 | 5.24 29 | -------------------------------------------------------------------------------- /tutorial/MeshData/LinBox_LenSq0009.D: -------------------------------------------------------------------------------- 1 | 27 1 2 | 0.0 3 | 0.9025 4 | 3.61 5 | 0.25 6 | 1.1525 7 | 3.86 8 | 1.0 9 | 1.9025 10 | 4.61 11 | 0.25 12 | 1.1525 13 | 3.86 14 | 0.5 15 | 1.4025 16 | 4.11 17 | 1.25 18 | 2.1525 19 | 4.86 20 | 1.0 21 | 1.9025 22 | 4.61 23 | 1.25 24 | 2.1525 25 | 4.86 26 | 2.0 27 | 2.9025 28 | 5.61 29 | -------------------------------------------------------------------------------- /tutorial/tutorial1.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ElemType, ReprType # import the symbols we'll need 20 | 21 | rootdir=scriptdir+'/MeshData' # scriptdir is a variable introduced by the runtime when a script is executed and is set to the path of the script's directory 22 | 23 | # acquire the plugin and ask it to load a scene object 24 | obj=CHeart.loadSceneObject(rootdir+'/linmesh_FE.X',rootdir+'/linmesh_FE.T',ElemType._Hex1NL) 25 | 26 | # load a data field which has 1 value per line and no topology; the spatial topology of the scene object will be used as the field topology 27 | df=obj.loadDataField(rootdir+'/linmesh_dist.D',1) 28 | 29 | # add the object to the scene 30 | mgr.addSceneObject(obj) 31 | 32 | # create a volume representation which is not refined and represents the external surface only 33 | rep=obj.createRepr(ReprType._volume,0,externalOnly=True) 34 | 35 | # add the representation to the scene 36 | mgr.addSceneObjectRepr(rep) 37 | 38 | mgr.setCameraSeeAll() # set the camera viewing parameters to match the object's size 39 | mgr.controller.setRotation(1.0,1.0) # rotate the camera slightly 40 | 41 | m=mgr.getMaterial('Rainbow') # acquire this pre-existing material 42 | 43 | # use the material to set properties and calculate a colour map (using the values of field 'df') for the representation 44 | rep.applyMaterial(m,field=df) 45 | 46 | mgr.saveScreenshot('screen.png') # take a pretty picture 47 | 48 | 49 | -------------------------------------------------------------------------------- /tutorial/tutorial2.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ReprType, AxesType, ElemType, color 20 | 21 | rootdir=scriptdir+'/MeshData' 22 | 23 | m1=mgr.cloneMaterial('Default') # create a semitransparent material 24 | m1.setAlpha(0.5) 25 | 26 | m2=mgr.cloneMaterial('Default') # create a point material 27 | m2.setPointSizeAbs(3.0) 28 | m2.useLighting(False) 29 | m2.useDepthCheck(False) 30 | m2.setDiffuse(color(0.75,0,0)) 31 | 32 | obj=CHeart.loadSceneObject(rootdir+'/1d_FE.X',rootdir+'/1d_FE.T',ElemType._Line2NL) # load the vessels 33 | df=obj.loadDataField(rootdir+'/1d_rad_avg_FE.D',1) # load per-node radius data 34 | 35 | mgr.addSceneObject(obj) 36 | 37 | # create a cylinder representation type, using 'df' as the radius field 38 | rep=obj.createRepr(ReprType._cylinder,30,radrefine=5,field=df) 39 | mgr.addSceneObjectRepr(rep) 40 | mgr.showBoundBox(rep) # draw a bound box around the vessels 41 | rep.applyMaterial(m1) 42 | 43 | # create a representation type plotting the vessel lines, this will draw over the cylinders since m2 doesn't depth check 44 | rep=obj.createRepr(ReprType._line,20) 45 | mgr.addSceneObjectRepr(rep) 46 | rep.applyMaterial(m2) 47 | 48 | # create a representation type plotting the control nodes 49 | rep=obj.createRepr(ReprType._node) 50 | mgr.addSceneObjectRepr(rep) 51 | rep.applyMaterial(m2) 52 | 53 | mgr.setAxesType(AxesType._cornerTR) # top right corner axes 54 | mgr.controller.setRotation(0.8,0.8) 55 | mgr.setCameraSeeAll() 56 | -------------------------------------------------------------------------------- /tutorial/tutorial3.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ElemType, ReprType, VecFunc, AxesType, ValueFunc, vec3 20 | 21 | rootdir=scriptdir+'/MeshData' 22 | 23 | m=mgr.getMaterial('Rainbow') 24 | 25 | obj=CHeart.loadSceneObject(rootdir+'/BORE_FE.X',rootdir+'/BORE_FE.T',ElemType._Tet1NL) 26 | 27 | # load a field with it's own topology which is a different order than the spatial topology 28 | df=obj.loadDataField(rootdir+'/Vel-1.D',3,rootdir+'/VBORE_FE.T',ElemType._Tet2NL) 29 | 30 | mgr.addSceneObject(obj) 31 | 32 | rep=obj.createRepr(ReprType._line,externalOnly=True) # create external lines 33 | mgr.addSceneObjectRepr(rep) 34 | 35 | # Create a glyph representation which uses the inbuilt arrow figure, uses df as the field to define arrow direction, uses df again for the scaling 36 | # field to indicate size, uses ZAxis as the scaling function to scale the arrows lengthwise only, and scales all the glyphs by an attractive factor 37 | rep=obj.createRepr(ReprType._glyph,5,externalOnly=False,drawInternal=True,glyphname='arrow',dfield=df.getName(),vecfunc=VecFunc._Linear,sfield=df.getName(),scalefunc=VecFunc._ZAxis,glyphscale=(0.0025,0.0025,0.01)) 38 | 39 | mgr.addSceneObjectRepr(rep) 40 | 41 | rep.applyMaterial(m,field=df,valfunc=ValueFunc._Magnitude) # colourize the representation using the same field, applying the magnitude function to each interpolated field value 42 | 43 | mgr.setAxesType(AxesType._cornerTR) # show the axes in the top right corner of the 3D window 44 | mgr.controller.setRotation(0.8,0.8) # move the camera to a nice angle 45 | mgr.setCameraSeeAll() 46 | 47 | -------------------------------------------------------------------------------- /tutorial/tutorial4.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ReprType,AxesType 20 | 21 | dds=Dicom.loadDirDataset(scriptdir+'/DicomData') # load the Dicom files from this directory, returns a DicomDataset object 22 | 23 | series='1.3.6.1.4.1.9590.100.1.1.2375764972290531328210423958986997132495' # series UID values are stored in the Dicom files 24 | 25 | obj=Dicom.loadSeries(series) # load the series, this produces a ImageSceneObject object 26 | 27 | mgr.addSceneObject(obj) 28 | 29 | rep=obj.createRepr(ReprType._imgtimestack) # this image has timesteps so load a time stack 30 | mgr.addSceneObjectRepr(rep) 31 | mgr.showBoundBox(rep) 32 | 33 | mgr.controller.setRotation(-2,0.5) 34 | mgr.setAxesType(AxesType._originarrows) 35 | mgr.setCameraSeeAll() 36 | -------------------------------------------------------------------------------- /tutorial/tutorial5.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ElemType, ReprType, AxesType 20 | 21 | root=scriptdir+'/MeshData' 22 | 23 | # load all of the spatial timesteps 24 | obj=CHeart.loadSceneObject(['%s/LinBox%.4i.X'%(root,i) for i in range(10)],root+'/LinBox.T',ElemType._Hex1NL) 25 | 26 | # load a field timestep for each spatial step, if there is more than one spatial timestep, the number of field timesteps must be the same 27 | dfs=obj.loadDataField(['%s/LinBox_LenSq%.4i.D'%(root,i) for i in range(10)],1) 28 | 29 | mgr.addSceneObject(obj) 30 | 31 | rep=obj.createRepr(ReprType._volume,10,externalOnly=True) 32 | mgr.addSceneObjectRepr(rep) 33 | 34 | mgr.setCameraSeeAll() 35 | mgr.controller.setRotation(-0.6,0.6) 36 | mgr.setAxesType(AxesType._cornerTR) 37 | 38 | m=mgr.getMaterial('Rainbow') 39 | rep.setDataField('LenSq') 40 | rep.applyMaterial(m) # alternatively use field=dfs as an argument instead of setting the field in the previous line 41 | -------------------------------------------------------------------------------- /tutorial/tutorial5a.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ElemType, ReprType, AxesType, vec3, PyDataSet, listToMatrix, generateHexBox, MeshSceneObject 20 | 21 | # The following code will recreate the data loaded in tutorial5.py thus is an example of algorithmic mesh generation 22 | 23 | nodes,inds=generateHexBox(1,1,1) # Generate a box in the unit cube comprised of 8 hexahedra 24 | nodes=listToMatrix(nodes,'Nodes') # use this helper function to convert Python lists to *Matrix types (Vec3Matrix in this case) 25 | inds=listToMatrix(inds,'LinHex',ElemType._Hex1NL) # convert here as well specifying a matrix type Hex1NL 26 | 27 | # construct a list of PyDataset objects which contain the node, topology, and field information for each timestep 28 | dds=[] 29 | for i in xrange(10): 30 | n1=nodes.clone() # clone the nodes 31 | n1.mul(vec3(1+i*0.1,1,1)) # scale the nodes in the X direction 32 | field=[n1.getAt(j).lenSq() for j in xrange(n1.n())]# generate a field defined as the squared length of each node 33 | fieldmat=listToMatrix(field,'LenSq') # convert field, the matrix for each timestep has the same name "LenSq" 34 | dds.append(PyDataSet('ds%i'%i,n1,[inds],[fieldmat])) # create the dataset, each shares the matrix `inds' which is safe 35 | 36 | obj=MeshSceneObject('LinBox',dds) # create the MeshSceneObject, note that this object's "plugin" attribute is None here 37 | mgr.addSceneObject(obj) # add it to the scene, the manager will assign its plugin attribute to be the default mesh plugin 38 | 39 | rep=obj.createRepr(ReprType._volume,10,externalOnly=True) 40 | mgr.addSceneObjectRepr(rep) 41 | 42 | mgr.setCameraSeeAll() 43 | mgr.controller.setRotation(-0.6,0.6) 44 | mgr.setAxesType(AxesType._cornerTR) 45 | 46 | rep.applyMaterial(mgr.getMaterial('Rainbow'),field='LenSq') # shortcut way to apply the material with the chosen field 47 | -------------------------------------------------------------------------------- /tutorial/tutorial6.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ReprType, vec3 20 | 21 | dds=Dicom.loadDirDataset(scriptdir+'/DicomData') 22 | 23 | series='1.3.6.1.4.1.9590.100.1.1.2375764972290531328210423958986997132495' 24 | 25 | # load the image object 26 | obj=Dicom.loadSeries(dds.getSeries(series)) 27 | mgr.addSceneObject(obj) 28 | 29 | # create the volume representation 30 | rep=obj.createRepr(ReprType._imgtimevolume) 31 | mgr.addSceneObjectRepr(rep) 32 | 33 | # create the plane object 34 | plane=SlicePlugin.createSlicePlane(rep.getAABB().center,vec3(0,0,1)) 35 | mgr.addSceneObject(plane) 36 | 37 | # create a line representation of the plane and show its handle 38 | prep=plane.createRepr(ReprType._line) 39 | mgr.addSceneObjectRepr(prep) 40 | mgr.showHandle(prep) 41 | 42 | plane.setApplyToRepr(rep) # apply the plane to the representation 43 | 44 | mgr.controller.setPosition(vec3(92,-41,-41)) 45 | mgr.controller.setRotation(2.3,0.45) 46 | mgr.controller.setZoom(700) 47 | mgr.setCameraSeeAll() 48 | 49 | -------------------------------------------------------------------------------- /tutorial/tutorial7.py: -------------------------------------------------------------------------------- 1 | # Eidolon Biomedical Framework 2 | # Copyright (C) 2016-8 Eric Kerfoot, King's College London, all rights reserved 3 | # 4 | # This file is part of Eidolon. 5 | # 6 | # Eidolon is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # Eidolon is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program (LICENSE.txt). If not, see 18 | 19 | from eidolon import ElemType, ReprType, ValueFunc # import the symbols we'll need 20 | 21 | rootdir=scriptdir+'/MeshData' 22 | 23 | # acquire the plugin and ask it to load a scene object 24 | obj=CHeart.loadSceneObject(rootdir+'/linmesh_FE.X',rootdir+'/linmesh_FE.T',ElemType._Hex1NL) 25 | 26 | # load a data field which has 1 value per line and no topology; the spatial topology of the scene object will be used as the field topology 27 | df=obj.loadDataField(rootdir+'/linmesh_dist.D',1) 28 | 29 | # add the object to the scene 30 | mgr.addSceneObject(obj) 31 | 32 | # create a volume representation which is not refined and represents the external surface only 33 | rep=obj.createRepr(ReprType._line,0,externalOnly=True) 34 | 35 | # add the representation to the scene 36 | mgr.addSceneObjectRepr(rep) 37 | 38 | mgr.setCameraSeeAll() # set the camera viewing parameters to match the object's size 39 | mgr.controller.setRotation(1.0,1.0) # rotate the camera slightly 40 | 41 | m=mgr.getMaterial('Rainbow') # acquire this pre-existing material 42 | 43 | # create an isosurface set using the field `df' as the input and generating 10 planes roughly between the field's minimum and maxmimum values 44 | rep=obj.createRepr(ReprType._isosurf,0,field=df.getName(),numitervals=10,minv=0.0,maxv=80.0,valfunc=ValueFunc._Magnitude) 45 | mgr.addSceneObjectRepr(rep) 46 | 47 | rep.applyMaterial(m,field=df.getName()) 48 | 49 | # do the same with isolines but at a higher refinement value 50 | rep=obj.createRepr(ReprType._isoline,5,field=df.getName(),numitervals=10,minv=0.0,maxv=80.0,radius=0.5,valfunc=ValueFunc._Magnitude) 51 | mgr.addSceneObjectRepr(rep) 52 | 53 | rep.applyMaterial(m,field=df.getName()) 54 | 55 | 56 | --------------------------------------------------------------------------------