├── .gitignore ├── Human.vtp ├── Icons ├── About.png ├── Arcs.png ├── Axes3D.png ├── Axial.png ├── BEV.PNG ├── Beam.png ├── Bones.png ├── CT.png ├── Camera.png ├── Charts.png ├── Color.png ├── Contrast.png ├── Coronal.png ├── DVH.png ├── Dose.png ├── Extent.png ├── Eye.png ├── Isocentre.png ├── KIMView.ico ├── KIMView.png ├── KIMView.tif ├── Legend.png ├── Mouse.png ├── POI.png ├── Page-read.png ├── Patient.png ├── Phone.png ├── Plan.png ├── Polygon.png ├── Profile.png ├── Protractor.png ├── Qt.png ├── Radiobiology.png ├── Reset.png ├── Rotate3D.png ├── RubberBandZoom.png ├── Ruler.png ├── Sagittal.png ├── Save-Figure.png ├── ScalarBar.png ├── Sphere.png ├── Start.png ├── Stop.png ├── StructureSet.png ├── Tile.png ├── UnderConstruction.png ├── View1.png ├── Zoom-In.png ├── Zoom-Out.png ├── Zoom-Reset.png ├── zoom in.png ├── zoom out.png └── zoom.png ├── KIMView.pro ├── LICENSE ├── LicenseTemplate ├── Notes ├── RC.qrc ├── README.md ├── Styles ├── AMOLED.qss ├── Aqua.qss ├── ConsoleStyle.qss ├── Dark.qss ├── ElegantDark.qss ├── ImageX.qss ├── ManjaroMix.qss └── MaterialDark.qss ├── aboutdialog.cpp ├── aboutdialog.h ├── aboutdialog.ui ├── alignimageinteractorstyle.cpp ├── alignimageinteractorstyle.h ├── bevwidget.cpp ├── bevwidget.h ├── bevwidget.ui ├── createobjects.cpp ├── createobjects.h ├── doseprofiledialog.cpp ├── doseprofiledialog.h ├── doseprofiledialog.ui ├── dvhcalc.cpp ├── dvhcalc.h ├── dvhdialog.cpp ├── dvhdialog.h ├── dvhdialog.ui ├── imageviewer2d.cpp ├── imageviewer2d.h ├── imageviewer2d.ui ├── ipconfigdialog.cpp ├── ipconfigdialog.h ├── ipconfigdialog.ui ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── mathutility.cpp ├── mathutility.h ├── meshreader.cpp ├── meshreader.h ├── planreader.cpp ├── planreader.h ├── presetwlwwdialog.cpp ├── presetwlwwdialog.h ├── presetwlwwdialog.ui ├── qDoubleSlider.cpp ├── qDoubleSlider.h ├── radiobiologycalc.cpp ├── radiobiologycalc.h ├── rangesliderdialog.cpp ├── rangesliderdialog.h ├── rangesliderdialog.ui ├── rtstructreaderdialog.cpp ├── rtstructreaderdialog.h ├── rtstructreaderdialog.ui ├── selecttargetdialog.cpp ├── selecttargetdialog.h ├── selecttargetdialog.ui ├── tcpdialog.cpp ├── tcpdialog.h ├── tcpdialog.ui ├── udplistener.cpp ├── udplistener.h ├── utilities.cpp ├── utilities.h ├── vtkinteractorstyleimagecustom.cpp ├── vtkinteractorstyleimagecustom.h ├── vtklinecallbackdose.cpp ├── vtklinecallbackdose.h ├── wlwwdialog.cpp ├── wlwwdialog.h └── wlwwdialog.ui /.gitignore: -------------------------------------------------------------------------------- 1 | # This file is used to ignore files which are generated 2 | # ---------------------------------------------------------------------------- 3 | 4 | *~ 5 | *.autosave 6 | *.a 7 | *.core 8 | *.moc 9 | *.o 10 | *.obj 11 | *.orig 12 | *.rej 13 | *.so 14 | *.so.* 15 | *_pch.h.cpp 16 | *_resource.rc 17 | *.qm 18 | .#* 19 | *.*# 20 | core 21 | !core/ 22 | tags 23 | .DS_Store 24 | .directory 25 | *.debug 26 | Makefile* 27 | *.prl 28 | *.app 29 | moc_*.cpp 30 | ui_*.h 31 | qrc_*.cpp 32 | Thumbs.db 33 | *.res 34 | *.rc 35 | /.qmake.cache 36 | /.qmake.stash 37 | 38 | # qtcreator generated files 39 | *.pro.user* 40 | 41 | # xemacs temporary files 42 | *.flc 43 | 44 | # Vim temporary files 45 | .*.swp 46 | 47 | # Visual Studio generated files 48 | *.ib_pdb_index 49 | *.idb 50 | *.ilk 51 | *.pdb 52 | *.sln 53 | *.suo 54 | *.vcproj 55 | *vcproj.*.*.user 56 | *.ncb 57 | *.sdf 58 | *.opensdf 59 | *.vcxproj 60 | *vcxproj.* 61 | 62 | # MinGW generated files 63 | *.Debug 64 | *.Release 65 | 66 | # Python byte code 67 | *.pyc 68 | 69 | # Binaries 70 | # -------- 71 | *.dll 72 | *.exe 73 | 74 | -------------------------------------------------------------------------------- /Human.vtp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Human.vtp -------------------------------------------------------------------------------- /Icons/About.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/About.png -------------------------------------------------------------------------------- /Icons/Arcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Arcs.png -------------------------------------------------------------------------------- /Icons/Axes3D.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Axes3D.png -------------------------------------------------------------------------------- /Icons/Axial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Axial.png -------------------------------------------------------------------------------- /Icons/BEV.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/BEV.PNG -------------------------------------------------------------------------------- /Icons/Beam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Beam.png -------------------------------------------------------------------------------- /Icons/Bones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Bones.png -------------------------------------------------------------------------------- /Icons/CT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/CT.png -------------------------------------------------------------------------------- /Icons/Camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Camera.png -------------------------------------------------------------------------------- /Icons/Charts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Charts.png -------------------------------------------------------------------------------- /Icons/Color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Color.png -------------------------------------------------------------------------------- /Icons/Contrast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Contrast.png -------------------------------------------------------------------------------- /Icons/Coronal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Coronal.png -------------------------------------------------------------------------------- /Icons/DVH.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/DVH.png -------------------------------------------------------------------------------- /Icons/Dose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Dose.png -------------------------------------------------------------------------------- /Icons/Extent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Extent.png -------------------------------------------------------------------------------- /Icons/Eye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Eye.png -------------------------------------------------------------------------------- /Icons/Isocentre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Isocentre.png -------------------------------------------------------------------------------- /Icons/KIMView.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/KIMView.ico -------------------------------------------------------------------------------- /Icons/KIMView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/KIMView.png -------------------------------------------------------------------------------- /Icons/KIMView.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/KIMView.tif -------------------------------------------------------------------------------- /Icons/Legend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Legend.png -------------------------------------------------------------------------------- /Icons/Mouse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Mouse.png -------------------------------------------------------------------------------- /Icons/POI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/POI.png -------------------------------------------------------------------------------- /Icons/Page-read.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Page-read.png -------------------------------------------------------------------------------- /Icons/Patient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Patient.png -------------------------------------------------------------------------------- /Icons/Phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Phone.png -------------------------------------------------------------------------------- /Icons/Plan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Plan.png -------------------------------------------------------------------------------- /Icons/Polygon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Polygon.png -------------------------------------------------------------------------------- /Icons/Profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Profile.png -------------------------------------------------------------------------------- /Icons/Protractor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Protractor.png -------------------------------------------------------------------------------- /Icons/Qt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Qt.png -------------------------------------------------------------------------------- /Icons/Radiobiology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Radiobiology.png -------------------------------------------------------------------------------- /Icons/Reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Reset.png -------------------------------------------------------------------------------- /Icons/Rotate3D.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Rotate3D.png -------------------------------------------------------------------------------- /Icons/RubberBandZoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/RubberBandZoom.png -------------------------------------------------------------------------------- /Icons/Ruler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Ruler.png -------------------------------------------------------------------------------- /Icons/Sagittal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Sagittal.png -------------------------------------------------------------------------------- /Icons/Save-Figure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Save-Figure.png -------------------------------------------------------------------------------- /Icons/ScalarBar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/ScalarBar.png -------------------------------------------------------------------------------- /Icons/Sphere.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Sphere.png -------------------------------------------------------------------------------- /Icons/Start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Start.png -------------------------------------------------------------------------------- /Icons/Stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Stop.png -------------------------------------------------------------------------------- /Icons/StructureSet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/StructureSet.png -------------------------------------------------------------------------------- /Icons/Tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Tile.png -------------------------------------------------------------------------------- /Icons/UnderConstruction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/UnderConstruction.png -------------------------------------------------------------------------------- /Icons/View1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/View1.png -------------------------------------------------------------------------------- /Icons/Zoom-In.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Zoom-In.png -------------------------------------------------------------------------------- /Icons/Zoom-Out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Zoom-Out.png -------------------------------------------------------------------------------- /Icons/Zoom-Reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/Zoom-Reset.png -------------------------------------------------------------------------------- /Icons/zoom in.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/zoom in.png -------------------------------------------------------------------------------- /Icons/zoom out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/zoom out.png -------------------------------------------------------------------------------- /Icons/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jothy/KIMView/7234d0394a139fa95dd69a07f750164f0c199811/Icons/zoom.png -------------------------------------------------------------------------------- /KIMView.pro: -------------------------------------------------------------------------------- 1 | QT += core gui 2 | 3 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets charts network 4 | 5 | CONFIG += c++19 6 | 7 | # You can make your code fail to compile if it uses deprecated APIs. 8 | # In order to do so, uncomment the following line. 9 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 10 | 11 | SOURCES +=\ 12 | aboutdialog.cpp \ 13 | alignimageinteractorstyle.cpp \ 14 | bevwidget.cpp \ 15 | createobjects.cpp \ 16 | ipconfigdialog.cpp \ 17 | doseprofiledialog.cpp \ 18 | dvhcalc.cpp \ 19 | dvhdialog.cpp \ 20 | imageviewer2d.cpp \ 21 | mathutility.cpp \ 22 | planreader.cpp \ 23 | presetwlwwdialog.cpp \ 24 | radiobiologycalc.cpp \ 25 | selecttargetdialog.cpp \ 26 | tcpdialog.cpp \ 27 | utilities.cpp \ 28 | main.cpp \ 29 | mainwindow.cpp \ 30 | meshreader.cpp \ 31 | qDoubleSlider.cpp \ 32 | rangesliderdialog.cpp \ 33 | wlwwdialog.cpp \ 34 | rtstructreaderdialog.cpp \ 35 | udplistener.cpp \ 36 | vtkinteractorstyleimagecustom.cpp \ 37 | vtklinecallbackdose.cpp 38 | 39 | 40 | 41 | HEADERS +=\ 42 | mathutility.h \ 43 | radiobiologycalc.h \ 44 | tcpdialog.h \ 45 | aboutdialog.h \ 46 | alignimageinteractorstyle.h \ 47 | bevwidget.h \ 48 | ipconfigdialog.h \ 49 | createobjects.h \ 50 | doseprofiledialog.h \ 51 | dvhcalc.h \ 52 | planreader.h \ 53 | presetwlwwdialog.h \ 54 | selecttargetdialog.h \ 55 | utilities.h \ 56 | dvhdialog.h \ 57 | wlwwdialog.h \ 58 | imageviewer2d.h \ 59 | mainwindow.h \ 60 | meshreader.h \ 61 | qDoubleSlider.h \ 62 | rangesliderdialog.h \ 63 | rtstructreaderdialog.h \ 64 | udplistener.h \ 65 | vtkinteractorstyleimagecustom.h \ 66 | vtklinecallbackdose.h 67 | 68 | 69 | 70 | FORMS += \ 71 | aboutdialog.ui \ 72 | bevwidget.ui \ 73 | doseprofiledialog.ui \ 74 | dvhdialog.ui \ 75 | imageviewer2d.ui \ 76 | ipconfigdialog.ui \ 77 | mainwindow.ui \ 78 | presetwlwwdialog.ui \ 79 | rangesliderdialog.ui \ 80 | rtstructreaderdialog.ui \ 81 | selecttargetdialog.ui \ 82 | tcpdialog.ui \ 83 | wlwwdialog.ui 84 | 85 | TRANSLATIONS += 86 | KIMView_en_AU.ts 87 | 88 | # Default rules for deployment. 89 | qnx: target.path = /tmp/$${TARGET}/bin 90 | else: unix:!android: target.path = /opt/$${TARGET}/bin 91 | !isEmpty(target.path): INSTALLS += target 92 | 93 | 94 | INCLUDEPATH+= D:\Libs\VTK\Install\include\vtk-7.1 95 | 96 | LIBS+= -LD:\Libs\VTK\Install\lib -lvtkalglib-7.1 -lvtkChartsCore-7.1 -lvtkCommonColor-7.1 -lvtkCommonComputationalGeometry-7.1 -lvtkCommonCore-7.1\ 97 | -lvtkCommonDataModel-7.1 -lvtkCommonExecutionModel-7.1 -lvtkCommonMath-7.1 -lvtkCommonMisc-7.1 -lvtkCommonSystem-7.1 -lvtkCommonTransforms-7.1\ 98 | -lvtkDICOMParser-7.1 -lvtkDomainsChemistry-7.1 -lvtkDomainsChemistryOpenGL2-7.1 -lvtkexoIIc-7.1 -lvtkexpat-7.1 -lvtkFiltersAMR-7.1\ 99 | -lvtkFiltersCore-7.1 -lvtkFiltersExtraction-7.1 -lvtkFiltersFlowPaths-7.1 -lvtkFiltersGeneral-7.1 -lvtkFiltersGeneric-7.1 -lvtkFiltersGeometry-7.1\ 100 | -lvtkFiltersHybrid-7.1 -lvtkFiltersHyperTree-7.1 -lvtkFiltersImaging-7.1 -lvtkFiltersModeling-7.1 -lvtkFiltersParallel-7.1 -lvtkFiltersParallelImaging-7.1\ 101 | -lvtkFiltersPoints-7.1 -lvtkFiltersProgrammable-7.1 -lvtkFiltersSelection-7.1 -lvtkFiltersSMP-7.1 -lvtkFiltersSources-7.1 -lvtkFiltersStatistics-7.1\ 102 | -lvtkFiltersTexture-7.1 -lvtkFiltersVerdict-7.1 -lvtkfreetype-7.1 -lvtkGeovisCore-7.1 -lvtkgl2ps-7.1 -lvtkglew-7.1 -lvtkGUISupportQt-7.1\ 103 | -lvtkGUISupportQtSQL-7.1 -lvtkhdf5-7.1 -lvtkhdf5_hl-7.1 -lvtkImagingColor-7.1 -lvtkImagingCore-7.1 -lvtkImagingFourier-7.1 -lvtkImagingGeneral-7.1\ 104 | -lvtkImagingHybrid-7.1 -lvtkImagingMath-7.1 -lvtkImagingMorphological-7.1 -lvtkImagingSources-7.1 -lvtkImagingStatistics-7.1 -lvtkImagingStencil-7.1\ 105 | -lvtkInfovisCore-7.1 -lvtkInfovisLayout-7.1 -lvtkInteractionImage-7.1 -lvtkInteractionStyle-7.1 -lvtkInteractionWidgets-7.1 -lvtkIOAMR-7.1\ 106 | -lvtkIOCore-7.1 -lvtkIOEnSight-7.1 -lvtkIOExodus-7.1 -lvtkIOExport-7.1 -lvtkIOGeometry-7.1 -lvtkIOImage-7.1 -lvtkIOImport-7.1\ 107 | -lvtkIOInfovis-7.1 -lvtkIOLegacy-7.1 -lvtkIOLSDyna-7.1 -lvtkIOMINC-7.1 -lvtkIOMovie-7.1 -lvtkIONetCDF-7.1 -lvtkIOParallel-7.1 -lvtkIOParallelXML-7.1\ 108 | -lvtkIOPLY-7.1 -lvtkIOSQL-7.1 -lvtkIOTecplotTable-7.1 -lvtkIOVideo-7.1 -lvtkIOXML-7.1 -lvtkIOXMLParser-7.1 -lvtkjpeg-7.1 -lvtkjsoncpp-7.1\ 109 | -lvtklibxml2-7.1 -lvtkmetaio-7.1 -lvtkNetCDF-7.1 -lvtkNetCDF_cxx-7.1 -lvtkoggtheora-7.1 -lvtkParallelCore-7.1 -lvtkpng-7.1 -lvtkproj4-7.1\ 110 | -lvtkRenderingAnnotation-7.1 -lvtkRenderingContext2D-7.1 -lvtkRenderingContextOpenGL2-7.1 -lvtkRenderingCore-7.1 -lvtkRenderingFreeType-7.1\ 111 | -lvtkRenderingGL2PSOpenGL2-7.1 -lvtkRenderingImage-7.1 -lvtkRenderingLabel-7.1 -lvtkRenderingLOD-7.1 -lvtkRenderingOpenGL2-7.1 -lvtkRenderingQt-7.1\ 112 | -lvtkRenderingVolume-7.1 -lvtkRenderingVolumeOpenGL2-7.1 -lvtksqlite-7.1 -lvtksys-7.1 -lvtktiff-7.1 -lvtkverdict-7.1 -lvtkViewsContext2D-7.1\ 113 | -lvtkViewsCore-7.1 -lvtkViewsGeovis-7.1 -lvtkViewsInfovis-7.1 -lvtkViewsQt-7.1 -lvtkzlib-7.1 114 | 115 | INCLUDEPATH+= D:\Libs\ITK\Install\include\ITK-4.13 116 | 117 | LIBS+= -LD:\Libs\ITK\Install\lib -lITKBiasCorrection-4.13 -lITKBioCell-4.13 -lITKCommon-4.13 -lITKDICOMParser-4.13 -litkdouble-conversion-4.13 -lITKEXPAT-4.13\ 118 | -lITKFEM-4.13 -litkgdcmcharls-4.13 -litkgdcmCommon-4.13 -litkgdcmDICT-4.13 -litkgdcmDSED-4.13 -litkgdcmIOD-4.13 -litkgdcmjpeg12-4.13 -litkgdcmjpeg16-4.13\ 119 | -litkgdcmjpeg8-4.13 -litkgdcmMEXD-4.13 -litkgdcmMSFF-4.13 -litkgdcmopenjp2-4.13 -litkgdcmsocketxx-4.13 -lITKgiftiio-4.13 -lITKIOBioRad-4.13 -lITKIOBMP-4.13\ 120 | -lITKIOBruker-4.13 -lITKIOCSV-4.13 -lITKIOGDCM-4.13 -lITKIOGE-4.13 -lITKIOGIPL-4.13 -lITKIOHDF5-4.13 -lITKIOImageBase-4.13 -lITKIOIPL-4.13\ 121 | -lITKIOJPEG-4.13 -lITKIOLSM-4.13 -lITKIOMesh-4.13 -lITKIOMeta-4.13 -lITKIOMINC-4.13 -lITKIOMRC-4.13 -lITKIONIFTI-4.13 -lITKIONRRD-4.13 -lITKIOPNG-4.13\ 122 | -lITKIOSiemens-4.13 -lITKIOSpatialObjects-4.13 -lITKIOStimulate-4.13 -lITKIOTIFF-4.13 -lITKIOTransformBase-4.13 -lITKIOTransformHDF5-4.13 -lITKIOTransformInsightLegacy-4.13\ 123 | -lITKIOTransformMatlab-4.13 -lITKIOVTK-4.13 -lITKIOXML-4.13 -litkjpeg-4.13 -lITKKLMRegionGrowing-4.13 -lITKLabelMap-4.13 -litklbfgs-4.13 -lITKMesh-4.13 -lITKMetaIO-4.13\ 124 | -litkminc2-4.13 -litknetlib-4.13 -litkNetlibSlatec-4.13 -lITKniftiio-4.13 -lITKNrrdIO-4.13 -lITKOptimizers-4.13 -lITKOptimizersv4-4.13 -lITKPath-4.13 -litkpng-4.13\ 125 | -lITKPolynomials-4.13 -lITKQuadEdgeMesh-4.13 -lITKSpatialObjects-4.13 -lITKStatistics-4.13 -litksys-4.13 -litktestlib-4.13 -litktiff-4.13 -lITKTransform-4.13\ 126 | -lITKTransformFactory-4.13 -litkv3p_netlib-4.13 -litkvcl-4.13 -lITKVideoCore-4.13 -lITKVideoIO-4.13 -litkvnl-4.13 -lITKVNLInstantiation-4.13 -litkvnl_algo-4.13\ 127 | -lITKVTK-4.13 -lITKVtkGlue-4.13 -lITKWatersheds-4.13 -litkzlib-4.13 -lITKznz-4.13 -llibitkhdf5 -llibitkhdf5_cpp 128 | 129 | ##Needed to link ITK libs. This is advanced windows api 130 | LIBS += advapi32.lib 131 | 132 | INCLUDEPATH+= D:\Libs\GDCM\Install\include\gdcm-2.8 133 | 134 | LIBS+= -LD:\Libs\GDCM\Install\lib -lgdcmcharls -lgdcmCommon -lgdcmDICT -lgdcmDSED -lgdcmexpat -lgdcmgetopt -lgdcmIOD -lgdcmjpeg8 -lgdcmjpeg12 -lgdcmjpeg16 -lgdcmMEXD -lgdcmMSFF -lgdcmopenjp2\ 135 | -lgdcmzlib -lsocketxx 136 | 137 | 138 | DISTFILES += \ 139 | Human.vtp \ 140 | LicenseTemplate \ 141 | Notes \ 142 | Styles/AMOLED.qss \ 143 | Styles/Aqua.qss \ 144 | Styles/ConsoleStyle.qss \ 145 | Styles/ElegantDark.qss \ 146 | Styles/ImageX.qss \ 147 | Styles/ManjaroMix.qss \ 148 | Styles/MaterialDark.qss \ 149 | Styles/darkstyle.qss 150 | 151 | RESOURCES += \ 152 | RC.qrc 153 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Jothy Selvaraj 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LicenseTemplate: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ******************************************************************************/ -------------------------------------------------------------------------------- /Notes: -------------------------------------------------------------------------------- 1 | *Remove openGL32.dll from the folder containing KIMView.exe when running on a computer with graphics card 2 | 3 | *Where there is no graphics card on the pc KIMView need to be deployed with mesa software (run the bacth files of mesa to configure) 4 | 5 | IEC2LPS conversion usage: 6 | Utilities *Util=new Utilities(); 7 | double IEC[3]={10.0,20.0,30.0}; 8 | double *LPS=Util->IEC2LPS(IEC); 9 | qDebug()</bin 16 | windeployqt --dir /path/to/deployment/dir /path/to/qt/application.exe 17 | //once executed copy the .exe to this folder 18 | 19 | 20 | -------------------------------------------------------------------------------- /RC.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Icons/Beam.png 4 | Icons/Bones.png 5 | Icons/Camera.png 6 | Icons/CT.png 7 | Icons/Eye.png 8 | Icons/Mouse.png 9 | Icons/Polygon.png 10 | Icons/Profile.png 11 | Icons/Protractor.png 12 | Icons/Reset.png 13 | Icons/Rotate3D.png 14 | Icons/ScalarBar.png 15 | Icons/Dose.png 16 | Icons/zoom in.png 17 | Icons/zoom out.png 18 | Icons/zoom.png 19 | Icons/BEV.PNG 20 | Icons/DVH.png 21 | Icons/Axes3D.png 22 | Icons/Contrast.png 23 | Icons/Axial.png 24 | Icons/Coronal.png 25 | Icons/Color.png 26 | Icons/Extent.png 27 | Icons/RubberBandZoom.png 28 | Icons/Ruler.png 29 | Icons/Sagittal.png 30 | Icons/Qt.png 31 | Icons/Phone.png 32 | Icons/Start.png 33 | Icons/Stop.png 34 | Icons/Patient.png 35 | Icons/Charts.png 36 | Icons/Zoom-In.png 37 | Icons/Zoom-Out.png 38 | Icons/Zoom-Reset.png 39 | Icons/Legend.png 40 | Icons/About.png 41 | Icons/Plan.png 42 | Icons/Isocentre.png 43 | Icons/StructureSet.png 44 | Icons/Arcs.png 45 | Icons/Save-Figure.png 46 | Icons/Page-read.png 47 | Icons/KIMView.ico 48 | Icons/KIMView.tif 49 | Icons/KIMView.png 50 | Icons/UnderConstruction.png 51 | Icons/POI.png 52 | Styles/AMOLED.qss 53 | Styles/Aqua.qss 54 | Styles/ConsoleStyle.qss 55 | Styles/ElegantDark.qss 56 | Styles/ImageX.qss 57 | Styles/ManjaroMix.qss 58 | Styles/MaterialDark.qss 59 | Styles/Dark.qss 60 | Human.vtp 61 | Icons/View1.png 62 | Icons/Tile.png 63 | Icons/Sphere.png 64 | Icons/Radiobiology.png 65 | 66 | 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Template to work on. Documentation work is in progressssssssss... 2 | 3 | ![KIMView](https://github.com/Jothy/KIMView/blob/master/Icons/KIMView.png) 4 | 5 | # KIMView: An open-source real-time tumour motion, dose, and anatomy visualisation tool for radiotherapy 6 | 7 | ## Introduction 8 | 9 | Image-guided radiotherapy (IGRT) typically focuses on measuring geometric errors in patient’s anatomy, especially tumor position and methods to account for it. Geometric accuracy is an indirect measure of treatment quality. The metric of most interest in radiotherapy that correlates directly with clinical outcomes is dose to tumour and critical organs [[1]](https://pubmed.ncbi.nlm.nih.gov/20171515/). The goal of this project is to develop an open-source real-time tumour motion, dose, and anatomy visualisation tool for radiotherapy so the treatment team can see the dose being delivered to the dynamic patient. 10 | 11 | ## Related publications 12 | 1. [J.Selvaraj,Modelling the effect of geometric uncertainties, clonogen distribution and IMRT interpaly effect on Tumour Control Probability, 2013, PhD Thesis, University of Liverpool, UK](https://tinyurl.com/JSelvarajPhDThesis) 13 | 14 | 15 | ## Getting Started 16 | 17 | 18 | 19 | ### Prerequisites 20 | KIMView depends on the following toolkits: 21 | 1. [QT 5.XX](https://www.qt.io/offline-installers) or later but not QT 6.X 22 | 2. [VTK 7.X](https://vtk.org/download/) 23 | 3. [GDCM 2.8.X](https://sourceforge.net/projects/gdcm/files/gdcm%202.x/) 24 | 4. [ITK 4.XX](https://itk.org/download/) 25 | 5. [CMake](https://cmake.org/download/) 26 | 6. [Visual Studio Community Edition](https://visualstudio.microsoft.com/vs/community/) 27 | 28 | Either you can download the tookits and build VTK, GDCM & ITK yourself or else you can use the libs and DLLs provided.The sequence of build is VTK->GDCM->ITK. You need to use CMake to configure the build process and genereate make files then build build with Visual Studio. The current version of KIMView is only compatible with the versions of libraries mentioned above. 29 | 30 | ### Installing 31 | 32 | A step by step series of examples that tell you how to get a development env running 33 | 34 | Say what the step will be 35 | 36 | ``` 37 | Give the example 38 | ``` 39 | 40 | And repeat 41 | 42 | ``` 43 | until finished 44 | ``` 45 | 46 | End with an example of getting some data out of the system or using it for a little demo 47 | 48 | ## Running the tests 49 | 50 | 51 | 52 | ### Break down into end to end tests 53 | 54 | Explain what these tests test and why 55 | 56 | ``` 57 | Give an example 58 | ``` 59 | 60 | ### And coding style tests 61 | 62 | Explain what these tests test and why 63 | 64 | ``` 65 | Give an example 66 | ``` 67 | 68 | ## Deployment 69 | 70 | Add additional notes about how to deploy this on a live system 71 | 72 | ## Built With 73 | 74 | * [QT Creator](https://www.qt.io/product/development-tools) 75 | 76 | 77 | ## Contributing 78 | 79 | Please read [CONTRIBUTING.md](https://gist.github.com/PurpleBooth/b24679402957c63ec426) for details on our code of conduct, and the process for submitting pull requests to us. 80 | 81 | ## Versioning 82 | 83 | We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/Jothy/KIMView/tags). 84 | 85 | ## Authors 86 | 87 | * **Jothy Selvaraj** - *Email: Jothybasu@gmail.com* - [Initial work](https://tinyurl.com/JSelvarajPhDThesis) 88 | 89 | See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project. 90 | 91 | ## License 92 | 93 | This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/Jothy/KIMView/blob/bbe98d173ba6c38958d506e7451bf99b1e25b5a4/LICENSE) file for details 94 | 95 | Thsi project uses Deleaker for deugging leaks. 96 | 97 | https://www.deleaker.com/ 98 | 99 | ## Acknowledgments 100 | 101 | * Hat tip to anyone whose code was used 102 | * Inspiration 103 | * etc 104 | 105 | -------------------------------------------------------------------------------- /Styles/ConsoleStyle.qss: -------------------------------------------------------------------------------- 1 | /* 2 | Dark Console Style Sheet for QT Applications 3 | Author: Jaime A. Quiroga P. 4 | Company: GTRONICK 5 | Last updated: 24/05/2018, 17:12. 6 | Available at: https://github.com/GTRONICK/QSS/blob/master/ConsoleStyle.qss 7 | */ 8 | QWidget { 9 | background-color:rgb(0, 0, 0); 10 | color: rgb(240, 240, 240); 11 | border-color: rgb(58, 58, 58); 12 | } 13 | 14 | QPlainTextEdit { 15 | background-color:rgb(0, 0, 0); 16 | color: rgb(200, 200, 200); 17 | selection-background-color: rgb(255, 153, 0); 18 | selection-color: rgb(0, 0, 0); 19 | } 20 | 21 | QTabWidget::pane { 22 | border-top: 1px solid #000000; 23 | } 24 | 25 | QTabBar::tab { 26 | background-color:rgb(0, 0, 0); 27 | border-style: outset; 28 | border-width: 1px; 29 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 30 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 31 | border-bottom-color: rgb(58, 58, 58); 32 | border-bottom-width: 1px; 33 | border-top-width: 0px; 34 | border-style: solid; 35 | color: rgb(255, 153, 0); 36 | padding: 4px; 37 | } 38 | 39 | QTabBar::tab:selected, QTabBar::tab:hover { 40 | color: rgb(255, 255, 255); 41 | background-color:rgb(0, 0, 0); 42 | border-color:rgb(42, 42, 42); 43 | margin-left: 0px; 44 | margin-right: 0px; 45 | border-bottom-right-radius:4px; 46 | border-bottom-left-radius:4px; 47 | } 48 | 49 | QTabBar::tab:last:selected { 50 | background-color:rgb(0, 0, 0); 51 | border-color:rgb(42, 42, 42); 52 | margin-left: 0px; 53 | margin-right: 0px; 54 | border-bottom-right-radius:4px; 55 | border-bottom-left-radius:4px; 56 | } 57 | 58 | QTabBar::tab:!selected { 59 | margin-bottom: 4px; 60 | border-bottom-right-radius:4px; 61 | border-bottom-left-radius:4px; 62 | } 63 | 64 | QPushButton{ 65 | border-style: outset; 66 | border-width: 2px; 67 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 68 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 69 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 70 | border-bottom-color: rgb(58, 58, 58); 71 | border-bottom-width: 1px; 72 | border-style: solid; 73 | color: rgb(255, 255, 255); 74 | padding: 6px; 75 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); 76 | } 77 | 78 | QPushButton:hover{ 79 | border-style: outset; 80 | border-width: 2px; 81 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); 82 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); 83 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); 84 | border-bottom-color: rgb(115, 115, 115); 85 | border-bottom-width: 1px; 86 | border-style: solid; 87 | color: rgb(255, 255, 255); 88 | padding: 6px; 89 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255)); 90 | } 91 | 92 | QPushButton:pressed{ 93 | border-style: outset; 94 | border-width: 2px; 95 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255)); 96 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 97 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 98 | border-bottom-color: rgb(58, 58, 58); 99 | border-bottom-width: 1px; 100 | border-style: solid; 101 | color: rgb(255, 255, 255); 102 | padding: 6px; 103 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); 104 | } 105 | 106 | QPushButton:disabled{ 107 | border-style: outset; 108 | border-width: 2px; 109 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 110 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 111 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 112 | border-bottom-color: rgb(58, 58, 58); 113 | border-bottom-width: 1px; 114 | border-style: solid; 115 | color: rgb(0, 0, 0); 116 | padding: 6px; 117 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255)); 118 | } 119 | 120 | QLineEdit { 121 | border-width: 1px; border-radius: 4px; 122 | border-color: rgb(58, 58, 58); 123 | border-style: inset; 124 | padding: 0 8px; 125 | color: rgb(255, 255, 255); 126 | background:rgb(101, 101, 101); 127 | selection-background-color: rgb(187, 187, 187); 128 | selection-color: rgb(60, 63, 65); 129 | } 130 | 131 | QProgressBar { 132 | text-align: center; 133 | color: rgb(255, 255, 255); 134 | border-width: 1px; 135 | border-radius: 10px; 136 | border-color: rgb(58, 58, 58); 137 | border-style: inset; 138 | } 139 | 140 | QProgressBar::chunk { 141 | background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(0, 200, 0, 255), stop:1 rgba(30, 230, 30, 255)); 142 | border-radius: 10px; 143 | } 144 | 145 | QMenuBar { 146 | background:rgb(0, 0, 0); 147 | color: rgb(255, 153, 0); 148 | } 149 | 150 | QMenuBar::item { 151 | spacing: 3px; 152 | padding: 1px 4px; 153 | background: transparent; 154 | } 155 | 156 | QMenuBar::item:selected { 157 | background:rgb(115, 115, 115); 158 | } 159 | 160 | QMenu { 161 | border-width: 2px; 162 | border-radius: 10px; 163 | border-color: rgb(255, 153, 0); 164 | border-style: outset; 165 | } 166 | 167 | QMenu::item { 168 | spacing: 3px; 169 | padding: 3px 15px; 170 | } 171 | 172 | QMenu::item:selected { 173 | spacing: 3px; 174 | padding: 3px 15px; 175 | background:rgb(115, 115, 115); 176 | color:rgb(255, 255, 255); 177 | border-width: 1px; 178 | border-radius: 10px; 179 | border-color: rgb(58, 58, 58); 180 | border-style: inset; 181 | } 182 | -------------------------------------------------------------------------------- /Styles/ElegantDark.qss: -------------------------------------------------------------------------------- 1 | /* 2 | ElegantDark Style Sheet for QT Applications 3 | Author: Jaime A. Quiroga P. 4 | Company: GTRONICK 5 | Last updated: 17/04/2018 6 | Available at: https://github.com/GTRONICK/QSS/blob/master/ElegantDark.qss 7 | */ 8 | QMainWindow { 9 | background-color:rgb(82, 82, 82); 10 | } 11 | QTextEdit { 12 | background-color:rgb(42, 42, 42); 13 | color: rgb(255, 255,255); 14 | } 15 | QPushButton{ 16 | border-style: outset; 17 | border-width: 2px; 18 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 19 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 20 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 21 | border-bottom-color: rgb(58, 58, 58); 22 | border-bottom-width: 1px; 23 | border-style: solid; 24 | color: rgb(255, 255, 255); 25 | padding: 2px; 26 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); 27 | } 28 | QPushButton:hover{ 29 | border-style: outset; 30 | border-width: 2px; 31 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); 32 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); 33 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(110, 110, 110, 255)); 34 | border-bottom-color: rgb(115, 115, 115); 35 | border-bottom-width: 1px; 36 | border-style: solid; 37 | color: rgb(255, 255, 255); 38 | padding: 2px; 39 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(107, 107, 107, 255), stop:1 rgba(157, 157, 157, 255)); 40 | } 41 | QPushButton:pressed{ 42 | border-style: outset; 43 | border-width: 2px; 44 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(62, 62, 62, 255), stop:1 rgba(22, 22, 22, 255)); 45 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 46 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 47 | border-bottom-color: rgb(58, 58, 58); 48 | border-bottom-width: 1px; 49 | border-style: solid; 50 | color: rgb(255, 255, 255); 51 | padding: 2px; 52 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); 53 | } 54 | QPushButton:disabled{ 55 | border-style: outset; 56 | border-width: 2px; 57 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 58 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 59 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 60 | border-bottom-color: rgb(58, 58, 58); 61 | border-bottom-width: 1px; 62 | border-style: solid; 63 | color: rgb(0, 0, 0); 64 | padding: 2px; 65 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(57, 57, 57, 255), stop:1 rgba(77, 77, 77, 255)); 66 | } 67 | QLineEdit { 68 | border-width: 1px; border-radius: 4px; 69 | border-color: rgb(58, 58, 58); 70 | border-style: inset; 71 | padding: 0 8px; 72 | color: rgb(255, 255, 255); 73 | background:rgb(100, 100, 100); 74 | selection-background-color: rgb(187, 187, 187); 75 | selection-color: rgb(60, 63, 65); 76 | } 77 | QLabel { 78 | color:rgb(50,50,50); 79 | } 80 | QProgressBar { 81 | text-align: center; 82 | color: rgb(240, 240, 240); 83 | border-width: 1px; 84 | border-radius: 10px; 85 | border-color: rgb(58, 58, 58); 86 | border-style: inset; 87 | background-color:rgb(77,77,77); 88 | } 89 | QProgressBar::chunk { 90 | background-color: qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); 91 | border-radius: 5px; 92 | } 93 | QMenuBar { 94 | background:rgb(82, 82, 82); 95 | } 96 | QMenuBar::item { 97 | color:rgb(223,219,210); 98 | spacing: 3px; 99 | padding: 1px 4px; 100 | background: transparent; 101 | } 102 | 103 | QMenuBar::item:selected { 104 | background:rgb(115, 115, 115); 105 | } 106 | QMenu::item:selected { 107 | color:rgb(255,255,255); 108 | border-width:2px; 109 | border-style:solid; 110 | padding-left:18px; 111 | padding-right:8px; 112 | padding-top:2px; 113 | padding-bottom:3px; 114 | background:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); 115 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 116 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 117 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(62, 62, 62, 255)); 118 | border-bottom-color: rgb(58, 58, 58); 119 | border-bottom-width: 1px; 120 | } 121 | QMenu::item { 122 | color:rgb(223,219,210); 123 | background-color:rgb(78,78,78); 124 | padding-left:20px; 125 | padding-top:4px; 126 | padding-bottom:4px; 127 | padding-right:10px; 128 | } 129 | QMenu{ 130 | background-color:rgb(78,78,78); 131 | } 132 | QTabWidget { 133 | color:rgb(0,0,0); 134 | background-color:rgb(247,246,246); 135 | } 136 | QTabWidget::pane { 137 | border-color: rgb(77,77,77); 138 | background-color:rgb(101,101,101); 139 | border-style: solid; 140 | border-width: 1px; 141 | border-radius: 6px; 142 | } 143 | QTabBar::tab { 144 | padding:2px; 145 | color:rgb(250,250,250); 146 | background-color: qlineargradient(spread:pad, x1:0.5, y1:1, x2:0.5, y2:0, stop:0 rgba(77, 77, 77, 255), stop:1 rgba(97, 97, 97, 255)); 147 | border-style: solid; 148 | border-width: 2px; 149 | border-top-right-radius:4px; 150 | border-top-left-radius:4px; 151 | border-top-color: qlineargradient(spread:pad, x1:0.5, y1:0.6, x2:0.5, y2:0.4, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); 152 | border-right-color: qlineargradient(spread:pad, x1:0.4, y1:0.5, x2:0.6, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); 153 | border-left-color: qlineargradient(spread:pad, x1:0.6, y1:0.5, x2:0.4, y2:0.5, stop:0 rgba(115, 115, 115, 255), stop:1 rgba(95, 92, 93, 255)); 154 | border-bottom-color: rgb(101,101,101); 155 | } 156 | QTabBar::tab:selected, QTabBar::tab:last:selected, QTabBar::tab:hover { 157 | background-color:rgb(101,101,101); 158 | margin-left: 0px; 159 | margin-right: 1px; 160 | } 161 | QTabBar::tab:!selected { 162 | margin-top: 1px; 163 | margin-right: 1px; 164 | } 165 | QCheckBox { 166 | color:rgb(50,50,50); 167 | padding: 2px; 168 | } 169 | QCheckBox:hover { 170 | border-radius:4px; 171 | border-style:solid; 172 | padding-left: 1px; 173 | padding-right: 1px; 174 | padding-bottom: 1px; 175 | padding-top: 1px; 176 | border-width:1px; 177 | border-color: rgb(87, 97, 106); 178 | background-color:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 150), stop:1 rgba(93, 103, 113, 150)); 179 | } 180 | QCheckBox::indicator:checked { 181 | border-radius:4px; 182 | border-style:solid; 183 | border-width:1px; 184 | border-color: rgb(180,180,180); 185 | background-color:qlineargradient(spread:pad, x1:0.5, y1:0.7, x2:0.5, y2:0.3, stop:0 rgba(87, 97, 106, 255), stop:1 rgba(93, 103, 113, 255)); 186 | } 187 | QCheckBox::indicator:unchecked { 188 | border-radius:4px; 189 | border-style:solid; 190 | border-width:1px; 191 | border-color: rgb(87, 97, 106); 192 | background-color:rgb(255,255,255); 193 | } 194 | QStatusBar { 195 | color:rgb(240,240,240); 196 | } 197 | 198 | QTreeWidget { 199 | background-color:rgb(110,110,110); 200 | } 201 | 202 | QMdiSubWindow{ 203 | selection-background-color: grey;/*for some styles it also used as title bar main gradient color...*/ 204 | padding: 4px;/*need for resize window with mouse*/ 205 | background-color: rgba(0,0,0,0); 206 | } 207 | 208 | -------------------------------------------------------------------------------- /aboutdialog.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the 11 | Software, and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ******************************************************************************/ 25 | #include "aboutdialog.h" 26 | 27 | #include 28 | 29 | #include "ui_aboutdialog.h" 30 | 31 | AboutDialog::AboutDialog(QWidget *parent) 32 | : QDialog(parent), ui(new Ui::AboutDialog) { 33 | ui->setupUi(this); 34 | } 35 | 36 | AboutDialog::~AboutDialog() { delete ui; } 37 | 38 | void AboutDialog::on_buttonBox_accepted() { 39 | this->acceptLicense = true; 40 | // qDebug() << this->acceptLicense; 41 | this->close(); 42 | } 43 | 44 | void AboutDialog::on_buttonBox_rejected() { 45 | this->acceptLicense = false; 46 | // qDebug() << this->acceptLicense; 47 | this->close(); 48 | } 49 | -------------------------------------------------------------------------------- /aboutdialog.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the 11 | Software, and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ******************************************************************************/ 25 | #ifndef ABOUTDIALOG_H 26 | #define ABOUTDIALOG_H 27 | 28 | #include 29 | 30 | namespace Ui { 31 | class AboutDialog; 32 | } 33 | 34 | class AboutDialog : public QDialog { 35 | Q_OBJECT 36 | 37 | public: 38 | explicit AboutDialog(QWidget *parent = nullptr); 39 | ~AboutDialog(); 40 | bool acceptLicense = false; 41 | 42 | private slots: 43 | void on_buttonBox_accepted(); 44 | 45 | void on_buttonBox_rejected(); 46 | 47 | private: 48 | Ui::AboutDialog *ui; 49 | }; 50 | 51 | #endif // ABOUTDIALOG_H 52 | -------------------------------------------------------------------------------- /alignimageinteractorstyle.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #include "alignimageinteractorstyle.h" 26 | 27 | #define vtkRenderingCore_AUTOINIT \ 28 | 3(vtkInteractionStyle, vtkRenderingFreeType, vtkRenderingOpenGL2) 29 | #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | AlignImageInteractorStyle::AlignImageInteractorStyle() { 37 | class SpinImage : public vtkCommand {}; 38 | } 39 | 40 | AlignImageInteractorStyle *AlignImageInteractorStyle::New() { 41 | return new AlignImageInteractorStyle; 42 | } 43 | 44 | // Disable rotation in 3D 45 | void AlignImageInteractorStyle::Rotate() { 46 | // qDebug()<<"Rotation disabled:)"; 47 | } 48 | 49 | // Disable zoom right button down 50 | void AlignImageInteractorStyle::OnRightButtonDown() {} 51 | -------------------------------------------------------------------------------- /alignimageinteractorstyle.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef ALIGNIMAGEINTERACTORSTYLE_H 26 | #define ALIGNIMAGEINTERACTORSTYLE_H 27 | 28 | #define vtkRenderingCore_AUTOINIT 3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) 29 | #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) 30 | 31 | 32 | #include 33 | #include 34 | 35 | 36 | class AlignImageInteractorStyle : public vtkInteractorStyleTrackballActor 37 | { 38 | public: 39 | AlignImageInteractorStyle(); 40 | static AlignImageInteractorStyle *New(); 41 | void Rotate(); 42 | void OnRightButtonDown(); 43 | 44 | }; 45 | 46 | #endif // ALIGNIMAGEINTERACTORSTYLE_H 47 | -------------------------------------------------------------------------------- /bevwidget.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef BEVWIDGET_H 26 | #define BEVWIDGET_H 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | #include 41 | 42 | namespace Ui { 43 | class BEVWidget; 44 | } 45 | 46 | class BEVWidget : public QWidget { 47 | Q_OBJECT 48 | 49 | public: 50 | explicit BEVWidget(QWidget *parent = nullptr, QActionGroup *contextMenus = 0); 51 | ~BEVWidget(); 52 | double (*ROIColors)[3]; 53 | std::vector > MeshList; 54 | std::vector > BeamList; 55 | // vtkSmartPointerViewRenderer; 56 | vtkSmartPointer MeshActors; 57 | vtkSmartPointer BeamActors; 58 | vtkSmartPointer ModelRenderer; 59 | vtkSmartPointer ModelRenderer2; 60 | vtkSmartPointer ImageStyleImg; 61 | vtkSmartPointer Interactor3D; 62 | vtkSmartPointer InteractorTrackball; 63 | vtkSmartPointer AnnotatedCube; 64 | vtkSmartPointer MarkerWidget; 65 | vtkSmartPointer MarkerWidget2; 66 | vtkSmartPointer BEVField; 67 | vtkSmartPointer Axes; 68 | vtkSmartPointer IsodoseSurface; 69 | vtkSmartPointer RTDose; 70 | QList ROITypes; 71 | 72 | double *Isocentre; 73 | double GantryAngle; 74 | 75 | void DisplayBEV(); 76 | void DisplayMeshes(); 77 | void DisplayBeams(); 78 | void ShowIsodoseSurface(double minDose, double maxDose); 79 | 80 | private: 81 | Ui::BEVWidget *ui; 82 | }; 83 | 84 | #endif // BEVWIDGET_H 85 | -------------------------------------------------------------------------------- /bevwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | BEVWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | BEV 15 | 16 | 17 | 18 | 19 | 20 | Qt::ActionsContextMenu 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | QVTKWidget 32 | QWidget 33 |
qvtkwidget.h
34 | 1 35 |
36 |
37 | 38 | 39 |
40 | -------------------------------------------------------------------------------- /createobjects.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef CREATEOBJECTS_H 26 | #define CREATEOBJECTS_H 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | 43 | class CreateObjects { 44 | public: 45 | CreateObjects(); 46 | vtkSmartPointer annotation; 47 | void createAnnotation(int location, double RGB[3], QString text1); 48 | vtkSmartPointer createSphere(double radius, int thetaR, int phiR, 49 | double center[3]); 50 | vtkSmartPointer createCube(double x, double y, double z, 51 | double center[3]); 52 | vtkSmartPointer createCylinder(double radius, double height, 53 | double center[3]); 54 | vtkSmartPointer createIsodoseLegend( 55 | std::vector isodoseValues, std::vector colorsR, 56 | std::vector colorsG, std::vector colorsB); 57 | 58 | vtkSmartPointer createRectangle(double x1, double x2, double y1, 59 | double y2, double gantryAngle, 60 | double collAngle, 61 | double isocenter[3]); 62 | vtkSmartPointer createLeaf(double length, double thickness, 63 | double position[3], double isocenter[3]); 64 | vtkSmartPointer createVarian120MLC(double isocenter[3], 65 | double gantryAngle, 66 | double collAngle, 67 | vtkTransform *userTr); 68 | vtkSmartPointer createVectorText(QString txt, double collAngle, 69 | double gantryAngle); 70 | vtkSmartPointer createAxes(double shift[3], double isocenter[3]); 71 | vtkSmartPointer createCaption2D(); 72 | vtkSmartPointer createGraticule(); 73 | vtkSmartPointer createArc(double radius, double gantryStart, 74 | double gantryStop, QString dir, 75 | double Iso[3]); 76 | vtkSmartPointer createBeam(double x1, double x2, double y1, 77 | double y2, double upperEnd, 78 | double lowerEnd, double gantryAngle, 79 | double collAngle, double couchAngle, 80 | double isocenter[3]); 81 | }; 82 | 83 | #endif // CREATEOBJECTS_H 84 | -------------------------------------------------------------------------------- /doseprofiledialog.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #include "doseprofiledialog.h" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | 62 | #include "ui_doseprofiledialog.h" 63 | #include "vtklinecallbackdose.h" 64 | 65 | QT_CHARTS_USE_NAMESPACE 66 | 67 | DoseProfileDialog::DoseProfileDialog(QWidget *parent) 68 | : QDialog(parent), ui(new Ui::DoseProfileDialog) { 69 | ui->setupUi(this); 70 | Qt::WindowFlags flags = nullptr; 71 | flags = Qt::Dialog; 72 | flags |= Qt::WindowMaximizeButtonHint; 73 | flags |= Qt::WindowMinimizeButtonHint; 74 | // flags |= Qt::WindowCloseButtonHint; 75 | this->setWindowFlags(flags); 76 | 77 | this->DoseData = new QSplineSeries; 78 | 79 | this->addAction(this->ui->actionSave_Figure); 80 | this->show(); 81 | } 82 | 83 | DoseProfileDialog::~DoseProfileDialog() { 84 | delete ui; 85 | delete this->DoseData; 86 | } 87 | 88 | void DoseProfileDialog::plotProfile() { 89 | QChart *chart = new QChart(); 90 | chart->legend()->show(); 91 | 92 | // Enable anti-aliasing 93 | this->ui->ChartView->setRenderHint(QPainter::Antialiasing, true); 94 | 95 | chart->addSeries(this->DoseData); 96 | this->ui->ChartView->setChart(chart); 97 | 98 | QValueAxis *axisX = new QValueAxis; 99 | axisX->setTickCount(10); 100 | axisX->setLabelFormat("%.0f"); 101 | axisX->setTitleText("Distance (mm)"); 102 | this->ui->ChartView->chart()->setAxisX(axisX, this->DoseData); 103 | 104 | QValueAxis *axisY = new QValueAxis; 105 | axisY->setTickCount(10); 106 | axisY->setLabelFormat("%.1f"); 107 | axisY->setTitleText("Dose (Gy)"); 108 | this->ui->ChartView->chart()->setAxisY(axisY, this->DoseData); 109 | } 110 | 111 | void DoseProfileDialog::on_actionSave_Figure_triggered() { 112 | QString fileName = QFileDialog::getSaveFileName(this, "Save DVH Figure", 113 | "Dose profile", "png(*.png)"); 114 | this->ui->ChartView->grab().save(fileName.append(".png")); 115 | } 116 | 117 | void DoseProfileDialog::closeEvent(QCloseEvent *event) {} 118 | -------------------------------------------------------------------------------- /doseprofiledialog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef DOSEPROFILEDIALOG_H 26 | #define DOSEPROFILEDIALOG_H 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | QT_CHARTS_USE_NAMESPACE 35 | 36 | namespace Ui { 37 | class DoseProfileDialog; 38 | } 39 | 40 | class DoseProfileDialog : public QDialog { 41 | Q_OBJECT 42 | 43 | public: 44 | explicit DoseProfileDialog(QWidget *parent = 0); 45 | ~DoseProfileDialog(); 46 | void plotProfile(); 47 | QSplineSeries *DoseData; 48 | void closeEvent(QCloseEvent *event); 49 | 50 | private: 51 | Ui::DoseProfileDialog *ui; 52 | 53 | private slots: 54 | void on_actionSave_Figure_triggered(); 55 | }; 56 | 57 | #endif // DOSEPROFILEDIALOG_H 58 | -------------------------------------------------------------------------------- /doseprofiledialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DoseProfileDialog 4 | 5 | 6 | Qt::NonModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 500 13 | 400 14 | 15 | 16 | 17 | 18 | 0 19 | 0 20 | 21 | 22 | 23 | 24 | 500 25 | 400 26 | 27 | 28 | 29 | Qt::ClickFocus 30 | 31 | 32 | Qt::ActionsContextMenu 33 | 34 | 35 | Dose Profile 36 | 37 | 38 | 39 | :/Icons/Eye.png:/Icons/Eye.png 40 | 41 | 42 | false 43 | 44 | 45 | false 46 | 47 | 48 | 49 | 50 | 51 | 52 | 0 53 | 0 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | :/Icons/Save-Figure.png:/Icons/Save-Figure.png 63 | 64 | 65 | Save figure 66 | 67 | 68 | Save figure in PNG format 69 | 70 | 71 | Alt+S 72 | 73 | 74 | 75 | 76 | 77 | QChartView 78 | QWidget 79 |
QtCharts
80 | 1 81 |
82 |
83 | 84 | 85 | 86 | 87 |
88 | -------------------------------------------------------------------------------- /dvhcalc.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | #ifndef DVHCALC_H 25 | #define DVHCALC_H 26 | 27 | #include 28 | #include 29 | #include 30 | //#include"boost/multi_array.hpp" 31 | 32 | #include 33 | 34 | class DVHCalc { 35 | public: 36 | DVHCalc(); 37 | ~DVHCalc(); 38 | std::vector calcStructDVH(vtkPolyData* structure, 39 | vtkImageData* doseGrid); 40 | std::vector getDoseValuesAsVector(std::vector, std::vector, 41 | std::vector, 42 | vtkImageData* doseGrid); 43 | std::vector getClonogensAsVector(vtkImageData* clonogenGrid); 44 | 45 | void getIndicesOfOnes(vtkImageData* imgData); 46 | void getDoseValues(std::vector, std::vector, std::vector, 47 | vtkImageData* doseGrid); 48 | void diffToCumulative(std::vector doseBins, 49 | std::vector volBins); 50 | void histogramData(int bins, std::vector data, double voxelVolume, 51 | bool dvhType); 52 | void histogramData2(double doseBinWidth, std::vector data, 53 | double voxelVolume, bool dvhType); 54 | void getStructBoundsInMatrixCoords(double imgBounds[6], 55 | double structBounds[6], double xSpc, 56 | double ySpc, double zSpc, int xDims, 57 | int yDims, int zDims); 58 | void resampleImage(vtkImageData* imgData, double, double, double, 59 | int interpolationFlag); 60 | 61 | std::vector indicesX; 62 | std::vector indicesY; 63 | std::vector indicesZ; 64 | std::vector doseValues; 65 | std::vector doseBins; 66 | std::vector volBins; 67 | std::vector cumVolume; 68 | double structBoundsInMatrixCoords[6]; 69 | vtkSmartPointer resampledImage; 70 | }; 71 | 72 | #endif // DVHCALC_H 73 | -------------------------------------------------------------------------------- /dvhdialog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | #ifndef DVHDIALOG_H 25 | #define DVHDIALOG_H 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | //#include"boost/multi_array.hpp" 40 | 41 | QT_CHARTS_USE_NAMESPACE 42 | 43 | namespace Ui { 44 | class DVHDialog; 45 | } 46 | 47 | class DVHDialog : public QDialog { 48 | Q_OBJECT 49 | 50 | public: 51 | explicit DVHDialog(QWidget *parent = 0); 52 | ~DVHDialog(); 53 | void setStructureNames(QList structNames); 54 | void setROIColors(double[30][3]); 55 | void getSelectedItems(); 56 | vtkSmartPointer doseMatrix; 57 | // vtkSmartPointer< vtkImageData>resampledDoseMatrix; 58 | std::vector > meshes; 59 | QList structNames; 60 | QList ROIType; 61 | double ROIColors[50][3]; // No. of ROIs,RGB- maximum 30 ROIs supported for 62 | // now 63 | double maxDose; 64 | unsigned int bins; 65 | unsigned int resampleDoseFlag; 66 | unsigned int interpolationTypeFlag; 67 | unsigned int dvhTypeFlag; 68 | double xSpc, ySpc, zSpc; 69 | std::vector > dvhTable; 70 | std::vector dvhBinsVector; // Imported dvh bin Nos 71 | QList refROINums; // Referenced ROi nos from DVH in RTDose.dcm 72 | QList ROINo; // ROi Referenced No. from RTStruct.dcm 73 | QList refNoOfSelectedROIs; 74 | QList sitems; // Selected items 75 | 76 | double alphaByBeta; 77 | double alpha; 78 | double alphaMean; 79 | double alphaStd; 80 | double clonogenDensity; 81 | double fractions; 82 | double temporalCF; 83 | double xMeanSys, yMeanSys, zMeanSys; 84 | double xSDSys, ySDSys, zSDSys; 85 | double xMeanRan, yMeanRan, zMeanRan; 86 | double xSDRan, ySDRan, zSDRan; 87 | int selectedStructureNum; 88 | 89 | private: 90 | Ui::DVHDialog *ui; 91 | 92 | private slots: 93 | void on_actionCalculate_DVH_triggered(); 94 | void on_actionReset_View_triggered(); 95 | void on_actionSave_Figure_triggered(); 96 | void on_saveFig_clicked(); 97 | void on_checkBoxLegend_clicked(); 98 | void on_groupBoxResampleDoseGrid_toggled(bool); 99 | void on_ResetViewButton_clicked(); 100 | void on_pushButton_clicked(); 101 | }; 102 | 103 | #endif // DVHDIALOG_H 104 | -------------------------------------------------------------------------------- /imageviewer2d.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef IMAGEVIEWER2D_H 26 | #define IMAGEVIEWER2D_H 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | 56 | // Initialize vtk modules 57 | VTK_MODULE_INIT(vtkRenderingOpenGL2); 58 | VTK_MODULE_INIT(vtkRenderingFreeType); 59 | VTK_MODULE_INIT(vtkInteractionStyle); 60 | VTK_MODULE_INIT(vtkRenderingContextOpenGL2); // Needed for charts 61 | 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | 71 | namespace Ui { 72 | class ImageViewer2D; 73 | } 74 | 75 | class ImageViewer2D : public QWidget { 76 | Q_OBJECT 77 | 78 | public: 79 | explicit ImageViewer2D(QWidget *parent = nullptr, 80 | QActionGroup *contextMenus = 0); 81 | ~ImageViewer2D(); 82 | void SetImageData(vtkSmartPointer Img); 83 | void SetRTDose(vtkSmartPointer Dose); 84 | void SetInteractorStyleToRegistration(); 85 | // 0=Axial,1=Sagittal,2=Coronal 86 | void SetSliceOrientation(int Orientation); 87 | void SetUpView(); 88 | void ShowImageAndDose(double SliceLoc); 89 | virtual void SliceImageAndDose(double SliceLoc); 90 | void ShowCursor(double *Bounds); 91 | void TriggerActionShowBeams(); 92 | void TriggerActionShowDose(); 93 | void TriggerActionShowContours(); 94 | void TriggerReset_WL_WW(); 95 | void DisplayROIs(double SliceLoc, int Orientation); 96 | void DisplayBeams(double SliceLoc, int Orientation); 97 | void DisplayPOIs(double SliceLoc, int Orientation); 98 | void DisplayScalarBar(); 99 | void HideBeams(); 100 | void HideContours(); 101 | void HideDose(); 102 | void UpdateView(); 103 | void MoveToLocation(double loc); 104 | void AdjustDoseRange(double min, double max); 105 | void AdjustImageWLWW(); 106 | 107 | double SliceStep; 108 | int SliceOrientation; // Axial by default 109 | double WindowUp = 600, WindowLow = -400; // corresponds to WW=1000 & WL=100 110 | double WindowWidth = 0.0, Windowlevel = 0.0; 111 | double Bounds[6]; 112 | double DoseRange[2] = {0.0, 1.0}; 113 | double SliceLoc; 114 | double (*ROIColors)[3]; // 50 ROIs supported as of now 115 | int NumOfROIs; 116 | bool BeamVisibility; 117 | bool ContourVisibility; 118 | bool DoseVisibility; 119 | bool POIVisibility; 120 | bool ScalarBarVisibility; 121 | 122 | vtkSmartPointer ImageData; 123 | vtkSmartPointer RTDose; 124 | vtkSmartPointer ImgPositionAnnotation; 125 | vtkSmartPointer WLWAnnotation; 126 | vtkSmartPointer AnnotatedCube; 127 | vtkSmartPointer InteractorImage2D; 128 | vtkSmartPointer InteractorImage; 129 | vtkSmartPointer DistanceWidget; 130 | vtkSmartPointer AngleWidget; 131 | vtkSmartPointer UserTransform; 132 | vtkSmartPointer CursorActor; 133 | vtkSmartPointer ROIActor; 134 | vtkSmartPointer ViewRenderer; 135 | vtkSmartPointer ImageSlice; 136 | vtkSmartPointer DoseSlice; 137 | vtkSmartPointer CutROI(vtkPolyData *mesh, double sliceNo, double R, 138 | double G, double B, int Orientation); 139 | vtkSmartPointer ContourActors; 140 | vtkSmartPointer BeamActors; 141 | vtkSmartPointer POIActors; 142 | vtkSmartPointer BeamColors; 143 | vtkSmartPointer IsocentreAxes; 144 | vtkSmartPointer DoseScalarBar; 145 | vtkSmartPointer DoseLUT; 146 | vtkSmartPointer lineCallbackDose; 147 | vtkSmartPointer lineWidget; 148 | vtkSmartPointer ScalarBar; 149 | vtkSmartPointer ImageReslice; 150 | 151 | vtkSmartPointer Axes; 152 | vtkSmartPointer HumanActor; 153 | vtkSmartPointer MarkerWidget; 154 | vtkSmartPointer AxesWidget; 155 | 156 | std::vector > MeshList; 157 | std::vector > BeamList; 158 | std::vector > POIList; 159 | 160 | QList ROINames; 161 | QList ROITypes; 162 | QList ROINo; 163 | 164 | private slots: 165 | void on_toolButtonSagittal_clicked(); 166 | 167 | void on_toolButtonAxial_clicked(); 168 | 169 | void on_toolButtonCoronal_clicked(); 170 | 171 | void on_toolButtonScreenshot_clicked(); 172 | 173 | void on_verticalScrollBar_valueChanged(int value); 174 | 175 | virtual void on_toolButtonContrast_clicked(); 176 | 177 | void on_actionMeasureDistance_triggered(); 178 | 179 | void on_actionMeasureAngle_triggered(); 180 | 181 | void on_actionReset_WL_WW_triggered(); 182 | 183 | void on_toolButtonProbe_clicked(); 184 | 185 | void on_toolButtonScalarBar_clicked(); 186 | 187 | void on_actionShowContours_triggered(); 188 | 189 | void on_actionShowDose_triggered(); 190 | 191 | void on_actionRubberBandZoom_triggered(); 192 | 193 | void on_actionShowBeams_triggered(); 194 | 195 | void on_actionShow_Image_Extent_triggered(); 196 | 197 | private: 198 | Ui::ImageViewer2D *ui; 199 | 200 | protected: 201 | void keyPressEvent(QKeyEvent *event); 202 | void wheelEvent(QWheelEvent *event); 203 | }; 204 | 205 | #endif // IMAGEVIEWER2D_H 206 | -------------------------------------------------------------------------------- /ipconfigdialog.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #include "ipconfigdialog.h" 26 | 27 | #include 28 | #include 29 | 30 | #include "ui_ipconfigdialog.h" 31 | 32 | IPConfigDialog::IPConfigDialog(QWidget *parent) 33 | : QDialog(parent), ui(new Ui::IPConfigDialog) { 34 | ui->setupUi(this); 35 | 36 | // Receiver port 37 | QSettings settings("ImageX", "KIMView"); 38 | QString KIMViewIP = settings.value("KIMViewIP").toString(); 39 | int KIMViewPort = settings.value("KIMViewPort").toInt(); 40 | // int KIMPort=settings.value("KIMPort").toInt(); 41 | 42 | this->ui->lineEdit_KIMViewIP->setText(KIMViewIP); 43 | // this->ui->lineEdit_KIMPort->setText(QString::number(KIMPort)); 44 | this->ui->lineEdit_KIMViewPort->setText(QString::number(KIMViewPort)); 45 | } 46 | 47 | IPConfigDialog::~IPConfigDialog() { delete ui; } 48 | 49 | void IPConfigDialog::on_buttonBox_accepted() { 50 | // qDebug()<ui->lineEdit_KIMViewIP->text(); 51 | // qDebug()<ui->lineEdit_KIMPort->text().toInt(); 52 | // qDebug()<ui->lineEdit_KIMViewPort->text().toInt(); 53 | 54 | QSettings settings("ImageX", "KIMView"); 55 | settings.setValue("KIMViewIP", this->ui->lineEdit_KIMViewIP->text()); 56 | // settings.setValue("KIMPort",this->ui->lineEdit_KIMPort->text().toInt()); 57 | settings.setValue("KIMViewPort", 58 | this->ui->lineEdit_KIMViewPort->text().toInt()); 59 | } 60 | -------------------------------------------------------------------------------- /ipconfigdialog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef IPCONFIGDIALOG_H 26 | #define IPCONFIGDIALOG_H 27 | 28 | #include 29 | 30 | namespace Ui { 31 | class IPConfigDialog; 32 | } 33 | 34 | class IPConfigDialog : public QDialog 35 | { 36 | Q_OBJECT 37 | 38 | public: 39 | explicit IPConfigDialog(QWidget *parent = nullptr); 40 | ~IPConfigDialog(); 41 | 42 | private slots: 43 | void on_buttonBox_accepted(); 44 | 45 | private: 46 | Ui::IPConfigDialog *ui; 47 | }; 48 | 49 | #endif // IPCONFIGDIALOG_H 50 | -------------------------------------------------------------------------------- /ipconfigdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | IPConfigDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 231 10 | 138 11 | 12 | 13 | 14 | IP Configuration 15 | 16 | 17 | 18 | 19 | 20 | Network Configuration 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | KIMView IP: 31 | 32 | 33 | 34 | 35 | 36 | 37 | KIMView Port: 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 127.0.0.1 49 | 50 | 51 | 52 | 53 | 54 | 55 | 45617 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | Qt::Horizontal 70 | 71 | 72 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | buttonBox 82 | accepted() 83 | IPConfigDialog 84 | accept() 85 | 86 | 87 | 248 88 | 254 89 | 90 | 91 | 157 92 | 274 93 | 94 | 95 | 96 | 97 | buttonBox 98 | rejected() 99 | IPConfigDialog 100 | reject() 101 | 102 | 103 | 316 104 | 260 105 | 106 | 107 | 286 108 | 274 109 | 110 | 111 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #include "aboutdialog.h" 30 | #include "mainwindow.h" 31 | 32 | // Testing 33 | 34 | int main(int argc, char *argv[]) { 35 | QApplication a(argc, argv); 36 | MainWindow w; 37 | 38 | AboutDialog *license = new AboutDialog(); 39 | license->exec(); 40 | 41 | if (license->acceptLicense == true) { 42 | // qDebug() << "Accepted"; 43 | w.showMaximized(); 44 | a.setStyle(QStyleFactory::create("Fusion")); 45 | a.setOrganizationName("ImageX"); 46 | a.setOrganizationDomain("https://image-x.sydney.edu.au/"); 47 | a.setApplicationName("KIMView"); 48 | return a.exec(); 49 | 50 | } 51 | 52 | else { 53 | // qDebug() << "Declined"; 54 | } 55 | 56 | // // Default style 57 | // QFile file(":/Styles/ElegantDark.qss"); 58 | // file.open(QFile::ReadOnly); 59 | // QString styleSheet = QLatin1String(file.readAll()); 60 | // a.setStyleSheet(styleSheet); 61 | } 62 | -------------------------------------------------------------------------------- /mainwindow.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef MAINWINDOW_H 26 | #define MAINWINDOW_H 27 | 28 | // vtkRenderingContextOpenGL2 needed for charts 29 | #define vtkRenderingCore_AUTOINIT \ 30 | 4(vtkInteractionStyle, vtkRenderingFreeType, vtkRenderingOpenGL2, \ 31 | vtkRenderingContextOpenGL2); 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | // Tracking function headers 56 | #include 57 | #include 58 | #include 59 | 60 | namespace Ui { 61 | class MainWindow; 62 | } 63 | 64 | class MainWindow : public QMainWindow { 65 | Q_OBJECT 66 | 67 | public: 68 | explicit MainWindow(QWidget *parent = nullptr); 69 | ~MainWindow(); 70 | QActionGroup *ContextMenus; 71 | vtkSmartPointer RTDose; 72 | std::vector> MeshList; 73 | std::vector> BeamList; 74 | std::vector> POIList; 75 | vtkSmartPointer MeshActors; 76 | vtkSmartPointer BeamActors; 77 | std::vector> arcList; 78 | 79 | // No. of ROIs,RGB- maximum 50 ROIs supported for now 80 | double ROIColors[50][3]; 81 | QList ROINames; 82 | QList ROITypes; 83 | QList ROINo; 84 | QList BeamAngles; 85 | QList CollAngles; 86 | int ROINum = 0; 87 | vtkSmartPointer CTImage; 88 | QList PhaseInfo; 89 | double DoseVOI[6]; 90 | double Isocentre[3] = {0.0, 0.0, 0.0}; // zero by default (CT origin) 91 | unsigned int BeamNum = 0; 92 | double DoseGridSpacing = 3.0; // 3mm default 93 | 94 | // Higher the fraction, lesser vertices 95 | double TargetReduction = 0.05; 96 | bool ROIVisibleFlag = 1; // Visible by default 97 | int DefaultTargetIdx = 0; 98 | 99 | vtkSmartPointer InteractorTrackball; 100 | 101 | ImageViewer2D *SagittalViewer; 102 | ImageViewer2D *AxialViewer; 103 | ImageViewer2D *CoronalViewer; 104 | BEVWidget *BEVViewer; 105 | double CalcSSD(double Iso[3], double GantryAngle, vtkDataSet *BodyMesh); 106 | 107 | UDPListener *listener; 108 | QFileSystemWatcher fileWatcher; 109 | 110 | QMap PatientInfo; 111 | 112 | // UDPListener not listening by default 113 | bool ListeningState = false; 114 | 115 | bool arcVisibility = true; 116 | 117 | private slots: 118 | void on_actionDose_triggered(); 119 | 120 | void on_actionCT_triggered(); 121 | 122 | void on_actionStructures_triggered(); 123 | 124 | void on_actionGo_To_Isocentre_triggered(); 125 | 126 | void on_actionBEV_triggered(); 127 | 128 | void on_action3DView_triggered(); 129 | 130 | void on_actionClose_Patient_triggered(); 131 | 132 | void on_actionReset_Zoom_triggered(); 133 | 134 | void on_actionShowBeams_triggered(); 135 | 136 | void on_actionShowDose_triggered(); 137 | 138 | void on_actionShowContours_triggered(); 139 | 140 | void on_actionZoom_In_All_triggered(); 141 | 142 | void on_actionZoom_Out_All_triggered(); 143 | 144 | void on_actionInformation_triggered(); 145 | 146 | void on_actionPlan_Information_triggered(); 147 | 148 | void on_actionCalc_DVH_triggered(); 149 | 150 | void on_actionAdjust_Range_triggered(); 151 | 152 | void on_actionReset_WL_WW_triggered(); 153 | 154 | void on_actionRender_Bones_triggered(); 155 | 156 | void on_actionHello_UDP_triggered(); 157 | 158 | void on_actionMove_ROI_triggered(); 159 | 160 | void on_actionRotate_ROI_triggered(); 161 | 162 | void on_actionAdd_Arc_triggered(); 163 | 164 | void on_actionSend_UDP_triggered(); 165 | 166 | void on_actionAbout_QT_triggered(); 167 | 168 | void on_actionIP_Configuration_triggered(); 169 | 170 | void on_actionStart_triggered(); 171 | 172 | void on_actionStop_triggered(); 173 | 174 | void on_actionWL_WW_triggered(); 175 | 176 | void on_actionAbout_triggered(); 177 | 178 | void on_actionPlan_triggered(); 179 | 180 | void on_actionArcsView_triggered(); 181 | 182 | void on_actionUpdate_Dose_triggered(); 183 | 184 | void on_actionAqua_triggered(); 185 | 186 | void on_actionDark_triggered(); 187 | 188 | void on_actionElegant_Dark_triggered(); 189 | 190 | void on_actionManjaro_triggered(); 191 | 192 | void on_actionMaterial_Dark_triggered(); 193 | 194 | void on_actionImageX_triggered(); 195 | 196 | void on_actionView1_triggered(); 197 | 198 | void on_actionTile_All_triggered(); 199 | 200 | void on_actionSphericity_Calc_triggered(); 201 | 202 | void on_actionTCP_triggered(); 203 | 204 | public slots: 205 | void updateDose(const QString &str); 206 | 207 | private: 208 | Ui::MainWindow *ui; 209 | 210 | protected: 211 | void closeEvent(QCloseEvent *event); 212 | }; 213 | 214 | #endif // MAINWINDOW_H 215 | -------------------------------------------------------------------------------- /mathutility.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | (c)Jothybasu Selvaraj 3 | This program comes with no gaurantee of it accuracy. 4 | Clinical decisions should not be made using this program 5 | **************************************************************************/ 6 | 7 | #include "mathutility.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | MathUtility::MathUtility() 21 | { 22 | //vtkMath::RandomSeed(time(NULL)); 23 | } 24 | 25 | //int MathUtility::getGaussRandomInt(double mean,double std) 26 | //{ 27 | // int rand=vtkMath::Round(vtkMath::Gaussian(mean,std)); 28 | // return rand; 29 | //} 30 | 31 | //std::vector MathUtility::getArrayOfGaussRandomInts(unsigned int length,double mean, double std) 32 | //{ 33 | // std::vectorrandArray; 34 | // for (unsigned int i=0;igetGaussRandomInt(mean,std)); 37 | // } 38 | // return randArray; 39 | //} 40 | 41 | //std::vector MathUtility::getGaussRandomSys(unsigned int fractions,double mean,double std) 42 | //{ 43 | // int x=this->getGaussRandomInt(mean,std); 44 | // std::vectorsysVectors; //Initialize to 0; 45 | 46 | // for (unsigned int i=0;i MathUtility::getGaussRandomRand(unsigned int fractions,double mean,double std) 55 | //{ 56 | // std::vectorrandVectors; 57 | // for (unsigned int i=0;igetGaussRandomInt(mean,std); 60 | // //qDebug()< MathUtility::addTwoIntArrays(std::vector array1,std::vectorarray2) 67 | //{ 68 | // unsigned int array1Size=array1.size(); 69 | // unsigned int array2Size=array2.size(); 70 | // std::vectorsummedArray; 71 | // //Check sizes are equal 72 | // if(array1Size!=array2Size) 73 | // { 74 | // qDebug()<<"Array sizes do not match!"; 75 | // } 76 | 77 | // else 78 | // { 79 | 80 | // for (unsigned int i=0;i MathUtility::addTwoDoubleArrays(std::vector array1,std::vectorarray2) 92 | //{ 93 | // unsigned int array1Size=array1.size(); 94 | // unsigned int array2Size=array2.size(); 95 | 96 | // std::vectorsummedArray; 97 | ////Check sizes are equal 98 | // if(array1Size!=array2Size) 99 | // { 100 | // qDebug()<<"Array sizes do not match!"; 101 | // } 102 | 103 | // else 104 | // { 105 | 106 | // for (unsigned int i=0;i MathUtility::divideDoubleArrayByInt(std::vector array,int dividerIn) 118 | //{ 119 | // unsigned int arraySize=array.size(); 120 | // std::vectordividedArray; 121 | // for (unsigned int i=0;i(dividerIn); 124 | // double sum=array[i]/divider; 125 | // dividedArray.push_back(sum); 126 | 127 | // } 128 | 129 | // return dividedArray; 130 | //} 131 | 132 | //std::vector MathUtility::addConstIntToIntArray(std::vector input,int num) 133 | //{ 134 | // unsigned int size=input.size(); 135 | // for(unsigned int i=0;iinput) 145 | //{ 146 | // int size=input.size(); 147 | // double result=1.0; 148 | // for (int i=0;i input) 157 | { 158 | double mean=std::accumulate(input.begin(),input.end(),0.0)/input.size(); 159 | return mean; 160 | } 161 | 162 | double MathUtility::calcStd(std::vector input) 163 | { 164 | double mean=this->calcMean(input); 165 | unsigned int size=input.size(); 166 | std::vectordifference; 167 | 168 | for(int i=0;i input) 180 | { 181 | double std=this->calcStd(input); 182 | //qDebug()<(vtkMath::Random(lowerLimit,upperLimit)); 191 | return randInt; 192 | } 193 | 194 | //double MathUtility::distanceBetweenTwoPoints(double p1[],double p2[])//target,src 195 | //{ 196 | // double d12 = sqrt(((p1[0] - p2[0]) * (p1[0] - p2[0]))+ 197 | // ( (p1[1] - p2[1]) * (p1[1] - p2[1]))+ 198 | // ((p1[2] - p2[2]) * (p1[2] - p2[2]))); 199 | // //qDebug()<distanceBetweenTwoPoints(raySrc,rayTarget); 207 | // double xDiff=(rayTarget[0]-raySrc[0])/dist; 208 | // double yDiff=(rayTarget[1]-raySrc[1])/dist; 209 | // double zDiff=(rayTarget[2]-raySrc[2])/dist; 210 | // this->extendedRay[0]=(xDiff*length)+rayTarget[0]; 211 | // this->extendedRay[1]=(yDiff*length)+rayTarget[1]; 212 | // this->extendedRay[2]=(zDiff*length)+rayTarget[2]; 213 | // //qDebug()<xPts,std::vectoryPts) 218 | { 219 | 220 | vtkSmartPointerinterpolator= 221 | vtkSmartPointer::New(); 222 | int size=xPts.size(); 223 | qDebug()<AddPoint(xPts[i],yPts[i]); 227 | } 228 | //qDebug()<GetValue(500.0); 229 | 230 | } 231 | 232 | 233 | std::vector MathUtility::xyzTOijk(double xyz[3], double* origin, double *spacing) 234 | { 235 | std::vectorijk; 236 | ijk.push_back(vtkMath::Round((xyz[0]-(origin[0]))/spacing[0])); 237 | ijk.push_back(vtkMath::Round((xyz[1]-(origin[1]))/spacing[1])); 238 | ijk.push_back(vtkMath::Round((xyz[2]-(origin[2]))/spacing[2])); 239 | return ijk; 240 | 241 | } 242 | 243 | std::vector MathUtility::extendVertex(double vertexCoords[3],double ROIOrigin[3], double distance) 244 | { 245 | double distanceFromOrigin= std::sqrt((std::pow((vertexCoords[0]-ROIOrigin[0]),2)+std::pow((vertexCoords[1]-ROIOrigin[1]),2)+std::pow((vertexCoords[2]-ROIOrigin[2]),2))); 246 | 247 | double x=(vertexCoords[0]/distanceFromOrigin)*(distanceFromOrigin+distance); 248 | double y=(vertexCoords[1]/distanceFromOrigin)*(distanceFromOrigin+distance); 249 | double z=(vertexCoords[2]/distanceFromOrigin)*(distanceFromOrigin+distance); 250 | std::vectorextendedVertex; 251 | extendedVertex.push_back(x); 252 | extendedVertex.push_back(y); 253 | extendedVertex.push_back(z); 254 | return extendedVertex; 255 | 256 | } 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | -------------------------------------------------------------------------------- /mathutility.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | (c)Jothybasu Selvaraj 3 | This program comes with no gaurantee of it accuracy. 4 | Clinical decisions should not be made using this program 5 | **************************************************************************/ 6 | 7 | #ifndef MATHUTILITY_H 8 | #define MATHUTILITY_H 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | class MathUtility 16 | { 17 | public: 18 | MathUtility(); 19 | 20 | inline int getGaussRandomInt(double mean,double std) 21 | { 22 | int rand=vtkMath::Round(vtkMath::Gaussian(mean,std)); 23 | return rand; 24 | } 25 | 26 | inline std::vector getArrayOfGaussRandomInts(unsigned int length,double mean, double std) 27 | { 28 | std::vectorrandArray; 29 | for (unsigned int i=0;igetGaussRandomInt(mean,std)); 32 | } 33 | return randArray; 34 | } 35 | 36 | inline std::vector getGaussRandomSys(unsigned int fractions,double mean,double std) 37 | { 38 | int x=this->getGaussRandomInt(mean,std); 39 | std::vectorsysVectors; //Initialize to 0; 40 | 41 | for (unsigned int i=0;i getGaussRandomRand(unsigned int fractions,double mean,double std) 51 | { 52 | std::vectorrandVectors; 53 | for (unsigned int i=0;igetGaussRandomInt(mean,std); 56 | //qDebug()< addTwoIntArrays(std::vector array1,std::vectorarray2) 64 | { 65 | unsigned int array1Size=array1.size(); 66 | unsigned int array2Size=array2.size(); 67 | std::vectorsummedArray; 68 | //Check sizes are equal 69 | if(array1Size!=array2Size) 70 | { 71 | qDebug()<<"Array sizes do not match!"; 72 | } 73 | 74 | else 75 | { 76 | 77 | for (unsigned int i=0;i addTwoDoubleArrays(std::vector array1,std::vectorarray2) 90 | { 91 | unsigned int array1Size=array1.size(); 92 | unsigned int array2Size=array2.size(); 93 | 94 | std::vectorsummedArray; 95 | //Check sizes are equal 96 | if(array1Size!=array2Size) 97 | { 98 | qDebug()<<"Array sizes do not match!"; 99 | } 100 | 101 | else 102 | { 103 | 104 | for (unsigned int i=0;i divideDoubleArrayByInt(std::vector array,int dividerIn) 117 | { 118 | unsigned int arraySize=array.size(); 119 | std::vectordividedArray; 120 | for (unsigned int i=0;i(dividerIn); 123 | double sum=array[i]/divider; 124 | dividedArray.push_back(sum); 125 | 126 | } 127 | 128 | return dividedArray; 129 | } 130 | 131 | inline std::vector addConstIntToIntArray(std::vectorinput,int num) 132 | { 133 | unsigned int size=input.size(); 134 | for(unsigned int i=0;iinput) 143 | { 144 | 145 | int size=input.size(); 146 | double result=1.0; 147 | for (int i=0;iinput); 155 | double calcStd(std::vectorinput); 156 | double calcSEM(std::vectorinput); 157 | int getRandomIntWithinLimits(int lowerLimit,int upperLimit); 158 | 159 | inline double distanceBetweenTwoPoints(double p1[],double p2[]) 160 | { 161 | double d12 = sqrt(((p1[0] - p2[0]) * (p1[0] - p2[0]))+ 162 | ( (p1[1] - p2[1]) * (p1[1] - p2[1]))+ 163 | ((p1[2] - p2[2]) * (p1[2] - p2[2]))); 164 | //qDebug()<distanceBetweenTwoPoints(raySrc,rayTarget); 171 | double xDiff=(rayTarget[0]-raySrc[0])/dist; 172 | double yDiff=(rayTarget[1]-raySrc[1])/dist; 173 | double zDiff=(rayTarget[2]-raySrc[2])/dist; 174 | this->extendedRay[0]=(xDiff*length)+rayTarget[0]; 175 | this->extendedRay[1]=(yDiff*length)+rayTarget[1]; 176 | this->extendedRay[2]=(zDiff*length)+rayTarget[2]; 177 | //qDebug()<xPts,std::vectoryPts); 182 | std::vectorxyzTOijk(double xyz[3],double *origin,double* spacing); 183 | std::vectorextendVertex(double vertexCoords[3],double ROIorigin[3],double distance); 184 | 185 | }; 186 | 187 | #endif // MATHUTILITY_H 188 | -------------------------------------------------------------------------------- /meshreader.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef MESHREADER_H 26 | #define MESHREADER_H 27 | 28 | #define vtkRenderingCore_AUTOINIT \ 29 | 3(vtkInteractionStyle, vtkRenderingFreeType, vtkRenderingOpenGL2) 30 | #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | class meshReader { 43 | public: 44 | meshReader(QWidget* parent); 45 | ~meshReader(); 46 | void getROIMeshes( 47 | vtkImageData* imgData, float zSpacing, float targetReduction, 48 | QList selectionList, 49 | QWidget* parent); // zSpacing is used for extrusion in meshing 50 | void getStructFileName(); 51 | QString structFileName; 52 | int NumberOfROIs; 53 | QList ROINo; 54 | QList ROINames; 55 | QList ROITypes; 56 | double ROIColors[50][3]; // No. of ROIs,RGB- maximum 50 ROIs supported for 57 | // now 58 | vtkSmartPointer ROIActors; 59 | std::vector > meshes; 60 | QString structSetLabel; 61 | QList selectionList; 62 | QWidget* parent; 63 | }; 64 | 65 | #endif // MESHREADER_H 66 | -------------------------------------------------------------------------------- /planreader.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the 11 | Software, and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ******************************************************************************/ 25 | #ifndef PLANREADER_H 26 | #define PLANREADER_H 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | class PlanReader { 37 | public: 38 | PlanReader(); 39 | ~PlanReader(); 40 | void readRTPlan(); 41 | QString planLabel; 42 | unsigned int fractionsPlanned; 43 | 44 | struct planDetail { 45 | QString mcName; 46 | double ssd; 47 | QString beamName; 48 | QString beamType; 49 | unsigned int beamEnergy; 50 | unsigned int beamNum; 51 | double beamAngle; 52 | double beamStopAngle = 53 | -1; // By default, if this is not set corectly the plan is not VMAT 54 | double collAngle = 0.0; 55 | double couchAngle = 0.0; 56 | double fieldX1 = 0.0; 57 | double fieldX2 = 0.0; 58 | double fieldY1 = 0.0; 59 | double fieldY2 = 0.0; 60 | double icX = 0.0; // Isocenter x 61 | double icY = 0.0; // Isocenter y 62 | double icZ = 0.0; // Isocenter z 63 | double mu = 0.0; 64 | double beamDose = 0.0; 65 | QString arcDirection; 66 | }; 67 | 68 | struct mlcDetail { 69 | int leafPairs = 0; 70 | double cmsw = 0.0; // Cumulative meter set weight 71 | QString beamName; 72 | QString arcDirection; 73 | int beamNo = 0; 74 | double beamAngle = 0.0; 75 | double collAngle = 0.0; 76 | double couchAngle = 0.0; 77 | double fieldX1 = 0.0; 78 | double fieldX2 = 0.0; 79 | double fieldY1 = 0.0; 80 | double fieldY2 = 0.0; 81 | int numCtrlPts = 0; // No. of control points 82 | std::vector> mlcX1Pos; 83 | std::vector> mlcX2Pos; 84 | }; 85 | 86 | std::vector planDetailStruct; 87 | std::vector mlcDetailStruct; 88 | std::vector> 89 | muWeights; // muWeight[3][5] corresponds to 3rd beam 5th segment 90 | unsigned int numOfBeams = 0; 91 | double targetDose = 0.0; 92 | }; 93 | 94 | #endif // PLANREADER_H 95 | -------------------------------------------------------------------------------- /presetwlwwdialog.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ******************************************************************************/ 24 | #include "presetwlwwdialog.h" 25 | #include "ui_presetwlwwdialog.h" 26 | 27 | PresetWLWWDialog::PresetWLWWDialog(QWidget *parent) : 28 | QDialog(parent), 29 | ui(new Ui::PresetWLWWDialog) 30 | { 31 | ui->setupUi(this); 32 | } 33 | 34 | PresetWLWWDialog::~PresetWLWWDialog() 35 | { 36 | delete ui; 37 | } 38 | -------------------------------------------------------------------------------- /presetwlwwdialog.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ******************************************************************************/ 24 | #ifndef PRESETWLWWDIALOG_H 25 | #define PRESETWLWWDIALOG_H 26 | 27 | #include 28 | 29 | namespace Ui { 30 | class PresetWLWWDialog; 31 | } 32 | 33 | class PresetWLWWDialog : public QDialog 34 | { 35 | Q_OBJECT 36 | 37 | public: 38 | explicit PresetWLWWDialog(QWidget *parent = nullptr); 39 | ~PresetWLWWDialog(); 40 | 41 | private: 42 | Ui::PresetWLWWDialog *ui; 43 | }; 44 | 45 | #endif // PRESETWLWWDIALOG_H 46 | -------------------------------------------------------------------------------- /presetwlwwdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | PresetWLWWDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 243 10 | 48 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | 21 | Abdomen 22 | 23 | 24 | 25 | 26 | Bone 27 | 28 | 29 | 30 | 31 | Breast 32 | 33 | 34 | 35 | 36 | Head 37 | 38 | 39 | 40 | 41 | Lung 42 | 43 | 44 | 45 | 46 | Neck 47 | 48 | 49 | 50 | 51 | Pelvis 52 | 53 | 54 | 55 | 56 | Thorax 57 | 58 | 59 | 60 | 61 | Custom1 62 | 63 | 64 | 65 | 66 | Custom2 67 | 68 | 69 | 70 | 71 | Custom3 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /qDoubleSlider.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #include "qDoubleSlider.h" 26 | QDoubleSlider::QDoubleSlider(QWidget* pParent/*= NULL*/) : 27 | QSlider(pParent), 28 | m_Multiplier(10000.0) 29 | { 30 | connect(this, SIGNAL(valueChanged(int)), this, SLOT(setValue(int))); 31 | 32 | setSingleStep(1); 33 | 34 | setOrientation(Qt::Horizontal); 35 | setFocusPolicy(Qt::NoFocus); 36 | } 37 | 38 | void QDoubleSlider::setValue(int Value) 39 | { 40 | emit valueChanged((double)Value/m_Multiplier); 41 | } 42 | 43 | void QDoubleSlider::setValue(double Value, bool BlockSignals) 44 | { 45 | QSlider::blockSignals(BlockSignals); 46 | 47 | QSlider::setValue(Value * m_Multiplier); 48 | 49 | if (!BlockSignals) 50 | emit valueChanged(Value); 51 | 52 | QSlider::blockSignals(false); 53 | } 54 | 55 | void QDoubleSlider::setRange(double Min, double Max) 56 | { 57 | QSlider::setRange(Min * m_Multiplier, Max * m_Multiplier); 58 | 59 | emit rangeChanged(Min, Max); 60 | } 61 | 62 | void QDoubleSlider::setMinimum(double Min) 63 | { 64 | QSlider::setMinimum(Min * m_Multiplier); 65 | 66 | emit rangeChanged(minimum(), maximum()); 67 | } 68 | 69 | double QDoubleSlider::minimum() const 70 | { 71 | return QSlider::minimum()/m_Multiplier; 72 | } 73 | 74 | void QDoubleSlider::setMaximum(double Max) 75 | { 76 | QSlider::setMaximum(Max * m_Multiplier); 77 | 78 | emit rangeChanged(minimum(), maximum()); 79 | } 80 | 81 | double QDoubleSlider::maximum() const 82 | { 83 | return QSlider::maximum()/m_Multiplier; 84 | } 85 | 86 | double QDoubleSlider::value() const 87 | { 88 | int Value = QSlider::value(); 89 | return (double)Value/m_Multiplier; 90 | } 91 | -------------------------------------------------------------------------------- /qDoubleSlider.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef Q_DOUBLE_SLIDER_H 26 | #define Q_DOUBLE_SLIDER_H 27 | 28 | #include 29 | #include 30 | 31 | class QDoubleSlider : public QSlider { 32 | Q_OBJECT 33 | 34 | public: 35 | QDoubleSlider(QWidget* pParent = NULL); 36 | 37 | void setRange(double Min, double Max); 38 | void setMinimum(double Min); 39 | double minimum() const; 40 | void setMaximum(double Max); 41 | double maximum() const; 42 | double value() const; 43 | 44 | public slots: 45 | void setValue(int value); 46 | void setValue(double Value, bool BlockSignals = false); 47 | 48 | private slots: 49 | 50 | signals: 51 | void valueChanged(double Value); 52 | void rangeChanged(double Min, double Max); 53 | 54 | private: 55 | double m_Multiplier; 56 | }; 57 | #endif 58 | -------------------------------------------------------------------------------- /radiobiologycalc.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | (c)Jothybasu Selvaraj 3 | This program comes with no gaurantee of its accuracy. 4 | Clinical decisions should not be made using this program 5 | **************************************************************************/ 6 | 7 | #include "radiobiologycalc.h" 8 | #include"mathutility.h" 9 | //#include"DEIntegrator.h" 10 | 11 | #include"math.h" 12 | #include"cmath" 13 | #include"numeric" 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | RadiobiologyCalc::RadiobiologyCalc() 21 | { 22 | this->T=26;//for 20# 23 | this->Td=3;//Default value in days 24 | this->Tk=21;//Days 25 | this->clonogenDensity=1e7; 26 | this->fractions=30.0; 27 | this->alpha=0.30; 28 | this->alphaByBeta=10; 29 | this->alphaStd=0.03; 30 | this->alphaMean=0.30; 31 | this->voxelVol=1.0; 32 | this->temporalCF=0.0; 33 | this->calcType=0;//Defaults to uniform clonogens 34 | 35 | //vtkMath::RandomSeed(time(NULL)); 36 | 37 | } 38 | 39 | RadiobiologyCalc::~RadiobiologyCalc() 40 | { 41 | this->T=0;//for 20# 42 | this->Td=0;//Default value in days 43 | this->Tk=0;//Days 44 | this->fractions=0; 45 | this->clonogenDensity=0; 46 | this->alpha=0.0; 47 | this->alphaByBeta=0.0; 48 | this->alphaStd=0.0; 49 | this->alphaMean=0.0; 50 | this->DoseBins.clear(); 51 | this->VolBins.clear(); 52 | } 53 | 54 | double RadiobiologyCalc::calcVCP(double dosePerFraction,double voxelVolume,double totalDose,double alpha, 55 | double alphaByBeta,double clonogenDensity,double temporalCorrectionFactor) 56 | { 57 | double vcp; 58 | vcp=exp(-clonogenDensity*voxelVolume*(exp((-alpha*totalDose*(1.0+(dosePerFraction/alphaByBeta)))+temporalCorrectionFactor))); 59 | //qDebug()<DoseBins.size(); 67 | std::vectorVCPs; 68 | for(int i=0;iDoseBins[i]/(this->fractions); 71 | double vol=this->VolBins[i]*this->voxelVol; 72 | double vcp=this->calcVCP(d,vol,this->DoseBins[i],alpha,this->alphaByBeta,this->clonogenDensity,this->temporalCF); 73 | VCPs.push_back(vcp); 74 | } 75 | 76 | MathUtility* productCalc=new MathUtility; 77 | double TCP= productCalc->productOfVector(VCPs); 78 | delete productCalc; 79 | double ff=std::exp(-(std::pow((alpha-this->alphaMean),2)/(2.0*std::pow(this->alphaStd,2)))); 80 | //qDebug()<alphaStd==0) 85 | { 86 | return TCP*100; 87 | } 88 | 89 | else 90 | { 91 | return TCPTotal; 92 | } 93 | } 94 | 95 | 96 | double RadiobiologyCalc::calcTCPVaryingClonogens(double alpha) 97 | { 98 | int DoseValueSize=this->doseValues.size(); 99 | //qDebug()<VCPs; 101 | for(int i=0;idoseValues[i]/(this->fractions); 104 | double vol=0.001;//Since the resolution of dose & clonogen grids is 1mm 105 | double clonogenDensityFactor=static_cast(this->clonogensVector[i]/100.0); 106 | //qDebug()<calcVCP(d,vol,this->doseValues[i],alpha,this->alphaByBeta,this->clonogenDensity*clonogenDensityFactor,this->temporalCF); 108 | //qDebug()<productOfVector(VCPs); 114 | delete productCalc; 115 | double ff=std::exp(-(std::pow((alpha-this->alphaMean),2)/(2.0*std::pow(this->alphaStd,2)))); 116 | 117 | double TCPTotal=TCP*(ff); 118 | if(this->alphaStd==0) 119 | { 120 | return TCP*100; 121 | } 122 | 123 | else 124 | { 125 | return TCPTotal; 126 | } 127 | 128 | } 129 | 130 | 131 | //Total treatment time T is not properly calculated 132 | double RadiobiologyCalc::calcTempCorrection(int Td,int Tk,int T) 133 | { 134 | double correction; 135 | if (TtemporalCF=0;//Ignore repopulation for now 155 | double accumulator=0.0; 156 | for (double i=start;i<=stop;i+=step) 157 | { 158 | if(this->calcType==0) 159 | { 160 | accumulator+=(this->calcTCP((i+(step/2.0)))*step); 161 | } 162 | else 163 | { 164 | accumulator+=(this->calcTCPVaryingClonogens((i+(step/2.0)))*step); 165 | } 166 | } 167 | double TCPFinal=(1.0/(this->alphaStd*std::sqrt(2*vtkMath::Pi())))*accumulator; 168 | //qDebug()<alphaStd*std::sqrt(2*3.1416))); 169 | return TCPFinal*100.0; 170 | } 171 | 172 | double RadiobiologyCalc::calcTCPRandomAlpha(double randAlpha) 173 | { 174 | 175 | if(randAlpha<0) 176 | { 177 | randAlpha=0.0; 178 | } 179 | 180 | int DoseBinSize=this->DoseBins.size(); 181 | std::vectorVCPs; 182 | for(int i=0;iDoseBins[i]/(this->fractions); 185 | double vol=this->VolBins[i]*this->voxelVol; 186 | double vcp=this->calcVCP(d,vol,this->DoseBins[i],randAlpha,this->alphaByBeta,this->clonogenDensity,this->temporalCF); 187 | VCPs.push_back(vcp); 188 | } 189 | 190 | MathUtility* productCalc=new MathUtility; 191 | double TCP= productCalc->productOfVector(VCPs); 192 | delete productCalc; 193 | 194 | if(TCP>=0) 195 | { 196 | return TCP ; 197 | } 198 | 199 | 200 | 201 | } 202 | 203 | -------------------------------------------------------------------------------- /radiobiologycalc.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | (c)Jothybasu Selvaraj 3 | This program comes with no gaurantee of its accuracy. 4 | Clinical decisions should not be made using this program 5 | **************************************************************************/ 6 | 7 | #ifndef RADIOBIOLOGYCALC_H 8 | #define RADIOBIOLOGYCALC_H 9 | 10 | #include"vector" 11 | 12 | class RadiobiologyCalc 13 | { 14 | public: 15 | RadiobiologyCalc(); 16 | ~RadiobiologyCalc(); 17 | //Doses are in Gy and volumes are in cc 18 | double calcVCP(double dosePerFraction,double voxelVolume,double totalDose,double alpha, 19 | double alphaByBeta,double clonogenDensity,double temporalCorrectionFactor); 20 | double calcTCP(double alpha); 21 | double calcTCPVaryingClonogens(double alpha); 22 | double calcNormalTCP(double start,double stop,double step); 23 | double calcTempCorrection(int Td,int Tk,int T); 24 | 25 | double Td;//Doubling time 26 | double Tk;//Time to kick start repopulation 27 | double T;//Overall treatment time 28 | std::vectorDoseBins; 29 | std::vectordoseValues; 30 | std::vectorVolBins; 31 | std::vectorclonogensVector; 32 | double alphaByBeta; 33 | double alpha; 34 | double alphaMean; 35 | double alphaStd; 36 | double clonogenDensity; 37 | double fractions; 38 | double temporalCF; 39 | double voxelVol; 40 | bool calcType; 41 | double calcTCPRandomAlpha(double randAlpha); 42 | 43 | 44 | }; 45 | 46 | #endif // RADIOBIOLOGYCALC_H 47 | -------------------------------------------------------------------------------- /rangesliderdialog.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #include "rangesliderdialog.h" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | #include "ui_rangesliderdialog.h" 35 | 36 | RangeSliderDialog::RangeSliderDialog(QWidget *parent) 37 | : QDialog(parent), ui(new Ui::RangeSliderDialog) { 38 | ui->setupUi(this); 39 | } 40 | 41 | RangeSliderDialog::~RangeSliderDialog() { delete ui; } 42 | 43 | void RangeSliderDialog::SetDoseRange() { 44 | this->ui->horizontalSlider->setMinimum(this->minDose); 45 | this->ui->horizontalSlider->setMaximum(this->maxDose); 46 | 47 | this->ui->SpinBoxMinDose->setMaximum(this->maxDose); 48 | this->ui->SpinBoxMinDose->setMinimum(this->minDose); 49 | 50 | this->ui->SpinBoxMaxDose->setMaximum(this->maxDose); 51 | this->ui->SpinBoxMaxDose->setMinimum(this->minDose); 52 | // qDebug()<<"Range changed."; 53 | } 54 | 55 | void RangeSliderDialog::on_SpinBoxMinDose_editingFinished() { 56 | this->minDose = this->ui->SpinBoxMinDose->value(); 57 | this->ui->horizontalSlider->setValue(this->minDose); 58 | // this->AxialViewer->AdjustDoseRange(this->ui->horizontalSlider->value(),this->maxDose); 59 | this->ModelViewer->ShowIsodoseSurface(this->minDose, this->minDose); 60 | } 61 | 62 | void RangeSliderDialog::on_SpinBoxMaxDose_editingFinished() { 63 | if (this->ui->SpinBoxMaxDose->value() > this->ui->SpinBoxMinDose->value()) { 64 | this->maxDose = this->ui->SpinBoxMaxDose->value(); 65 | this->AxialViewer->AdjustDoseRange(this->ui->horizontalSlider->value(), 66 | this->maxDose); 67 | this->SagittalViewer->AdjustDoseRange(this->ui->horizontalSlider->value(), 68 | this->maxDose); 69 | this->CoronalViewer->AdjustDoseRange(this->ui->horizontalSlider->value(), 70 | this->maxDose); 71 | this->ModelViewer->ShowIsodoseSurface(this->minDose, this->minDose); 72 | } else { 73 | this->ui->SpinBoxMaxDose->setValue(this->ui->SpinBoxMinDose->value()); 74 | } 75 | } 76 | 77 | void RangeSliderDialog::on_horizontalSlider_valueChanged(double value) { 78 | this->ui->SpinBoxMinDose->setValue(value); 79 | this->AxialViewer->AdjustDoseRange(value, this->maxDose); 80 | this->SagittalViewer->AdjustDoseRange(value, this->maxDose); 81 | this->CoronalViewer->AdjustDoseRange(value, this->maxDose); 82 | this->ModelViewer->ShowIsodoseSurface(this->minDose, this->minDose); 83 | this->ModelViewer->ModelRenderer->GetRenderWindow()->Render(); 84 | this->ModelViewer->show(); 85 | } 86 | 87 | // Reset dose range 88 | void RangeSliderDialog::on_pushButton_clicked() { 89 | this->minDose = this->AxialViewer->RTDose->GetScalarRange()[0]; 90 | this->maxDose = this->AxialViewer->RTDose->GetScalarRange()[1]; 91 | this->ui->SpinBoxMinDose->setValue(this->minDose); 92 | this->ui->SpinBoxMaxDose->setValue(this->maxDose); 93 | this->AxialViewer->AdjustDoseRange(this->minDose, this->maxDose); 94 | this->SagittalViewer->AdjustDoseRange(this->minDose, this->maxDose); 95 | this->CoronalViewer->AdjustDoseRange(this->minDose, this->maxDose); 96 | this->ModelViewer->ShowIsodoseSurface(this->minDose, this->minDose); 97 | this->AxialViewer->UpdateView(); 98 | this->SagittalViewer->UpdateView(); 99 | this->CoronalViewer->UpdateView(); 100 | } 101 | -------------------------------------------------------------------------------- /rangesliderdialog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef RANGESLIDERDIALOG_H 26 | #define RANGESLIDERDIALOG_H 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | namespace Ui { 34 | class RangeSliderDialog; 35 | } 36 | 37 | class RangeSliderDialog : public QDialog { 38 | Q_OBJECT 39 | 40 | public: 41 | explicit RangeSliderDialog(QWidget *parent = nullptr); 42 | ~RangeSliderDialog(); 43 | void SetDoseRange(); 44 | double minDose = 0; 45 | double maxDose = 100; 46 | ImageViewer2D *AxialViewer; 47 | ImageViewer2D *CoronalViewer; 48 | ImageViewer2D *SagittalViewer; 49 | BEVWidget *ModelViewer; 50 | 51 | private slots: 52 | void on_SpinBoxMinDose_editingFinished(); 53 | void on_SpinBoxMaxDose_editingFinished(); 54 | void on_horizontalSlider_valueChanged(double value); 55 | 56 | void on_pushButton_clicked(); 57 | 58 | private: 59 | Ui::RangeSliderDialog *ui; 60 | }; 61 | 62 | #endif // RANGESLIDERDIALOG_H 63 | -------------------------------------------------------------------------------- /rangesliderdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | RangeSliderDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 533 10 | 84 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 500 22 | 0 23 | 24 | 25 | 26 | 27 | 16777215 28 | 100 29 | 30 | 31 | 32 | Dose Range 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 0 44 | 0 45 | 46 | 47 | 48 | 49 | 50 50 | 30 51 | 52 | 53 | 54 | 55 | 60 56 | 50 57 | 58 | 59 | 60 | true 61 | 62 | 63 | true 64 | 65 | 66 | QAbstractSpinBox::NoButtons 67 | 68 | 69 | 70 | 71 | 72 | 73 | Qt::NoFocus 74 | 75 | 76 | 77 | 78 | 79 | Qt::Horizontal 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 0 88 | 0 89 | 90 | 91 | 92 | 93 | 40 94 | 30 95 | 96 | 97 | 98 | 99 | 60 100 | 40 101 | 102 | 103 | 104 | QAbstractSpinBox::NoButtons 105 | 106 | 107 | QAbstractSpinBox::CorrectToNearestValue 108 | 109 | 110 | 100.000000000000000 111 | 112 | 113 | 100.000000000000000 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | Qt::Horizontal 125 | 126 | 127 | 128 | 40 129 | 20 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | Qt::NoFocus 138 | 139 | 140 | Reset 141 | 142 | 143 | 144 | :/Icons/Reset.png:/Icons/Reset.png 145 | 146 | 147 | 148 | 149 | 150 | 151 | Qt::Horizontal 152 | 153 | 154 | 155 | 40 156 | 20 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | QDoubleSlider 170 | QSlider 171 |
qDoubleSlider.h
172 |
173 |
174 | 175 | SpinBoxMinDose 176 | SpinBoxMaxDose 177 | pushButton 178 | horizontalSlider 179 | 180 | 181 | 182 | 183 | 184 |
185 | -------------------------------------------------------------------------------- /rtstructreaderdialog.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #include "rtstructreaderdialog.h" 26 | 27 | #include "ui_rtstructreaderdialog.h" 28 | 29 | #define vtkRenderingCore_AUTOINIT \ 30 | 3(vtkInteractionStyle, vtkRenderingFreeType, vtkRenderingOpenGL2) 31 | #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | RTStructReaderDialog::RTStructReaderDialog(QWidget *parent) 49 | : QDialog(parent), ui(new Ui::RTStructReaderDialog) { 50 | ui->setupUi(this); 51 | 52 | // For auto opening the file dialog 53 | this->ui->pushButtonChooseFile->click(); 54 | } 55 | 56 | RTStructReaderDialog::~RTStructReaderDialog() { delete ui; } 57 | 58 | void RTStructReaderDialog::on_pushButtonChooseFile_clicked() { 59 | this->ui->listWidgetStructs->clear(); 60 | this->structFileName = 61 | QFileDialog::getOpenFileName(this, "Open RT Structures"); 62 | this->ui->lineEdit->setText(this->structFileName); 63 | gdcm::Reader RTreader; 64 | RTreader.SetFileName(this->structFileName.toLatin1().data()); 65 | 66 | // show error msg if file can't be read. 67 | if (!RTreader.Read()) { 68 | QMessageBox msgBox; 69 | msgBox.setText("Not a valid DICOM file!"); 70 | msgBox.setIcon(QMessageBox::Critical); 71 | msgBox.exec(); 72 | } 73 | 74 | else // Start reading the necessary info 75 | { 76 | const gdcm::DataSet &ds = RTreader.GetFile().GetDataSet(); 77 | 78 | gdcm::Tag tssroisq(0x3006, 0x0020); // Structure set ROI sequence 79 | if (!ds.FindDataElement(tssroisq)) { 80 | // qDebug() <<"Problem locating 0x3006,0x0020 - Is this a valid RT Struct 81 | // file?"; 82 | QMessageBox msgBox; 83 | msgBox.setText("This is not a valid RT structure file!"); 84 | msgBox.setIcon(QMessageBox::Critical); 85 | msgBox.exec(); 86 | } 87 | 88 | else { 89 | gdcm::Tag troicsq(0x3006, 0x0039); // ROI contour sequence 90 | if (!ds.FindDataElement(troicsq)) { 91 | // qDebug() << "Problem locating 0x3006,0x0039 - Is this a valid RT 92 | // Struct file?"; 93 | QMessageBox msgBox; 94 | msgBox.setText("This is not a RT structure file!"); 95 | msgBox.setIcon(QMessageBox::Critical); 96 | msgBox.exec(); 97 | } else { 98 | gdcm::Tag troiobsq(0x3006, 0x0080); // ROI observation sequence 99 | const gdcm::DataElement &roicsq = ds.GetDataElement(troicsq); 100 | gdcm::SmartPointer sqi = roicsq.GetValueAsSQ(); 101 | 102 | const gdcm::DataElement &ssroisq = ds.GetDataElement(tssroisq); 103 | gdcm::SmartPointer ssqi = ssroisq.GetValueAsSQ(); 104 | this->NumberOfROIs = sqi->GetNumberOfItems(); 105 | // qDebug()<< "Number of structures found:" << this->NumberOfROIs; 106 | 107 | const gdcm::DataElement &roiobsq = ds.GetDataElement(troiobsq); 108 | gdcm::SmartPointer obsq = 109 | roiobsq.GetValueAsSQ(); // observation sequence 110 | qDebug() << "No. of ROIs found:" << this->NumberOfROIs; 111 | if (this->NumberOfROIs > 50) { 112 | this->NumberOfROIs = 50; // Only read the first 50 ROIs 113 | QMessageBox messageBox; 114 | messageBox.warning( 115 | this, "Warning", 116 | "More than 50 ROIs found, only reading the first 50."); 117 | messageBox.setFixedSize(500, 200); 118 | } 119 | 120 | for (int i = 1; i < this->NumberOfROIs + 1; i++) { 121 | // Get the ROI Nos. 122 | gdcm::Item &item = sqi->GetItem(i); 123 | const gdcm::DataSet &nestedds = item.GetNestedDataSet(); 124 | 125 | // Get ROIs color 126 | gdcm::Attribute<0x3006, 0x002a> roiColor; // ROI color tag 127 | roiColor.SetFromDataElement( 128 | nestedds.GetDataElement(roiColor.GetTag())); 129 | double R = roiColor.GetValues()[0]; 130 | double G = roiColor.GetValues()[1]; 131 | double B = roiColor.GetValues()[2]; 132 | // qDebug()<<"ROi color:"<ROIColors[i - 1][0] = R; 134 | this->ROIColors[i - 1][1] = G; 135 | this->ROIColors[i - 1][2] = B; // C++ array starts from "0". 136 | 137 | // Get ROI Names 138 | gdcm::Item &sitem = ssqi->GetItem(i); 139 | gdcm::Attribute<0x3006, 0x0026> 140 | roiName; // ROI Name tag in Structure Set ROI Sequence 141 | const gdcm::DataSet &snestedds = sitem.GetNestedDataSet(); 142 | roiName.SetFromDataElement( 143 | snestedds.GetDataElement(roiName.GetTag())); 144 | // qDebug()<ROINames.append(QString(roiName.GetValue())); 146 | 147 | QListWidgetItem *wItem = 148 | new QListWidgetItem(QString(roiName.GetValue())); 149 | wItem->setCheckState(Qt::Unchecked); 150 | wItem->setBackgroundColor(QColor(R, G, B)); 151 | this->ui->listWidgetStructs->addItem(wItem); 152 | } 153 | } 154 | } 155 | } 156 | } 157 | 158 | void RTStructReaderDialog::getSelectedItems() { 159 | this->selectedItems.clear(); 160 | if (this->ui->groupBox->isChecked()) { 161 | for (int i = 0; i < this->NumberOfROIs; i++) { 162 | int checkState = this->ui->listWidgetStructs->item(i)->checkState(); 163 | // qDebug()<selectedItems.append(i + 166 | 1); // In GDCM dicom items start from "1"; 167 | } 168 | } 169 | 170 | } else { 171 | for (int i = 0; i < this->NumberOfROIs; i++) { 172 | this->selectedItems.append(i + 1); 173 | } 174 | } 175 | } 176 | 177 | void RTStructReaderDialog::on_pushButtonRead_clicked() { 178 | this->getSelectedItems(); 179 | this->close(); 180 | } 181 | -------------------------------------------------------------------------------- /rtstructreaderdialog.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef RTSTRUCTREADERDIALOG_H 26 | #define RTSTRUCTREADERDIALOG_H 27 | 28 | #include 29 | 30 | namespace Ui { 31 | class RTStructReaderDialog; 32 | } 33 | 34 | class RTStructReaderDialog : public QDialog { 35 | Q_OBJECT 36 | 37 | public: 38 | explicit RTStructReaderDialog(QWidget *parent = 0); 39 | ~RTStructReaderDialog(); 40 | int NumberOfROIs; 41 | double ROIColors[50][3]; // No. of ROIs,RGB- maximum 50 ROIs supported for now 42 | QList ROINames; 43 | QList selectedItems; 44 | QString structFileName; 45 | QString structSetLabel; 46 | void getSelectedItems(); 47 | 48 | private: 49 | Ui::RTStructReaderDialog *ui; 50 | 51 | private slots: 52 | void on_pushButtonRead_clicked(); 53 | void on_pushButtonChooseFile_clicked(); 54 | }; 55 | 56 | #endif // RTSTRUCTREADERDIALOG_H 57 | -------------------------------------------------------------------------------- /rtstructreaderdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | RTStructReaderDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 250 10 | 594 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 250 22 | 594 23 | 24 | 25 | 26 | RT Structure Reader 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | true 39 | 40 | 41 | 42 | 43 | 44 | 45 | Choose File 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | Select Structures 57 | 58 | 59 | true 60 | 61 | 62 | false 63 | 64 | 65 | 66 | 67 | 68 | 69 | 10 70 | PreferAntialias 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | Qt::Horizontal 88 | 89 | 90 | 91 | 228 92 | 20 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | Read 101 | 102 | 103 | 104 | :/Icons/Page-read.png:/Icons/Page-read.png 105 | 106 | 107 | 108 | 109 | 110 | 111 | Qt::Horizontal 112 | 113 | 114 | 115 | 258 116 | 20 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | pushButtonChooseFile 129 | groupBox 130 | pushButtonRead 131 | lineEdit 132 | listWidgetStructs 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /selecttargetdialog.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the 11 | Software, and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ******************************************************************************/ 25 | #include "selecttargetdialog.h" 26 | 27 | #include 28 | 29 | #include "ui_selecttargetdialog.h" 30 | 31 | SelectTargetDialog::SelectTargetDialog(QWidget *parent) 32 | : QDialog(parent), ui(new Ui::SelectTargetDialog) { 33 | ui->setupUi(this); 34 | this->parent = parent; 35 | } 36 | 37 | SelectTargetDialog::~SelectTargetDialog() { delete ui; } 38 | 39 | void SelectTargetDialog::setROINames() { 40 | for (int i = 0; i < this->ROINames.size(); i++) { 41 | // qDebug() << this->ROINames[i]; 42 | this->ui->comboBox->addItem(this->ROINames[i]); 43 | this->ui->comboBox->setItemData(i, 44 | QColor(this->ROIColors[i][0], 45 | this->ROIColors[i][1], 46 | this->ROIColors[i][2]), 47 | Qt::BackgroundRole); 48 | } 49 | } 50 | 51 | void SelectTargetDialog::on_buttonBox_accepted() { 52 | this->selectedROINum = this->ui->comboBox->currentIndex(); 53 | this->ROISelected = true; 54 | if (this->ROISelected) { 55 | qDebug() << "Selected item: " << this->selectedROINum; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /selecttargetdialog.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the 11 | Software, and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ******************************************************************************/ 25 | #ifndef SELECTTARGETDIALOG_H 26 | #define SELECTTARGETDIALOG_H 27 | 28 | #include 29 | 30 | namespace Ui { 31 | class SelectTargetDialog; 32 | } 33 | 34 | class SelectTargetDialog : public QDialog { 35 | Q_OBJECT 36 | 37 | public: 38 | explicit SelectTargetDialog(QWidget *parent = nullptr); 39 | ~SelectTargetDialog(); 40 | QWidget *parent; 41 | double (*ROIColors)[3]; 42 | unsigned int selectedROINum; 43 | QList ROINames; 44 | void setROINames(); 45 | bool ROISelected = false; 46 | 47 | private: 48 | Ui::SelectTargetDialog *ui; 49 | 50 | private slots: 51 | void on_buttonBox_accepted(); 52 | }; 53 | 54 | #endif // SELECTTARGETDIALOG_H 55 | -------------------------------------------------------------------------------- /selecttargetdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | SelectTargetDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 189 10 | 78 11 | 12 | 13 | 14 | Select Target 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | Qt::Horizontal 26 | 27 | 28 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | buttonBox 40 | accepted() 41 | SelectTargetDialog 42 | accept() 43 | 44 | 45 | 248 46 | 254 47 | 48 | 49 | 157 50 | 274 51 | 52 | 53 | 54 | 55 | buttonBox 56 | rejected() 57 | SelectTargetDialog 58 | reject() 59 | 60 | 61 | 316 62 | 260 63 | 64 | 65 | 286 66 | 274 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /tcpdialog.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | (c)Jothybasu Selvaraj 3 | This program comes with no gaurantee of its accuracy. 4 | Clinical decisions should not be made using this program 5 | **************************************************************************/ 6 | 7 | #include "tcpdialog.h" 8 | #include "ui_tcpdialog.h" 9 | 10 | #include"radiobiologycalc.h" 11 | #include"dvhcalc.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | TCPDialog::TCPDialog(QWidget *parent) : 22 | QDialog(parent), 23 | ui(new Ui::TCPDialog) 24 | { 25 | ui->setupUi(this); 26 | this->calcType=0;//Defaults to uniform clonogen in CTV 27 | } 28 | 29 | TCPDialog::~TCPDialog() 30 | { 31 | delete ui; 32 | } 33 | 34 | void TCPDialog::setStructureNames(QListstructures) 35 | { 36 | const int itemNo=structures.count();//No. of items in QList 37 | 38 | for (int n=0;nui->comboBox->addItem(structures[n]); 41 | } 42 | 43 | } 44 | 45 | void TCPDialog::on_pushButton_clicked() 46 | { 47 | if(this->calcType==0) 48 | { 49 | this->calcTCP(); 50 | } 51 | 52 | else if (this->calcType==1) 53 | { 54 | this->calcTCPVaryingClonogens(); 55 | } 56 | 57 | } 58 | 59 | 60 | 61 | 62 | void TCPDialog::calcTCP() 63 | { 64 | this->alpha=this->ui->alpahMeanValue->text().toDouble(); 65 | this->alphaByBeta=this->ui->alphaBetaValue->text().toDouble(); 66 | this->alphaStd=this->ui->alphaStdValue->text().toDouble(); 67 | this->clonogenDensity=this->ui->CDValue->text().toDouble(); 68 | this->alphaMean=this->alpha; 69 | 70 | this->selectedStructureNum=this->ui->comboBox->currentIndex(); 71 | DVHCalc* myDVHCalc=new DVHCalc; 72 | std::vectorresults; 73 | this->structure=this->meshes[this->selectedStructureNum]; 74 | results=myDVHCalc->calcStructDVH(this->structure,this->doseGrid); 75 | 76 | myDVHCalc->histogramData2(0.02,myDVHCalc->doseValues,results[5],1); 77 | this->voxelVol=results[5]; 78 | 79 | RadiobiologyCalc* RBcalc=new RadiobiologyCalc; 80 | RBcalc->DoseBins=myDVHCalc->doseBins; 81 | RBcalc->VolBins=myDVHCalc->volBins; 82 | RBcalc->alpha=this->alpha; 83 | RBcalc->alphaMean=this->alpha; 84 | RBcalc->alphaByBeta=this->alphaByBeta; 85 | RBcalc->alphaStd=this->alphaStd; 86 | RBcalc->clonogenDensity=this->clonogenDensity; 87 | RBcalc->fractions=this->fractions; 88 | RBcalc->voxelVol=results[5]; 89 | RBcalc->Td=this->ui->TdValue->value(); 90 | RBcalc->Tk=this->ui->TkValue->value(); 91 | RBcalc->T=((this->fractions/5)*7)-1.6;//Assuming 5 frs/week 92 | 93 | this->doseBins=myDVHCalc->doseBins; 94 | this->volBins=myDVHCalc->volBins; 95 | 96 | double TCP; 97 | 98 | if(this->alphaStd==0) 99 | { 100 | 101 | TCP=RBcalc->calcTCP(this->alpha); 102 | } 103 | else 104 | { 105 | 106 | double stop=this->alphaMean+(this->alphaStd*3.0)+0.0; 107 | double start=this->alphaMean-(this->alphaStd*3.0)-0.0; 108 | if(start<0) 109 | { 110 | start=0.0; 111 | } 112 | //qDebug()<calcNormalTCP(start,stop,0.01); 114 | } 115 | delete RBcalc; 116 | delete myDVHCalc; 117 | 118 | QMessageBox* msg=new QMessageBox; 119 | msg->setText(QString::number(TCP,'f',1)+" %"); 120 | msg->setIcon(QMessageBox::Information); 121 | msg->setWindowTitle("TCP"); 122 | msg->setTextFormat(Qt::RichText); 123 | QFont font; 124 | font.setPointSize(11); 125 | font.setBold(true); 126 | font.setWeight(50); 127 | msg->setFont(font); 128 | QIcon msgIcon; 129 | msgIcon.addFile(QString::fromUtf8(":/Icons/Icons/wand.png"), QSize(), QIcon::Normal, QIcon::Off); 130 | msg->setWindowIcon(msgIcon); 131 | msg->exec(); 132 | delete msg; 133 | } 134 | 135 | 136 | void TCPDialog::calcTCPVaryingClonogens() 137 | { 138 | this->alpha=this->ui->alpahMeanValue->text().toDouble(); 139 | this->alphaByBeta=this->ui->alphaBetaValue->text().toDouble(); 140 | this->alphaStd=this->ui->alphaStdValue->text().toDouble(); 141 | this->clonogenDensity=this->ui->CDValue->text().toDouble(); 142 | this->alphaMean=this->alpha; 143 | 144 | this->selectedStructureNum=this->ui->comboBox->currentIndex(); 145 | DVHCalc* myDVHCalc=new DVHCalc; 146 | std::vectorresults; 147 | this->structure=this->meshes[this->selectedStructureNum]; 148 | results=myDVHCalc->calcStructDVH(this->structure,this->doseGrid); 149 | //this->clonogenVector=myDVHCalc->getClonogensAsVector(this->clonogenGrid); 150 | 151 | //myDVHCalc->histogramData2(0.02,myDVHCalc->doseValues,results[5],1); 152 | this->voxelVol=results[5]; 153 | 154 | RadiobiologyCalc* RBcalc=new RadiobiologyCalc; 155 | RBcalc->calcType=1; 156 | RBcalc->doseValues=myDVHCalc->doseValues; 157 | RBcalc->VolBins=myDVHCalc->volBins; 158 | RBcalc->clonogensVector=myDVHCalc->getClonogensAsVector(this->clonogenGrid); 159 | RBcalc->alpha=this->alpha; 160 | RBcalc->alphaMean=this->alpha; 161 | RBcalc->alphaByBeta=this->alphaByBeta; 162 | RBcalc->alphaStd=this->alphaStd; 163 | RBcalc->clonogenDensity=this->clonogenDensity; 164 | RBcalc->fractions=this->fractions; 165 | RBcalc->voxelVol=results[5]; 166 | RBcalc->Td=this->ui->TdValue->value(); 167 | RBcalc->Tk=this->ui->TkValue->value(); 168 | RBcalc->T=((this->fractions/5)*7)-1.6;//Assuming 5 frs/week 169 | 170 | this->doseBins=myDVHCalc->doseBins; 171 | this->volBins=myDVHCalc->volBins; 172 | 173 | double TCP; 174 | 175 | if(this->alphaStd==0) 176 | { 177 | 178 | TCP=RBcalc->calcTCP(this->alpha); 179 | } 180 | else 181 | { 182 | 183 | double stop=this->alphaMean+(this->alphaStd*3.0)+0.0; 184 | double start=this->alphaMean-(this->alphaStd*3.0)-0.0; 185 | if(start<0) 186 | { 187 | start=0.0; 188 | } 189 | //qDebug()<calcNormalTCP(start,stop,0.01); 191 | } 192 | delete RBcalc; 193 | delete myDVHCalc; 194 | 195 | QMessageBox* msg=new QMessageBox; 196 | msg->setText(QString::number(TCP,'f',1)+" %"); 197 | msg->setIcon(QMessageBox::Information); 198 | msg->setWindowTitle("TCP"); 199 | msg->setTextFormat(Qt::RichText); 200 | QFont font; 201 | font.setPointSize(11); 202 | font.setBold(true); 203 | font.setWeight(50); 204 | msg->setFont(font); 205 | QIcon msgIcon; 206 | msgIcon.addFile(QString::fromUtf8(":/Icons/Icons/wand.png"), QSize(), QIcon::Normal, QIcon::Off); 207 | msg->setWindowIcon(msgIcon); 208 | msg->exec(); 209 | delete msg; 210 | } 211 | -------------------------------------------------------------------------------- /tcpdialog.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | (c)Jothybasu Selvaraj 3 | This program comes with no gaurantee of its accuracy. 4 | Clinical decisions should not be made using this program 5 | **************************************************************************/ 6 | 7 | #ifndef TCPDIALOG_H 8 | #define TCPDIALOG_H 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | namespace Ui { 21 | class TCPDialog; 22 | } 23 | 24 | class TCPDialog : public QDialog 25 | { 26 | Q_OBJECT 27 | 28 | public: 29 | explicit TCPDialog(QWidget *parent = 0); 30 | ~TCPDialog(); 31 | void setStructureNames(QListstructNames); 32 | int selectedStructureNum; 33 | std::vector >meshes; 34 | vtkSmartPointerstructure; 35 | vtkSmartPointerdoseGrid; 36 | vtkSmartPointerclonogenGrid; 37 | double alphaByBeta; 38 | double alpha; 39 | double alphaMean; 40 | double alphaStd; 41 | double clonogenDensity; 42 | double fractions; 43 | double temporalCF; 44 | std::vectordoseBins; 45 | std::vectorvolBins; 46 | std::vectorclonogenVector; 47 | double voxelVol; 48 | bool calcType; 49 | void calcTCP(); 50 | void calcTCPVaryingClonogens(); 51 | 52 | 53 | private: 54 | Ui::TCPDialog *ui; 55 | 56 | private slots: 57 | void on_pushButton_clicked(); 58 | 59 | }; 60 | 61 | #endif // TCPDIALOG_H 62 | -------------------------------------------------------------------------------- /udplistener.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef UDPLISTENER_H 26 | #define UDPLISTENER_H 27 | 28 | #include 29 | #include 30 | 31 | // Tracking function headers 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | class UDPListener : public QObject { 42 | Q_OBJECT 43 | public: 44 | explicit UDPListener(QObject *parent = nullptr); 45 | ~UDPListener(); 46 | void HelloUDP(); 47 | double shifts[3] = {0, 0, 0}; 48 | 49 | // Tracking members 50 | vtkSmartPointer TrackingTransform; 51 | vtkSmartPointer TrackingPolydataTransform; 52 | vtkSmartPointer TrackingActor3D; 53 | vtkSmartPointer TrackingMapper; 54 | vtkSmartPointer TrackingActorAxial; 55 | vtkSmartPointer TrackingActorSagittal; 56 | vtkSmartPointer TrackingActorCoronal; 57 | vtkSmartPointer TrackingPolyData; 58 | vtkSmartPointer TrackingTarget; 59 | std::vector> MeshList; 60 | ImageViewer2D *AxialViewer; 61 | ImageViewer2D *CoronalViewer; 62 | ImageViewer2D *SagittalViewer; 63 | BEVWidget *BEVViewer; 64 | unsigned int SelectROINum; 65 | void UpdateViews(); 66 | double (*ROIColors)[3]; 67 | unsigned int selectedStructureNum; 68 | QList ROINames; 69 | bool connectionState = false; // disconnected by default 70 | 71 | QWidget *parent; 72 | struct UDPMsg { 73 | double shiftX = 0.0; 74 | double shiftY = 0.0; 75 | double shiftZ = 0.0; 76 | double rotationX = 0.0; 77 | double rotationY = 0.0; 78 | double rotationZ = 0.0; 79 | double gantryAngle = 0.0; 80 | bool beamHold = false; 81 | }; 82 | 83 | signals: 84 | 85 | public slots: 86 | void readMessage(); 87 | void StartListening(); 88 | void StopListening(); 89 | 90 | private: 91 | QUdpSocket *socket; 92 | }; 93 | 94 | #endif // UDPLISTENER_H 95 | -------------------------------------------------------------------------------- /utilities.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #include "utilities.h" 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | Utilities::Utilities() {} 34 | 35 | double *Utilities::IEC2LPS(double IEC[3]) { 36 | vtkSmartPointer IEC2LPSTransform = 37 | vtkSmartPointer::New(); 38 | IEC2LPSTransform->Identity(); 39 | IEC2LPSTransform->RotateX(90); 40 | double *LPS = IEC2LPSTransform->TransformPoint(IEC); 41 | // qDebug()< 29 | #include 30 | 31 | class Utilities { 32 | public: 33 | Utilities(); 34 | // Converts points from IEC to LPS (DICOM) coordinates 35 | double *IEC2LPS(double IEC[3]); 36 | }; 37 | 38 | #endif // UTILITIES_H 39 | -------------------------------------------------------------------------------- /vtkinteractorstyleimagecustom.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #include "vtkinteractorstyleimagecustom.h" 26 | 27 | #define vtkRenderingCore_AUTOINIT \ 28 | 3(vtkInteractionStyle, vtkRenderingFreeType, vtkRenderingOpenGL2) 29 | #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) 30 | 31 | #include 32 | 33 | #include "vtkAbstractPropPicker.h" 34 | #include "vtkAssemblyPath.h" 35 | #include "vtkCallbackCommand.h" 36 | #include "vtkCamera.h" 37 | #include "vtkImageMapper3D.h" 38 | #include "vtkImageProperty.h" 39 | #include "vtkImageSlice.h" 40 | #include "vtkMath.h" 41 | #include "vtkObjectFactory.h" 42 | #include "vtkPropCollection.h" 43 | #include "vtkRenderWindow.h" 44 | #include "vtkRenderWindowInteractor.h" 45 | #include "vtkRenderer.h" 46 | 47 | vtkInteractorStyleImageCustom::vtkInteractorStyleImageCustom() {} 48 | 49 | vtkInteractorStyleImageCustom *vtkInteractorStyleImageCustom::New() { 50 | return new vtkInteractorStyleImageCustom; 51 | } 52 | 53 | //---------------------------------------------------------------------------- 54 | // This is a way of dealing with images as if they were layers. 55 | // It looks through the renderer's list of props and sets the 56 | // interactor ivars from the Nth image that it finds. You can 57 | // also use negative numbers, i.e. -1 will return the last image, 58 | // -2 will return the second-to-last image, etc. 59 | void vtkInteractorStyleImageCustom::SetCurrentImageToNthImage(int i) { 60 | if (!this->CurrentRenderer) { 61 | return; 62 | } 63 | 64 | vtkPropCollection *props = this->CurrentRenderer->GetViewProps(); 65 | vtkProp *prop = 0; 66 | vtkAssemblyPath *path; 67 | vtkImageSlice *imageProp = 0; 68 | vtkCollectionSimpleIterator pit; 69 | 70 | for (int k = 0; k < 2; k++) { 71 | int j = 0; 72 | for (props->InitTraversal(pit); (prop = props->GetNextProp(pit));) { 73 | bool foundImageProp = false; 74 | for (prop->InitPathTraversal(); (path = prop->GetNextPath());) { 75 | vtkProp *tryProp = path->GetLastNode()->GetViewProp(); 76 | if ((imageProp = vtkImageSlice::SafeDownCast(tryProp)) != 0) 77 | imageProp = vtkImageSlice::SafeDownCast(tryProp); 78 | if (imageProp) { 79 | if (j == i) 80 | if (j == i && imageProp->GetPickable()) { 81 | foundImageProp = true; 82 | break; 83 | } 84 | imageProp = 0; 85 | j++; 86 | } 87 | } 88 | if (foundImageProp) { 89 | break; 90 | } 91 | } 92 | if (i < 0) { 93 | i += j; 94 | } 95 | } 96 | 97 | vtkImageProperty *property = 0; 98 | if (imageProp) { 99 | property = imageProp->GetProperty(); 100 | } 101 | 102 | if (property != this->CurrentImageProperty) { 103 | if (this->CurrentImageProperty) { 104 | this->CurrentImageProperty->Delete(); 105 | } 106 | 107 | this->CurrentImageProperty = property; 108 | 109 | if (this->CurrentImageProperty) { 110 | this->CurrentImageProperty->Register(this); 111 | } 112 | } 113 | } 114 | 115 | //---------------------------------------------------------------------------- 116 | void vtkInteractorStyleImageCustom::StartWindowLevel() { 117 | if (this->State != VTKIS_NONE) { 118 | return; 119 | } 120 | this->StartState(VTKIS_WINDOW_LEVEL); 121 | 122 | // Get the last (the first) image 123 | this->SetCurrentImageToNthImage(0); 124 | 125 | if (this->HandleObservers && 126 | this->HasObserver(vtkCommand::StartWindowLevelEvent)) { 127 | this->InvokeEvent(vtkCommand::StartWindowLevelEvent, this); 128 | } else { 129 | if (this->CurrentImageProperty) { 130 | vtkImageProperty *property = this->CurrentImageProperty; 131 | this->WindowLevelInitial[0] = property->GetColorWindow(); 132 | this->WindowLevelInitial[1] = property->GetColorLevel(); 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /vtkinteractorstyleimagecustom.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef VTKINTERACTORSTYLEIMAGECUSTOM_H 26 | #define VTKINTERACTORSTYLEIMAGECUSTOM_H 27 | 28 | #define vtkRenderingCore_AUTOINIT 3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL2) 29 | #define vtkRenderingVolume_AUTOINIT 1(vtkRenderingVolumeOpenGL2) 30 | 31 | #include 32 | #include 33 | 34 | //vtkInteractorStyleImage is subclassed to interact only with the FIRST image (using SetCurrentImageToNthImage(0) 35 | //so that only the CT image WL/WW is changed 36 | 37 | class vtkInteractorStyleImageCustom : public vtkInteractorStyleImage 38 | { 39 | public: 40 | vtkInteractorStyleImageCustom(); 41 | static vtkInteractorStyleImageCustom *New(); 42 | void StartWindowLevel(); 43 | 44 | protected: 45 | void SetCurrentImageToNthImage(int i); 46 | 47 | }; 48 | 49 | #endif // VTKINTERACTORSTYLEIMAGECUSTOM_H 50 | -------------------------------------------------------------------------------- /vtklinecallbackdose.cpp: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #include "vtklinecallbackdose.h" 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #include 52 | #include 53 | #include 54 | #include 55 | 56 | #include "doseprofiledialog.h" 57 | 58 | QT_CHARTS_USE_NAMESPACE 59 | 60 | vtkLineCallbackDose::vtkLineCallbackDose(QWidget *parent) { 61 | this->doseProfiler = new DoseProfileDialog(parent); 62 | this->doseProfiler->show(); 63 | this->trX = 0.0; 64 | this->trY = 0.0; 65 | this->trZ = 0.0; 66 | } 67 | 68 | vtkLineCallbackDose::~vtkLineCallbackDose() { 69 | this->trX = 0.0; 70 | this->trY = 0.0; 71 | this->trZ = 0.0; 72 | delete doseProfiler; 73 | } 74 | 75 | vtkLineCallbackDose *vtkLineCallbackDose::New(QWidget *parent) { 76 | return new vtkLineCallbackDose(parent); 77 | } 78 | 79 | void vtkLineCallbackDose::Execute(vtkObject *caller, unsigned long, void *) { 80 | // qDebug()<<"'Executing..."; 81 | vtkLineWidget2 *lineWidget = reinterpret_cast(caller); 82 | 83 | // Get the actual box coordinates of the line 84 | this->lineData = vtkSmartPointer::New(); 85 | static_cast(lineWidget->GetRepresentation()) 86 | ->GetPolyData(this->lineData); 87 | this->distance = 88 | static_cast(lineWidget->GetRepresentation()) 89 | ->GetDistance(); 90 | // qDebug()<distance<<"Distance"; 91 | 92 | vtkSmartPointer pfDose = 93 | vtkSmartPointer::New(); 94 | 95 | // Axial 96 | if (this->SliceOrientation == 0) { 97 | this->transformPolyData(); 98 | 99 | pfDose->SetInputData(this->lineData); 100 | pfDose->SetSourceData(this->dose); 101 | pfDose->Update(); 102 | 103 | } 104 | 105 | // Sagittal 106 | else if (this->SliceOrientation == 1) { 107 | // Start modifying line data 108 | vtkSmartPointer points = vtkSmartPointer::New(); 109 | vtkSmartPointer cells = vtkSmartPointer::New(); 110 | 111 | int npts = this->lineData->GetNumberOfPoints(); 112 | points->SetNumberOfPoints(npts); 113 | cells->InsertNextCell(npts); 114 | for (int p = 0; p < npts; p++) { 115 | double pt[3]; 116 | this->lineData->GetPoint(p, pt); 117 | points->SetPoint(p, this->trX, pt[0], -pt[1]); 118 | cells->InsertCellPoint(p); 119 | } 120 | cells->InsertCellPoint(npts); 121 | 122 | vtkSmartPointer newLineData = 123 | vtkSmartPointer::New(); 124 | newLineData->Initialize(); 125 | newLineData->SetLines(cells); 126 | newLineData->SetPoints(points); 127 | // End of modifying line data 128 | 129 | this->transformPolyData(); 130 | 131 | pfDose->SetInputData(newLineData); 132 | pfDose->SetSourceData(this->dose); 133 | pfDose->Update(); 134 | 135 | } 136 | 137 | // Coronal 138 | else if (this->SliceOrientation == 2) { 139 | // Start modifying line data 140 | vtkSmartPointer points = vtkSmartPointer::New(); 141 | vtkSmartPointer cells = vtkSmartPointer::New(); 142 | 143 | int npts = this->lineData->GetNumberOfPoints(); 144 | points->SetNumberOfPoints(npts); 145 | cells->InsertNextCell(npts); 146 | for (int p = 0; p < npts; p++) { 147 | double pt[3]; 148 | this->lineData->GetPoint(p, pt); 149 | points->SetPoint(p, pt[0], this->trY, -pt[1]); 150 | cells->InsertCellPoint(p); 151 | } 152 | cells->InsertCellPoint(npts); 153 | 154 | vtkSmartPointer newLineData = 155 | vtkSmartPointer::New(); 156 | newLineData->Initialize(); 157 | newLineData->SetLines(cells); 158 | newLineData->SetPoints(points); 159 | // End of modifying line data 160 | 161 | this->transformPolyData(); 162 | 163 | pfDose->SetInputData(newLineData); 164 | pfDose->SetSourceData(this->dose); 165 | pfDose->Update(); 166 | } 167 | 168 | vtkSmartPointer polyDataToTableDose = 169 | vtkSmartPointer::New(); 170 | polyDataToTableDose->SetInputConnection(pfDose->GetOutputPort()); 171 | polyDataToTableDose->SetFieldType(vtkDataObjectToTable::POINT_DATA); 172 | polyDataToTableDose->Update(); 173 | 174 | this->doseProfiler->DoseData->clear(); 175 | 176 | this->SplineSeries = new QSplineSeries; 177 | this->SplineSeries->setName("Dose (Spline interpolated)"); 178 | QPen pen = SplineSeries->pen(); 179 | pen.setWidth(2); 180 | pen.setBrush(QBrush(QColor(255, 127, 39))); 181 | SplineSeries->setPen(pen); 182 | 183 | int numPoints = this->lineData->GetNumberOfPoints(); 184 | for (int i = 0; i < numPoints; ++i) { 185 | float dist; 186 | dist = (this->distance / 1000) * i; 187 | float dose = polyDataToTableDose->GetOutput()->GetValue(i, 0).ToFloat(); 188 | this->SplineSeries->append(dist, dose); 189 | } 190 | 191 | this->doseProfiler->DoseData = this->SplineSeries; 192 | this->doseProfiler->plotProfile(); 193 | } 194 | 195 | void vtkLineCallbackDose::transformPolyData() { 196 | vtkSmartPointer transform = 197 | vtkSmartPointer::New(); 198 | // qDebug()<trX<trY<trZ<<"tr"; 199 | transform->Translate(this->trX, this->trY, this->trZ); 200 | transform->Update(); 201 | 202 | vtkSmartPointer transF = 203 | vtkSmartPointer::New(); 204 | transF->SetInputData(this->lineData); 205 | transF->SetTransform(transform); 206 | transF->Update(); 207 | this->lineData = transF->GetOutput(); 208 | } 209 | -------------------------------------------------------------------------------- /vtklinecallbackdose.h: -------------------------------------------------------------------------------- 1 | /******************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | ********************************************************************************/ 24 | 25 | #ifndef VTKLINECALLBACKDOSE_H 26 | #define VTKLINECALLBACKDOSE_H 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | #include "doseprofiledialog.h" 38 | 39 | class vtkLineCallbackDose : public vtkCommand { 40 | public: 41 | vtkLineCallbackDose(QWidget *parent); 42 | ~vtkLineCallbackDose(); 43 | vtkLineCallbackDose *New(QWidget *parent); 44 | vtkSmartPointer lineData; 45 | void Execute(vtkObject *caller, unsigned long, void *); 46 | vtkSmartPointer dose; 47 | DoseProfileDialog *doseProfiler; 48 | float distance; 49 | double trX, trY, trZ; // X,Y,Z translations 50 | void transformPolyData(); 51 | int SliceOrientation = 0; // Axial by default 52 | QSplineSeries *SplineSeries; 53 | }; 54 | 55 | #endif // VTKLINECALLBACKDOSE_H 56 | -------------------------------------------------------------------------------- /wlwwdialog.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the 11 | Software, and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ******************************************************************************/ 25 | #include "wlwwdialog.h" 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | #include "ui_wlwwdialog.h" 34 | 35 | WLWWDialog::WLWWDialog(QWidget *parent) 36 | : QDialog(parent), ui(new Ui::WLWWDialog) { 37 | ui->setupUi(this); 38 | } 39 | 40 | WLWWDialog::~WLWWDialog() { delete ui; } 41 | 42 | void WLWWDialog::on_pushButtonReset_clicked() { 43 | this->ui->ScrollBar_width->setValue(1000); 44 | this->ui->ScrollBar_level->setValue(100); 45 | this->ui->lineEditWidth->setText("1000"); 46 | this->ui->lineEditLevel->setText("100"); 47 | 48 | this->updateWLWW(); 49 | } 50 | 51 | void WLWWDialog::on_ScrollBar_level_sliderMoved(int position) { 52 | // qDebug() << position; 53 | this->ui->lineEditLevel->setText( 54 | QString::number(this->ui->ScrollBar_level->value())); 55 | this->updateWLWW(); 56 | } 57 | 58 | void WLWWDialog::on_ScrollBar_width_sliderMoved(int position) { 59 | // qDebug() << position; 60 | this->ui->lineEditWidth->setText( 61 | QString::number(this->ui->ScrollBar_width->value())); 62 | this->updateWLWW(); 63 | } 64 | 65 | void WLWWDialog::on_lineEditWidth_editingFinished() { 66 | this->ui->ScrollBar_width->setValue(this->ui->lineEditWidth->text().toInt()); 67 | this->updateWLWW(); 68 | } 69 | 70 | void WLWWDialog::on_lineEditLevel_editingFinished() { 71 | this->ui->ScrollBar_level->setValue(this->ui->lineEditLevel->text().toInt()); 72 | this->updateWLWW(); 73 | } 74 | 75 | void WLWWDialog::updateWLWW() { 76 | // Calculate range of CT values ,ÇwindowLow and WindowUp for WL & WW 77 | double winUp = this->ui->ScrollBar_level->value() + 78 | (this->ui->ScrollBar_width->value() / 2.0); 79 | double winLow = this->ui->ScrollBar_level->value() - 80 | (this->ui->ScrollBar_width->value() / 2.0); 81 | 82 | // qDebug() << winLow << "'" << winUp; 83 | 84 | this->AxialViewer->ViewRenderer->RemoveActor(this->AxialViewer->ImageSlice); 85 | this->AxialViewer->ViewRenderer->RemoveActor(this->AxialViewer->DoseSlice); 86 | this->AxialViewer->WindowLow = winLow; 87 | this->AxialViewer->WindowUp = winUp; 88 | this->AxialViewer->AdjustImageWLWW(); 89 | this->AxialViewer->ViewRenderer->AddActor(this->AxialViewer->ImageSlice); 90 | if (this->AxialViewer->DoseVisibility == 1) { 91 | this->AxialViewer->ViewRenderer->AddActor(this->AxialViewer->DoseSlice); 92 | } 93 | this->AxialViewer->ViewRenderer->GetRenderWindow()->Render(); 94 | 95 | this->SagittalViewer->ViewRenderer->RemoveActor( 96 | this->SagittalViewer->ImageSlice); 97 | this->SagittalViewer->ViewRenderer->RemoveActor( 98 | this->SagittalViewer->DoseSlice); 99 | this->SagittalViewer->WindowLow = winLow; 100 | this->SagittalViewer->WindowUp = winUp; 101 | this->SagittalViewer->AdjustImageWLWW(); 102 | this->SagittalViewer->ViewRenderer->AddActor( 103 | this->SagittalViewer->ImageSlice); 104 | if (this->SagittalViewer->DoseVisibility == 1) { 105 | this->SagittalViewer->ViewRenderer->AddActor( 106 | this->SagittalViewer->DoseSlice); 107 | } 108 | this->SagittalViewer->ViewRenderer->GetRenderWindow()->Render(); 109 | 110 | this->CoronalViewer->ViewRenderer->RemoveActor( 111 | this->CoronalViewer->ImageSlice); 112 | this->CoronalViewer->ViewRenderer->RemoveActor( 113 | this->CoronalViewer->DoseSlice); 114 | this->CoronalViewer->WindowLow = winLow; 115 | this->CoronalViewer->WindowUp = winUp; 116 | this->CoronalViewer->AdjustImageWLWW(); 117 | this->CoronalViewer->ViewRenderer->AddActor(this->CoronalViewer->ImageSlice); 118 | if (this->CoronalViewer->DoseVisibility == 1) { 119 | this->CoronalViewer->ViewRenderer->AddActor(this->CoronalViewer->DoseSlice); 120 | } 121 | this->CoronalViewer->ViewRenderer->GetRenderWindow()->Render(); 122 | } 123 | -------------------------------------------------------------------------------- /wlwwdialog.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | MIT License 3 | 4 | Copyright (c) 2021 Jothy Selvaraj 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including without limitation the 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the 11 | Software, and to permit persons to whom the Software is furnished to do so, 12 | subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ******************************************************************************/ 25 | #ifndef WLWWDIALOG_H 26 | #define WLWWDIALOG_H 27 | 28 | #include 29 | 30 | #include 31 | 32 | namespace Ui { 33 | class WLWWDialog; 34 | } 35 | 36 | class WLWWDialog : public QDialog { 37 | Q_OBJECT 38 | 39 | public: 40 | explicit WLWWDialog(QWidget *parent = nullptr); 41 | ~WLWWDialog(); 42 | ImageViewer2D *AxialViewer; 43 | ImageViewer2D *CoronalViewer; 44 | ImageViewer2D *SagittalViewer; 45 | 46 | private slots: 47 | 48 | void on_pushButtonReset_clicked(); 49 | 50 | void on_ScrollBar_level_sliderMoved(int position); 51 | 52 | void on_ScrollBar_width_sliderMoved(int position); 53 | 54 | void on_lineEditWidth_editingFinished(); 55 | 56 | void on_lineEditLevel_editingFinished(); 57 | 58 | void updateWLWW(); 59 | 60 | private: 61 | Ui::WLWWDialog *ui; 62 | }; 63 | 64 | #endif // WLWWDIALOG_H 65 | -------------------------------------------------------------------------------- /wlwwdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | WLWWDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 439 10 | 108 11 | 12 | 13 | 14 | Adjust WL & WW 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 50 26 | 16777215 27 | 28 | 29 | 30 | Width 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 150 39 | 0 40 | 41 | 42 | 43 | background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255)); 44 | 45 | 46 | -1000 47 | 48 | 49 | 3000 50 | 51 | 52 | 1000 53 | 54 | 55 | true 56 | 57 | 58 | Qt::Horizontal 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 50 67 | 16777215 68 | 69 | 70 | 71 | 1000 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 50 84 | 16777215 85 | 86 | 87 | 88 | Level 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 150 97 | 0 98 | 99 | 100 | 101 | background-color: qlineargradient(spread:pad, x1:1, y1:0, x2:0, y2:1, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255)); 102 | 103 | 104 | -1000 105 | 106 | 107 | 3000 108 | 109 | 110 | 100 111 | 112 | 113 | Qt::Horizontal 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 50 122 | 16777215 123 | 124 | 125 | 126 | 100 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | Qt::Horizontal 138 | 139 | 140 | 141 | 40 142 | 20 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | Qt::NoFocus 151 | 152 | 153 | Reset 154 | 155 | 156 | 157 | :/Icons/Reset.png:/Icons/Reset.png 158 | 159 | 160 | 161 | 162 | 163 | 164 | Qt::Horizontal 165 | 166 | 167 | 168 | 40 169 | 20 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | --------------------------------------------------------------------------------