melage 0.0.65__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- assets/copyright.png +0 -0
- assets/resource/color/FreeSurferColorLUT.txt +2006 -0
- assets/resource/color/LUT_30.txt +31 -0
- assets/resource/color/SynthSeg.txt +34 -0
- assets/resource/color/lut_prostate.txt +20 -0
- assets/resource/horizontalview.png +0 -0
- assets/resource/main.ico +0 -0
- assets/resource/theme/create_ticks.py +85 -0
- assets/resource/theme/rc/checkbox_checked.png +0 -0
- assets/resource/theme/rc/checkbox_checked@2x.png +0 -0
- assets/resource/theme/rc/checkbox_checked_disabled.png +0 -0
- assets/resource/theme/rc/checkbox_checked_disabled@2x.png +0 -0
- assets/resource/theme/rc/checkbox_checked_focus.png +0 -0
- assets/resource/theme/rc/checkbox_checked_focus@2x.png +0 -0
- assets/resource/theme/rc/checkbox_checked_pressed.png +0 -0
- assets/resource/theme/rc/checkbox_checked_pressed@2x.png +0 -0
- assets/resource/theme/rc/checkbox_indeterminate.png +0 -0
- assets/resource/theme/rc/checkbox_indeterminate@2x.png +0 -0
- assets/resource/theme/rc/checkbox_indeterminate_disabled.png +0 -0
- assets/resource/theme/rc/checkbox_indeterminate_disabled@2x.png +0 -0
- assets/resource/theme/rc/checkbox_indeterminate_focus.png +0 -0
- assets/resource/theme/rc/checkbox_indeterminate_focus@2x.png +0 -0
- assets/resource/theme/rc/checkbox_indeterminate_pressed.png +0 -0
- assets/resource/theme/rc/checkbox_indeterminate_pressed@2x.png +0 -0
- assets/resource/theme/rc/checkbox_unchecked.png +0 -0
- assets/resource/theme/rc/checkbox_unchecked@2x.png +0 -0
- assets/resource/theme/rc/checkbox_unchecked_disabled.png +0 -0
- assets/resource/theme/rc/checkbox_unchecked_disabled@2x.png +0 -0
- assets/resource/theme/rc/checkbox_unchecked_focus.png +0 -0
- assets/resource/theme/rc/checkbox_unchecked_focus@2x.png +0 -0
- assets/resource/theme/rc/checkbox_unchecked_pressed.png +0 -0
- assets/resource/theme/rc/checkbox_unchecked_pressed@2x.png +0 -0
- assets/resource/verticalview.png +0 -0
- assets/resource/zoom_in.png +0 -0
- assets/resource/zoom_neutral (copy).png +0 -0
- assets/resource/zoom_neutral.png +0 -0
- assets/resource/zoom_out.png +0 -0
- data/MNI/mni_icbm152_t1_tal_nlin_sym_09a.nii +0 -0
- data/MNI/mni_icbm152_t1_tal_nlin_sym_09a_masked.nii.gz +0 -0
- data/MNI/mni_icbm152_t1_tal_nlin_sym_09a_seg.nii.gz +0 -0
- docs/manual_images/3D_rightc.png +0 -0
- docs/manual_images/3D_rightc_goto.png +0 -0
- docs/manual_images/3D_rightc_paint.png +0 -0
- docs/manual_images/3D_rightc_paint_draw1.png +0 -0
- docs/manual_images/3D_rightc_paint_draw2.png +0 -0
- docs/manual_images/3D_rightc_paint_render.png +0 -0
- docs/manual_images/3D_rightc_paint_render2.png +0 -0
- docs/manual_images/3D_rightc_paint_render3.png +0 -0
- docs/manual_images/3D_rightc_paint_render4.png +0 -0
- docs/manual_images/3D_rightc_paint_render5.png +0 -0
- docs/manual_images/3D_rightc_paint_render6.png +0 -0
- docs/manual_images/3D_rightc_seg.png +0 -0
- docs/manual_images/exit_toolbar.png +0 -0
- docs/manual_images/load_image_file.png +0 -0
- docs/manual_images/load_image_file_openp.png +0 -0
- docs/manual_images/main_page.png +0 -0
- docs/manual_images/menu_file.png +0 -0
- docs/manual_images/menu_file_export.png +0 -0
- docs/manual_images/menu_file_import.png +0 -0
- docs/manual_images/menu_file_settings.png +0 -0
- docs/manual_images/menu_file_ss.png +0 -0
- docs/manual_images/open_save_load.png +0 -0
- docs/manual_images/panning_toolbar.png +0 -0
- docs/manual_images/segmentation_toolbar.png +0 -0
- docs/manual_images/tab_mri.png +0 -0
- docs/manual_images/tab_us.png +0 -0
- docs/manual_images/tabs.png +0 -0
- docs/manual_images/toolbar_tools.png +0 -0
- docs/manual_images/tools_basic.png +0 -0
- docs/manual_images/tools_bet.png +0 -0
- docs/manual_images/tools_cs.png +0 -0
- docs/manual_images/tools_deepbet.png +0 -0
- docs/manual_images/tools_imageinfo.png +0 -0
- docs/manual_images/tools_maskO.png +0 -0
- docs/manual_images/tools_masking.png +0 -0
- docs/manual_images/tools_n4b.png +0 -0
- docs/manual_images/tools_resize.png +0 -0
- docs/manual_images/tools_ruler.png +0 -0
- docs/manual_images/tools_seg.png +0 -0
- docs/manual_images/tools_threshold.png +0 -0
- docs/manual_images/tools_tools.png +0 -0
- docs/manual_images/widget_color.png +0 -0
- docs/manual_images/widget_color_add.png +0 -0
- docs/manual_images/widget_color_add2.png +0 -0
- docs/manual_images/widget_color_additional.png +0 -0
- docs/manual_images/widget_images.png +0 -0
- docs/manual_images/widget_images2.png +0 -0
- docs/manual_images/widget_images3.png +0 -0
- docs/manual_images/widget_marker.png +0 -0
- docs/manual_images/widget_mri.png +0 -0
- docs/manual_images/widget_mri2.png +0 -0
- docs/manual_images/widget_segintensity.png +0 -0
- docs/manual_images/widget_tab_mutualview.png +0 -0
- docs/manual_images/widget_tab_mutualview2.png +0 -0
- docs/manual_images/widget_table.png +0 -0
- docs/manual_images/widget_table2.png +0 -0
- docs/manual_images/widget_us.png +0 -0
- melage/__init__.py +1 -1
- melage/config/__init__.py +100 -0
- melage/core/Registration/registration.py +54 -0
- melage/{utils/readData.py → core/io.py} +12 -4
- melage/{widgets/melageAbout.py → dialogs/AboutDialog.py} +1 -1
- melage/dialogs/MaskOperationsDialog.py +146 -0
- melage/dialogs/MaskingDialog.py +139 -0
- melage/dialogs/RegistrationDialog.py +311 -0
- melage/{widgets/ImageThresholding.py → dialogs/ThresholdingDialog.py} +2 -2
- melage/dialogs/TransformationDialog.py +275 -0
- melage/dialogs/__init__.py +9 -0
- melage/dialogs/dynamic_gui.py +327 -0
- melage/{widgets/fileDialog_widget.py → dialogs/helpers/FileDialog.py} +226 -1
- melage/dialogs/helpers/__init__.py +5 -0
- melage/main.py +13 -13
- melage/{widgets/mainwindow_widget.py → mainwindow_widget.py} +1434 -1408
- melage/plugins/N4_bias/N4.py +115 -0
- melage/plugins/N4_bias/N4_schema.py +40 -0
- melage/plugins/N4_bias/main/utils.py +46 -0
- melage/plugins/__init__.py +2 -0
- melage/plugins/bet/bet.py +176 -0
- melage/plugins/bet/bet_schema.py +73 -0
- melage/{widgets/brain_extraction.py → plugins/bet/main/BET.py} +51 -316
- melage/plugins/change_coord/change_coord.py +197 -0
- melage/plugins/change_coord/change_coord_schema.py +31 -0
- melage/plugins/change_coord/main/utils.py +15 -0
- melage/{widgets/Segmentation → plugins/esfcm/main}/FCM.py +3 -5
- melage/plugins/esfcm/main/test.py +57 -0
- melage/{widgets/Segmentation → plugins/esfcm/main}/utils.py +20 -0
- melage/plugins/esfcm/tissue_segmentation.py +124 -0
- melage/plugins/esfcm/tissue_segmentation_schema.py +33 -0
- melage/plugins/masking_operation/mo.py +115 -0
- melage/plugins/masking_operation/mo_schema.py +33 -0
- melage/plugins/mga_net/MGA_Net.py +145 -0
- melage/plugins/mga_net/MGA_Net_schema.py +29 -0
- melage/plugins/mga_net/main/figures/Network.txt +1 -0
- melage/{widgets/DeepLModels/new_unet.py → plugins/mga_net/main/model/mga_net.py} +3 -3
- melage/plugins/mga_net/main/model/utils.py +258 -0
- melage/plugins/mga_net/main/test_mgaNet.py +134 -0
- melage/plugins/resize/resize.py +136 -0
- melage/plugins/resize/resize_schema.py +41 -0
- melage/plugins/ui_helpers.py +144 -0
- melage/plugins/warpseg/WarpSeg.py +195 -0
- melage/plugins/warpseg/WarpSeg_schema.py +41 -0
- melage/plugins/warpseg/__init__.py +2 -0
- melage/plugins/warpseg/warpseg_main/data_reader/DDSet.py +303 -0
- melage/plugins/warpseg/warpseg_main/data_reader/DDSetSeg.py +279 -0
- melage/plugins/warpseg/warpseg_main/data_reader/__init__.py +60 -0
- melage/plugins/warpseg/warpseg_main/data_reader/baseData.py +18 -0
- melage/plugins/warpseg/warpseg_main/data_reader/utils.py +267 -0
- melage/plugins/warpseg/warpseg_main/dist_utils.py +18 -0
- melage/plugins/warpseg/warpseg_main/requirements.txt +10 -0
- melage/plugins/warpseg/warpseg_main/test.py +272 -0
- melage/plugins/warpseg/warpseg_main/train.py +432 -0
- melage/plugins/warpseg/warpseg_main/train_reg.py +373 -0
- melage/plugins/warpseg/warpseg_main/verify_post_process.py +73 -0
- melage/plugins/warpseg/warpseg_main/voxelmorph/__init__.py +45 -0
- melage/plugins/warpseg/warpseg_main/voxelmorph/py/__init__.py +1 -0
- melage/plugins/warpseg/warpseg_main/voxelmorph/py/utils.py +99 -0
- melage/{widgets/Synthstrip.py → plugins/warpseg/warpseg_main/voxelmorph/torch/Unet.py} +71 -51
- melage/plugins/warpseg/warpseg_main/voxelmorph/torch/__init__.py +4 -0
- melage/plugins/warpseg/warpseg_main/voxelmorph/torch/layers.py +97 -0
- melage/plugins/warpseg/warpseg_main/voxelmorph/torch/losses.py +462 -0
- melage/plugins/warpseg/warpseg_main/voxelmorph/torch/modelio.py +77 -0
- melage/{widgets/DeepLModels/InfantSegment/Unet.py → plugins/warpseg/warpseg_main/voxelmorph/torch/multi_stage_net.py} +76 -52
- melage/plugins/warpseg/warpseg_main/voxelmorph/torch/networks.py +308 -0
- melage/plugins/warpseg/warpseg_main/voxelmorph/torch/utils.py +470 -0
- melage/{utils/DispalyIm.py → rendering/DisplayIm.py} +67 -79
- melage/{utils → rendering}/glScientific.py +1 -1
- melage/utils/__init__.py +1 -0
- melage/utils/utils.py +343 -196
- melage/widgets/{dockWidgets.py → DockWidgets.py} +123 -55
- melage/widgets/SettingsWidget.py +98 -0
- melage/widgets/__init__.py +49 -0
- melage/widgets/openglWidgets.py +344 -156
- melage/widgets/openglWidgets_bu.py +645 -0
- melage/widgets/plugin_manager.py +62 -0
- melage-1.0.0.dist-info/METADATA +953 -0
- melage-1.0.0.dist-info/RECORD +571 -0
- melage-1.0.0.dist-info/entry_points.txt +2 -0
- melage-1.0.0.dist-info/top_level.txt +4 -0
- melage/requirements22.txt +0 -25
- melage/requirements_old.txt +0 -28
- melage/resource/theme/rc/checkbox_checked.png +0 -0
- melage/resource/theme/rc/checkbox_checked@2x.png +0 -0
- melage/resource/theme/rc/checkbox_checked@2x0.png +0 -0
- melage/resource/theme/rc/checkbox_checked@2x000.png.png +0 -0
- melage/resource/theme/rc/checkbox_checked_disabled.png +0 -0
- melage/resource/theme/rc/checkbox_checked_disabled0.png +0 -0
- melage/resource/theme/rc/checkbox_checked_disabled@2x.png +0 -0
- melage/resource/theme/rc/checkbox_checked_disabled@2x0.png +0 -0
- melage/resource/theme/rc/checkbox_checked_focus.png +0 -0
- melage/resource/theme/rc/checkbox_checked_focus0.png +0 -0
- melage/resource/theme/rc/checkbox_checked_focus@2x.png +0 -0
- melage/resource/theme/rc/checkbox_checked_focus@2x0.png +0 -0
- melage/resource/theme/rc/checkbox_checked_pressed.png +0 -0
- melage/resource/theme/rc/checkbox_checked_pressed0.png +0 -0
- melage/resource/theme/rc/checkbox_checked_pressed@2x.png +0 -0
- melage/resource/theme/rc/checkbox_checked_pressed@2x0.png +0 -0
- melage/resource/theme/rc/checkbox_indeterminate.png +0 -0
- melage/resource/theme/rc/checkbox_indeterminate@2x.png +0 -0
- melage/resource/theme/rc/checkbox_indeterminate_disabled.png +0 -0
- melage/resource/theme/rc/checkbox_indeterminate_disabled@2x.png +0 -0
- melage/resource/theme/rc/checkbox_indeterminate_focus.png +0 -0
- melage/resource/theme/rc/checkbox_indeterminate_focus@2x.png +0 -0
- melage/resource/theme/rc/checkbox_indeterminate_pressed.png +0 -0
- melage/resource/theme/rc/checkbox_indeterminate_pressed@2x.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked0.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked00.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked@2x.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked@2x0.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked@2x00.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_disabled.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_disabled0.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_disabled00.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_disabled@2x.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_disabled@2x0.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_disabled@2x00.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_focus.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_focus0.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_focus00.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_focus@2x.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_focus@2x0.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_focus@2x00.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_pressed.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_pressed0.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_pressed00.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_pressed@2x.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_pressed@2x0.png +0 -0
- melage/resource/theme/rc/checkbox_unchecked_pressed@2x00.png +0 -0
- melage/some_notes.txt +0 -3
- melage/utils/GMM.py +0 -720
- melage/utils/Shaders_bu.py +0 -314
- melage/utils/__init__0.py +0 -7
- melage/utils/glScientific_bc.py +0 -1585
- melage/utils/registration.py +0 -512
- melage/utils/source_folder.py +0 -18
- melage/version.txt +0 -1
- melage/widgets/ApplyMask.py +0 -212
- melage/widgets/ChangeSystem.py +0 -152
- melage/widgets/DeepLModels/NPP/dataset/mri_dataset_affine.py +0 -149
- melage/widgets/DeepLModels/NPP/models/checkpoints/npp_v1.pth.py +0 -0
- melage/widgets/DeepLModels/NPP/models/losses.py +0 -146
- melage/widgets/DeepLModels/NPP/models/model.py +0 -272
- melage/widgets/DeepLModels/NPP/models/utils.py +0 -303
- melage/widgets/DeepLModels/NPP/npp.py +0 -116
- melage/widgets/DeepLModels/NPP/requirements.txt +0 -8
- melage/widgets/DeepLModels/NPP/train/train.py +0 -116
- melage/widgets/DeepLModels/Unet3DAtt.py +0 -657
- melage/widgets/DeepLModels/Unet3D_basic.py +0 -648
- melage/widgets/DeepLModels/new_unet_old.py +0 -639
- melage/widgets/DeepLModels/new_unet_old2.py +0 -658
- melage/widgets/MaskOperations.py +0 -147
- melage/widgets/N4Dialog.py +0 -241
- melage/widgets/Segmentation/__init__.py +0 -588
- melage/widgets/SemiAutoSeg.py +0 -666
- melage/widgets/__init__0.py +0 -5
- melage/widgets/about.py +0 -246
- melage/widgets/activator.py +0 -147
- melage/widgets/be_dl.py +0 -409
- melage/widgets/be_dl_unet3d.py +0 -441
- melage/widgets/brain_extraction_dl.py +0 -887
- melage/widgets/brain_extraction_dl_bu.py +0 -869
- melage/widgets/registrationWidget.py +0 -342
- melage/widgets/settings_widget.py +0 -77
- melage/widgets/tranformationWidget.py +0 -275
- melage-0.0.65.dist-info/METADATA +0 -742
- melage-0.0.65.dist-info/RECORD +0 -501
- melage-0.0.65.dist-info/entry_points.txt +0 -2
- melage-0.0.65.dist-info/top_level.txt +0 -1
- {melage/resource → assets}/main.ico +0 -0
- {melage → assets}/resource/0circle.png +0 -0
- {melage → assets}/resource/0circle_faded.png +0 -0
- {melage → assets}/resource/3d.png +0 -0
- {melage → assets}/resource/3d.psd +0 -0
- {melage → assets}/resource/3dFaded.png +0 -0
- {melage → assets}/resource/Eraser.png +0 -0
- {melage → assets}/resource/EraserFaded.png +0 -0
- {melage → assets}/resource/EraserX.png +0 -0
- {melage → assets}/resource/EraserXFaded.png +0 -0
- {melage → assets}/resource/Eraser_icon.svg +0 -0
- {melage → assets}/resource/Hand.png +0 -0
- {melage → assets}/resource/HandIcons_0.png +0 -0
- {melage → assets}/resource/Hand_IX.png +0 -0
- {melage → assets}/resource/Hand_IXFaded.png +0 -0
- {melage → assets}/resource/Handsqueezed.png +0 -0
- {melage → assets}/resource/Handwriting (copy).png +0 -0
- {melage → assets}/resource/Handwriting.png +0 -0
- {melage → assets}/resource/HandwritingMinus.png +0 -0
- {melage → assets}/resource/HandwritingMinusX.png +0 -0
- {melage → assets}/resource/HandwritingPlus.png +0 -0
- {melage → assets}/resource/HandwritingPlusX.png +0 -0
- {melage → assets}/resource/Move_icon.svg +0 -0
- {melage → assets}/resource/PngItem_2422924.png +0 -0
- {melage → assets}/resource/about.png +0 -0
- {melage → assets}/resource/about_logo.png +0 -0
- {melage → assets}/resource/about_logo0.png +0 -0
- {melage → assets}/resource/action_check.png +0 -0
- {melage → assets}/resource/action_check_OFF.png +0 -0
- {melage → assets}/resource/arrow).png +0 -0
- {melage → assets}/resource/arrow.png +0 -0
- {melage → assets}/resource/arrowFaded.png +0 -0
- {melage → assets}/resource/arrow_org.png +0 -0
- {melage → assets}/resource/arrow_org.png.png +0 -0
- {melage → assets}/resource/arrows.png +0 -0
- {melage → assets}/resource/authors.mp4 +0 -0
- {melage → assets}/resource/box.png +0 -0
- {melage → assets}/resource/check-image-icon-0.jpg +0 -0
- {melage → assets}/resource/circle.png +0 -0
- {melage → assets}/resource/circle_faded.png +0 -0
- {melage → assets}/resource/circle_or.png +0 -0
- {melage → assets}/resource/close.png +0 -0
- {melage → assets}/resource/close_bg.png +0 -0
- {melage → assets}/resource/color/Simple.txt +0 -0
- {melage → assets}/resource/color/Tissue.txt +0 -0
- {melage → assets}/resource/color/Tissue12.txt +0 -0
- {melage → assets}/resource/color/albert_LUT.txt +0 -0
- {melage → assets}/resource/color/mcrib_LUT.txt +0 -0
- {melage → assets}/resource/color/pediatric1.txt +0 -0
- {melage → assets}/resource/color/pediatric1_old.txt +0 -0
- {melage → assets}/resource/color/pediatric2.txt +0 -0
- {melage → assets}/resource/color/pediatric3.txt +0 -0
- {melage → assets}/resource/color/pediatrics (copy).csv +0 -0
- {melage → assets}/resource/color/tissue_seg.txt +0 -0
- {melage → assets}/resource/contour.png +0 -0
- {melage → assets}/resource/contour.svg +0 -0
- {melage → assets}/resource/contourFaded.png +0 -0
- {melage → assets}/resource/contourX.png +0 -0
- {melage → assets}/resource/contourXFaded.png +0 -0
- {melage → assets}/resource/dti.png +0 -0
- {melage → assets}/resource/dti0.png +0 -0
- {melage → assets}/resource/dti222.png +0 -0
- {melage → assets}/resource/dti_or.png +0 -0
- {melage → assets}/resource/eco.png +0 -0
- {melage → assets}/resource/eco22.png +0 -0
- {melage → assets}/resource/eco_old.png +0 -0
- {melage → assets}/resource/eco_or.png +0 -0
- {melage → assets}/resource/eco_or2.png +0 -0
- {melage → assets}/resource/eco_seg.png +0 -0
- {melage → assets}/resource/eco_seg_old.png +0 -0
- {melage → assets}/resource/export.png +0 -0
- {melage → assets}/resource/hand-grab-icon-10.jpg +0 -0
- {melage → assets}/resource/hand-grab-icon-25.jpg +0 -0
- {melage → assets}/resource/info.png +0 -0
- {melage → assets}/resource/line.png +0 -0
- {melage → assets}/resource/linefaded.png +0 -0
- {melage → assets}/resource/load.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_goto.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_paint.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_paint_draw1.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_paint_draw2.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_paint_render.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_paint_render2.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_paint_render3.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_paint_render4.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_paint_render5.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_paint_render6.png +0 -0
- {melage → assets}/resource/manual_images/3D_rightc_seg.png +0 -0
- {melage → assets}/resource/manual_images/exit_toolbar.png +0 -0
- {melage → assets}/resource/manual_images/load_image_file.png +0 -0
- {melage → assets}/resource/manual_images/load_image_file_openp.png +0 -0
- {melage → assets}/resource/manual_images/main_page.png +0 -0
- {melage → assets}/resource/manual_images/menu_file.png +0 -0
- {melage → assets}/resource/manual_images/menu_file_export.png +0 -0
- {melage → assets}/resource/manual_images/menu_file_import.png +0 -0
- {melage → assets}/resource/manual_images/menu_file_settings.png +0 -0
- {melage → assets}/resource/manual_images/menu_file_ss.png +0 -0
- {melage → assets}/resource/manual_images/open_save_load.png +0 -0
- {melage → assets}/resource/manual_images/panning_toolbar.png +0 -0
- {melage → assets}/resource/manual_images/segmentation_toolbar.png +0 -0
- {melage → assets}/resource/manual_images/tab_mri.png +0 -0
- {melage → assets}/resource/manual_images/tab_us.png +0 -0
- {melage → assets}/resource/manual_images/tabs.png +0 -0
- {melage → assets}/resource/manual_images/toolbar_tools.png +0 -0
- {melage → assets}/resource/manual_images/tools_basic.png +0 -0
- {melage → assets}/resource/manual_images/tools_bet.png +0 -0
- {melage → assets}/resource/manual_images/tools_cs.png +0 -0
- {melage → assets}/resource/manual_images/tools_deepbet.png +0 -0
- {melage → assets}/resource/manual_images/tools_imageinfo.png +0 -0
- {melage → assets}/resource/manual_images/tools_maskO.png +0 -0
- {melage → assets}/resource/manual_images/tools_masking.png +0 -0
- {melage → assets}/resource/manual_images/tools_n4b.png +0 -0
- {melage → assets}/resource/manual_images/tools_resize.png +0 -0
- {melage → assets}/resource/manual_images/tools_ruler.png +0 -0
- {melage → assets}/resource/manual_images/tools_seg.png +0 -0
- {melage → assets}/resource/manual_images/tools_threshold.png +0 -0
- {melage → assets}/resource/manual_images/tools_tools.png +0 -0
- {melage → assets}/resource/manual_images/widget_color.png +0 -0
- {melage → assets}/resource/manual_images/widget_color_add.png +0 -0
- {melage → assets}/resource/manual_images/widget_color_add2.png +0 -0
- {melage → assets}/resource/manual_images/widget_color_additional.png +0 -0
- {melage → assets}/resource/manual_images/widget_images.png +0 -0
- {melage → assets}/resource/manual_images/widget_images2.png +0 -0
- {melage → assets}/resource/manual_images/widget_images3.png +0 -0
- {melage → assets}/resource/manual_images/widget_marker.png +0 -0
- {melage → assets}/resource/manual_images/widget_mri.png +0 -0
- {melage → assets}/resource/manual_images/widget_mri2.png +0 -0
- {melage → assets}/resource/manual_images/widget_segintensity.png +0 -0
- {melage → assets}/resource/manual_images/widget_tab_mutualview.png +0 -0
- {melage → assets}/resource/manual_images/widget_tab_mutualview2.png +0 -0
- {melage → assets}/resource/manual_images/widget_table.png +0 -0
- {melage → assets}/resource/manual_images/widget_table2.png +0 -0
- {melage → assets}/resource/manual_images/widget_us.png +0 -0
- {melage → assets}/resource/melage_top.ico +0 -0
- {melage → assets}/resource/melage_top.png +0 -0
- {melage → assets}/resource/melage_top0.png +0 -0
- {melage → assets}/resource/melage_top1.png +0 -0
- {melage → assets}/resource/melage_top4.png +0 -0
- {melage → assets}/resource/mri (copy).png +0 -0
- {melage → assets}/resource/mri.png +0 -0
- {melage → assets}/resource/mri0.png +0 -0
- {melage → assets}/resource/mri000.png +0 -0
- {melage → assets}/resource/mri22.png +0 -0
- {melage → assets}/resource/mri_big.png +0 -0
- {melage → assets}/resource/mri_old.png +0 -0
- {melage → assets}/resource/mri_seg.png +0 -0
- {melage → assets}/resource/mri_seg_old.png +0 -0
- {melage → assets}/resource/new.png +0 -0
- {melage → assets}/resource/open.png +0 -0
- {melage → assets}/resource/open2.png +0 -0
- {melage → assets}/resource/pan.png +0 -0
- {melage → assets}/resource/pencil.png +0 -0
- {melage → assets}/resource/pencilFaded.png +0 -0
- {melage → assets}/resource/points.png +0 -0
- {melage → assets}/resource/pointsFaded.png +0 -0
- {melage → assets}/resource/rotate.png +0 -0
- {melage → assets}/resource/ruler.png +0 -0
- {melage → assets}/resource/rulerFaded.png +0 -0
- {melage → assets}/resource/s.png +0 -0
- {melage → assets}/resource/s.psd +0 -0
- {melage → assets}/resource/save.png +0 -0
- {melage → assets}/resource/saveas.png +0 -0
- {melage → assets}/resource/seg_mri.png +0 -0
- {melage → assets}/resource/seg_mri2.png +0 -0
- {melage → assets}/resource/settings.png +0 -0
- {melage → assets}/resource/synch.png +0 -0
- {melage → assets}/resource/synchFaded.png +0 -0
- {melage → assets}/resource/theme/rc/.keep +0 -0
- {melage → assets}/resource/theme/rc/arrow_down.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_down@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_down_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_down_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_down_focus.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_down_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_down_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_down_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_left.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_left@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_left_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_left_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_left_focus.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_left_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_left_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_left_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_right.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_right@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_right_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_right_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_right_focus.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_right_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_right_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_right_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_up.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_up@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_up_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_up_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_up_focus.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_up_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_up_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/arrow_up_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/base_icon.png +0 -0
- {melage → assets}/resource/theme/rc/base_icon@2x.png +0 -0
- {melage → assets}/resource/theme/rc/base_icon_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/base_icon_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/base_icon_focus.png +0 -0
- {melage → assets}/resource/theme/rc/base_icon_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/base_icon_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/base_icon_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_closed.png +0 -0
- {melage → assets}/resource/theme/rc/branch_closed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_closed_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/branch_closed_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_closed_focus.png +0 -0
- {melage → assets}/resource/theme/rc/branch_closed_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_closed_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/branch_closed_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_end.png +0 -0
- {melage → assets}/resource/theme/rc/branch_end@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_end_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/branch_end_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_end_focus.png +0 -0
- {melage → assets}/resource/theme/rc/branch_end_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_end_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/branch_end_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_line.png +0 -0
- {melage → assets}/resource/theme/rc/branch_line@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_line_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/branch_line_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_line_focus.png +0 -0
- {melage → assets}/resource/theme/rc/branch_line_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_line_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/branch_line_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_more.png +0 -0
- {melage → assets}/resource/theme/rc/branch_more@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_more_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/branch_more_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_more_focus.png +0 -0
- {melage → assets}/resource/theme/rc/branch_more_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_more_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/branch_more_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_open.png +0 -0
- {melage → assets}/resource/theme/rc/branch_open@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_open_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/branch_open_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_open_focus.png +0 -0
- {melage → assets}/resource/theme/rc/branch_open_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/branch_open_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/branch_open_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/checkbox_checked0.png +0 -0
- {melage → assets}/resource/theme/rc/line_horizontal.png +0 -0
- {melage → assets}/resource/theme/rc/line_horizontal@2x.png +0 -0
- {melage → assets}/resource/theme/rc/line_horizontal_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/line_horizontal_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/line_horizontal_focus.png +0 -0
- {melage → assets}/resource/theme/rc/line_horizontal_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/line_horizontal_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/line_horizontal_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/line_vertical.png +0 -0
- {melage → assets}/resource/theme/rc/line_vertical@2x.png +0 -0
- {melage → assets}/resource/theme/rc/line_vertical_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/line_vertical_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/line_vertical_focus.png +0 -0
- {melage → assets}/resource/theme/rc/line_vertical_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/line_vertical_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/line_vertical_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/radio_checked.png +0 -0
- {melage → assets}/resource/theme/rc/radio_checked@2x.png +0 -0
- {melage → assets}/resource/theme/rc/radio_checked_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/radio_checked_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/radio_checked_focus.png +0 -0
- {melage → assets}/resource/theme/rc/radio_checked_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/radio_checked_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/radio_checked_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/radio_unchecked.png +0 -0
- {melage → assets}/resource/theme/rc/radio_unchecked@2x.png +0 -0
- {melage → assets}/resource/theme/rc/radio_unchecked_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/radio_unchecked_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/radio_unchecked_focus.png +0 -0
- {melage → assets}/resource/theme/rc/radio_unchecked_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/radio_unchecked_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/radio_unchecked_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_horizontal.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_horizontal@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_horizontal_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_horizontal_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_horizontal_focus.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_horizontal_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_horizontal_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_horizontal_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_vertical.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_vertical@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_vertical_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_vertical_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_vertical_focus.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_vertical_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_vertical_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_move_vertical_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_horizontal.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_horizontal@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_horizontal_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_horizontal_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_horizontal_focus.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_horizontal_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_horizontal_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_horizontal_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_vertical.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_vertical@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_vertical_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_vertical_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_vertical_focus.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_vertical_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_vertical_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/toolbar_separator_vertical_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/transparent.png +0 -0
- {melage → assets}/resource/theme/rc/transparent@2x.png +0 -0
- {melage → assets}/resource/theme/rc/transparent_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/transparent_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/transparent_focus.png +0 -0
- {melage → assets}/resource/theme/rc/transparent_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/transparent_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/transparent_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_close.png +0 -0
- {melage → assets}/resource/theme/rc/window_close@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_close_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/window_close_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_close_focus.png +0 -0
- {melage → assets}/resource/theme/rc/window_close_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_close_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/window_close_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_grip.png +0 -0
- {melage → assets}/resource/theme/rc/window_grip@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_grip_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/window_grip_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_grip_focus.png +0 -0
- {melage → assets}/resource/theme/rc/window_grip_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_grip_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/window_grip_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_minimize.png +0 -0
- {melage → assets}/resource/theme/rc/window_minimize@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_minimize_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/window_minimize_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_minimize_focus.png +0 -0
- {melage → assets}/resource/theme/rc/window_minimize_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_minimize_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/window_minimize_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_undock.png +0 -0
- {melage → assets}/resource/theme/rc/window_undock@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_undock_disabled.png +0 -0
- {melage → assets}/resource/theme/rc/window_undock_disabled@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_undock_focus.png +0 -0
- {melage → assets}/resource/theme/rc/window_undock_focus@2x.png +0 -0
- {melage → assets}/resource/theme/rc/window_undock_pressed.png +0 -0
- {melage → assets}/resource/theme/rc/window_undock_pressed@2x.png +0 -0
- {melage → assets}/resource/theme/style.qss +0 -0
- {melage → assets}/resource/tract.png +0 -0
- {melage → assets}/resource/view1.png +0 -0
- {melage → assets}/resource/view1_eco.png +0 -0
- {melage → assets}/resource/view1_mri.png +0 -0
- {melage → assets}/resource/view1_seg.png +0 -0
- {melage → assets}/resource/view2.png +0 -0
- {melage → assets}/resource/view2_seg.png +0 -0
- {melage → assets}/resource/w.png +0 -0
- {melage → assets}/resource/zoom_inFaded.png +0 -0
- /melage/resource/zoom_in.png → /assets/resource/zoom_in_old.png +0 -0
- {melage → assets}/resource/zoom_outFaded.png +0 -0
- /melage/resource/zoom_out.png → /assets/resource/zoom_out_old.png +0 -0
- /melage/{widgets/activation.py → dialogs/ActivationDialog.py} +0 -0
- /melage/{widgets/HistImage.py → dialogs/HistogramDialog.py} +0 -0
- /melage/{widgets/iminfo.py → dialogs/ImInfoDialog.py} +0 -0
- /melage/{widgets/colorwidget.py → dialogs/helpers/ColorDialog.py} +0 -0
- /melage/{utils/custom_QScrollBar.py → dialogs/helpers/CustomScrollbar.py} +0 -0
- /melage/{widgets/repeat_widget.py → dialogs/helpers/RepeatDialog.py} +0 -0
- /melage/{widgets/screenshot_widget.py → dialogs/helpers/ScreenshotDialog.py} +0 -0
- /melage/{cli.py → melage.py} +0 -0
- /melage/{utils/brain_extraction_helper.py → plugins/bet/main/utils.py} +0 -0
- /melage/{graphics → rendering}/GLGraphicsItem.py +0 -0
- /melage/{graphics → rendering}/GLViewWidget.py +0 -0
- /melage/{graphics → rendering}/Transform3D.py +0 -0
- /melage/{graphics → rendering}/__init__.py +0 -0
- /melage/{graphics → rendering}/functions.py +0 -0
- /melage/{utils → rendering/helpers}/Shaders_120.py +0 -0
- /melage/{utils → rendering/helpers}/Shaders_330.py +0 -0
- /melage/{graphics → rendering}/items/GLAxisItem.py +0 -0
- /melage/{graphics → rendering}/items/GLGridItem.py +0 -0
- /melage/{graphics → rendering}/items/GLPolygonItem.py +0 -0
- /melage/{graphics → rendering}/items/GLScatterPlotItem.py +0 -0
- /melage/{graphics → rendering}/items/GLVolumeItem.py +0 -0
- /melage/{graphics → rendering}/items/GLVolumeItem_b.py +0 -0
- /melage/{graphics → rendering}/items/__init__.py +0 -0
- /melage/{graphics → rendering}/shaders.py +0 -0
- /melage/widgets/{enhanceImWidget.py → EnhanceImageWidget.py} +0 -0
- {melage-0.0.65.dist-info → melage-1.0.0.dist-info}/WHEEL +0 -0
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
__AUTHOR__ = 'Bahram Jafrasteh'
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
import os
|
|
5
4
|
import sys
|
|
6
5
|
sys.path.append('..')
|
|
7
6
|
from os.path import join, basename, dirname
|
|
8
7
|
#from PyQt5.QtWidgets import QFileDialog
|
|
9
8
|
from PyQt5 import QtWidgets, QtCore, QtGui
|
|
10
|
-
from melage.
|
|
11
|
-
from melage.
|
|
9
|
+
from melage.dialogs.helpers import QFileDialogPreview, repeatN, screenshot, NewDialog
|
|
10
|
+
from melage.dialogs import iminfo_dialog
|
|
11
|
+
from melage.core.io import readData
|
|
12
12
|
from melage.utils.utils import rhasattr
|
|
13
|
-
from melage.widgets
|
|
14
|
-
from melage.widgets.repeat_widget import repeatN
|
|
15
|
-
from melage.widgets.screenshot_widget import screenshot
|
|
16
|
-
from melage.widgets.enhanceImWidget import enhanceIm
|
|
13
|
+
from melage.widgets import enhanceIm, SettingsDialog, dockWidgets, openglWidgets
|
|
17
14
|
from PyQt5.QtCore import Qt, QSettings
|
|
18
|
-
from melage.
|
|
19
|
-
from melage.widgets.dockWidgets import dockWidgets
|
|
20
|
-
from melage.widgets.openglWidgets import openglWidgets
|
|
21
|
-
from melage.widgets.iminfo import iminfo_dialog
|
|
22
|
-
from melage.widgets.N4Dialog import N4Dialog, Worker
|
|
23
|
-
from melage.utils.utils import select_proper_widgets, setCursorWidget, \
|
|
15
|
+
from melage.utils.utils import select_proper_widgets, setCursorWidget, get_filter_for_file, \
|
|
24
16
|
getCurrentSlice, updateSight, changeCoronalSagittalAxial, setSliceSeg, str_conv, find_avail_widgets,\
|
|
25
17
|
update_last, manually_check_tree_item, update_image_sch, clean_parent_image, compute_volume
|
|
26
|
-
from melage.
|
|
18
|
+
#from melage.config.paths import RESOURCE_FOLDER, DOCS_FOLDER,
|
|
19
|
+
from melage.config import settings, VERSION
|
|
27
20
|
import time
|
|
28
21
|
from functools import partial
|
|
29
22
|
from collections import defaultdict
|
|
23
|
+
from melage.widgets import PluginManager
|
|
30
24
|
|
|
31
25
|
|
|
32
26
|
class Ui_Main(dockWidgets, openglWidgets):
|
|
@@ -51,6 +45,17 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
51
45
|
self.format_eco = 'None'
|
|
52
46
|
self.format_mri = 'None'
|
|
53
47
|
self._loaded = False
|
|
48
|
+
self.readImECO = []
|
|
49
|
+
self.readImMRI = []
|
|
50
|
+
self.MRI_RADIO_NAMES = [
|
|
51
|
+
'radioButton_21', 'radioButton_21_1',
|
|
52
|
+
'radioButton_21_2', 'radioButton_21_3'
|
|
53
|
+
]
|
|
54
|
+
self.US_RADIO_NAMES = ['radioButton_1', 'radioButton_2',
|
|
55
|
+
'radioButton_3', 'radioButton_4']
|
|
56
|
+
self.MRI_VIEW_INDICES = [4, 5, 6, 12]
|
|
57
|
+
self.US_VIEW_INDICES = [1, 2, 3, 11]
|
|
58
|
+
self.current_view = 'horizontal'
|
|
54
59
|
self._num_adapted_points = 0
|
|
55
60
|
self._firstSelection = None
|
|
56
61
|
self._Xtimes = 1
|
|
@@ -58,9 +63,9 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
58
63
|
self._rad_circle_dot = 50
|
|
59
64
|
self.num_measure_area = 0
|
|
60
65
|
self.num_measure_length = 0
|
|
61
|
-
self.source_dir = os.path.dirname(os.path.dirname(pwd))
|
|
62
|
-
self.settingsBN =
|
|
63
|
-
self.expectedTime = self.settingsBN.
|
|
66
|
+
#self.source_dir = os.path.dirname(os.path.dirname(pwd))
|
|
67
|
+
self.settingsBN = SettingsDialog(self)
|
|
68
|
+
self.expectedTime = self.settingsBN.auto_save_spinbox.value() * 60
|
|
64
69
|
self.iminfo_dialog = iminfo_dialog(self)
|
|
65
70
|
self._points_adapt_eco = []
|
|
66
71
|
self._points_adapt_mri = []
|
|
@@ -73,112 +78,16 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
73
78
|
self.linked = False
|
|
74
79
|
self.filenameEco = ''
|
|
75
80
|
self.filenameMRI = ''
|
|
76
|
-
self.settingsBN.newConfig.connect(
|
|
77
|
-
lambda vals: self.setConf(vals))
|
|
78
|
-
|
|
79
|
-
self.repeatTimes = repeatN(self)
|
|
80
|
-
self.repeatTimes.numberN.connect(
|
|
81
|
-
lambda value: self.setXTimes(value)
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
self.screenShot = screenshot(self)
|
|
85
|
-
self.N4_dialog = N4Dialog(self)
|
|
86
|
-
self.N4_dialog.closeSig.connect(partial(self.maskingClose, 3))
|
|
87
|
-
|
|
88
|
-
self.N4_dialog.buttonpressed.connect(
|
|
89
|
-
lambda value: self.N4_correction(value)
|
|
90
|
-
)
|
|
91
|
-
self.N4_dialog.buttonpressed2.connect(
|
|
92
|
-
lambda value: self.N4_back(value)
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
from melage.widgets.ApplyMask import Masking
|
|
96
|
-
from melage.widgets.ChangeSystem import ChangeCoordSys
|
|
97
|
-
from melage.widgets.MaskOperations import MaskOperations
|
|
98
|
-
from melage.widgets.HistImage import HistImage
|
|
99
|
-
from melage.widgets.ImageThresholding import ThresholdingImage
|
|
100
|
-
from melage.widgets.brain_extraction import BET
|
|
101
|
-
from melage.widgets.brain_extraction_dl import BE_DL
|
|
102
|
-
from melage.widgets.Segmentation import Tissue_Seg
|
|
103
|
-
from melage.widgets.registrationWidget import RegistrationDialog
|
|
104
|
-
from melage.widgets.tranformationWidget import TransformationDialog
|
|
105
|
-
from melage.utils.utils import resize_window
|
|
106
|
-
self.resizeImage = resize_window(self, use_combobox=True)
|
|
107
|
-
self.Masking = Masking(self)
|
|
108
|
-
self.ImageThresholding = ThresholdingImage(self)
|
|
109
|
-
self.HistImage = HistImage(self)
|
|
110
|
-
|
|
111
|
-
self.BET = BET(self)
|
|
112
|
-
self.BET.set_pars()
|
|
113
|
-
self.BE_DL = BE_DL(self)
|
|
114
|
-
self.BE_DL.set_pars()
|
|
115
|
-
|
|
116
|
-
self.Tissue_Seg = Tissue_Seg(self)
|
|
117
|
-
self.Tissue_Seg.set_pars()
|
|
118
|
-
|
|
119
|
-
self.registrationD = RegistrationDialog(self, self.source_dir)
|
|
120
|
-
self.transformationD = TransformationDialog(self, self.source_dir)
|
|
121
|
-
self.registrationD.datachange.connect(self.updateDataRegistration)
|
|
122
|
-
self.MaskingOperations = MaskOperations(self)
|
|
123
|
-
self.ChCoordSys = ChangeCoordSys(self)
|
|
124
|
-
self.Masking.closeSig.connect(partial(self.maskingClose, 3))
|
|
125
|
-
self.resizeImage.closeSig.connect(partial(self.maskingClose, 3))
|
|
126
|
-
self.resizeImage.pushbutton.accepted.connect(partial(self.maskingClose, 3))
|
|
127
|
-
self.resizeImage.pushbutton.rejected.connect(partial(self.maskingClose, 3))
|
|
128
|
-
self.resizeImage.resizeim.connect(
|
|
129
|
-
lambda value: self.resize_image(value, None)
|
|
130
|
-
)
|
|
131
|
-
self.resizeImage.comboboxCh.connect(
|
|
132
|
-
lambda value1, value2: self.resize_image(value1, value2)
|
|
133
|
-
)
|
|
134
|
-
self.HistImage.closeSig.connect(partial(self.maskingClose, 3))
|
|
135
|
-
self.BET.closeSig.connect(partial(self.maskingClose, 4))
|
|
136
|
-
self.BE_DL.closeSig.connect(partial(self.maskingClose, 5))
|
|
137
|
-
self.Tissue_Seg.closeSig.connect(partial(self.maskingClose, 10))
|
|
138
81
|
|
|
82
|
+
self.create_dialog()
|
|
83
|
+
self.all_dialog_connect()
|
|
139
84
|
|
|
140
|
-
self.ImageThresholding.closeSig.connect(partial(self.maskingClose, 3))
|
|
141
|
-
self.MaskingOperations.closeSig.connect(partial(self.maskingClose, 3))
|
|
142
|
-
self.registrationD.closeSig.connect(partial(self.maskingClose, 3))
|
|
143
|
-
self.transformationD.closeSig.connect(partial(self.maskingClose, 3))
|
|
144
|
-
self.ChCoordSys.closeSig.connect(partial(self.maskingClose, 3))
|
|
145
|
-
self.iminfo_dialog.closeSig.connect(partial(self.maskingClose, 3))
|
|
146
|
-
self.iminfo_dialog.buttonBox.clicked.connect(partial(self.maskingClose, 3))
|
|
147
|
-
self.BET.betcomp.connect(
|
|
148
|
-
lambda value: self.Thresholding('BET', value))
|
|
149
|
-
self.BET.datachange.connect(self.updateDataBET)
|
|
150
|
-
self.BE_DL.betcomp.connect(
|
|
151
|
-
lambda value: self.Thresholding('Deep BET', value))
|
|
152
85
|
|
|
153
|
-
self.BE_DL.back_orig.connect(
|
|
154
|
-
lambda value: self.Thresholding('Deep BET', value))
|
|
155
|
-
self.BE_DL.datachange.connect(partial(self.updateDataBEDL, 0))
|
|
156
|
-
self.Tissue_Seg.datachange.connect(partial(self.updateDataBEDL, 1))
|
|
157
|
-
self.Tissue_Seg.betcomp.connect(
|
|
158
|
-
lambda value: self.Thresholding('Segmentation', value))
|
|
159
86
|
|
|
160
87
|
|
|
161
|
-
self.ImageThresholding.applySig.connect(partial(self.Thresholding, 'apply'))
|
|
162
|
-
self.ImageThresholding.histeqSig.connect(
|
|
163
|
-
lambda value: self.Thresholding('histeq', value))
|
|
164
|
-
self.ImageThresholding.repltSig.connect(partial(self.Thresholding, 'replot'))
|
|
165
|
-
self.ChCoordSys.buttonpressed.connect(
|
|
166
|
-
lambda value: self.applyNewCoordSys(value)
|
|
167
|
-
)
|
|
168
|
-
self.ChCoordSys.comboBox_image.currentIndexChanged.connect(
|
|
169
|
-
self.setCurrentCoordsystem
|
|
170
|
-
)
|
|
171
|
-
self.Masking.buttonpressed.connect(
|
|
172
|
-
lambda value: self.applyMaskToImage(value, False)
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
self.MaskingOperations.buttonpressed.connect(
|
|
176
|
-
lambda value: self.applyMaskToImage(value, True)
|
|
177
|
-
)
|
|
178
|
-
|
|
179
88
|
self.axis_eco = [0, 0, 1]
|
|
180
89
|
self.axis_mri = [0, 0, 1]
|
|
181
|
-
|
|
90
|
+
|
|
182
91
|
if not os.path.exists('.temp'):
|
|
183
92
|
os.mkdir('.temp')
|
|
184
93
|
self.MouseButtonPress = False
|
|
@@ -205,8 +114,82 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
205
114
|
self.settings = QSettings("./brainNeonatal.ini", QSettings.IniFormat) # setting to save
|
|
206
115
|
self._basefileSave = ''
|
|
207
116
|
|
|
117
|
+
### plugins
|
|
118
|
+
self.plugin_widgets = [] # To keep references to open plugin dialogs
|
|
208
119
|
|
|
209
120
|
|
|
121
|
+
def create_dialog(self):
|
|
122
|
+
from melage.dialogs import (Masking, MaskOperationsDialog, HistImage,
|
|
123
|
+
ThresholdingImage, RegistrationDialog,
|
|
124
|
+
TransformationDialog)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
self.repeatTimes = repeatN(self)
|
|
129
|
+
self.screenShot = screenshot(self)
|
|
130
|
+
|
|
131
|
+
self.Masking = Masking(self)
|
|
132
|
+
self.ImageThresholding = ThresholdingImage(self)
|
|
133
|
+
self.HistImage = HistImage(self)
|
|
134
|
+
|
|
135
|
+
self.registrationD = RegistrationDialog(self, settings.DEFAULT_USE_DIR)
|
|
136
|
+
self.transformationD = TransformationDialog(self, settings.DEFAULT_USE_DIR)
|
|
137
|
+
self.MaskingOperations = MaskOperationsDialog(self)
|
|
138
|
+
|
|
139
|
+
self.enhanceIm = enhanceIm(self)
|
|
140
|
+
# Group all dialogs that need resizing
|
|
141
|
+
dialogs_to_resize = [
|
|
142
|
+
self.repeatTimes, self.screenShot,
|
|
143
|
+
self.Masking, self.ImageThresholding, self.HistImage,
|
|
144
|
+
self.registrationD, self.transformationD,
|
|
145
|
+
self.MaskingOperations, self.enhanceIm
|
|
146
|
+
]
|
|
147
|
+
for dialog in dialogs_to_resize:
|
|
148
|
+
self.adapt_dialog_size(dialog)
|
|
149
|
+
def all_dialog_connect(self):
|
|
150
|
+
self.registrationD.datachange.connect(self.updateDataRegistration)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
self.repeatTimes.numberN.connect(
|
|
154
|
+
lambda value: self.setXTimes(value)
|
|
155
|
+
)
|
|
156
|
+
self.Masking.closeSig.connect(partial(self.maskingClose, 3))
|
|
157
|
+
|
|
158
|
+
self.HistImage.closeSig.connect(partial(self.maskingClose, 3))
|
|
159
|
+
self.ImageThresholding.closeSig.connect(partial(self.maskingClose, 3))
|
|
160
|
+
self.MaskingOperations.closeSig.connect(partial(self.maskingClose, 3))
|
|
161
|
+
self.registrationD.closeSig.connect(partial(self.maskingClose, 3))
|
|
162
|
+
self.transformationD.closeSig.connect(partial(self.maskingClose, 3))
|
|
163
|
+
|
|
164
|
+
self.iminfo_dialog.closeSig.connect(partial(self.maskingClose, 3))
|
|
165
|
+
self.iminfo_dialog.buttonBox.clicked.connect(partial(self.maskingClose, 3))
|
|
166
|
+
|
|
167
|
+
self.ImageThresholding.applySig.connect(partial(self.Thresholding, 'apply'))
|
|
168
|
+
self.ImageThresholding.histeqSig.connect(
|
|
169
|
+
lambda value: self.Thresholding('histeq', value))
|
|
170
|
+
self.ImageThresholding.repltSig.connect(partial(self.Thresholding, 'replot'))
|
|
171
|
+
|
|
172
|
+
self.Masking.apply_pressed.connect(
|
|
173
|
+
lambda value: self.applyMaskToImage(value, False)
|
|
174
|
+
)
|
|
175
|
+
self.MaskingOperations.apply_pressed.connect(
|
|
176
|
+
lambda value: self.applyMaskToImage(value, True)
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
def adapt_dialog_size(self, dialog):
|
|
180
|
+
parent_size = self.size()
|
|
181
|
+
dialog_width = int(parent_size.width()*1.5 ) # e.g., 60% of parent width
|
|
182
|
+
dialog_height = int(parent_size.height()*1.5 ) # e.g., 50% of parent height
|
|
183
|
+
|
|
184
|
+
# Don't let it be smaller than its own minimum size
|
|
185
|
+
min_size = dialog.minimumSize()
|
|
186
|
+
if dialog_width < min_size.width():
|
|
187
|
+
dialog_width = min_size.width()
|
|
188
|
+
if dialog_height < min_size.height():
|
|
189
|
+
dialog_height = min_size.height()
|
|
190
|
+
|
|
191
|
+
dialog.resize(dialog_width, dialog_height)
|
|
192
|
+
|
|
210
193
|
def setConf(self, list_vals):
|
|
211
194
|
"""
|
|
212
195
|
Configuration of MELAGE
|
|
@@ -268,13 +251,13 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
268
251
|
screen = QtWidgets.QApplication.primaryScreen()
|
|
269
252
|
winid = QtWidgets.QApplication.desktop().winId()
|
|
270
253
|
p = screen.grabWindow(winid)
|
|
271
|
-
fileObj = QtWidgets.QFileDialog.getSaveFileName(self, "Open File",
|
|
254
|
+
fileObj = QtWidgets.QFileDialog.getSaveFileName(self, "Open File", settings.DEFAULT_USE_DIR, filters, options=opts)
|
|
272
255
|
if fileObj[0] == '':
|
|
273
256
|
return
|
|
274
257
|
filename = fileObj[0] + '.png'
|
|
275
258
|
p.save(filename, 'png')
|
|
276
259
|
else:
|
|
277
|
-
fileObj = QtWidgets.QFileDialog.getSaveFileName(self, "Open File",
|
|
260
|
+
fileObj = QtWidgets.QFileDialog.getSaveFileName(self, "Open File", settings.DEFAULT_USE_DIR, filters, options=opts)
|
|
278
261
|
if fileObj[0] == '':
|
|
279
262
|
return
|
|
280
263
|
filename = fileObj[0] + '.png'
|
|
@@ -304,195 +287,144 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
304
287
|
def showImInfoWindow(self):
|
|
305
288
|
self.iminfo_dialog.show()
|
|
306
289
|
|
|
307
|
-
def
|
|
290
|
+
def setupUi0(self, Main):
|
|
308
291
|
"""
|
|
309
|
-
|
|
310
|
-
:param Main:
|
|
311
|
-
:return:
|
|
292
|
+
Sets up the entire user interface by calling logical helper methods.
|
|
312
293
|
"""
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
|
317
|
-
sizePolicy.setHorizontalStretch(0)
|
|
318
|
-
sizePolicy.setVerticalStretch(0)
|
|
319
|
-
sizePolicy.setHeightForWidth(Main.sizePolicy().hasHeightForWidth())
|
|
320
|
-
Main.setSizePolicy(sizePolicy)
|
|
321
|
-
Main.setMinimumSize(QtCore.QSize(800, 800))
|
|
322
|
-
Main.setBaseSize(QtCore.QSize(1280, 720))
|
|
323
|
-
### change geometry
|
|
324
|
-
availableGeometry = self.screen().availableGeometry()
|
|
325
|
-
self.resize(availableGeometry.width() , availableGeometry.height() )
|
|
326
|
-
#self.move((availableGeometry.width() ) // 2, (availableGeometry.height()) // 2)
|
|
327
|
-
###
|
|
328
|
-
font = QtGui.QFont()
|
|
329
|
-
font.setFamily("Ubuntu")
|
|
330
|
-
Main.setFont(font)
|
|
331
|
-
Main.setCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
|
|
332
|
-
Main.setDockNestingEnabled(True)
|
|
333
|
-
self.centralwidget = QtWidgets.QWidget(Main)
|
|
334
|
-
self.centralwidget.setEnabled(True)
|
|
335
|
-
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
|
|
336
|
-
QtWidgets.QSizePolicy.MinimumExpanding)
|
|
337
|
-
sizePolicy.setHorizontalStretch(0)
|
|
338
|
-
sizePolicy.setVerticalStretch(0)
|
|
339
|
-
sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth())
|
|
340
|
-
self.centralwidget.setSizePolicy(sizePolicy)
|
|
341
|
-
self.centralwidget.setMinimumSize(QtCore.QSize(800, 600))
|
|
342
|
-
self.centralwidget.setObjectName("centralwidget")
|
|
343
|
-
self.setContextMenuPolicy(Qt.ActionsContextMenu)
|
|
344
|
-
|
|
345
|
-
self.createDockWidget(Main)
|
|
346
|
-
self.createOpenGLWidgets(self.centralwidget, self.colorsCombinations)
|
|
347
|
-
self.widgets_mri = [4, 5, 6, 12]
|
|
348
|
-
self.widgets_eco = [11,1,2,3]
|
|
349
|
-
#self.table_widget.setFunctionRemove(self.removeTableItem)
|
|
350
|
-
#self.table_widget_measure.setFunctionRemove(self.removeTableMeasureItem)
|
|
294
|
+
# A class attribute for the icon path is cleaner
|
|
295
|
+
# Make sure to define this in your class __init__ or here
|
|
296
|
+
#self.settings.RESOURCE_DIR = "path/to/your/icons" # <-- DEFINE THIS
|
|
351
297
|
|
|
298
|
+
# --- 1. Basic window and layout setup ---
|
|
299
|
+
self._setup_main_window(Main)
|
|
300
|
+
self._setup_central_layout(Main)
|
|
352
301
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
self.
|
|
356
|
-
self.horizontalSlider_4.valueChanged.connect(self.changeSight4)
|
|
357
|
-
self.horizontalSlider_5.valueChanged.connect(self.changeSight5)
|
|
358
|
-
self.horizontalSlider_6.valueChanged.connect(self.changeSight6)
|
|
359
|
-
self.horizontalSlider_11.valueChanged.connect(self.changeSightTab3)
|
|
360
|
-
self.horizontalSlider_12.valueChanged.connect(self.changeSightTab4)
|
|
361
|
-
|
|
362
|
-
self.table_update.clicked.connect(self.linkMRIECO)
|
|
363
|
-
self.table_link.clicked.connect(self.linkBoth)
|
|
364
|
-
|
|
365
|
-
self.horizontalSlider_1.setVisible(False)
|
|
366
|
-
self.horizontalSlider_2.setVisible(False)
|
|
367
|
-
self.horizontalSlider_3.setVisible(False)
|
|
368
|
-
self.horizontalSlider_4.setVisible(False)
|
|
369
|
-
self.horizontalSlider_5.setVisible(False)
|
|
370
|
-
self.horizontalSlider_6.setVisible(False)
|
|
371
|
-
self.horizontalSlider_7.setVisible(False)
|
|
372
|
-
self.horizontalSlider_8.setVisible(False)
|
|
373
|
-
self.horizontalSlider_9.setVisible(False)
|
|
374
|
-
self.horizontalSlider_10.setVisible(False)
|
|
375
|
-
self.horizontalSlider_11.setVisible(False)
|
|
376
|
-
self.horizontalSlider_12.setVisible(False)
|
|
302
|
+
# --- 2. Create UI components ---
|
|
303
|
+
# Create all actions first, so menus and toolbars can share them.
|
|
304
|
+
self._create_actions(Main)
|
|
377
305
|
|
|
378
|
-
|
|
379
|
-
self.
|
|
380
|
-
self.radioButton_3.setVisible(False)
|
|
381
|
-
self.radioButton_4.setVisible(False)
|
|
382
|
-
self.radioButton_21_1.setVisible(False)
|
|
383
|
-
self.radioButton_21_2.setVisible(False)
|
|
384
|
-
self.radioButton_21_3.setVisible(False)
|
|
385
|
-
self.radioButton_21.setVisible(False)
|
|
306
|
+
# Create menus and add actions to them
|
|
307
|
+
self._setup_menus(Main)
|
|
386
308
|
|
|
387
|
-
self.radioButton_1.clicked.connect( partial(self.changeToCoronal, 'eco') )
|
|
388
|
-
self.radioButton_2.clicked.connect( partial (self.changeToSagittal, 'eco') )
|
|
389
|
-
self.radioButton_3.clicked.connect( partial( self.changeToAxial, 'eco') )
|
|
390
|
-
self.radioButton_4.clicked.connect(self.showSegOnWindow)
|
|
391
309
|
|
|
392
|
-
|
|
393
|
-
self.
|
|
394
|
-
self.radioButton_21_3.clicked.connect( partial( self.changeToAxial, 'mri') )
|
|
395
|
-
self.radioButton_21.clicked.connect( self.showSegOnWindow)
|
|
310
|
+
# Create other widgets (Docks, OpenGL, ComboBox, Logo)
|
|
311
|
+
self._setup_other_widgets(Main)
|
|
396
312
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
|
|
401
|
-
self.label_1.setSizePolicy(sizePolicy)
|
|
402
|
-
self.label_2.setSizePolicy(sizePolicy)
|
|
403
|
-
self.label_3.setSizePolicy(sizePolicy)
|
|
404
|
-
self.label_4.setSizePolicy(sizePolicy)
|
|
405
|
-
self.label_5.setSizePolicy(sizePolicy)
|
|
406
|
-
self.label_6.setSizePolicy(sizePolicy)
|
|
407
|
-
self.label_7.setSizePolicy(sizePolicy)
|
|
408
|
-
self.label_8.setSizePolicy(sizePolicy)
|
|
409
|
-
self.label_9.setSizePolicy(sizePolicy)
|
|
410
|
-
self.label_10.setSizePolicy(sizePolicy)
|
|
411
|
-
self.label_11.setSizePolicy(sizePolicy)
|
|
412
|
-
self.label_12.setSizePolicy(sizePolicy)
|
|
313
|
+
# Create toolbars and add actions/widgets to them
|
|
314
|
+
# (Must be after _setup_other_widgets to add logo/combobox)
|
|
315
|
+
self._setup_toolbars(Main)
|
|
413
316
|
|
|
414
|
-
|
|
317
|
+
# --- 3. Connect logic ---
|
|
318
|
+
# Group all signal/slot connections together
|
|
319
|
+
self._connect_signals()
|
|
415
320
|
|
|
416
|
-
#
|
|
321
|
+
# --- 4. Set initial UI state ---
|
|
322
|
+
# Group all .setVisible(False), .setDisabled(True), etc.
|
|
323
|
+
self._set_initial_state()
|
|
417
324
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
self.menubar.setNativeMenuBar(False)
|
|
422
|
-
self.menubar.setGeometry(QtCore.QRect(0, 0, 1050, 22))
|
|
423
|
-
self.menubar.setObjectName("menubar")
|
|
424
|
-
Main.setMenuBar(self.menubar)
|
|
325
|
+
# --- 5. Finalize ---
|
|
326
|
+
self.retranslateUi(Main)
|
|
327
|
+
QtCore.QMetaObject.connectSlotsByName(Main)
|
|
425
328
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
self.
|
|
329
|
+
# Your other final init steps
|
|
330
|
+
Main.setFocusPolicy(Qt.StrongFocus)
|
|
331
|
+
Main.installEventFilter(Main) # Use Main, not self
|
|
332
|
+
self.init_state()
|
|
333
|
+
self.create_cursors()
|
|
430
334
|
|
|
431
|
-
self.
|
|
432
|
-
self.menuView.setObjectName("menuView")
|
|
335
|
+
self.Main = Main
|
|
433
336
|
|
|
434
|
-
|
|
435
|
-
|
|
337
|
+
def _setup_main_window(self, Main):
|
|
338
|
+
"""Sets up the main QMainWindow properties (size, font, statusbar)."""
|
|
339
|
+
Main.setObjectName("Main")
|
|
340
|
+
Main.setEnabled(True)
|
|
341
|
+
Main.setMinimumSize(QtCore.QSize(500, 400)) # Your reasonable minimum size
|
|
436
342
|
|
|
437
|
-
|
|
438
|
-
|
|
343
|
+
# Set default size relative to user's screen
|
|
344
|
+
try:
|
|
345
|
+
availableGeometry = Main.screen().availableGeometry() # Use Main.screen()
|
|
346
|
+
default_width = int(availableGeometry.width() * 1)
|
|
347
|
+
default_height = int(availableGeometry.height() * 1)
|
|
348
|
+
Main.resize(default_width, default_height)
|
|
349
|
+
except AttributeError:
|
|
350
|
+
Main.resize(1024, 768) # Fallback
|
|
351
|
+
|
|
352
|
+
# Set font
|
|
353
|
+
font = QtGui.QFont()
|
|
354
|
+
font.setFamily("Ubuntu") # Note: This font may not exist on all systems
|
|
355
|
+
Main.setFont(font)
|
|
439
356
|
|
|
440
|
-
|
|
441
|
-
self.menuTools.setObjectName("menuTools")
|
|
357
|
+
Main.setDockNestingEnabled(True)
|
|
442
358
|
|
|
443
|
-
|
|
444
|
-
self.
|
|
359
|
+
# Status bar
|
|
360
|
+
self.statusbar = QtWidgets.QStatusBar(Main)
|
|
361
|
+
self.statusbar.setObjectName("statusbar")
|
|
362
|
+
Main.setStatusBar(self.statusbar)
|
|
445
363
|
|
|
446
|
-
|
|
447
|
-
|
|
364
|
+
def _setup_central_layout(self, Main):
|
|
365
|
+
"""Creates the central widget and its main layout."""
|
|
366
|
+
self.centralwidget = QtWidgets.QWidget(Main)
|
|
367
|
+
self.centralwidget.setEnabled(True)
|
|
448
368
|
|
|
449
|
-
|
|
450
|
-
|
|
369
|
+
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding,
|
|
370
|
+
QtWidgets.QSizePolicy.MinimumExpanding)
|
|
371
|
+
self.centralwidget.setSizePolicy(sizePolicy)
|
|
372
|
+
self.centralwidget.setObjectName("centralwidget")
|
|
451
373
|
|
|
452
|
-
|
|
453
|
-
self.
|
|
374
|
+
# **CRITICAL FIX**: Removed the line:
|
|
375
|
+
# self.centralwidget.setMinimumSize(QtCore.QSize(800, 600))
|
|
376
|
+
# This was preventing your UI from shrinking!
|
|
454
377
|
|
|
455
|
-
|
|
456
|
-
self.
|
|
378
|
+
# This single line creates the layout and assigns it.
|
|
379
|
+
#self.main_layout = QtWidgets.QVBoxLayout(self.centralwidget)
|
|
380
|
+
#self.main_layout.setObjectName("main_layout")
|
|
381
|
+
Main.setCentralWidget(self.centralwidget)
|
|
457
382
|
|
|
458
|
-
|
|
459
|
-
self.menuBasicInfo.setObjectName("MenuBasicInfo")
|
|
383
|
+
Main.setContextMenuPolicy(Qt.ActionsContextMenu) # Use Main, not self
|
|
460
384
|
|
|
461
|
-
|
|
462
|
-
self.
|
|
385
|
+
# Create OpenGL Widgets (fits well here as they are in the central layout)
|
|
386
|
+
self.widgets_mri = [4, 5, 6, 12]
|
|
387
|
+
self.widgets_eco = [11, 1, 2, 3]
|
|
388
|
+
self.createOpenGLWidgets(self.centralwidget, self.colorsCombinations)
|
|
463
389
|
|
|
464
|
-
|
|
465
|
-
|
|
390
|
+
def _create_actions(self, Main):
|
|
391
|
+
"""Creates all QActions and stores them as class attributes."""
|
|
392
|
+
# This function will be long, but it has only ONE job: create actions.
|
|
466
393
|
|
|
467
|
-
|
|
468
|
-
self.menuTV.setObjectName("menuTV")
|
|
394
|
+
# --- Color Action ---
|
|
469
395
|
|
|
470
|
-
|
|
471
|
-
self.
|
|
472
|
-
self.
|
|
473
|
-
|
|
396
|
+
self.actionColor = QtWidgets.QAction(Main)
|
|
397
|
+
self.actionColor.setObjectName("actionColor")
|
|
398
|
+
self._icon_colorXFaded = QtGui.QIcon()
|
|
399
|
+
self.pixmap_box_color = QtGui.QPixmap(settings.RESOURCE_DIR + "/box.png")
|
|
400
|
+
colr = [1, 1, 1]
|
|
401
|
+
self.pixmap_box_color.fill((QtGui.QColor(colr[0] * 255, colr[1] * 255, colr[2] * 255, 1 * 255)))
|
|
402
|
+
self._icon_colorXFaded.addPixmap(self.pixmap_box_color, QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
403
|
+
self._icon_colorX = QtGui.QIcon()
|
|
404
|
+
colr = [1, 0, 0]
|
|
405
|
+
self.pixmap_box_color.fill((QtGui.QColor(colr[0] * 255, colr[1] * 255, colr[2] * 255, 1 * 255)))
|
|
406
|
+
self._icon_colorX.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/box.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
407
|
+
self.actionColor.setIcon(self._icon_colorXFaded)
|
|
474
408
|
|
|
475
|
-
|
|
409
|
+
# --- File Actions ---
|
|
476
410
|
self.actionOpenUS = QtWidgets.QAction(Main)
|
|
477
411
|
self.actionOpenUS.setObjectName("actionOpenUS")
|
|
478
412
|
icon_eco = QtGui.QIcon()
|
|
479
|
-
icon_eco.addPixmap(QtGui.QPixmap(
|
|
413
|
+
icon_eco.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/view1.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
480
414
|
|
|
481
415
|
self.actionOpenUS.setIcon(icon_eco)
|
|
482
416
|
self.actionOpenUS.setIconText('open')
|
|
483
|
-
|
|
417
|
+
|
|
484
418
|
self.actionOpenUS.setDisabled(True)
|
|
485
419
|
|
|
486
420
|
self.actionOpenMRI = QtWidgets.QAction(Main)
|
|
487
421
|
self.actionOpenMRI.setObjectName("actionOpenMRI")
|
|
488
422
|
icon_mri = QtGui.QIcon()
|
|
489
|
-
icon_mri.addPixmap(QtGui.QPixmap(
|
|
423
|
+
icon_mri.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/view2.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
490
424
|
self.actionOpenMRI.setIcon(icon_mri)
|
|
491
425
|
self.actionOpenMRI.setIconText('open')
|
|
492
|
-
self.actionOpenMRI.triggered.connect(self.browseMRI)
|
|
493
426
|
self.actionOpenMRI.setDisabled(True)
|
|
494
427
|
|
|
495
|
-
######################### Actiton Open MultiSlices ###################
|
|
496
428
|
self.actionComboBox = QtWidgets.QComboBox(Main)
|
|
497
429
|
self.actionComboBox.setObjectName("actionComboBox")
|
|
498
430
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
|
|
@@ -503,203 +435,138 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
503
435
|
self.actionComboBox.setMinimumSize(QtCore.QSize(100, 0))
|
|
504
436
|
self.actionComboBox.setSizePolicy(sizePolicy)
|
|
505
437
|
self.actionComboBox.setObjectName("View1")
|
|
506
|
-
|
|
438
|
+
|
|
507
439
|
self.actionComboBox.setDisabled(True)
|
|
508
440
|
self.actionComboBox.setObjectName("comboBox")
|
|
509
441
|
cbstyle = """
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
442
|
+
QComboBox QAbstractItemView {border: 1px solid grey;
|
|
443
|
+
background: #03211c;
|
|
444
|
+
selection-background-color: #03211c;
|
|
445
|
+
"text-align: left;"}
|
|
446
|
+
QComboBox {background: #03211c;margin-right: 1px;}
|
|
447
|
+
QComboBox::drop-down {
|
|
448
|
+
subcontrol-origin: margin;}
|
|
449
|
+
padding-left
|
|
450
|
+
"""
|
|
519
451
|
self.actionComboBox.setStyleSheet(cbstyle)
|
|
520
452
|
for r in range(2):
|
|
521
453
|
self.actionComboBox.addItem("{}".format(r))
|
|
522
454
|
self.actionComboBox.setVisible(False)
|
|
523
455
|
|
|
524
|
-
|
|
525
|
-
######################### Load MEAN FA ###############################
|
|
526
456
|
self.actionOpenFA = QtWidgets.QAction(Main)
|
|
527
457
|
self.actionOpenFA.setObjectName("actionOpenFA")
|
|
528
458
|
icon = QtGui.QIcon()
|
|
529
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
459
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/dti.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
530
460
|
self.actionOpenFA.setIcon(icon)
|
|
531
461
|
self.actionOpenFA.setIconText('open')
|
|
532
|
-
self.actionOpenFA.triggered.connect(self.browseFA)
|
|
533
462
|
self.actionOpenFA.setDisabled(True)
|
|
534
463
|
|
|
535
|
-
######################### Load Tractography ###############################
|
|
536
464
|
self.actionOpenTract = QtWidgets.QAction(Main)
|
|
537
465
|
self.actionOpenTract.setObjectName("actionOpenTract")
|
|
538
466
|
icon = QtGui.QIcon()
|
|
539
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
467
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/tract.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
540
468
|
self.actionOpenTract.setIcon(icon)
|
|
541
469
|
self.actionOpenTract.setIconText('open')
|
|
542
|
-
self.actionOpenTract.triggered.connect(self.browseTractoGraphy)
|
|
543
470
|
self.actionOpenTract.setDisabled(True)
|
|
544
471
|
|
|
545
|
-
######################### New Project ################################
|
|
546
472
|
self.actionNew = QtWidgets.QAction(Main)
|
|
547
473
|
self.actionNew.setObjectName("actionNew")
|
|
548
474
|
icon = QtGui.QIcon()
|
|
549
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
475
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
550
476
|
self.actionNew.setIcon(icon)
|
|
551
477
|
self.actionNew.setIconText('New')
|
|
552
|
-
self.actionNew.triggered.connect(self.newProject)
|
|
553
478
|
|
|
554
|
-
|
|
479
|
+
# ...
|
|
480
|
+
|
|
555
481
|
self.actionCloseUS = QtWidgets.QAction(Main)
|
|
556
482
|
self.actionCloseUS.setObjectName("actionNew")
|
|
557
|
-
#icon = QtGui.QIcon()
|
|
558
|
-
#icon.addPixmap(QtGui.QPixmap(source_folder+"/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
559
|
-
#self.actionCloseUS.setIcon(icon)
|
|
560
483
|
self.actionCloseUS.setIconText('Close View 1')
|
|
561
|
-
self.actionCloseUS.triggered.connect(self.CloseUS)
|
|
562
|
-
#self.actionCloseUS.triggered.connect(self.CloseUS)
|
|
563
484
|
|
|
485
|
+
# ...
|
|
564
486
|
######################### Close MRI ################################
|
|
565
487
|
self.actionCloseMRI = QtWidgets.QAction(Main)
|
|
566
488
|
self.actionCloseMRI.setObjectName("actionNew")
|
|
567
|
-
#icon = QtGui.QIcon()
|
|
568
|
-
#icon.addPixmap(QtGui.QPixmap(source_folder+"/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
569
|
-
#self.actionCloseUS.setIcon(icon)
|
|
570
489
|
self.actionCloseMRI.setIconText('Close View 2')
|
|
571
|
-
self.actionCloseMRI.triggered.connect(self.CloseMRI)
|
|
572
|
-
#self.actionCloseMRI.triggered.connect(partial(self.CloseMRI, dialogue=False))
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
######################### Import ################################
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
490
|
|
|
581
491
|
self.actionImportSegMRI = QtWidgets.QAction(Main)
|
|
582
492
|
self.actionImportSegMRI.setObjectName("action SegEco")
|
|
583
|
-
#icon = QtGui.QIcon()
|
|
584
|
-
#icon.addPixmap(QtGui.QPixmap(
|
|
585
|
-
#self.actionCloseUS.setIcon(icon)
|
|
493
|
+
# icon = QtGui.QIcon()
|
|
494
|
+
# icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
495
|
+
# self.actionCloseUS.setIcon(icon)
|
|
586
496
|
icon_mriS = QtGui.QIcon()
|
|
587
|
-
icon_mriS.addPixmap(QtGui.QPixmap(
|
|
497
|
+
icon_mriS.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/view2_seg.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
588
498
|
self.actionImportSegMRI.setIcon(icon_mriS)
|
|
589
499
|
self.actionImportSegMRI.setIconText('Segmented View 2')
|
|
590
|
-
self.actionImportSegMRI.triggered.connect(partial(self.importData, 'MRISEG'))
|
|
591
500
|
self.actionImportSegMRI.setDisabled(True)
|
|
592
501
|
|
|
593
502
|
self.actionImportSegEco = QtWidgets.QAction(Main)
|
|
594
503
|
self.actionImportSegEco.setObjectName("action SegEco")
|
|
595
504
|
icon_ecoS = QtGui.QIcon()
|
|
596
|
-
icon_ecoS.addPixmap(QtGui.QPixmap(
|
|
505
|
+
icon_ecoS.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/view1_seg.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
597
506
|
self.actionImportSegEco.setIcon(icon_ecoS)
|
|
598
507
|
self.actionImportSegEco.setIconText('Segmented view 1')
|
|
599
|
-
self.actionImportSegEco.triggered.connect(partial(self.importData, 'USSEG'))
|
|
600
508
|
self.actionImportSegEco.setDisabled(True)
|
|
601
|
-
self.menuImport.addAction(self.actionOpenUS)
|
|
602
|
-
self.menuImport.addAction(self.actionOpenMRI)
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
self.menuImport.addSeparator()
|
|
606
|
-
self.menuImport.addAction(self.actionImportSegEco)
|
|
607
|
-
self.menuImport.addAction(self.actionImportSegMRI)
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
509
|
|
|
613
510
|
######################### Export ################################
|
|
614
511
|
self.actionExportImEco = QtWidgets.QAction(Main)
|
|
615
512
|
self.actionExportImEco.setObjectName("action ImEco")
|
|
616
|
-
#icon = QtGui.QIcon()
|
|
617
|
-
#icon.addPixmap(QtGui.QPixmap(
|
|
618
|
-
#self.actionCloseUS.setIcon(icon)
|
|
513
|
+
# icon = QtGui.QIcon()
|
|
514
|
+
# icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
515
|
+
# self.actionCloseUS.setIcon(icon)
|
|
619
516
|
self.actionExportImEco.setIcon(icon_eco)
|
|
620
517
|
self.actionExportImEco.setIconText('Image View 1')
|
|
621
|
-
self.actionExportImEco.triggered.connect(partial(self.exportData, 'USIM'))
|
|
622
|
-
|
|
623
|
-
|
|
624
518
|
|
|
625
519
|
self.actionExportSegEco = QtWidgets.QAction(Main)
|
|
626
520
|
self.actionExportSegEco.setObjectName("action SegEco")
|
|
627
521
|
self.actionExportSegEco.setIcon(icon_ecoS)
|
|
628
|
-
#icon = QtGui.QIcon()
|
|
629
|
-
#icon.addPixmap(QtGui.QPixmap(
|
|
630
|
-
#self.actionCloseUS.setIcon(icon)
|
|
522
|
+
# icon = QtGui.QIcon()
|
|
523
|
+
# icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
524
|
+
# self.actionCloseUS.setIcon(icon)
|
|
631
525
|
self.actionExportSegEco.setIconText('Segmented View 1')
|
|
632
|
-
self.actionExportSegEco.triggered.connect(partial(self.exportData, 'USSEG'))
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
526
|
|
|
637
527
|
self.actionExportImMRI = QtWidgets.QAction(Main)
|
|
638
528
|
self.actionExportImMRI.setObjectName("action IMMRI")
|
|
639
529
|
self.actionExportImMRI.setIcon(icon_mri)
|
|
640
|
-
#icon = QtGui.QIcon()
|
|
641
|
-
#icon.addPixmap(QtGui.QPixmap(
|
|
642
|
-
#self.actionCloseUS.setIcon(icon)
|
|
530
|
+
# icon = QtGui.QIcon()
|
|
531
|
+
# icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
532
|
+
# self.actionCloseUS.setIcon(icon)
|
|
643
533
|
self.actionExportImMRI.setIconText('Image view 2')
|
|
644
|
-
self.actionExportImMRI.triggered.connect(partial(self.exportData, 'MRIIM'))
|
|
645
|
-
|
|
646
534
|
|
|
647
535
|
self.actionExportSegMRI = QtWidgets.QAction(Main)
|
|
648
536
|
self.actionExportSegMRI.setObjectName("action SegEco")
|
|
649
537
|
self.actionExportSegMRI.setIcon(icon_mriS)
|
|
650
|
-
#icon = QtGui.QIcon()
|
|
651
|
-
#icon.addPixmap(QtGui.QPixmap(
|
|
652
|
-
#self.actionCloseUS.setIcon(icon)
|
|
538
|
+
# icon = QtGui.QIcon()
|
|
539
|
+
# icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
540
|
+
# self.actionCloseUS.setIcon(icon)
|
|
653
541
|
self.actionExportSegMRI.setIconText('Segmented View 2')
|
|
654
|
-
self.actionExportSegMRI.triggered.connect(partial(self.exportData, 'MRISEG'))
|
|
655
|
-
|
|
656
|
-
self.menuExport.addAction(self.actionExportImMRI)
|
|
657
|
-
self.menuExport.addAction(self.actionExportImEco)
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
self.menuExport.addSeparator()
|
|
663
|
-
self.menuExport.addAction(self.actionExportSegEco)
|
|
664
|
-
self.menuExport.addAction(self.actionExportSegMRI)
|
|
665
542
|
|
|
666
543
|
self.actionExportImMRI.setDisabled(True)
|
|
667
544
|
self.actionExportSegMRI.setDisabled(True)
|
|
668
|
-
|
|
669
545
|
self.actionExportImEco.setDisabled(True)
|
|
670
546
|
self.actionExportSegEco.setDisabled(True)
|
|
671
547
|
|
|
672
|
-
|
|
673
|
-
######################### ScreenShot ################################
|
|
674
548
|
self.actionScreenS = QtWidgets.QAction(Main)
|
|
675
549
|
self.actionScreenS.setObjectName("actionNew")
|
|
676
|
-
#icon = QtGui.QIcon()
|
|
677
|
-
#icon.addPixmap(QtGui.QPixmap(
|
|
678
|
-
#self.actionCloseUS.setIcon(icon)
|
|
550
|
+
# icon = QtGui.QIcon()
|
|
551
|
+
# icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/new.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
552
|
+
# self.actionCloseUS.setIcon(icon)
|
|
679
553
|
self.actionScreenS.setIconText('Screen Shot')
|
|
680
|
-
self.actionScreenS.triggered.connect(self.showScreenShotWindow)
|
|
681
|
-
|
|
682
554
|
|
|
683
|
-
|
|
684
|
-
######################### Load ################################
|
|
685
555
|
self.actionLoad = QtWidgets.QAction(Main)
|
|
686
556
|
self.actionLoad.setObjectName("actionLoad")
|
|
687
557
|
icon = QtGui.QIcon()
|
|
688
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
558
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/load.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
689
559
|
self.actionLoad.setIcon(icon)
|
|
690
560
|
self.actionLoad.setIconText('load')
|
|
691
|
-
self.actionLoad.triggered.connect(self.loadProject)
|
|
692
561
|
|
|
693
|
-
######################### View -> Main Toolbar ################################
|
|
694
562
|
self.actionMain_Toolbar = QtWidgets.QAction(Main)
|
|
695
563
|
icon1 = QtGui.QIcon()
|
|
696
|
-
#icon1.addPixmap(QtGui.QPixmap(
|
|
697
|
-
#icon1.addPixmap(QtGui.QPixmap(
|
|
698
|
-
#self.actionMain_Toolbar.setIcon(icon1)
|
|
564
|
+
# icon1.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"e/action_check.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
565
|
+
# icon1.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/action_check_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
566
|
+
# self.actionMain_Toolbar.setIcon(icon1)
|
|
699
567
|
self.actionMain_Toolbar.setObjectName("actionMain_Toolbar")
|
|
700
568
|
self.actionMain_Toolbar.setCheckable(True)
|
|
701
569
|
|
|
702
|
-
######################### View -> GUIDELINES ################################
|
|
703
570
|
self.action_guideLines = QtWidgets.QAction(Main)
|
|
704
571
|
icon1 = QtGui.QIcon()
|
|
705
572
|
self.action_guideLines.setObjectName("Guide lines")
|
|
@@ -719,155 +586,137 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
719
586
|
######################### File -> INFO ################################
|
|
720
587
|
self.actionFile_info = QtWidgets.QAction(Main)
|
|
721
588
|
icon2 = QtGui.QIcon()
|
|
722
|
-
icon2.addPixmap(QtGui.QPixmap(
|
|
589
|
+
icon2.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/settings.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
723
590
|
self.actionFile_info.setIcon(icon2)
|
|
724
591
|
self.actionFile_info.setObjectName("actionFile_info")
|
|
725
|
-
self.actionFile_info.triggered.connect(self.showInfoWindow)
|
|
726
|
-
|
|
727
|
-
|
|
728
592
|
######################### Tools -> Undo ################################
|
|
729
593
|
self.actionUndo = QtWidgets.QAction(Main)
|
|
730
|
-
#icon2 = QtGui.QIcon()
|
|
731
|
-
#icon2.addPixmap(QtGui.QPixmap(
|
|
732
|
-
#self.actionUndo.setIcon(icon2)
|
|
594
|
+
# icon2 = QtGui.QIcon()
|
|
595
|
+
# icon2.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/settings.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
596
|
+
# self.actionUndo.setIcon(icon2)
|
|
733
597
|
self.actionUndo.setObjectName("action Undo")
|
|
734
|
-
self.actionUndo.triggered.connect(self.Undo)
|
|
735
|
-
|
|
736
598
|
######################### Tools -> Redo ################################
|
|
737
599
|
self.actionRedo = QtWidgets.QAction(Main)
|
|
738
600
|
# icon2 = QtGui.QIcon()
|
|
739
|
-
# icon2.addPixmap(QtGui.QPixmap(
|
|
601
|
+
# icon2.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/settings.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
740
602
|
# self.actionUndo.setIcon(icon2)
|
|
741
603
|
self.actionRedo.setObjectName("action Redo")
|
|
742
|
-
self.actionRedo.triggered.connect(self.Redo)
|
|
743
|
-
######################### Tools -> contourGen ################################
|
|
744
|
-
#self.actionContourGen = QtWidgets.QAction(Main)
|
|
745
|
-
#self.actionContourGen.setObjectName("action contour generator")
|
|
746
|
-
#self.actionContourGen.triggered.connect(self.GenerateContour)
|
|
747
604
|
|
|
748
605
|
######################### File -> ChangeImage ################################
|
|
749
606
|
self.actionFile_changeIM = QtWidgets.QAction(Main)
|
|
750
607
|
icon2 = QtGui.QIcon()
|
|
751
|
-
icon2.addPixmap(QtGui.QPixmap(
|
|
608
|
+
icon2.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/info.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
752
609
|
self.actionFile_changeIM.setIcon(icon2)
|
|
753
610
|
self.actionFile_changeIM.setObjectName("actionFile_changeIM")
|
|
754
|
-
self.actionFile_changeIM.triggered.connect(self.showIMVARSWindow)
|
|
755
611
|
|
|
756
612
|
######################### File -> Info ################################
|
|
757
613
|
self.actionfile_iminfo = QtWidgets.QAction(Main)
|
|
758
614
|
self.actionfile_iminfo.setObjectName("actionFile_info")
|
|
759
|
-
self.actionfile_iminfo.triggered.connect(partial(self.maskingShow, 5))
|
|
760
|
-
|
|
761
615
|
######################### File -> convert ################################
|
|
762
616
|
self.actionconvert = QtWidgets.QAction(Main)
|
|
763
617
|
icon = QtGui.QIcon()
|
|
764
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
618
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/export.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
765
619
|
self.actionconvert.setIcon(icon)
|
|
766
620
|
self.actionconvert.setObjectName("actionconvert")
|
|
767
|
-
self.actionconvert.triggered.connect(self.convert)
|
|
768
|
-
|
|
769
621
|
|
|
770
622
|
######################### File -> save to nifti ################################
|
|
771
|
-
#self.actionsaveModified = QtWidgets.QAction(Main)
|
|
772
|
-
#icon = QtGui.QIcon()
|
|
773
|
-
#icon.addPixmap(QtGui.QPixmap(
|
|
774
|
-
#self.actionsaveModified.setIcon(icon)
|
|
775
|
-
#self.actionsaveModified.setObjectName("actionsavemodified")
|
|
776
|
-
#self.actionsaveModified.triggered.connect(self.save_eco_to_nifti)
|
|
623
|
+
# self.actionsaveModified = QtWidgets.QAction(Main)
|
|
624
|
+
# icon = QtGui.QIcon()
|
|
625
|
+
# icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/export.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
626
|
+
# self.actionsaveModified.setIcon(icon)
|
|
627
|
+
# self.actionsaveModified.setObjectName("actionsavemodified")
|
|
628
|
+
# self.actionsaveModified.triggered.connect(self.save_eco_to_nifti)
|
|
777
629
|
|
|
778
|
-
######################### File -> exit ################################
|
|
779
630
|
self.actionexit = QtWidgets.QAction(Main)
|
|
780
631
|
self.actionexit.setObjectName("actionexit")
|
|
781
632
|
icon = QtGui.QIcon()
|
|
782
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
633
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/close.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
783
634
|
self.actionexit.setIcon(icon)
|
|
784
|
-
self.actionexit.triggered.connect(self.close)
|
|
785
635
|
|
|
786
636
|
######################### Logo ################################
|
|
787
637
|
self.logo = QtWidgets.QLabel(Main)
|
|
788
|
-
self.logo.setPixmap(QtGui.QPixmap(
|
|
789
|
-
self.logo.resize(100,50)
|
|
638
|
+
self.logo.setPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/melage_top.png"))
|
|
639
|
+
self.logo.resize(100, 50)
|
|
790
640
|
|
|
791
641
|
######################### File -> save ################################
|
|
792
642
|
self.actionsave = QtWidgets.QAction(Main)
|
|
793
643
|
self.actionsave.setObjectName("actionsave")
|
|
794
644
|
icon = QtGui.QIcon()
|
|
795
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
645
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/save.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
796
646
|
self.actionsave.setIcon(icon)
|
|
797
|
-
|
|
647
|
+
|
|
798
648
|
self.actionsave.setDisabled(True)
|
|
799
649
|
|
|
800
650
|
######################### File -> saveas ################################
|
|
801
651
|
self.actionsaveas = QtWidgets.QAction(Main)
|
|
802
652
|
self.actionsaveas.setObjectName("actionsaveas")
|
|
803
653
|
icon = QtGui.QIcon()
|
|
804
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
654
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/saveas.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
805
655
|
self.actionsaveas.setIcon(icon)
|
|
806
|
-
|
|
656
|
+
|
|
807
657
|
self.actionsaveas.setDisabled(True)
|
|
808
658
|
|
|
809
659
|
######################### Pan Zoom ################################
|
|
810
660
|
self.actionPan = QtWidgets.QAction(Main)
|
|
811
661
|
self.actionPan.setObjectName("actionPan")
|
|
812
662
|
self._icon_Hand_IXFaded = QtGui.QIcon()
|
|
813
|
-
self._icon_Hand_IXFaded.addPixmap(QtGui.QPixmap(
|
|
814
|
-
self._icon_Hand_IX = QtGui.QIcon()
|
|
815
|
-
self._icon_Hand_IX.addPixmap(QtGui.QPixmap(source_folder+"/Hand_IX.png"), QtGui.QIcon.Normal,
|
|
663
|
+
self._icon_Hand_IXFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/Hand_IXFaded.png"), QtGui.QIcon.Normal,
|
|
816
664
|
QtGui.QIcon.On)
|
|
665
|
+
self._icon_Hand_IX = QtGui.QIcon()
|
|
666
|
+
self._icon_Hand_IX.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/Hand_IX.png"), QtGui.QIcon.Normal,
|
|
667
|
+
QtGui.QIcon.On)
|
|
817
668
|
|
|
818
669
|
self.actionPan.setIcon(self._icon_Hand_IXFaded)
|
|
819
670
|
|
|
820
671
|
self.actionContour = QtWidgets.QAction(Main)
|
|
821
672
|
self.actionContour.setObjectName("actionContour")
|
|
822
673
|
self._icon_contourFaded = QtGui.QIcon()
|
|
823
|
-
self._icon_contourFaded.addPixmap(QtGui.QPixmap(
|
|
674
|
+
self._icon_contourFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/contourFaded.png"), QtGui.QIcon.Normal,
|
|
675
|
+
QtGui.QIcon.On)
|
|
824
676
|
self._icon_contour = QtGui.QIcon()
|
|
825
|
-
self._icon_contour.addPixmap(QtGui.QPixmap(
|
|
677
|
+
self._icon_contour.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/contour.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
826
678
|
|
|
827
679
|
self.actionContour.setIcon(self._icon_contourFaded)
|
|
828
680
|
|
|
829
|
-
|
|
830
681
|
self.actionPoints = QtWidgets.QAction(Main)
|
|
831
682
|
self.actionPoints.setObjectName("actionPoints")
|
|
832
683
|
self._icon_pointsFaded = QtGui.QIcon()
|
|
833
|
-
self._icon_pointsFaded.addPixmap(QtGui.QPixmap(
|
|
684
|
+
self._icon_pointsFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/pointsFaded.png"), QtGui.QIcon.Normal,
|
|
685
|
+
QtGui.QIcon.On)
|
|
834
686
|
self._icon_points = QtGui.QIcon()
|
|
835
|
-
self._icon_points.addPixmap(QtGui.QPixmap(
|
|
687
|
+
self._icon_points.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/points.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
836
688
|
|
|
837
689
|
self.actionPoints.setIcon(self._icon_pointsFaded)
|
|
838
690
|
|
|
839
|
-
|
|
840
|
-
|
|
841
691
|
self.actionCircles = QtWidgets.QAction(Main)
|
|
842
692
|
self.actionCircles.setObjectName("action Circles")
|
|
843
693
|
self._icon_CircleFaded = QtGui.QIcon()
|
|
844
|
-
self._icon_CircleFaded.addPixmap(QtGui.QPixmap(
|
|
694
|
+
self._icon_CircleFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/circle_faded.png"), QtGui.QIcon.Normal,
|
|
695
|
+
QtGui.QIcon.On)
|
|
845
696
|
self._icon_circles = QtGui.QIcon()
|
|
846
|
-
self._icon_circles.addPixmap(QtGui.QPixmap(
|
|
697
|
+
self._icon_circles.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/circle.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
847
698
|
|
|
848
699
|
self.actionCircles.setIcon(self._icon_CircleFaded)
|
|
849
700
|
|
|
850
|
-
|
|
851
701
|
self.actionGoTo = QtWidgets.QAction(Main)
|
|
852
702
|
self.actionGoTo.setCheckable(True)
|
|
853
703
|
self.actionGoTo.setObjectName("goto")
|
|
854
704
|
self._icon_gotoFaded = QtGui.QIcon()
|
|
855
|
-
self._icon_gotoFaded.addPixmap(QtGui.QPixmap(
|
|
705
|
+
self._icon_gotoFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/synchFaded.png"), QtGui.QIcon.Normal,
|
|
706
|
+
QtGui.QIcon.On)
|
|
856
707
|
self._icon_goto = QtGui.QIcon()
|
|
857
|
-
self._icon_goto.addPixmap(QtGui.QPixmap(
|
|
708
|
+
self._icon_goto.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/synch.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
858
709
|
|
|
859
710
|
self.actionGoTo.setIcon(self._icon_gotoFaded)
|
|
860
711
|
|
|
861
|
-
|
|
862
|
-
|
|
863
712
|
self.action3D = QtWidgets.QAction(Main)
|
|
864
713
|
self.action3D.setCheckable(True)
|
|
865
714
|
self.action3D.setChecked(True)
|
|
866
715
|
self.action3D.setObjectName("goto")
|
|
867
716
|
self._icon_3dFaded = QtGui.QIcon()
|
|
868
|
-
self._icon_3dFaded.addPixmap(QtGui.QPixmap(
|
|
717
|
+
self._icon_3dFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/3dFaded.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
869
718
|
self._icon_3d = QtGui.QIcon()
|
|
870
|
-
self._icon_3d.addPixmap(QtGui.QPixmap(
|
|
719
|
+
self._icon_3d.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/3d.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
871
720
|
|
|
872
721
|
self.action3D.setIcon(self._icon_3d)
|
|
873
722
|
|
|
@@ -876,172 +725,179 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
876
725
|
self.actionZoomIn.setChecked(True)
|
|
877
726
|
self.actionZoomIn.setObjectName("goto")
|
|
878
727
|
self._icon_zoomIn = QtGui.QIcon()
|
|
879
|
-
self._icon_zoomIn.addPixmap(QtGui.QPixmap(
|
|
728
|
+
self._icon_zoomIn.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/zoom_in.png"), QtGui.QIcon.Normal,
|
|
729
|
+
QtGui.QIcon.On)
|
|
880
730
|
self._icon_zoomIn = QtGui.QIcon()
|
|
881
|
-
self._icon_zoomIn.addPixmap(QtGui.QPixmap(
|
|
731
|
+
self._icon_zoomIn.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/zoom_in.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
882
732
|
|
|
883
733
|
self.actionZoomIn.setIcon(self._icon_zoomIn)
|
|
884
734
|
|
|
885
|
-
|
|
886
735
|
self.actionZoomOut = QtWidgets.QAction(Main)
|
|
887
736
|
self.actionZoomOut.setCheckable(True)
|
|
888
737
|
self.actionZoomOut.setChecked(True)
|
|
889
738
|
self.actionZoomOut.setObjectName("goto")
|
|
890
739
|
self._icon_zoomOut = QtGui.QIcon()
|
|
891
|
-
self._icon_zoomOut.addPixmap(QtGui.QPixmap(
|
|
740
|
+
self._icon_zoomOut.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/zoom_out.png"), QtGui.QIcon.Normal,
|
|
741
|
+
QtGui.QIcon.On)
|
|
892
742
|
self._icon_zoomOut = QtGui.QIcon()
|
|
893
|
-
self._icon_zoomOut.addPixmap(QtGui.QPixmap(
|
|
743
|
+
self._icon_zoomOut.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/zoom_out.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
894
744
|
|
|
895
745
|
self.actionZoomOut.setIcon(self._icon_zoomOut)
|
|
896
746
|
|
|
897
747
|
|
|
748
|
+
self.actionZoomNeutral = QtWidgets.QAction(Main)
|
|
749
|
+
self.actionZoomNeutral.setCheckable(True)
|
|
750
|
+
self.actionZoomNeutral.setChecked(True)
|
|
751
|
+
self.actionZoomNeutral.setObjectName("goto")
|
|
752
|
+
_icon_zoomInN = QtGui.QIcon()
|
|
753
|
+
_icon_zoomInN.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/zoom_neutral.png"), QtGui.QIcon.Normal,
|
|
754
|
+
QtGui.QIcon.On)
|
|
755
|
+
self.actionZoomNeutral.setIcon(_icon_zoomInN)
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
898
759
|
self.actionContourX = QtWidgets.QAction(Main)
|
|
899
760
|
self.actionContourX.setObjectName("actionContourX")
|
|
900
761
|
self._icon_contourXFaded = QtGui.QIcon()
|
|
901
|
-
self._icon_contourXFaded.addPixmap(QtGui.QPixmap(
|
|
762
|
+
self._icon_contourXFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/contourXFaded.png"), QtGui.QIcon.Normal,
|
|
763
|
+
QtGui.QIcon.On)
|
|
902
764
|
self._icon_contourX = QtGui.QIcon()
|
|
903
|
-
self._icon_contourX.addPixmap(QtGui.QPixmap(
|
|
765
|
+
self._icon_contourX.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/contourX.png"), QtGui.QIcon.Normal,
|
|
766
|
+
QtGui.QIcon.On)
|
|
904
767
|
self.actionContourX.setIcon(self._icon_contourXFaded)
|
|
905
768
|
|
|
906
|
-
|
|
907
|
-
self.actionColor = QtWidgets.QAction(Main)
|
|
908
|
-
self.actionColor.setObjectName("actionColor")
|
|
909
|
-
self._icon_colorXFaded = QtGui.QIcon()
|
|
910
|
-
self.pixmap_box_color = QtGui.QPixmap(source_folder + "/box.png")
|
|
911
|
-
colr = [1,1,1]
|
|
912
|
-
self.pixmap_box_color.fill((QtGui.QColor(colr[0]*255, colr[1]*255, colr[2]*255, 1*255)))
|
|
913
|
-
self._icon_colorXFaded.addPixmap(self.pixmap_box_color, QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
914
|
-
self._icon_colorX = QtGui.QIcon()
|
|
915
|
-
colr = [1, 0, 0]
|
|
916
|
-
self.pixmap_box_color.fill((QtGui.QColor(colr[0]*255, colr[1]*255, colr[2]*255, 1*255)))
|
|
917
|
-
self._icon_colorX.addPixmap(QtGui.QPixmap(source_folder+"/box.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
918
|
-
self.actionColor.setIcon(self._icon_colorXFaded)
|
|
919
|
-
self.actionColor.triggered.connect(self.color_picker)
|
|
920
|
-
self.newdialog = NewDialog(Main)
|
|
921
|
-
|
|
922
|
-
self.pixmap_box_label = QtWidgets.QLabel(Main)
|
|
923
|
-
self.pixmap_box_label.setText('Combined')
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
769
|
self.actionEraseX = QtWidgets.QAction(Main)
|
|
930
770
|
self.actionEraseX.setObjectName("actionEraseX")
|
|
931
771
|
self._icon_eraseXFaded = QtGui.QIcon()
|
|
932
|
-
self._icon_eraseXFaded.addPixmap(QtGui.QPixmap(
|
|
772
|
+
self._icon_eraseXFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/EraserXFaded.png"), QtGui.QIcon.Normal,
|
|
773
|
+
QtGui.QIcon.On)
|
|
933
774
|
self._icon_eraseX = QtGui.QIcon()
|
|
934
|
-
self._icon_eraseX.addPixmap(QtGui.QPixmap(
|
|
775
|
+
self._icon_eraseX.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/EraserX.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
935
776
|
self.actionEraseX.setIcon(self._icon_eraseXFaded)
|
|
936
777
|
|
|
778
|
+
self.actionRuler = QtWidgets.QAction(Main)
|
|
779
|
+
self.actionRuler.setObjectName("actionMeasure")
|
|
780
|
+
self._icon_rulerFaded = QtGui.QIcon()
|
|
781
|
+
self._icon_rulerFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/rulerFaded.png"), QtGui.QIcon.Normal,
|
|
782
|
+
QtGui.QIcon.On)
|
|
783
|
+
self._icon_ruler = QtGui.QIcon()
|
|
784
|
+
self._icon_ruler.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/ruler.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
785
|
+
self.actionRuler.setIcon(self._icon_ruler)
|
|
786
|
+
|
|
787
|
+
##########################################################
|
|
788
|
+
|
|
789
|
+
# --- Horizontal (Axial) View Action ---
|
|
790
|
+
self.actionHorizontalView = QtWidgets.QAction(Main)
|
|
791
|
+
self.actionHorizontalView.setObjectName("actionHorizontalView")
|
|
792
|
+
|
|
793
|
+
# Icons for horizontal view
|
|
794
|
+
self._icon_HVFaded = QtGui.QIcon()
|
|
795
|
+
self._icon_HVFaded.addPixmap(
|
|
796
|
+
QtGui.QPixmap(settings.RESOURCE_DIR + "/horizontalview.png"),
|
|
797
|
+
QtGui.QIcon.Normal, QtGui.QIcon.On
|
|
798
|
+
)
|
|
799
|
+
self._icon_HV = QtGui.QIcon()
|
|
800
|
+
self._icon_HV.addPixmap(
|
|
801
|
+
QtGui.QPixmap(settings.RESOURCE_DIR + "/horizontalview.png"),
|
|
802
|
+
QtGui.QIcon.Normal, QtGui.QIcon.On
|
|
803
|
+
)
|
|
804
|
+
|
|
805
|
+
self.actionHorizontalView.setIcon(self._icon_HV)
|
|
806
|
+
self.actionHorizontalView.setCheckable(True)
|
|
807
|
+
self.actionHorizontalView.setToolTip("Switch to Horizontal (Axial) View")
|
|
808
|
+
self.actionHorizontalView.triggered.connect(lambda: self.setView("horizontal"))
|
|
937
809
|
|
|
810
|
+
# --- Vertical (Coronal/Sagittal) View Action ---
|
|
811
|
+
self.actionVerticalView = QtWidgets.QAction(Main)
|
|
812
|
+
self.actionVerticalView.setObjectName("actionVerticalView")
|
|
938
813
|
|
|
939
|
-
|
|
940
|
-
self.
|
|
941
|
-
self.
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
self.
|
|
814
|
+
# Icons for vertical view
|
|
815
|
+
self._icon_VVFaded = QtGui.QIcon()
|
|
816
|
+
self._icon_VVFaded.addPixmap(
|
|
817
|
+
QtGui.QPixmap(settings.RESOURCE_DIR + "/verticalview.png"),
|
|
818
|
+
QtGui.QIcon.Normal, QtGui.QIcon.On
|
|
819
|
+
)
|
|
820
|
+
self._icon_VV = QtGui.QIcon()
|
|
821
|
+
self._icon_VV.addPixmap(
|
|
822
|
+
QtGui.QPixmap(settings.RESOURCE_DIR + "/verticalview.png"),
|
|
823
|
+
QtGui.QIcon.Normal, QtGui.QIcon.On
|
|
824
|
+
)
|
|
946
825
|
|
|
826
|
+
self.actionVerticalView.setIcon(self._icon_VV)
|
|
827
|
+
self.actionVerticalView.setCheckable(True)
|
|
828
|
+
self.actionVerticalView.setToolTip("Switch to Vertical (Coronal) View")
|
|
829
|
+
self.actionVerticalView.triggered.connect(lambda: self.setView("vertical"))
|
|
947
830
|
|
|
831
|
+
#############################################################
|
|
948
832
|
self.actionLine = QtWidgets.QAction(Main)
|
|
949
833
|
self.actionLine.setObjectName("actionLine")
|
|
950
834
|
self._icon_lineFaded = QtGui.QIcon()
|
|
951
|
-
self._icon_lineFaded.addPixmap(QtGui.QPixmap(
|
|
835
|
+
self._icon_lineFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/linefaded.png"), QtGui.QIcon.Normal,
|
|
836
|
+
QtGui.QIcon.On)
|
|
952
837
|
self._icon_line = QtGui.QIcon()
|
|
953
|
-
self._icon_line.addPixmap(QtGui.QPixmap(
|
|
838
|
+
self._icon_line.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/line.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
954
839
|
self.actionLine.setIcon(self._icon_line)
|
|
955
840
|
|
|
956
|
-
|
|
957
|
-
|
|
958
841
|
self.actionPaint = QtWidgets.QAction(Main)
|
|
959
842
|
self.actionPaint.setObjectName("actionPaint")
|
|
960
843
|
self._icon_pencilFaded = QtGui.QIcon()
|
|
961
|
-
self._icon_pencilFaded.addPixmap(QtGui.QPixmap(
|
|
844
|
+
self._icon_pencilFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/pencilFaded.png"), QtGui.QIcon.Normal,
|
|
845
|
+
QtGui.QIcon.On)
|
|
962
846
|
self._icon_pencil = QtGui.QIcon()
|
|
963
|
-
self._icon_pencil.addPixmap(QtGui.QPixmap(
|
|
847
|
+
self._icon_pencil.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/pencil.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
964
848
|
|
|
965
849
|
self.actionPaint.setIcon(self._icon_pencilFaded)
|
|
966
850
|
|
|
967
|
-
|
|
968
851
|
self.actionErase = QtWidgets.QAction(Main)
|
|
969
852
|
self.actionErase.setObjectName("actionErase")
|
|
970
853
|
self._icon_EraserFaded = QtGui.QIcon()
|
|
971
|
-
self._icon_EraserFaded.addPixmap(QtGui.QPixmap(
|
|
854
|
+
self._icon_EraserFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/EraserFaded.png"), QtGui.QIcon.Normal,
|
|
855
|
+
QtGui.QIcon.On)
|
|
972
856
|
self._icon_Eraser = QtGui.QIcon()
|
|
973
|
-
self._icon_Eraser.addPixmap(QtGui.QPixmap(
|
|
857
|
+
self._icon_Eraser.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/Eraser.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
974
858
|
self.actionErase.setIcon(self._icon_EraserFaded)
|
|
975
859
|
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
860
|
self.actionLazyContour = QtWidgets.QAction(Main)
|
|
980
861
|
self.actionLazyContour.setObjectName("actionLazyContour")
|
|
981
862
|
icon = QtGui.QIcon()
|
|
982
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
863
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/zoom_out.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
983
864
|
self.actionLazyContour.setIcon(icon)
|
|
984
865
|
|
|
985
|
-
|
|
986
866
|
self.actionArrow = QtWidgets.QAction(Main)
|
|
987
867
|
self.actionArrow.setObjectName("actionArrow")
|
|
988
868
|
self._icon_arrowFaded = QtGui.QIcon()
|
|
989
|
-
self._icon_arrowFaded.addPixmap(QtGui.QPixmap(
|
|
869
|
+
self._icon_arrowFaded.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/arrowFaded.png"), QtGui.QIcon.Normal,
|
|
870
|
+
QtGui.QIcon.On)
|
|
990
871
|
self._icon_arrow = QtGui.QIcon()
|
|
991
|
-
self._icon_arrow.addPixmap(QtGui.QPixmap(
|
|
872
|
+
self._icon_arrow.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/arrow.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
992
873
|
self.actionArrow.setIcon(self._icon_arrowFaded)
|
|
993
874
|
|
|
994
875
|
######################### Rotate ################################
|
|
995
876
|
|
|
996
877
|
self.actionrotate = QtWidgets.QAction(Main)
|
|
997
878
|
icon1 = QtGui.QIcon()
|
|
998
|
-
icon1.addPixmap(QtGui.QPixmap(
|
|
999
|
-
icon1.addPixmap(QtGui.QPixmap(
|
|
879
|
+
icon1.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/action_check.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
880
|
+
icon1.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/action_check_OFF.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
1000
881
|
self.actionrotate.setIcon(icon1)
|
|
1001
882
|
self.actionrotate.setObjectName("actionrotate")
|
|
1002
883
|
self.actionrotate.setCheckable(True)
|
|
1003
884
|
|
|
1004
|
-
|
|
1005
|
-
#self.pushButton
|
|
1006
|
-
#self.pushButton.
|
|
1007
|
-
#self.pushButton.setObjectName("pushButton")
|
|
1008
|
-
|
|
885
|
+
# self.pushButton = QtWidgets.QPushButton(self.centralwidget)
|
|
886
|
+
# self.pushButton.setGeometry(QtCore.QRect(50, 330, 89, 25))
|
|
887
|
+
# self.pushButton.setObjectName("pushButton")
|
|
1009
888
|
|
|
1010
889
|
|
|
1011
|
-
######################## SEG ########################################
|
|
1012
|
-
self.actionNNVentriclesSagittal = QtWidgets.QAction(Main)
|
|
1013
|
-
self.actionNNVentriclesSagittal.setObjectName("actionSag")
|
|
1014
|
-
self.actionNNVentriclesCoronal = QtWidgets.QAction(Main)
|
|
1015
|
-
self.actionNNVentriclesCoronal.setObjectName("actionCor")
|
|
1016
|
-
self.actionNNVentriclesAxial = QtWidgets.QAction(Main)
|
|
1017
|
-
self.actionNNVentriclesAxial.setObjectName("actionNNVentriclesAxial")
|
|
1018
|
-
|
|
1019
|
-
self.actionNNventricleSegm = QtWidgets.QAction(Main)
|
|
1020
|
-
self.actionNNventricleSegm.setObjectName('Ventricle segmentation')
|
|
1021
|
-
|
|
1022
|
-
self.actionN4Bias = QtWidgets.QAction(Main)
|
|
1023
|
-
self.actionN4Bias.setObjectName('N4 Bias field correction')
|
|
1024
|
-
|
|
1025
|
-
self.actionTissueSeg = QtWidgets.QAction(Main)
|
|
1026
|
-
self.actionTissueSeg.setObjectName('FCM')
|
|
1027
|
-
|
|
1028
890
|
|
|
1029
891
|
self.actionHistImage = QtWidgets.QAction(Main)
|
|
1030
892
|
self.actionHistImage.setObjectName('Histogram Image')
|
|
1031
893
|
|
|
1032
|
-
self.actionResizeImage = QtWidgets.QAction(Main)
|
|
1033
|
-
self.actionResizeImage.setObjectName('Histogram Image')
|
|
1034
894
|
|
|
1035
|
-
self.actionBET = QtWidgets.QAction(Main)
|
|
1036
|
-
self.actionBET.setObjectName('BET')
|
|
1037
895
|
|
|
1038
|
-
|
|
1039
|
-
self.actionBEDL.setObjectName('Deep BET')
|
|
896
|
+
|
|
1040
897
|
|
|
1041
898
|
self.actionImageThresholding = QtWidgets.QAction(Main)
|
|
1042
899
|
self.actionImageThresholding.setObjectName('Image Thresholding')
|
|
1043
900
|
|
|
1044
|
-
|
|
1045
901
|
self.actionImageRegistration = QtWidgets.QAction(Main)
|
|
1046
902
|
self.actionImageRegistration.setObjectName('Image Registration')
|
|
1047
903
|
|
|
@@ -1051,16 +907,13 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
1051
907
|
self.actionMasking = QtWidgets.QAction(Main)
|
|
1052
908
|
self.actionMasking.setObjectName('Image Masking')
|
|
1053
909
|
|
|
910
|
+
|
|
911
|
+
|
|
1054
912
|
self.actionOperationMask = QtWidgets.QAction(Main)
|
|
1055
913
|
self.actionOperationMask.setObjectName('Masking Operations')
|
|
1056
914
|
|
|
1057
|
-
self.actionChangeCS = QtWidgets.QAction(Main)
|
|
1058
|
-
self.actionChangeCS.setObjectName('Change CS')
|
|
1059
915
|
|
|
1060
916
|
|
|
1061
|
-
self.actionNNventricleGatherIm = QtWidgets.QAction(Main)
|
|
1062
|
-
self.actionNNventricleGatherIm.setObjectName("actionNNventricleGatherIm")
|
|
1063
|
-
|
|
1064
917
|
######################## CALC ########################################
|
|
1065
918
|
|
|
1066
919
|
self.actionTVCor = QtWidgets.QAction(Main)
|
|
@@ -1076,17 +929,9 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
1076
929
|
self.actionabout = QtWidgets.QAction(Main)
|
|
1077
930
|
self.actionabout.setObjectName("actionabout")
|
|
1078
931
|
icon = QtGui.QIcon()
|
|
1079
|
-
icon.addPixmap(QtGui.QPixmap(
|
|
932
|
+
icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/about.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
1080
933
|
self.actionabout.setIcon(icon)
|
|
1081
|
-
self.actionabout.triggered.connect(self.about)
|
|
1082
934
|
|
|
1083
|
-
|
|
1084
|
-
######################### Help->Aobut ################################
|
|
1085
|
-
#self.actionVersion = QtWidgets.QAction(self.menubar)
|
|
1086
|
-
#self.actionVersion.setObjectName("actionVersion")
|
|
1087
|
-
#self.actionVersion.setStyleSheet("color: blue;")
|
|
1088
|
-
#self.actionVersion = QtWidgets.QWidgetAction(Main)
|
|
1089
|
-
#self.actionVersion.setForeground(QtGui.QColor('blue'))
|
|
1090
935
|
self.actionVersion = QtWidgets.QWidgetAction(self)
|
|
1091
936
|
label = QtWidgets.QLabel("Version {}".format(VERSION))
|
|
1092
937
|
label.setStyleSheet("color: white;")
|
|
@@ -1095,24 +940,85 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
1095
940
|
######################### Help->Manual ################################
|
|
1096
941
|
self.actionmanual = QtWidgets.QAction(Main)
|
|
1097
942
|
self.actionmanual.setObjectName("actionabout")
|
|
1098
|
-
#icon = QtGui.QIcon()
|
|
1099
|
-
#icon.addPixmap(QtGui.QPixmap(
|
|
1100
|
-
#self.actionmanual.setIcon(icon)
|
|
1101
|
-
|
|
943
|
+
# icon = QtGui.QIcon()
|
|
944
|
+
# icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/about.png"), QtGui.QIcon.Normal, QtGui.QIcon.On)
|
|
945
|
+
# self.actionmanual.setIcon(icon)
|
|
946
|
+
|
|
947
|
+
def _setup_menus(self, Main):
|
|
948
|
+
"""Creates the menubar and menus, then populates them with actions."""
|
|
949
|
+
self.menubar = QtWidgets.QMenuBar(Main)
|
|
950
|
+
self.menubar.setNativeMenuBar(False)
|
|
951
|
+
self.menubar.setGeometry(QtCore.QRect(0, 0, 1050, 22))
|
|
952
|
+
self.menubar.setObjectName("menubar")
|
|
953
|
+
Main.setMenuBar(self.menubar)
|
|
954
|
+
|
|
955
|
+
self.menuFile = QtWidgets.QMenu(self.menubar)
|
|
956
|
+
self.menuFile.setObjectName("menuFile")
|
|
957
|
+
self.menuAbout = QtWidgets.QMenu(self.menubar)
|
|
958
|
+
self.menuAbout.setObjectName("menuAbout")
|
|
959
|
+
|
|
960
|
+
self.menuView = QtWidgets.QMenu(self.menubar)
|
|
961
|
+
self.menuView.setObjectName("menuView")
|
|
962
|
+
|
|
963
|
+
self.menuToolbar = QtWidgets.QMenu(self.menuView)
|
|
964
|
+
self.menuToolbar.setObjectName("menuToolbar")
|
|
965
|
+
|
|
966
|
+
self.menuWidgets = QtWidgets.QMenu(self.menuView)
|
|
967
|
+
self.menuWidgets.setObjectName("menuWidgets")
|
|
968
|
+
|
|
969
|
+
self.menuTools = QtWidgets.QMenu(self.menubar)
|
|
970
|
+
self.menuTools.setObjectName("menuTools")
|
|
971
|
+
|
|
972
|
+
self.menuPlugins = QtWidgets.QMenu(self.menubar)
|
|
973
|
+
self.menuPlugins.setObjectName("MenuPlugins")
|
|
974
|
+
|
|
975
|
+
self.menuSeg = QtWidgets.QMenu(self.menuTools)
|
|
976
|
+
self.menuSeg.setObjectName("menuSeg")
|
|
977
|
+
|
|
978
|
+
self.menuCalc = QtWidgets.QMenu(self.menubar)
|
|
979
|
+
self.menuCalc.setObjectName("menuCalc")
|
|
980
|
+
|
|
981
|
+
self.menuPreprocess = QtWidgets.QMenu(self.menuTools)
|
|
982
|
+
self.menuPreprocess.setObjectName("menuPrep")
|
|
983
|
+
|
|
1102
984
|
|
|
985
|
+
self.menuRegistration = QtWidgets.QMenu(self.menuTools)
|
|
986
|
+
self.menuRegistration.setObjectName("menuRegistration")
|
|
987
|
+
|
|
988
|
+
self.menuBasicInfo = QtWidgets.QMenu(self.menuTools)
|
|
989
|
+
self.menuBasicInfo.setObjectName("MenuBasicInfo")
|
|
990
|
+
|
|
991
|
+
self.menuImport = QtWidgets.QMenu(self.menubar)
|
|
992
|
+
self.menuImport.setObjectName("menuImport")
|
|
993
|
+
|
|
994
|
+
self.menuExport = QtWidgets.QMenu(self.menubar)
|
|
995
|
+
self.menuExport.setObjectName("menuExport")
|
|
996
|
+
|
|
997
|
+
self.menuTV = QtWidgets.QMenu(self.menuCalc)
|
|
998
|
+
self.menuTV.setObjectName("menuTV")
|
|
999
|
+
|
|
1000
|
+
self.menuImport.addAction(self.actionOpenUS)
|
|
1001
|
+
self.menuImport.addAction(self.actionOpenMRI)
|
|
1002
|
+
|
|
1003
|
+
self.menuImport.addSeparator()
|
|
1004
|
+
self.menuImport.addAction(self.actionImportSegEco)
|
|
1005
|
+
self.menuImport.addAction(self.actionImportSegMRI)
|
|
1006
|
+
|
|
1007
|
+
self.menuExport.addAction(self.actionExportImMRI)
|
|
1008
|
+
self.menuExport.addAction(self.actionExportImEco)
|
|
1103
1009
|
|
|
1010
|
+
self.menuExport.addSeparator()
|
|
1011
|
+
self.menuExport.addAction(self.actionExportSegEco)
|
|
1012
|
+
self.menuExport.addAction(self.actionExportSegMRI)
|
|
1104
1013
|
|
|
1105
|
-
######################### Actions ################################
|
|
1106
|
-
#self.menuFile.addAction(self.actionOpenUS)
|
|
1107
|
-
#self.menuFile.addAction(self.actionOpenMRI)
|
|
1108
1014
|
self.menuFile.addAction(self.actionNew)
|
|
1109
1015
|
self.menuFile.addAction(self.actionLoad)
|
|
1110
1016
|
self.menuFile.addSeparator()
|
|
1111
1017
|
self.menuFile.addAction(self.actionsave)
|
|
1112
1018
|
self.menuFile.addAction(self.actionsaveas)
|
|
1113
|
-
#self.menuFile.addAction(self.actionsaveModified)
|
|
1019
|
+
# self.menuFile.addAction(self.actionsaveModified)
|
|
1114
1020
|
self.menuFile.addSeparator()
|
|
1115
|
-
#self.menuFile.addAction(self.actionconvert)
|
|
1021
|
+
# self.menuFile.addAction(self.actionconvert)
|
|
1116
1022
|
self.menuFile.addMenu(self.menuImport)
|
|
1117
1023
|
self.menuFile.addMenu(self.menuExport)
|
|
1118
1024
|
self.menuFile.addSeparator()
|
|
@@ -1130,7 +1036,6 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
1130
1036
|
self.menuAbout.addAction(self.actionabout)
|
|
1131
1037
|
self.menuAbout.addAction(self.actionVersion)
|
|
1132
1038
|
|
|
1133
|
-
|
|
1134
1039
|
self.menuView.addAction(self.actionMain_Toolbar)
|
|
1135
1040
|
self.menuView.addAction(self.action_interaction_Toolbar)
|
|
1136
1041
|
self.menuView.addAction(self.action_guideLines)
|
|
@@ -1139,19 +1044,19 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
1139
1044
|
self.menuToolbar.addAction(self.actionMain_Toolbar)
|
|
1140
1045
|
self.menuToolbar.addAction(self.action_interaction_Toolbar)
|
|
1141
1046
|
self.menuView.addMenu(self.menuWidgets)
|
|
1047
|
+
|
|
1048
|
+
# ... (all menuView adds) ...
|
|
1049
|
+
"""
|
|
1050
|
+
|
|
1142
1051
|
actions_widgets = self.createPopupMenu().actions()
|
|
1143
1052
|
for action in actions_widgets:
|
|
1144
1053
|
self.menuWidgets.addAction(action)
|
|
1145
|
-
|
|
1054
|
+
"""
|
|
1146
1055
|
self.menuSeg.addSeparator()
|
|
1147
1056
|
|
|
1148
|
-
#self.menuSeg.addAction(self.actionNNVentriclesSagittal)
|
|
1149
|
-
#self.menuSeg.addAction(self.actionNNVentriclesCoronal)
|
|
1150
|
-
#self.menuSeg.addAction(self.actionNNVentriclesAxial)
|
|
1151
|
-
self.menuSeg.addAction(self.actionNNventricleSegm)
|
|
1152
1057
|
|
|
1153
|
-
#self.menuSeg.addAction(self.actionNNventricleGatherIm)
|
|
1154
1058
|
|
|
1059
|
+
# self.menuSeg.addAction(self.actionNNventricleGatherIm)
|
|
1155
1060
|
|
|
1156
1061
|
self.menuTV.addSeparator()
|
|
1157
1062
|
self.menuTV.addAction(self.actionTVCor)
|
|
@@ -1165,54 +1070,89 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
1165
1070
|
self.menuRegistration.addAction(self.actionImageRegistration)
|
|
1166
1071
|
self.menuRegistration.addAction(self.actionImageTransformation)
|
|
1167
1072
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
1073
|
self.menuPreprocess.addAction(self.actionMasking)
|
|
1171
1074
|
self.menuPreprocess.addAction(self.actionOperationMask)
|
|
1172
1075
|
self.menuPreprocess.addSeparator()
|
|
1173
|
-
self.menuPreprocess.addAction(self.
|
|
1174
|
-
|
|
1175
|
-
self.menuPreprocess.addSeparator()
|
|
1176
|
-
self.menuPreprocess.addAction(self.actionN4Bias)
|
|
1076
|
+
self.menuPreprocess.addAction(self.actionImageThresholding)
|
|
1077
|
+
|
|
1177
1078
|
|
|
1178
1079
|
|
|
1179
1080
|
|
|
1180
|
-
self.menuSegmentation.addAction(self.actionBEDL)
|
|
1181
|
-
self.menuSegmentation.addAction(self.actionBET)
|
|
1182
|
-
self.menuSegmentation.addSeparator()
|
|
1183
|
-
self.menuSegmentation.addAction(self.actionTissueSeg)
|
|
1184
|
-
self.menuSegmentation.addAction(self.actionImageThresholding)
|
|
1185
1081
|
|
|
1186
1082
|
|
|
1187
1083
|
self.menuCalc.addAction(self.menuTV.menuAction())
|
|
1084
|
+
standard_style = """
|
|
1085
|
+
QMenu::separator {
|
|
1086
|
+
height: 1px; /* Set the height of the separator line */
|
|
1087
|
+
background: lightgray; /* Give the line a color */
|
|
1088
|
+
margin-top: 5px; /* Add 5 pixels of empty space above the line */
|
|
1089
|
+
margin-bottom: 5px; /* Add 5 pixels of empty space below the line */
|
|
1090
|
+
}
|
|
1091
|
+
"""
|
|
1092
|
+
self.menuTools.setStyleSheet(standard_style)
|
|
1093
|
+
self.menuPlugins.setStyleSheet(standard_style)
|
|
1094
|
+
|
|
1095
|
+
|
|
1188
1096
|
|
|
1189
|
-
#
|
|
1190
|
-
#self.menuTools.addAction(self.actionPan)
|
|
1191
|
-
#self.menuTools.addAction(self.actionContour)
|
|
1192
|
-
#self.menuTools.addAction(self.actionLazyContour)
|
|
1193
|
-
#self.menuTools.addAction(self.actionNNventricleSegm)
|
|
1194
|
-
#self.menuTools.addAction(self.actionFile_changeIM)
|
|
1097
|
+
# Your existing code to add actions and separators
|
|
1195
1098
|
self.menuTools.addAction(self.actionUndo)
|
|
1196
1099
|
self.menuTools.addAction(self.actionRedo)
|
|
1197
|
-
#self.menuTools.addAction(self.actionContourGen)
|
|
1198
|
-
#self.menuTools.addAction(self.menuSeg.menuAction())
|
|
1199
1100
|
self.menuTools.addSeparator()
|
|
1200
1101
|
self.menuTools.addAction(self.menuPreprocess.menuAction())
|
|
1201
1102
|
self.menuTools.addSeparator()
|
|
1202
|
-
self.menuTools.addAction(self.
|
|
1103
|
+
self.menuTools.addAction(self.menuRegistration.menuAction())
|
|
1203
1104
|
self.menuTools.addSeparator()
|
|
1204
|
-
#self.menuTools.addAction(self.menuRegistration.menuAction())
|
|
1205
1105
|
self.menuTools.addAction(self.menuBasicInfo.menuAction())
|
|
1206
1106
|
|
|
1207
|
-
#self.menuTools.addAction(self.actionNNventricleGatherIm)
|
|
1107
|
+
# self.menuTools.addAction(self.actionNNventricleGatherIm)
|
|
1208
1108
|
|
|
1209
1109
|
self.menubar.addAction(self.menuFile.menuAction())
|
|
1210
1110
|
self.menubar.addAction(self.menuView.menuAction())
|
|
1211
1111
|
self.menubar.addAction(self.menuTools.menuAction())
|
|
1212
|
-
|
|
1112
|
+
self.menubar.addAction(self.menuPlugins.menuAction())
|
|
1213
1113
|
self.menubar.addAction(self.menuAbout.menuAction())
|
|
1214
|
-
#self.menubar.addAction(self.actionVersion)
|
|
1215
1114
|
|
|
1115
|
+
# self.menubar.addAction(self.actionVersion)
|
|
1116
|
+
|
|
1117
|
+
def _setup_other_widgets(self, Main):
|
|
1118
|
+
"""Creates widgets not in menus/toolbars (Docks, ComboBox, Logo)."""
|
|
1119
|
+
self.pixmap_box_label = QtWidgets.QLabel(Main)
|
|
1120
|
+
self.pixmap_box_label.setText('Combined')
|
|
1121
|
+
|
|
1122
|
+
self.createDockWidget(Main)
|
|
1123
|
+
|
|
1124
|
+
# Logo for toolbar
|
|
1125
|
+
self.logo = QtWidgets.QLabel(Main)
|
|
1126
|
+
self.logo.setPixmap(QtGui.QPixmap(settings.DEFAULT_USE_DIR + "/melage_top.png"))
|
|
1127
|
+
self.logo.resize(100, 50) # This hardcoded size is not ideal
|
|
1128
|
+
|
|
1129
|
+
# NewDialog
|
|
1130
|
+
self.newdialog = NewDialog(Main) # Assumes NewDialog is imported
|
|
1131
|
+
|
|
1132
|
+
# Label Size Policies (This assumes self.label_1, etc. exist from a .ui file)
|
|
1133
|
+
try:
|
|
1134
|
+
|
|
1135
|
+
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed)
|
|
1136
|
+
sizePolicy.setHorizontalStretch(0)
|
|
1137
|
+
sizePolicy.setVerticalStretch(0)
|
|
1138
|
+
sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
|
|
1139
|
+
self.label_1.setSizePolicy(sizePolicy)
|
|
1140
|
+
self.label_2.setSizePolicy(sizePolicy)
|
|
1141
|
+
self.label_3.setSizePolicy(sizePolicy)
|
|
1142
|
+
self.label_4.setSizePolicy(sizePolicy)
|
|
1143
|
+
self.label_5.setSizePolicy(sizePolicy)
|
|
1144
|
+
self.label_6.setSizePolicy(sizePolicy)
|
|
1145
|
+
self.label_7.setSizePolicy(sizePolicy)
|
|
1146
|
+
self.label_8.setSizePolicy(sizePolicy)
|
|
1147
|
+
self.label_9.setSizePolicy(sizePolicy)
|
|
1148
|
+
self.label_10.setSizePolicy(sizePolicy)
|
|
1149
|
+
self.label_11.setSizePolicy(sizePolicy)
|
|
1150
|
+
self.label_12.setSizePolicy(sizePolicy)
|
|
1151
|
+
except AttributeError:
|
|
1152
|
+
print("Warning: Labels not found. Skipping label size policy setup.")
|
|
1153
|
+
|
|
1154
|
+
def _setup_toolbars(self, Main):
|
|
1155
|
+
"""Creates and populates all toolbars."""
|
|
1216
1156
|
|
|
1217
1157
|
self.toolBar = QtWidgets.QToolBar(Main)
|
|
1218
1158
|
self.toolBar.setObjectName("toolBar")
|
|
@@ -1223,26 +1163,26 @@ class Ui_Main(dockWidgets, openglWidgets):
|
|
|
1223
1163
|
self.toolBar.addAction(self.actionsave)
|
|
1224
1164
|
|
|
1225
1165
|
self.toolBar.addSeparator()
|
|
1226
|
-
#self.toolBar.addAction(self.actionsaveas)
|
|
1227
|
-
#spacerItem = QtWidgets.QWidget()
|
|
1228
|
-
#spacerItem.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
|
1229
|
-
#self.toolBar.addWidget(spacerItem)
|
|
1166
|
+
# self.toolBar.addAction(self.actionsaveas)
|
|
1167
|
+
# spacerItem = QtWidgets.QWidget()
|
|
1168
|
+
# spacerItem.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
|
1169
|
+
# self.toolBar.addWidget(spacerItem)
|
|
1230
1170
|
cts = """
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
}
|
|
1238
|
-
QToolBar::separator:horizontal
|
|
1239
|
-
{
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
}
|
|
1244
|
-
QToolButton{margin: 2px 2px;}
|
|
1245
|
-
|
|
1171
|
+
QToolBar {
|
|
1172
|
+
background-color: #000000;
|
|
1173
|
+
border-bottom: 0px solid #19232D;
|
|
1174
|
+
padding: 0px;
|
|
1175
|
+
font-weight: bold;
|
|
1176
|
+
spacing: 0px;
|
|
1177
|
+
}
|
|
1178
|
+
QToolBar::separator:horizontal
|
|
1179
|
+
{
|
|
1180
|
+
width: 10px;
|
|
1181
|
+
margin-left: 10px;
|
|
1182
|
+
margin-right: 10px;
|
|
1183
|
+
}
|
|
1184
|
+
QToolButton{margin: 2px 2px;}
|
|
1185
|
+
"""
|
|
1246
1186
|
self.toolBar.setStyleSheet(cts)
|
|
1247
1187
|
|
|
1248
1188
|
self.toolBar.addAction(self.actionOpenUS)
|
|
@@ -1251,14 +1191,12 @@ QToolButton{margin: 2px 2px;}
|
|
|
1251
1191
|
self.toolBar.addAction(self.actionOpenMRI)
|
|
1252
1192
|
self.toolBar.addAction(self.actionImportSegMRI)
|
|
1253
1193
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
#self.toolBar.addAction(self.actionOpenFA)
|
|
1257
|
-
#self.toolBar.addAction(self.actionOpenTract)
|
|
1194
|
+
# self.toolBar.addAction(self.actionOpenFA)
|
|
1195
|
+
# self.toolBar.addAction(self.actionOpenTract)
|
|
1258
1196
|
self.toolBar.addSeparator()
|
|
1259
1197
|
self.actionComboBox_visible = self.toolBar.addWidget(self.actionComboBox)
|
|
1260
1198
|
self.actionComboBox_visible.setVisible(False)
|
|
1261
|
-
#self.toolBar.addSeparator()
|
|
1199
|
+
# self.toolBar.addSeparator()
|
|
1262
1200
|
spacerItem = QtWidgets.QWidget()
|
|
1263
1201
|
spacerItem.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
|
1264
1202
|
|
|
@@ -1285,10 +1223,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
1285
1223
|
self.toolBar2.addSeparator()
|
|
1286
1224
|
self.toolBar2.addAction(self.actionColor)
|
|
1287
1225
|
self.toolBar2.addWidget(self.pixmap_box_label)
|
|
1288
|
-
#self.toolBar2.addSeparator()
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1226
|
+
# self.toolBar2.addSeparator()
|
|
1292
1227
|
|
|
1293
1228
|
spacerItem = QtWidgets.QWidget()
|
|
1294
1229
|
spacerItem.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
|
|
@@ -1299,139 +1234,142 @@ QToolButton{margin: 2px 2px;}
|
|
|
1299
1234
|
|
|
1300
1235
|
self.toolBar2.addAction(self.actionPoints)
|
|
1301
1236
|
self.toolBar2.addSeparator()
|
|
1237
|
+
self.toolBar2.addAction(self.actionZoomNeutral)
|
|
1302
1238
|
self.toolBar2.addAction(self.actionZoomIn)
|
|
1303
1239
|
self.toolBar2.addAction(self.actionZoomOut)
|
|
1304
1240
|
self.toolBar2.addSeparator()
|
|
1241
|
+
self.toolBar2.addAction(self.actionVerticalView)
|
|
1242
|
+
self.toolBar2.addAction(self.actionHorizontalView)
|
|
1305
1243
|
self.toolBar2.addAction(self.actionRuler)
|
|
1306
1244
|
self.toolBar2.addAction(self.actionGoTo)
|
|
1307
1245
|
self.toolBar2.addAction(self.action3D)
|
|
1308
1246
|
self.toolBar2.setDisabled(True)
|
|
1247
|
+
pixel_ratio = self.devicePixelRatio()
|
|
1248
|
+
base_size = 36
|
|
1249
|
+
dynamic_size = int(base_size * pixel_ratio)
|
|
1250
|
+
self.toolBar2.setIconSize(QtCore.QSize(dynamic_size, dynamic_size))
|
|
1251
|
+
self.toolBar.setIconSize(QtCore.QSize(dynamic_size, dynamic_size))
|
|
1252
|
+
# Set fixed size policy
|
|
1253
|
+
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
|
1254
|
+
self.toolBar.setSizePolicy(sizePolicy)
|
|
1255
|
+
self.toolBar2.setSizePolicy(sizePolicy)
|
|
1256
|
+
|
|
1257
|
+
def _connect_signals(self):
|
|
1258
|
+
"""Connects all signals to slots."""
|
|
1259
|
+
|
|
1260
|
+
# --- Action Connections ---
|
|
1261
|
+
self.actionColor.triggered.connect(self.color_picker)
|
|
1262
|
+
self.horizontalSlider_1.valueChanged.connect(self.changeSight1)
|
|
1263
|
+
self.horizontalSlider_2.valueChanged.connect(self.changeSight2)
|
|
1264
|
+
self.horizontalSlider_3.valueChanged.connect(self.changeSight3)
|
|
1265
|
+
self.horizontalSlider_4.valueChanged.connect(self.changeSight4)
|
|
1266
|
+
self.horizontalSlider_5.valueChanged.connect(self.changeSight5)
|
|
1267
|
+
self.horizontalSlider_6.valueChanged.connect(self.changeSight6)
|
|
1268
|
+
self.horizontalSlider_11.valueChanged.connect(self.changeSightTab3)
|
|
1269
|
+
self.horizontalSlider_12.valueChanged.connect(self.changeSightTab4)
|
|
1270
|
+
self.table_update.clicked.connect(self.linkMRIECO)
|
|
1271
|
+
self.table_link.clicked.connect(self.linkBoth)
|
|
1272
|
+
|
|
1273
|
+
self.radioButton_1.clicked.connect(partial(self.changeToCoronal, 'eco'))
|
|
1274
|
+
self.radioButton_2.clicked.connect(partial(self.changeToSagittal, 'eco'))
|
|
1275
|
+
self.radioButton_3.clicked.connect(partial(self.changeToAxial, 'eco'))
|
|
1276
|
+
self.radioButton_4.clicked.connect(self.showSegOnWindow)
|
|
1309
1277
|
|
|
1278
|
+
self.radioButton_21_1.clicked.connect(partial(self.changeToCoronal, 'mri'))
|
|
1279
|
+
self.radioButton_21_2.clicked.connect(partial(self.changeToSagittal, 'mri'))
|
|
1280
|
+
self.radioButton_21_3.clicked.connect(partial(self.changeToAxial, 'mri'))
|
|
1281
|
+
self.radioButton_21.clicked.connect(self.showSegOnWindow)
|
|
1310
1282
|
|
|
1283
|
+
self.actionOpenUS.triggered.connect(self.browseUS)
|
|
1284
|
+
self.actionOpenMRI.triggered.connect(self.browseMRI)
|
|
1285
|
+
self.actionComboBox.currentTextChanged.connect(self.changeVolume)
|
|
1286
|
+
self.actionOpenFA.triggered.connect(self.browseFA)
|
|
1287
|
+
self.actionOpenTract.triggered.connect(self.browseTractoGraphy)
|
|
1288
|
+
self.actionNew.triggered.connect(self.newProject)
|
|
1289
|
+
self.actionCloseUS.triggered.connect(self.CloseUS)
|
|
1290
|
+
self.actionCloseMRI.triggered.connect(self.CloseMRI)
|
|
1291
|
+
self.actionImportSegMRI.triggered.connect(partial(self.importData, 'MRISEG'))
|
|
1292
|
+
self.actionImportSegEco.triggered.connect(partial(self.importData, 'USSEG'))
|
|
1293
|
+
self.actionExportImEco.triggered.connect(partial(self.exportData, 'USIM'))
|
|
1294
|
+
self.actionExportSegEco.triggered.connect(partial(self.exportData, 'USSEG'))
|
|
1295
|
+
self.actionExportImMRI.triggered.connect(partial(self.exportData, 'MRIIM'))
|
|
1296
|
+
self.actionExportSegMRI.triggered.connect(partial(self.exportData, 'MRISEG'))
|
|
1297
|
+
self.actionScreenS.triggered.connect(self.showScreenShotWindow)
|
|
1298
|
+
self.actionLoad.triggered.connect(self.loadProject)
|
|
1299
|
+
self.actionFile_info.triggered.connect(self.showInfoWindow)
|
|
1300
|
+
self.actionUndo.triggered.connect(self.Undo)
|
|
1301
|
+
self.actionRedo.triggered.connect(self.Redo)
|
|
1302
|
+
self.actionFile_changeIM.triggered.connect(self.showIMVARSWindow)
|
|
1303
|
+
self.actionfile_iminfo.triggered.connect(partial(self.maskingShow, 5))
|
|
1304
|
+
self.actionconvert.triggered.connect(self.convert)
|
|
1305
|
+
self.actionexit.triggered.connect(self.close)
|
|
1306
|
+
self.actionsave.triggered.connect(self.save)
|
|
1307
|
+
self.actionsaveas.triggered.connect(self.saveas)
|
|
1308
|
+
self.actionabout.triggered.connect(self.about)
|
|
1309
|
+
self.actionmanual.triggered.connect(self.manual)
|
|
1311
1310
|
self.actionArrow.triggered.connect(partial(self.setCursors, 0))
|
|
1312
1311
|
self.actionPan.triggered.connect(partial(self.setCursors, 2))
|
|
1313
1312
|
self.actionPaint.triggered.connect(partial(self.setCursors, 1))
|
|
1314
1313
|
self.actionErase.triggered.connect(partial(self.setCursors, 3))
|
|
1315
|
-
self.actionRuler.triggered.connect(partial(self.setCursors,6))
|
|
1314
|
+
self.actionRuler.triggered.connect(partial(self.setCursors, 6))
|
|
1316
1315
|
self.actionLine.triggered.connect(partial(self.setCursors, 8))
|
|
1317
1316
|
self.actionContour.triggered.connect(partial(self.setCursors, 4))
|
|
1318
1317
|
self.actionPoints.triggered.connect(partial(self.setCursors, 5))
|
|
1319
1318
|
self.actionCircles.triggered.connect(partial(self.setCursors, 9, None))
|
|
1320
|
-
#self.actionGoTo.triggered.connect(partial(self.setCursors, 7))
|
|
1319
|
+
# self.actionGoTo.triggered.connect(partial(self.setCursors, 7))
|
|
1321
1320
|
self.actionGoTo.triggered.connect(self.activateGuidelines)
|
|
1322
1321
|
self.action3D.triggered.connect(self.activate3d)
|
|
1323
1322
|
self.actionZoomIn.triggered.connect(partial(self.Zoom, 'In'))
|
|
1324
1323
|
self.actionZoomOut.triggered.connect(partial(self.Zoom, 'Out'))
|
|
1324
|
+
self.actionZoomNeutral.triggered.connect(partial(self.Zoom, 'Neutral'))
|
|
1325
|
+
|
|
1325
1326
|
self.actionContourX.triggered.connect(self.showRpeatWindow)
|
|
1326
1327
|
self.actionContourX.triggered.connect(partial(self.setCursorsX, 4))
|
|
1327
1328
|
self.actionEraseX.triggered.connect(self.showRpeatWindow)
|
|
1328
1329
|
self.actionEraseX.triggered.connect(partial(self.setCursorsX, 3))
|
|
1329
|
-
#self.actionSegExportEco.triggered.connect(self.showScreenShotWindow)
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
self.retranslateUi(Main)
|
|
1335
|
-
QtCore.QMetaObject.connectSlotsByName(Main)
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
#self.horizontalSlider.valueChanged.connect(self.openGLWidget.setXRotation)
|
|
1339
|
-
#self.openGLWidget.xRotationChanged.connect(self.horizontalSlider.setValue)
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
######################### Visibility ################################
|
|
1343
|
-
|
|
1330
|
+
# self.actionSegExportEco.triggered.connect(self.showScreenShotWindow)
|
|
1344
1331
|
self.actionMain_Toolbar.triggered.connect(self.toolBar.setVisible)
|
|
1345
1332
|
self.action_guideLines.triggered.connect(self.activateGuidelines)
|
|
1346
1333
|
self.action_axisLines.triggered.connect(self.activateAxisLines)
|
|
1347
1334
|
self.toolBar.visibilityChanged.connect(self.actionMain_Toolbar.setChecked)
|
|
1348
|
-
|
|
1349
|
-
#self.action_interaction_Toolbar.triggered.connect(self.toolBar2.setVisible)
|
|
1350
|
-
#self.toolBar2.visibilityChanged.connect(self.action_interaction_Toolbar.setChecked)
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
######################## OPENG GL CONTROL PANNEL ########################
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
1335
|
self.hs_t1_1.valueChanged.connect(self.changeBrightness)
|
|
1357
1336
|
self.hs_t1_2.valueChanged.connect(self.changeContrast)
|
|
1358
1337
|
self.hs_t1_3.valueChanged.connect(self.changeBandPass)
|
|
1359
1338
|
self.hs_t1_4.valueChanged.connect(self.changeSobel)
|
|
1360
1339
|
self.hs_t1_5.valueChanged.connect(self.Rotate)
|
|
1361
1340
|
self.hs_t1_7.valueChanged.connect(self.changeBandPass)
|
|
1362
|
-
#self.hs_t1_8.valueChanged.connect(self.changeColorize)
|
|
1363
|
-
#self.colorize.clicked.connect(self.changeColorize)
|
|
1364
1341
|
self.toggle1_1.clicked.connect(self.changeHamming)
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
1342
|
self.hs_t2_1.valueChanged.connect(self.changeBrightness)
|
|
1368
1343
|
self.hs_t2_2.valueChanged.connect(self.changeContrast)
|
|
1369
1344
|
self.hs_t2_3.valueChanged.connect(self.changeBandPass)
|
|
1370
1345
|
self.hs_t2_7.valueChanged.connect(self.changeBandPass)
|
|
1371
|
-
#self.hs_t2_8.valueChanged.connect(self.changeColorize)
|
|
1372
|
-
#self.colorize_MRI.clicked.connect(self.changeColorize)
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
1346
|
self.hs_t2_4.valueChanged.connect(self.changeSobel)
|
|
1376
1347
|
self.hs_t2_5.valueChanged.connect(self.Rotate)
|
|
1377
1348
|
self.toggle2_1.clicked.connect(self.changeHamming)
|
|
1378
|
-
|
|
1379
1349
|
self.page1_s2c.clicked.connect(self.C2S)
|
|
1380
1350
|
self.page2_s2c.clicked.connect(self.C2S)
|
|
1381
|
-
|
|
1382
|
-
#self.dw2_cb.currentTextChanged.connect(self.changeColorPen)
|
|
1383
|
-
|
|
1384
|
-
#self.dockWidgetContents_mri_colors.cha
|
|
1385
1351
|
self.dw2_s2.valueChanged.connect(self.changeSizePen)
|
|
1386
1352
|
self.dw2_s1.valueChanged.connect(lambda value: self.changeRadiusCircle(value, True))
|
|
1387
1353
|
|
|
1388
|
-
|
|
1389
|
-
self.dw4_s1.valueChanged.connect(self.vnetricleSegmentShow)
|
|
1390
1354
|
self.scroll_intensity.valueChanged.connect(lambda thrsh: self.ColorIntensityChange(thrsh, 'seg'))
|
|
1391
1355
|
self.scroll_image_intensity.valueChanged.connect(lambda thrsh: self.ColorIntensityChange(thrsh, 'image'))
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
1356
|
self.page1_rot_cor.currentTextChanged.connect(self.changeRotAx)
|
|
1396
1357
|
self.page2_rot_cor.currentTextChanged.connect(self.changeRotAx)
|
|
1397
|
-
|
|
1398
1358
|
self.dw5_s1.valueChanged.connect(self.trackDistance)
|
|
1399
1359
|
self.dw5_s2.valueChanged.connect(self.trackThickness)
|
|
1400
1360
|
|
|
1401
1361
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
#self.actionrotate.triggered.connect(self.horizontalSlider.setVisible)
|
|
1407
|
-
#self.actionrotate.triggered.connect(self.label_horizontalSlider.setVisible)
|
|
1408
|
-
self.actionNNventricleSegm.triggered.connect(self.segmentVentricles)
|
|
1409
|
-
self.actionN4Bias.triggered.connect(partial(self.maskingShow, 3))
|
|
1410
1362
|
self.actionHistImage.triggered.connect(partial(self.maskingShow, 4))
|
|
1411
|
-
self.actionResizeImage.triggered.connect(partial(self.maskingShow, 8))
|
|
1412
|
-
self.actionBET.triggered.connect(partial(self.maskingShow, 7))
|
|
1413
|
-
self.actionBEDL.triggered.connect(partial(self.maskingShow, 9))#masking
|
|
1414
|
-
|
|
1415
|
-
self.actionTissueSeg.triggered.connect(partial(self.maskingShow, 10)) # FCM
|
|
1416
|
-
# FCM
|
|
1417
1363
|
|
|
1418
1364
|
|
|
1365
|
+
# FCM
|
|
1419
1366
|
self.actionImageThresholding.triggered.connect(partial(self.maskingShow, 6))
|
|
1420
1367
|
self.actionImageRegistration.triggered.connect(partial(self.registerShow, 0))
|
|
1421
1368
|
self.actionImageTransformation.triggered.connect(partial(self.registerShow, 1))
|
|
1422
1369
|
self.actionMasking.triggered.connect(partial(self.maskingShow, 0))
|
|
1423
1370
|
self.actionOperationMask.triggered.connect(partial(self.maskingShow, 1))
|
|
1424
|
-
self.actionChangeCS.triggered.connect(partial(self.maskingShow, 2))
|
|
1425
1371
|
|
|
1426
|
-
self.actionNNVentriclesCoronal.triggered.connect(partial(self.vnetricleSegmentShow, 50))
|
|
1427
|
-
self.actionNNVentriclesAxial.triggered.connect(partial(self.vnetricleSegmentShow, 50))
|
|
1428
|
-
self.actionNNVentriclesSagittal.triggered.connect(partial(self.vnetricleSegmentShow, 50))
|
|
1429
1372
|
|
|
1430
|
-
self.actionTVCor.triggered.connect(partial(self.CalcTotalVolume, 'Coronal'))
|
|
1431
|
-
self.actionTVSag.triggered.connect(partial(self.CalcTotalVolume, 'sagittal'))
|
|
1432
|
-
self.actionTVAx.triggered.connect(partial(self.CalcTotalVolume, 'Axial'))
|
|
1433
|
-
|
|
1434
|
-
self.actionNNventricleGatherIm.triggered.connect(self.gatherToIm)
|
|
1435
1373
|
name = 'openGLWidget_'
|
|
1436
1374
|
for i in range(12):
|
|
1437
1375
|
|
|
@@ -1439,8 +1377,9 @@ QToolButton{margin: 2px 2px;}
|
|
|
1439
1377
|
if hasattr(self, nameWidget):
|
|
1440
1378
|
widget = getattr(self, name + str(i + 1))
|
|
1441
1379
|
widget.segChanged.connect(
|
|
1442
|
-
lambda whiteInd, currentWidnowName, colorInd, sliceNum: self.updateSegmentation(whiteInd,
|
|
1443
|
-
|
|
1380
|
+
lambda whiteInd, currentWidnowName, colorInd, sliceNum: self.updateSegmentation(whiteInd,
|
|
1381
|
+
currentWidnowName,
|
|
1382
|
+
colorInd, sliceNum))
|
|
1444
1383
|
|
|
1445
1384
|
widget.LineChanged.connect(
|
|
1446
1385
|
lambda params: self.updateLP(params))
|
|
@@ -1467,84 +1406,114 @@ QToolButton{margin: 2px 2px;}
|
|
|
1467
1406
|
)
|
|
1468
1407
|
|
|
1469
1408
|
self.openGLWidget_14.point3dpos.connect(
|
|
1470
|
-
lambda pose3d, windowName
|
|
1409
|
+
lambda pose3d, windowName: self.updateLabelPs(pose3d, windowName, 'eco')
|
|
1471
1410
|
)
|
|
1472
1411
|
self.openGLWidget_24.point3dpos.connect(
|
|
1473
|
-
lambda pose3d, windowName
|
|
1412
|
+
lambda pose3d, windowName: self.updateLabelPs(pose3d, windowName, 'mri')
|
|
1413
|
+
)
|
|
1414
|
+
|
|
1415
|
+
self.openGLWidget_14.update_3dview.connect(
|
|
1416
|
+
lambda map_type, reset: self.update3Dview(map_type, None, 'eco')
|
|
1417
|
+
)
|
|
1418
|
+
self.openGLWidget_24.update_3dview.connect(
|
|
1419
|
+
lambda map_type, reset: self.update3Dview(map_type, None, 'mri')
|
|
1420
|
+
)
|
|
1421
|
+
|
|
1422
|
+
self.openGLWidget_14.update_cmap.connect(
|
|
1423
|
+
lambda map_type, reset: self.update3Dview(map_type, reset, 'eco')
|
|
1424
|
+
)
|
|
1425
|
+
self.openGLWidget_24.update_cmap.connect(
|
|
1426
|
+
lambda map_type, reset: self.update3Dview(map_type, reset, 'mri')
|
|
1474
1427
|
)
|
|
1475
1428
|
|
|
1429
|
+
self.tabWidget.currentChanged.connect(self.changedTab)
|
|
1430
|
+
self.openGLWidget_11.resized.connect(self.changedTab)
|
|
1431
|
+
self.openGLWidget_12.resized.connect(self.changedTab)
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
def _set_initial_state(self):
|
|
1436
|
+
"""Sets the initial visibility and enabled state of widgets."""
|
|
1437
|
+
|
|
1438
|
+
# Actions
|
|
1439
|
+
self.actionOpenUS.setDisabled(True)
|
|
1440
|
+
self.actionOpenMRI.setDisabled(True)
|
|
1441
|
+
self.actionComboBox.setDisabled(True)
|
|
1442
|
+
self.actionOpenFA.setDisabled(True)
|
|
1443
|
+
self.actionOpenTract.setDisabled(True)
|
|
1444
|
+
self.actionImportSegMRI.setDisabled(True)
|
|
1445
|
+
self.actionImportSegEco.setDisabled(True)
|
|
1446
|
+
self.actionExportImMRI.setDisabled(True)
|
|
1447
|
+
self.actionExportSegMRI.setDisabled(True)
|
|
1448
|
+
self.actionExportImEco.setDisabled(True)
|
|
1449
|
+
self.actionExportSegEco.setDisabled(True)
|
|
1450
|
+
self.actionsave.setDisabled(True)
|
|
1451
|
+
self.actionsaveas.setDisabled(True)
|
|
1452
|
+
|
|
1453
|
+
# Toolbars
|
|
1454
|
+
self.toolBar2.setDisabled(True)
|
|
1455
|
+
self.actionComboBox_visible.setVisible(False)
|
|
1456
|
+
self.actionComboBox.setVisible(False) # Also hide the widget itself
|
|
1457
|
+
|
|
1458
|
+
# Sliders
|
|
1459
|
+
self.horizontalSlider_1.setVisible(False)
|
|
1460
|
+
self.horizontalSlider_2.setVisible(False)
|
|
1461
|
+
self.horizontalSlider_3.setVisible(False)
|
|
1462
|
+
self.horizontalSlider_4.setVisible(False)
|
|
1463
|
+
self.horizontalSlider_5.setVisible(False)
|
|
1464
|
+
self.horizontalSlider_6.setVisible(False)
|
|
1465
|
+
self.horizontalSlider_7.setVisible(False)
|
|
1466
|
+
self.horizontalSlider_8.setVisible(False)
|
|
1467
|
+
self.horizontalSlider_9.setVisible(False)
|
|
1468
|
+
self.horizontalSlider_10.setVisible(False)
|
|
1469
|
+
self.horizontalSlider_11.setVisible(False)
|
|
1470
|
+
self.horizontalSlider_12.setVisible(False)
|
|
1471
|
+
|
|
1472
|
+
# Radio Buttons
|
|
1473
|
+
self.radioButton_1.setVisible(False)
|
|
1474
|
+
self.radioButton_2.setVisible(False)
|
|
1475
|
+
self.radioButton_3.setVisible(False)
|
|
1476
|
+
self.radioButton_4.setVisible(False)
|
|
1477
|
+
self.radioButton_21_1.setVisible(False)
|
|
1478
|
+
self.radioButton_21_2.setVisible(False)
|
|
1479
|
+
self.radioButton_21_3.setVisible(False)
|
|
1480
|
+
self.radioButton_21.setVisible(False)
|
|
1481
|
+
|
|
1476
1482
|
|
|
1477
|
-
self.openGLWidget_14.update_3dview.connect(
|
|
1478
|
-
lambda map_type, reset : self.update3Dview(map_type, None, 'eco')
|
|
1479
|
-
)
|
|
1480
|
-
self.openGLWidget_24.update_3dview.connect(
|
|
1481
|
-
lambda map_type, reset : self.update3Dview(map_type, None, 'mri')
|
|
1482
|
-
)
|
|
1483
1483
|
|
|
1484
|
+
def setupUi(self, Main):
|
|
1485
|
+
"""
|
|
1484
1486
|
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
self.
|
|
1489
|
-
|
|
1490
|
-
)
|
|
1487
|
+
:param Main:
|
|
1488
|
+
:return:
|
|
1489
|
+
"""
|
|
1490
|
+
self._setup_main_window(Main)
|
|
1491
|
+
self._setup_central_layout(Main)
|
|
1491
1492
|
|
|
1493
|
+
self._create_actions(Main)
|
|
1492
1494
|
|
|
1495
|
+
self._setup_menus(Main)
|
|
1496
|
+
self.load_plugins()
|
|
1497
|
+
self._setup_other_widgets(Main)
|
|
1493
1498
|
|
|
1494
|
-
self.
|
|
1495
|
-
|
|
1496
|
-
|
|
1499
|
+
self._setup_toolbars(Main)
|
|
1500
|
+
|
|
1501
|
+
# Group all signal/slot connections together
|
|
1502
|
+
self._connect_signals()
|
|
1503
|
+
|
|
1504
|
+
# Group all .setVisible(False), .setDisabled(True), etc.
|
|
1505
|
+
self._set_initial_state()
|
|
1506
|
+
self.retranslateUi(Main)
|
|
1507
|
+
QtCore.QMetaObject.connectSlotsByName(Main)
|
|
1497
1508
|
|
|
1498
1509
|
self.setFocusPolicy(Qt.StrongFocus)
|
|
1499
1510
|
self.installEventFilter(self)
|
|
1500
1511
|
self.init_state()
|
|
1501
1512
|
self.create_cursors()
|
|
1502
1513
|
|
|
1503
|
-
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
|
1504
|
-
self.toolBar2.setSizePolicy(sizePolicy)
|
|
1505
|
-
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
|
1506
|
-
self.toolBar.setSizePolicy(sizePolicy)
|
|
1507
|
-
|
|
1508
1514
|
self.Main = Main
|
|
1509
1515
|
|
|
1510
1516
|
|
|
1511
|
-
def updateDataBEDL(self, index):
|
|
1512
|
-
"""
|
|
1513
|
-
Brain Extraction widget
|
|
1514
|
-
:return:
|
|
1515
|
-
"""
|
|
1516
|
-
if index ==0:
|
|
1517
|
-
el = self.BE_DL
|
|
1518
|
-
elif index == 1:
|
|
1519
|
-
el = self.Tissue_Seg
|
|
1520
|
-
ind_image = el.comboBox_image.currentIndex()
|
|
1521
|
-
from melage.utils.utils import make_image_using_affine
|
|
1522
|
-
if ind_image==0:
|
|
1523
|
-
if not hasattr(self, 'readImECO'):
|
|
1524
|
-
return
|
|
1525
|
-
if not hasattr(self.readImECO, 'im'):
|
|
1526
|
-
return
|
|
1527
|
-
affine, header = None, None
|
|
1528
|
-
if hasattr(self.readImECO, 'affine'):
|
|
1529
|
-
affine = self.readImECO.affine
|
|
1530
|
-
if hasattr(self.readImECO, 'header'):
|
|
1531
|
-
header = self.readImECO.header
|
|
1532
|
-
img = make_image_using_affine(self.readImECO.npImage, affine, header)
|
|
1533
|
-
el.setData(img, self.readImECO.ImSpacing)
|
|
1534
|
-
elif ind_image==1:
|
|
1535
|
-
if not hasattr(self, 'readImMRI'):
|
|
1536
|
-
return
|
|
1537
|
-
if not hasattr(self.readImMRI, 'im'):
|
|
1538
|
-
return
|
|
1539
|
-
affine, header = None, None
|
|
1540
|
-
if hasattr(self.readImMRI, 'affine'):
|
|
1541
|
-
affine = self.readImMRI.affine
|
|
1542
|
-
if hasattr(self.readImMRI, 'header'):
|
|
1543
|
-
header = self.readImMRI.header
|
|
1544
|
-
img = make_image_using_affine(self.readImMRI.npImage, affine, header)
|
|
1545
|
-
el.setData(img, self.readImMRI.ImSpacing)
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
1517
|
def updateDataRegistration(self):
|
|
1549
1518
|
"""
|
|
1550
1519
|
Image to Image registration window
|
|
@@ -1567,86 +1536,13 @@ QToolButton{margin: 2px 2px;}
|
|
|
1567
1536
|
val.setData(self.readImMRI.im)
|
|
1568
1537
|
|
|
1569
1538
|
|
|
1570
|
-
def updateDataBET(self):
|
|
1571
|
-
"""
|
|
1572
|
-
Updating Brain Extraction Tools
|
|
1573
|
-
:return:
|
|
1574
|
-
"""
|
|
1575
|
-
ind_image = self.BET.comboBox_image.currentIndex()
|
|
1576
|
-
if ind_image==0:
|
|
1577
|
-
if not hasattr(self, 'readImECO'):
|
|
1578
|
-
return
|
|
1579
|
-
if not hasattr(self.readImECO, 'im'):
|
|
1580
|
-
return
|
|
1581
|
-
self.BET.setData(self.readImECO.npImage, self.readImECO.ImSpacing)
|
|
1582
|
-
elif ind_image==1:
|
|
1583
|
-
if not hasattr(self, 'readImMRI'):
|
|
1584
|
-
return
|
|
1585
|
-
if not hasattr(self.readImMRI, 'im'):
|
|
1586
|
-
return
|
|
1587
|
-
|
|
1588
|
-
self.BET.setData(self.readImMRI.npImage, self.readImMRI.ImSpacing)
|
|
1589
|
-
|
|
1590
|
-
def resize_image(self, ind_image, ind=None):
|
|
1591
|
-
"""
|
|
1592
|
-
Image resize
|
|
1593
|
-
:param ind_image:
|
|
1594
|
-
:param ind:
|
|
1595
|
-
:return:
|
|
1596
|
-
"""
|
|
1597
|
-
hasattr(self.readImMRI, 'im')
|
|
1598
|
-
if ind is not None:
|
|
1599
|
-
if ind == 0 and hasattr(self.readImECO, 'im'):
|
|
1600
|
-
spacing = self.readImECO.ImSpacing
|
|
1601
|
-
txt = '{:.3f},{:.3f},{:.3f}'.format(spacing[0], spacing[1], spacing[2])
|
|
1602
|
-
self.resizeImage.label_current_spc.setText(txt)
|
|
1603
|
-
elif ind == 1 and hasattr(self.readImMRI, 'im'):
|
|
1604
|
-
spacing = self.readImMRI.ImSpacing
|
|
1605
|
-
txt = '{:.3f},{:.3f},{:.3f}'.format(spacing[0], spacing[1], spacing[2])
|
|
1606
|
-
self.resizeImage.label_current_spc.setText(txt)
|
|
1607
|
-
else:
|
|
1608
|
-
txt = '{:.3f},{:.3f},{:.3f}'.format(0, 0, 0)
|
|
1609
|
-
self.resizeImage.label_current_spc.setText(txt)
|
|
1610
|
-
return
|
|
1611
|
-
from melage.utils.utils import resample_to_spacing, convert_to_ras
|
|
1612
|
-
spacing = self.resizeImage.label_new_spc.value()
|
|
1613
|
-
isLinear = self.resizeImage.radioButton_1.isChecked()
|
|
1614
|
-
method = 'spline'
|
|
1615
|
-
if isLinear:
|
|
1616
|
-
method='linear'
|
|
1617
|
-
|
|
1618
|
-
if ind_image==0:
|
|
1619
|
-
if not hasattr(self, 'readImECO'):
|
|
1620
|
-
return
|
|
1621
|
-
if not hasattr(self.readImECO, 'im'):
|
|
1622
|
-
return
|
|
1623
|
-
self.readImECO.im = resample_to_spacing(self.readImECO.im, spacing, method)
|
|
1624
|
-
transform, self.readImECO.source_system = convert_to_ras(self.readImECO.im.affine, target=self.readImECO.target_system)
|
|
1625
|
-
self.readImECO.im = self.readImECO.im.as_reoriented(transform)
|
|
1626
|
-
self.readImECO.set_metadata()
|
|
1627
|
-
self.readImECO.read_pars(reset_seg=True)
|
|
1628
|
-
self.browseUS(fileObj=None, use_dialog=False)
|
|
1629
|
-
self.changedTab()
|
|
1630
|
-
elif ind_image==1:
|
|
1631
|
-
if not hasattr(self, 'readImMRI'):
|
|
1632
|
-
return
|
|
1633
|
-
if not hasattr(self.readImMRI, 'im'):
|
|
1634
|
-
return
|
|
1635
|
-
self.readImMRI.im = resample_to_spacing(self.readImMRI.im, spacing, method)
|
|
1636
|
-
transform, self.readImMRI.source_system = convert_to_ras(self.readImMRI.im.affine, target=self.readImMRI.target_system)
|
|
1637
|
-
self.readImMRI.im = self.readImMRI.im.as_reoriented(transform)
|
|
1638
|
-
self.readImMRI.set_metadata()
|
|
1639
|
-
self.readImMRI.read_pars(reset_seg=True)
|
|
1640
|
-
self.browseMRI(fileObj=None, use_dialog=False)
|
|
1641
|
-
self.changedTab()
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
1539
|
def applyMaskToImage(self, values, operation=False):
|
|
1645
1540
|
"""
|
|
1646
1541
|
Apply masks to image
|
|
1647
1542
|
:param values:
|
|
1648
1543
|
:return:
|
|
1649
1544
|
"""
|
|
1545
|
+
self.setEnabled(True)
|
|
1650
1546
|
if len(values)==3:
|
|
1651
1547
|
ind_image, ind_sel, keep = values
|
|
1652
1548
|
ind_color = int(float(self.color_name[ind_sel].split('_')[0]))
|
|
@@ -1716,24 +1612,6 @@ QToolButton{margin: 2px 2px;}
|
|
|
1716
1612
|
self.browseMRI(fileObj=None, use_dialog=False)
|
|
1717
1613
|
self.changedTab()
|
|
1718
1614
|
|
|
1719
|
-
def setCurrentCoordsystem(self):
|
|
1720
|
-
"""
|
|
1721
|
-
Current Coordinate System
|
|
1722
|
-
:return:
|
|
1723
|
-
"""
|
|
1724
|
-
from melage.utils.utils import getCurrentCoordSystem
|
|
1725
|
-
current = 'None'
|
|
1726
|
-
if self.ChCoordSys.comboBox_image.currentIndex()==0:
|
|
1727
|
-
try:
|
|
1728
|
-
current = getCurrentCoordSystem(self.readImECO.im.affine)
|
|
1729
|
-
except:
|
|
1730
|
-
pass
|
|
1731
|
-
elif self.ChCoordSys.comboBox_image.currentIndex()==1:
|
|
1732
|
-
try:
|
|
1733
|
-
current = getCurrentCoordSystem(self.readImMRI.im.affine)
|
|
1734
|
-
except:
|
|
1735
|
-
pass
|
|
1736
|
-
self.ChCoordSys.label_current.setText(current)
|
|
1737
1615
|
|
|
1738
1616
|
def applyNewCoordSys(self, values):
|
|
1739
1617
|
"""
|
|
@@ -1750,7 +1628,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
1750
1628
|
|
|
1751
1629
|
status = self.readImECO._changeCoordSystem(targ_system)
|
|
1752
1630
|
if status:
|
|
1753
|
-
|
|
1631
|
+
|
|
1754
1632
|
self.readImECO.source_system = targ_system
|
|
1755
1633
|
self.browseUS(fileObj=None, use_dialog=False)
|
|
1756
1634
|
self.changedTab()
|
|
@@ -1761,7 +1639,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
1761
1639
|
return
|
|
1762
1640
|
status = self.readImMRI._changeCoordSystem(targ_system)
|
|
1763
1641
|
if status:
|
|
1764
|
-
|
|
1642
|
+
|
|
1765
1643
|
self.browseMRI(fileObj=None, use_dialog=False)
|
|
1766
1644
|
self.changedTab()
|
|
1767
1645
|
|
|
@@ -1771,17 +1649,6 @@ QToolButton{margin: 2px 2px;}
|
|
|
1771
1649
|
:param val:
|
|
1772
1650
|
:return:
|
|
1773
1651
|
"""
|
|
1774
|
-
if val==4:
|
|
1775
|
-
self.BET.clear()
|
|
1776
|
-
elif val==5:
|
|
1777
|
-
self.BE_DL.clear()
|
|
1778
|
-
for ind in range(2):
|
|
1779
|
-
save_var = '_immri_bedl_{}'.format(ind)
|
|
1780
|
-
save_var_seg = '_immri_bedl_seg_{}'.format(ind)
|
|
1781
|
-
setattr(self, save_var, None)
|
|
1782
|
-
setattr(self, save_var_seg, None)
|
|
1783
|
-
elif val==10:
|
|
1784
|
-
self.Tissue_Seg.clear()
|
|
1785
1652
|
self.setEnabled(True)
|
|
1786
1653
|
|
|
1787
1654
|
|
|
@@ -1835,15 +1702,10 @@ QToolButton{margin: 2px 2px;}
|
|
|
1835
1702
|
at_eco = hasattr(self, 'readImECO')
|
|
1836
1703
|
at_mri = hasattr(self, 'readImMRI')
|
|
1837
1704
|
|
|
1838
|
-
if val
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
elif val == 'histeq':
|
|
1705
|
+
if val in ('BET', 'Deep BET', 'histeq', 'Segmentation', 'MorphSeg'):
|
|
1706
|
+
|
|
1707
|
+
if val == 'histeq':
|
|
1842
1708
|
alg = self.ImageThresholding
|
|
1843
|
-
elif val=='Deep BET':
|
|
1844
|
-
alg = self.BE_DL
|
|
1845
|
-
elif val=='Segmentation':
|
|
1846
|
-
alg = self.Tissue_Seg
|
|
1847
1709
|
ind = alg.comboBox_image.currentIndex()
|
|
1848
1710
|
if ind == 0 and at_eco:
|
|
1849
1711
|
if hasattr(self.readImECO, 'npImage'):
|
|
@@ -1854,17 +1716,17 @@ QToolButton{margin: 2px 2px;}
|
|
|
1854
1716
|
if alg.im_rec is not None:
|
|
1855
1717
|
if not hasattr(alg.im_rec, 'get_fdata'):
|
|
1856
1718
|
from melage.utils.utils import make_image
|
|
1857
|
-
alg.im_rec = make_image(alg.im_rec, reader.im)
|
|
1719
|
+
alg.im_rec = make_image(alg.im_rec.transpose(2, 1, 0)[::-1, ::-1, ::-1], reader.im)
|
|
1858
1720
|
self.reconstruction(reconstruct, ind, reader, alg)
|
|
1859
1721
|
if val == 'histeq' and not reconstruct:
|
|
1860
1722
|
alg.plot(self.readImECO.npImage)
|
|
1861
1723
|
if self.readImECO.npImage is not None:
|
|
1862
1724
|
self.updateDispEco(self.readImECO.npImage, self.readImECO.npSeg, initialState=True)
|
|
1863
|
-
|
|
1725
|
+
|
|
1864
1726
|
elif ind == 1 and at_mri:
|
|
1865
1727
|
if hasattr(self.readImMRI, 'npImage'):
|
|
1866
1728
|
if val != 'histeq':
|
|
1867
|
-
self.readImMRI.npSeg = alg.mask
|
|
1729
|
+
self.readImMRI.npSeg = alg.mask.transpose(2, 1, 0)[::-1, ::-1, ::-1]
|
|
1868
1730
|
if hasattr(alg,'im_rec'):
|
|
1869
1731
|
reader = self.readImMRI
|
|
1870
1732
|
if alg.im_rec is not None:
|
|
@@ -1876,7 +1738,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
1876
1738
|
alg.plot(self.readImMRI.npImage)
|
|
1877
1739
|
if self.readImMRI.npImage is not None:
|
|
1878
1740
|
self.updateDispMRI(self.readImMRI.npImage, self.readImMRI.npSeg, initialState=True)
|
|
1879
|
-
|
|
1741
|
+
|
|
1880
1742
|
return
|
|
1881
1743
|
|
|
1882
1744
|
ind = self.ImageThresholding.comboBox_image.currentIndex()
|
|
@@ -1919,10 +1781,11 @@ QToolButton{margin: 2px 2px;}
|
|
|
1919
1781
|
:param val: the parameter that defines type of operation (transformation or registration)
|
|
1920
1782
|
:return:
|
|
1921
1783
|
"""
|
|
1922
|
-
self.setEnabled(False)
|
|
1784
|
+
#self.setEnabled(False)
|
|
1923
1785
|
|
|
1924
1786
|
if val == 0:
|
|
1925
1787
|
el = self.registrationD
|
|
1788
|
+
el.set_source(settings.DEFAULT_USE_DIR)
|
|
1926
1789
|
at_eco = hasattr(self, 'readImECO')
|
|
1927
1790
|
at_mri = hasattr(self, 'readImMRI')
|
|
1928
1791
|
if at_eco and at_mri:
|
|
@@ -1932,7 +1795,8 @@ QToolButton{margin: 2px 2px;}
|
|
|
1932
1795
|
el.comboBox_image.setCurrentIndex(1)
|
|
1933
1796
|
elif val == 1:
|
|
1934
1797
|
el = self.transformationD
|
|
1935
|
-
|
|
1798
|
+
el.set_source(settings.DEFAULT_USE_DIR)
|
|
1799
|
+
#el.setEnabled(True)
|
|
1936
1800
|
el.show()
|
|
1937
1801
|
|
|
1938
1802
|
def maskingShow(self, val=1):
|
|
@@ -1946,10 +1810,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
1946
1810
|
el = self.Masking
|
|
1947
1811
|
elif val == 1:
|
|
1948
1812
|
el = self.MaskingOperations
|
|
1949
|
-
|
|
1950
|
-
el = self.ChCoordSys
|
|
1951
|
-
elif val==3:
|
|
1952
|
-
el = self.N4_dialog
|
|
1813
|
+
|
|
1953
1814
|
elif val == 4:
|
|
1954
1815
|
el = self.HistImage
|
|
1955
1816
|
elif val == 5:
|
|
@@ -1963,17 +1824,6 @@ QToolButton{margin: 2px 2px;}
|
|
|
1963
1824
|
|
|
1964
1825
|
elif val == 6:
|
|
1965
1826
|
el = self.ImageThresholding
|
|
1966
|
-
elif val == 7:
|
|
1967
|
-
el = self.BET
|
|
1968
|
-
elif val == 8:
|
|
1969
|
-
el = self.resizeImage
|
|
1970
|
-
el.label_warning.setText('Image Resizing (isotropic)?')
|
|
1971
|
-
elif val == 9:
|
|
1972
|
-
el = self.BE_DL
|
|
1973
|
-
self.setEnabled(True)
|
|
1974
|
-
elif val==10:
|
|
1975
|
-
el = self.Tissue_Seg
|
|
1976
|
-
self.setEnabled(True)
|
|
1977
1827
|
try:
|
|
1978
1828
|
at_eco = hasattr(self, 'readImECO')
|
|
1979
1829
|
at_mri = hasattr(self, 'readImMRI')
|
|
@@ -1983,11 +1833,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
1983
1833
|
el.comboBox_image.setCurrentIndex(1)
|
|
1984
1834
|
if hasattr(el, 'comboBox_image_type'):
|
|
1985
1835
|
el.comboBox_image_type.setCurrentIndex(1)
|
|
1986
|
-
|
|
1987
|
-
self.BET.setData(self.readImMRI.npImage, self.readImMRI.ImSpacing)
|
|
1988
|
-
self.BE_DL.comboBox_image.setCurrentIndex(1)
|
|
1989
|
-
self.updateDataBEDL(index=0)
|
|
1990
|
-
elif val in [9, 10]:
|
|
1836
|
+
elif val in [9, 10, 11]:
|
|
1991
1837
|
from melage.utils.utils import make_image_using_affine
|
|
1992
1838
|
affine = getattr(self.readImMRI, 'affine', None)
|
|
1993
1839
|
header = getattr(self.readImMRI, 'header', None)
|
|
@@ -1996,9 +1842,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
1996
1842
|
el.comboBox_image.setCurrentIndex(1)
|
|
1997
1843
|
|
|
1998
1844
|
elif at_eco and hasattr(self.readImECO, 'npImage'):
|
|
1999
|
-
if val
|
|
2000
|
-
self.BET.setData(self.readImECO.npImage, self.readImECO.ImSpacing)
|
|
2001
|
-
elif val in [9, 10]:
|
|
1845
|
+
if val in [9, 10, 11]:
|
|
2002
1846
|
from melage.utils.utils import make_image_using_affine
|
|
2003
1847
|
affine = getattr(self.readImECO, 'affine', None)
|
|
2004
1848
|
header = getattr(self.readImECO, 'header', None)
|
|
@@ -2028,9 +1872,8 @@ QToolButton{margin: 2px 2px;}
|
|
|
2028
1872
|
self.resize_image(None, ind)
|
|
2029
1873
|
|
|
2030
1874
|
if val in [0, 1]:
|
|
2031
|
-
el.
|
|
2032
|
-
|
|
2033
|
-
self.setCurrentCoordsystem()
|
|
1875
|
+
el.set_color_options(self.color_name)
|
|
1876
|
+
|
|
2034
1877
|
|
|
2035
1878
|
|
|
2036
1879
|
el.setEnabled(True)
|
|
@@ -2119,51 +1962,6 @@ QToolButton{margin: 2px 2px;}
|
|
|
2119
1962
|
|
|
2120
1963
|
|
|
2121
1964
|
|
|
2122
|
-
def CalcTotalVolume(self, segwnd='sagital'):
|
|
2123
|
-
"""
|
|
2124
|
-
Calculate region volume
|
|
2125
|
-
:param segwnd:
|
|
2126
|
-
:return:
|
|
2127
|
-
"""
|
|
2128
|
-
from melage.utils.utils import compute_vol_seg
|
|
2129
|
-
|
|
2130
|
-
widgets = select_proper_widgets(self)
|
|
2131
|
-
sender = QtCore.QObject.sender(self)
|
|
2132
|
-
try:
|
|
2133
|
-
#sender_ind = widgets.index(sender)
|
|
2134
|
-
if rhasattr(self, 'readImECO.npSeg'):
|
|
2135
|
-
sender_ind = 1
|
|
2136
|
-
elif rhasattr(self, 'readImMRI.npSeg'):
|
|
2137
|
-
sender_ind = 5
|
|
2138
|
-
|
|
2139
|
-
reader = self.readImECO if sender_ind < 3 else self.readImMRI
|
|
2140
|
-
self.dockWidget_3.setVisible(True)
|
|
2141
|
-
self.setEnabled(False)
|
|
2142
|
-
self.progressBarSaving.setValue(20)
|
|
2143
|
-
selected_points_total = compute_vol_seg(reader.npSeg, segwnd)
|
|
2144
|
-
if sender_ind < 3:
|
|
2145
|
-
self.updateSegmentation(selected_points_total, 'ECO_'+segwnd, self.openGLWidget_1.colorInd, self.openGLWidget_1.sliceNum)
|
|
2146
|
-
else:
|
|
2147
|
-
self.updateSegmentation(selected_points_total, 'MRI_'+segwnd, self.openGLWidget_3.colorInd, self.openGLWidget_3.sliceNum)
|
|
2148
|
-
self.progressBarSaving.setValue(80)
|
|
2149
|
-
selected_points_total = []
|
|
2150
|
-
#if sender_ind < 3 and sender_ind != 11:
|
|
2151
|
-
# self.openedFileName.setText(
|
|
2152
|
-
# 'File: {}, TV: {}'.format(self.filenameEco,
|
|
2153
|
-
# Seg_new.sum() * self.readImECO.ImSpacing[0]**3))
|
|
2154
|
-
#else:
|
|
2155
|
-
# self.openedFileName.setText(
|
|
2156
|
-
# 'File: {}, TV: {}'.format(self.filenameMRI,
|
|
2157
|
-
# Seg_new.sum() * self.readImMRI.ImSpacing[0]**3))
|
|
2158
|
-
self.progressBarSaving.setValue(100)
|
|
2159
|
-
self.setEnabled(True)
|
|
2160
|
-
self.dockWidget_3.setVisible(False)
|
|
2161
|
-
except Exception as e:
|
|
2162
|
-
print('Calculate Total Volume')
|
|
2163
|
-
print(e)
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
1965
|
|
|
2168
1966
|
def activateAxisLines(self, val):
|
|
2169
1967
|
"""
|
|
@@ -2206,6 +2004,12 @@ QToolButton{margin: 2px 2px;}
|
|
|
2206
2004
|
widget.scaleF = widget.ZOOM_IN_FACTOR
|
|
2207
2005
|
if 0.0 < widget.zoom_level_y * widget.scaleF < 5 or 0.0 < widget.zoom_level_x * widget.scaleF < 5:
|
|
2208
2006
|
widget.updateScale(0, 0, widget.scaleF, widget.scaleF)
|
|
2007
|
+
else:
|
|
2008
|
+
for widget in widgets:
|
|
2009
|
+
if widget.isVisible():
|
|
2010
|
+
widget.scaleF = widget.ZOOM_IN_FACTOR
|
|
2011
|
+
widget.UpdatePaintInfo()
|
|
2012
|
+
widget.updateScale(0, 0, 1, 1)
|
|
2209
2013
|
def activate3d(self, val):
|
|
2210
2014
|
"""
|
|
2211
2015
|
Activate 3D show
|
|
@@ -2443,7 +2247,154 @@ QToolButton{margin: 2px 2px;}
|
|
|
2443
2247
|
else:
|
|
2444
2248
|
self.table_link.setChecked(False)
|
|
2445
2249
|
|
|
2250
|
+
def load_plugins(self):
|
|
2251
|
+
"""
|
|
2252
|
+
Finds and loads all plugins and builds the 'Plugins' menu.
|
|
2253
|
+
"""
|
|
2254
|
+
print("Loading plugins...")
|
|
2255
|
+
|
|
2256
|
+
plugin_dir = settings.PLUGIN_DIR
|
|
2257
|
+
|
|
2258
|
+
self.plugin_manager = PluginManager(plugin_dir)
|
|
2259
|
+
self.plugin_manager.discover_plugins()
|
|
2260
|
+
|
|
2261
|
+
|
|
2262
|
+
categories = {}
|
|
2263
|
+
for plugin in self.plugin_manager.get_plugins():
|
|
2264
|
+
if plugin.category not in categories:
|
|
2265
|
+
categories[plugin.category] = []
|
|
2266
|
+
categories[plugin.category].append(plugin)
|
|
2267
|
+
|
|
2268
|
+
for category_name, plugins_in_category in sorted(categories.items()):
|
|
2269
|
+
# Create a sub-menu for the category
|
|
2270
|
+
category_menu = self.menuPlugins.addMenu(category_name)
|
|
2271
|
+
for plugin in plugins_in_category:
|
|
2272
|
+
self.add_plugin_action(category_menu, plugin)
|
|
2273
|
+
|
|
2274
|
+
print(f"Finished loading {len(self.plugin_manager.get_plugins())} plugins.")
|
|
2275
|
+
|
|
2276
|
+
def add_plugin_action(self, menu: QtWidgets.QMenu, plugin):
|
|
2277
|
+
"""Helper to create a QAction for a plugin."""
|
|
2278
|
+
action = QtWidgets.QAction(plugin.name, self)
|
|
2279
|
+
action.setToolTip(plugin.description)
|
|
2280
|
+
|
|
2281
|
+
# --- This is the trigger ---
|
|
2282
|
+
# Connect the menu action to our "brain" function
|
|
2283
|
+
action.triggered.connect(lambda: self.launch_plugin(plugin))
|
|
2284
|
+
menu.addAction(action)
|
|
2285
|
+
|
|
2286
|
+
def launch_plugin(self, plugin):
|
|
2287
|
+
"""
|
|
2288
|
+
Called when a plugin's menu item is clicked.
|
|
2289
|
+
This "brain" function decides how to launch the plugin.
|
|
2290
|
+
"""
|
|
2291
|
+
print(f"Launching plugin: {plugin.name}")
|
|
2292
|
+
try:
|
|
2293
|
+
# --- 1. Give the plugin the current data ---
|
|
2294
|
+
# (You must implement get_current_image_data)
|
|
2295
|
+
data_context = self.get_current_image_data()
|
|
2296
|
+
#data_context = plugin.update_data_context(current_data)
|
|
2297
|
+
|
|
2298
|
+
# --- 2. Path A: CUSTOM UI (like MorphSeg) ---
|
|
2299
|
+
# Check if the plugin has a get_widget() method
|
|
2300
|
+
widget = plugin.get_widget(data_context, parent=self)
|
|
2301
|
+
|
|
2302
|
+
if widget:
|
|
2303
|
+
print("Plugin is 'Custom UI'. Showing widget.")
|
|
2304
|
+
self.plugin_widgets.append(widget)
|
|
2305
|
+
widget.show()
|
|
2306
|
+
#if hasattr(widget, 'finished'):
|
|
2307
|
+
#widget.finished.connect(lambda: self.plugin_widgets.remove(widget))
|
|
2308
|
+
widget.destroyed.connect(
|
|
2309
|
+
lambda: self.plugin_widgets.remove(widget) if widget in self.plugin_widgets else None)
|
|
2310
|
+
# Connect the widget's 'completed' signal
|
|
2311
|
+
if hasattr(widget, 'completed'):
|
|
2312
|
+
widget.completed.connect(self.on_plugin_complete)
|
|
2313
|
+
return
|
|
2314
|
+
|
|
2315
|
+
# --- 3. Path B: AUTO-GUI (Simple Plugin) ---
|
|
2316
|
+
# Plugin has no custom widget, so we build one.
|
|
2317
|
+
param_spec = plugin.get_parameters()
|
|
2318
|
+
|
|
2319
|
+
if param_spec is None:
|
|
2320
|
+
raise ValueError("Plugin provides no get_widget() or get_parameters()")
|
|
2321
|
+
|
|
2322
|
+
print("Plugin is 'Simple UI'. Generating AutoGuiDialog.")
|
|
2323
|
+
|
|
2324
|
+
# ****** HERE IT IS! ******
|
|
2325
|
+
# This is where the AutoGuiDialog is created and used
|
|
2326
|
+
dialog = AutoGuiDialog(param_spec, self)
|
|
2327
|
+
|
|
2328
|
+
# --- 4. Show the dialog and get results ---
|
|
2329
|
+
if dialog.exec_():
|
|
2330
|
+
# User clicked OK!
|
|
2331
|
+
user_parameters = dialog.get_values()
|
|
2332
|
+
|
|
2333
|
+
print(f"Executing plugin with params: {user_parameters}")
|
|
2334
|
+
# TODO: This is where you should use a QThread
|
|
2335
|
+
# to run the plugin's `execute` method
|
|
2336
|
+
# without freezing the main window.
|
|
2337
|
+
|
|
2338
|
+
# (Simple, non-threaded way for now)
|
|
2339
|
+
results = plugin.execute(user_parameters)
|
|
2340
|
+
|
|
2341
|
+
# --- 5. Handle the plugin's results ---
|
|
2342
|
+
self.on_plugin_complete(results)
|
|
2343
|
+
|
|
2344
|
+
except Exception as e:
|
|
2345
|
+
print(f"Error launching plugin {plugin.name}: {e}")
|
|
2346
|
+
QtWidgets.QMessageBox.critical(self, "Plugin Error", f"Error launching {plugin.name}:\n{e}")
|
|
2347
|
+
|
|
2348
|
+
# --- DATA & RESULTS HANDLING (You must implement these) ---
|
|
2349
|
+
|
|
2350
|
+
def get_current_image_data(self):
|
|
2351
|
+
"""
|
|
2352
|
+
(Placeholder) You must implement this.
|
|
2353
|
+
This should return your main data object (e.g., the Nifti image).
|
|
2354
|
+
"""
|
|
2355
|
+
result = {"view 1":None, "view 2":None}
|
|
2356
|
+
if hasattr(self.readImECO, 'im'):
|
|
2357
|
+
result["view 1"] = self.readImECO.im
|
|
2358
|
+
if hasattr(self.readImMRI, 'im'):
|
|
2359
|
+
result["view 2"] = self.readImMRI.im
|
|
2360
|
+
return result
|
|
2361
|
+
|
|
2362
|
+
def on_plugin_complete(self, results: dict):
|
|
2363
|
+
"""
|
|
2364
|
+
(Placeholder) This is called when a plugin finishes.
|
|
2365
|
+
"""
|
|
2366
|
+
print(f"Plugin finished. Results: {results.keys()}")
|
|
2367
|
+
out_image = results.get('image', None)
|
|
2368
|
+
out_affine = results.get('affine', None)
|
|
2369
|
+
out_seg = results.get('label', None)
|
|
2370
|
+
view = results.get('view', None)
|
|
2371
|
+
if view == "view 1":
|
|
2372
|
+
reader = self.readImECO
|
|
2373
|
+
updater = self.updateDispEco
|
|
2374
|
+
elif view == 'view 2':
|
|
2375
|
+
reader = self.readImMRI
|
|
2376
|
+
updater = self.updateDispMRI
|
|
2377
|
+
else:
|
|
2378
|
+
return
|
|
2379
|
+
npSeg = reader.npSeg
|
|
2380
|
+
img = reader.im
|
|
2381
|
+
if out_seg is not None:
|
|
2382
|
+
npSeg = out_seg.transpose(2, 1, 0)[::-1, ::-1, ::-1] # adjustment for show
|
|
2383
|
+
|
|
2384
|
+
if out_image is not None:
|
|
2385
|
+
from melage.utils.utils import make_image, make_image_using_affine
|
|
2386
|
+
if out_affine is None:
|
|
2387
|
+
img = make_image(out_image, reader.im)
|
|
2388
|
+
else:
|
|
2389
|
+
img = make_image_using_affine(out_image, out_affine, None)
|
|
2390
|
+
#reader.im = img
|
|
2391
|
+
#reader.npImage = out_image.transpose(2, 1, 0)[::-1, ::-1, ::-1]
|
|
2392
|
+
|
|
2393
|
+
reader.read_pars(im_new=img, seg_new = npSeg, reset_seg=False)
|
|
2446
2394
|
|
|
2395
|
+
if reader.npImage is not None:
|
|
2396
|
+
updater(reader.npImage, reader.npSeg, initialState=True)
|
|
2397
|
+
#self.changedTab()
|
|
2447
2398
|
|
|
2448
2399
|
|
|
2449
2400
|
def updateSliceNumber(self, val):
|
|
@@ -2697,6 +2648,24 @@ QToolButton{margin: 2px 2px;}
|
|
|
2697
2648
|
elif val == 3:
|
|
2698
2649
|
self.actionEraseX.setIcon(self._icon_eraseX)
|
|
2699
2650
|
|
|
2651
|
+
def setView(self, selected_view):
|
|
2652
|
+
selected_view = selected_view.lower()
|
|
2653
|
+
|
|
2654
|
+
if not hasattr(self, 'current_view'):
|
|
2655
|
+
self.current_view = 'horizontal' # initialize on first call
|
|
2656
|
+
|
|
2657
|
+
if selected_view == self.current_view:
|
|
2658
|
+
# View is already set, do nothing
|
|
2659
|
+
return
|
|
2660
|
+
|
|
2661
|
+
# Update the view
|
|
2662
|
+
if selected_view == 'horizontal':
|
|
2663
|
+
self.create_horizontal_mutualview()
|
|
2664
|
+
elif selected_view == 'vertical':
|
|
2665
|
+
self.create_vertical_mutualview()
|
|
2666
|
+
|
|
2667
|
+
self.current_view = selected_view # store the current view
|
|
2668
|
+
|
|
2700
2669
|
def setCursorsX(self, val):
|
|
2701
2670
|
"""
|
|
2702
2671
|
Selecting correct cursor with repetition
|
|
@@ -2714,7 +2683,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
2714
2683
|
#self.table_widget.clear()
|
|
2715
2684
|
|
|
2716
2685
|
#icon = QtGui.QIcon()
|
|
2717
|
-
#icon.addPixmap(QtGui.QPixmap(
|
|
2686
|
+
#icon.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR+"/contourX.png"), QtGui.QIcon.Selected, QtGui.QIcon.On)
|
|
2718
2687
|
if abs(self._Xtimes) >1:
|
|
2719
2688
|
self._setFadedPix(val)
|
|
2720
2689
|
|
|
@@ -2952,7 +2921,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
2952
2921
|
self._lastChangedWidgest = widgets
|
|
2953
2922
|
self._lastReader = readerName
|
|
2954
2923
|
#self._lastReaderSegInd, self._lastReaderSegCol = getNoneZeroSeg(reader.npSeg)
|
|
2955
|
-
print(a)
|
|
2924
|
+
print(a) # neverused
|
|
2956
2925
|
self._lastReaderSegInd.append(whiteIn)
|
|
2957
2926
|
self._lastReaderSegCol.append(colorInd)
|
|
2958
2927
|
self._lastReaderSegPrevCol.append(widgets[0].colorInd)
|
|
@@ -3286,19 +3255,6 @@ QToolButton{margin: 2px 2px;}
|
|
|
3286
3255
|
|
|
3287
3256
|
|
|
3288
3257
|
|
|
3289
|
-
def gatherToIm(self):
|
|
3290
|
-
"""
|
|
3291
|
-
For ventricle segmentation
|
|
3292
|
-
:return:
|
|
3293
|
-
"""
|
|
3294
|
-
from melage.utils.utils import findWhiteVoxels
|
|
3295
|
-
if not hasattr(self, 'seg'):
|
|
3296
|
-
return
|
|
3297
|
-
totalPs = self.openGLWidget_11.totalPs[self.segmentShowWindowName]
|
|
3298
|
-
Nseg = findWhiteVoxels(totalPs, self.segmentShowWindowName, self._segNN)
|
|
3299
|
-
setattr(self, 'seg_'+self.segmentShowWindowName, Nseg)
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
3258
|
def changeRotAx(self, val):
|
|
3303
3259
|
"""
|
|
3304
3260
|
rotating image
|
|
@@ -3393,53 +3349,6 @@ QToolButton{margin: 2px 2px;}
|
|
|
3393
3349
|
self.updateDispMRI(self.readImMRI.npImage, self.readImMRI.npSeg, initialState=True, tract=self.readImMRI.tract)
|
|
3394
3350
|
|
|
3395
3351
|
|
|
3396
|
-
def segmentVentricles(self):
|
|
3397
|
-
"""
|
|
3398
|
-
Segmentation of ventricles
|
|
3399
|
-
:return:
|
|
3400
|
-
"""
|
|
3401
|
-
try:
|
|
3402
|
-
from Ventriculos.options.options import options as netOpts
|
|
3403
|
-
from Ventriculos.test import test as netEval
|
|
3404
|
-
except:
|
|
3405
|
-
print('We can not segment image. Please check pytorch installation')
|
|
3406
|
-
pass
|
|
3407
|
-
|
|
3408
|
-
if hasattr(self, 'readImECO'):
|
|
3409
|
-
if hasattr(self.readImECO,'npImage'):
|
|
3410
|
-
print('be patient...')
|
|
3411
|
-
opts = netOpts().parse()
|
|
3412
|
-
opts.chkptDir = '../Ventriculos/'+opts.chkptDir
|
|
3413
|
-
opts.modelName = 'Net2D'
|
|
3414
|
-
opts.state = 'train'
|
|
3415
|
-
opts.dataDir = 'dataset'
|
|
3416
|
-
opts.dataset = 'twoD'
|
|
3417
|
-
opts.GPUs = '0'
|
|
3418
|
-
opts.batchSize = 64
|
|
3419
|
-
opts.shuffle = False
|
|
3420
|
-
opts.useAugment = False
|
|
3421
|
-
opts.dir3d = 'Ventriculos/Seg/TestIsa'
|
|
3422
|
-
opts.modelNetG = 'unet2d'
|
|
3423
|
-
opts.numThreads = 8
|
|
3424
|
-
im = self.readImECO.npImage
|
|
3425
|
-
im = im.transpose([0, 2, 1])
|
|
3426
|
-
|
|
3427
|
-
self.dockWidget_3.setVisible(True)
|
|
3428
|
-
self.setEnabled(False)
|
|
3429
|
-
self.progressBarSaving.setValue(20)
|
|
3430
|
-
|
|
3431
|
-
self._segNN = netEval(im, opts).transpose([0, 2, 1])
|
|
3432
|
-
self.progressBarSaving.setValue(80)
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
self.vnetricleSegmentShow(thrsh=50)
|
|
3436
|
-
|
|
3437
|
-
self.progressBarSaving.setValue(100)
|
|
3438
|
-
|
|
3439
|
-
self.setEnabled(True)
|
|
3440
|
-
self.dockWidget_3.setVisible(False)
|
|
3441
|
-
self.progressBarSaving.setValue(0)
|
|
3442
|
-
pass
|
|
3443
3352
|
|
|
3444
3353
|
def ColorIntensityChange(self, thrsh = 0, dtype='image'):
|
|
3445
3354
|
"""
|
|
@@ -3555,31 +3464,6 @@ QToolButton{margin: 2px 2px;}
|
|
|
3555
3464
|
widget.update()
|
|
3556
3465
|
widget.show()
|
|
3557
3466
|
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
def vnetricleSegmentShow(self, thrsh = 50):
|
|
3561
|
-
"""
|
|
3562
|
-
Show segmentation widget
|
|
3563
|
-
:param thrsh:
|
|
3564
|
-
:return:
|
|
3565
|
-
"""
|
|
3566
|
-
if not hasattr(self, '_segNN'):
|
|
3567
|
-
self.dw4_s1.setValue(50)
|
|
3568
|
-
self.dw4lb1.setText('50')
|
|
3569
|
-
#MessageBox = QtWidgets.QMessageBox(self)
|
|
3570
|
-
#MessageBox.setText('Please segment image before using this command')
|
|
3571
|
-
#MessageBox.show()
|
|
3572
|
-
return
|
|
3573
|
-
thrsh /= 100
|
|
3574
|
-
seg = self._segNN/255.0
|
|
3575
|
-
seg[seg>thrsh]=1
|
|
3576
|
-
seg[seg<=thrsh]=0
|
|
3577
|
-
self.openGLWidget_14.clear()
|
|
3578
|
-
self.readImECO.npSeg = seg
|
|
3579
|
-
self.updateDispEco(self.readImECO.npImage, self.readImECO.npSeg, initialState=True)
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
3467
|
def changeMagicToolTo222l(self, value):
|
|
3584
3468
|
widgets = find_avail_widgets(self)
|
|
3585
3469
|
for k in widgets:
|
|
@@ -3671,6 +3555,46 @@ QToolButton{margin: 2px 2px;}
|
|
|
3671
3555
|
self.openGLWidget_12._tol_cricle_tool = val_tol
|
|
3672
3556
|
self.openGLWidget_12.update()
|
|
3673
3557
|
|
|
3558
|
+
|
|
3559
|
+
|
|
3560
|
+
@QtCore.pyqtSlot(QtCore.QModelIndex)
|
|
3561
|
+
def on_row_clicked_image(self, proxy_index):
|
|
3562
|
+
"""
|
|
3563
|
+
Handles all logic in response to a user click by toggling the
|
|
3564
|
+
check state of the item in the first column of the clicked row.
|
|
3565
|
+
"""
|
|
3566
|
+
# 1. Get the proxy index for the first column in the clicked row.
|
|
3567
|
+
check_proxy_index = proxy_index.sibling(proxy_index.row(), 0)
|
|
3568
|
+
|
|
3569
|
+
# 2. Map this proxy index back to the original source model index.
|
|
3570
|
+
source_index = self.tree_images.model().mapToSource(check_proxy_index)
|
|
3571
|
+
|
|
3572
|
+
# 3. Get the actual QStandardItem from the source model.
|
|
3573
|
+
item = self.tree_images.model().sourceModel().itemFromIndex(source_index)
|
|
3574
|
+
|
|
3575
|
+
# 4. If the item doesn't exist or isn't checkable, do nothing.
|
|
3576
|
+
if not item or not item.isCheckable():
|
|
3577
|
+
return
|
|
3578
|
+
|
|
3579
|
+
# 5. Determine the new state and TOGGLE THE CHECKBOX EXACTLY ONCE.
|
|
3580
|
+
new_state = QtCore.Qt.Unchecked if item.checkState() == QtCore.Qt.Checked else QtCore.Qt.Checked
|
|
3581
|
+
old_state = item.checkState()
|
|
3582
|
+
|
|
3583
|
+
|
|
3584
|
+
# 6. Manually update the styling for all rows.
|
|
3585
|
+
|
|
3586
|
+
cond = self.changeImage(item)
|
|
3587
|
+
try:
|
|
3588
|
+
if cond:
|
|
3589
|
+
item.setCheckState(new_state)
|
|
3590
|
+
else:
|
|
3591
|
+
item.setCheckState(old_state)
|
|
3592
|
+
self.style_all_rows(self.tree_images)
|
|
3593
|
+
except:
|
|
3594
|
+
pass
|
|
3595
|
+
|
|
3596
|
+
|
|
3597
|
+
|
|
3674
3598
|
def changeImage(self, value):
|
|
3675
3599
|
"""
|
|
3676
3600
|
Change Image
|
|
@@ -3683,7 +3607,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
3683
3607
|
[info, _, _, indc] = self.imported_images[index_row]#
|
|
3684
3608
|
index_view = info[0][2]
|
|
3685
3609
|
try:
|
|
3686
|
-
if value.checkState()==Qt.
|
|
3610
|
+
if value.checkState()==Qt.Unchecked:
|
|
3687
3611
|
if info[1]<3:#image loading
|
|
3688
3612
|
#if info[1]<2: #eco loading
|
|
3689
3613
|
if index_view==0:
|
|
@@ -3692,14 +3616,14 @@ QToolButton{margin: 2px 2px;}
|
|
|
3692
3616
|
self.imported_images[index_row][2] = True
|
|
3693
3617
|
clean_parent_image(self, index_row, [indc, indc+'_Seg'], index_view=index_view)
|
|
3694
3618
|
else:
|
|
3695
|
-
|
|
3619
|
+
return cond
|
|
3696
3620
|
else:
|
|
3697
3621
|
cond = self.browseMRI(info, use_dialog=False)
|
|
3698
3622
|
if cond:
|
|
3699
3623
|
self.imported_images[index_row][2] = True
|
|
3700
3624
|
clean_parent_image(self, index_row, [indc, indc+'_Seg'], index_view=index_view)
|
|
3701
3625
|
else:
|
|
3702
|
-
|
|
3626
|
+
return cond
|
|
3703
3627
|
else: #segmentation loading
|
|
3704
3628
|
#if info[1]<5: #eco loading
|
|
3705
3629
|
if index_view == 0:
|
|
@@ -3708,14 +3632,14 @@ QToolButton{margin: 2px 2px;}
|
|
|
3708
3632
|
self.imported_images[index_row][2] = True
|
|
3709
3633
|
clean_parent_image(self, index_row, [indc], index_view=index_view)
|
|
3710
3634
|
else:
|
|
3711
|
-
|
|
3635
|
+
return cond
|
|
3712
3636
|
else:
|
|
3713
3637
|
cond = self.importData(type_image='mriseg', fileObj=info[0])
|
|
3714
3638
|
if cond:
|
|
3715
3639
|
self.imported_images[index_row][2] = True
|
|
3716
3640
|
clean_parent_image(self, index_row, [indc],index_view=index_view)
|
|
3717
3641
|
else:
|
|
3718
|
-
|
|
3642
|
+
return cond
|
|
3719
3643
|
|
|
3720
3644
|
else: #close image
|
|
3721
3645
|
if info[1]<3:#image loading
|
|
@@ -3723,7 +3647,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
3723
3647
|
if index_view == 0:
|
|
3724
3648
|
cond = self.CloseUS(message_box='on')
|
|
3725
3649
|
if cond:
|
|
3726
|
-
if '
|
|
3650
|
+
if '*View 1 (loaded)' in info[0][1]:
|
|
3727
3651
|
self.imported_images.pop(index_row)
|
|
3728
3652
|
parent = self.tree_images.model().sourceModel().invisibleRootItem()
|
|
3729
3653
|
parent.removeRow(index_row)
|
|
@@ -3731,11 +3655,11 @@ QToolButton{margin: 2px 2px;}
|
|
|
3731
3655
|
self.imported_images[index_row][2] = False
|
|
3732
3656
|
clean_parent_image(self, -1, ['Fetal_Seg','US_Seg'], index_view=index_view)
|
|
3733
3657
|
else:
|
|
3734
|
-
|
|
3658
|
+
return cond
|
|
3735
3659
|
else:
|
|
3736
3660
|
cond = self.CloseMRI(message_box='on', dialogue=True)
|
|
3737
3661
|
if cond:
|
|
3738
|
-
if '
|
|
3662
|
+
if '*View 2 (loaded)' in info[0][1]:
|
|
3739
3663
|
self.imported_images.pop(index_row)
|
|
3740
3664
|
parent = self.tree_images.model().sourceModel().invisibleRootItem()
|
|
3741
3665
|
parent.removeRow(index_row)
|
|
@@ -3743,7 +3667,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
3743
3667
|
self.imported_images[index_row][2] = False
|
|
3744
3668
|
clean_parent_image(self, -1, ['MRI_Seg'],index_view)
|
|
3745
3669
|
else:
|
|
3746
|
-
|
|
3670
|
+
return cond
|
|
3747
3671
|
else: #segmentation loading
|
|
3748
3672
|
#if info[1] < 5: # eco loading
|
|
3749
3673
|
if index_view == 0:
|
|
@@ -3754,6 +3678,98 @@ QToolButton{margin: 2px 2px;}
|
|
|
3754
3678
|
self.imported_images[index_row][2] = False
|
|
3755
3679
|
except Exception as e:
|
|
3756
3680
|
print(e)
|
|
3681
|
+
return False
|
|
3682
|
+
return True
|
|
3683
|
+
|
|
3684
|
+
# Add these three methods to your class
|
|
3685
|
+
|
|
3686
|
+
@QtCore.pyqtSlot(QtCore.QModelIndex)
|
|
3687
|
+
def on_row_clicked(self, proxy_index):
|
|
3688
|
+
"""
|
|
3689
|
+
Handles all logic in response to a user click by toggling the
|
|
3690
|
+
check state of the item in the first column of the clicked row.
|
|
3691
|
+
"""
|
|
3692
|
+
# 1. Get the proxy index for the first column in the clicked row.
|
|
3693
|
+
check_proxy_index = proxy_index.sibling(proxy_index.row(), 0)
|
|
3694
|
+
|
|
3695
|
+
# 2. Map this proxy index back to the original source model index.
|
|
3696
|
+
source_index = self.tree_colors.model().mapToSource(check_proxy_index)
|
|
3697
|
+
|
|
3698
|
+
# 3. Get the actual QStandardItem from the source model.
|
|
3699
|
+
item = self.tree_colors.model().sourceModel().itemFromIndex(source_index)
|
|
3700
|
+
|
|
3701
|
+
# 4. If the item doesn't exist or isn't checkable, do nothing.
|
|
3702
|
+
if not item or not item.isCheckable():
|
|
3703
|
+
return
|
|
3704
|
+
|
|
3705
|
+
# 5. Determine the new state and TOGGLE THE CHECKBOX EXACTLY ONCE.
|
|
3706
|
+
new_state = QtCore.Qt.Unchecked if item.checkState() == QtCore.Qt.Checked else QtCore.Qt.Checked
|
|
3707
|
+
item.setCheckState(new_state)
|
|
3708
|
+
|
|
3709
|
+
# 6. Now, use this definitive new state for all follow-up logic.
|
|
3710
|
+
if item.text().startswith('9876'):
|
|
3711
|
+
# If the master was clicked, update all children
|
|
3712
|
+
root = self.tree_colors.model().sourceModel().invisibleRootItem()
|
|
3713
|
+
for row in range(root.rowCount()):
|
|
3714
|
+
child_item = root.child(row, 0)
|
|
3715
|
+
if child_item and child_item.isCheckable() and child_item != item:
|
|
3716
|
+
child_item.setCheckState(new_state)
|
|
3717
|
+
else:
|
|
3718
|
+
# If a child was clicked, update the master
|
|
3719
|
+
self.update_master_checkbox_state(self.tree_colors)
|
|
3720
|
+
|
|
3721
|
+
# 7. Manually update the styling for all rows.
|
|
3722
|
+
self.style_all_rows(self.tree_colors)
|
|
3723
|
+
self.changeColorPen(item)
|
|
3724
|
+
|
|
3725
|
+
def update_master_checkbox_state(self, tree):
|
|
3726
|
+
"""Checks children and updates the master checkbox state."""
|
|
3727
|
+
model = tree.model().sourceModel()
|
|
3728
|
+
root = model.invisibleRootItem()
|
|
3729
|
+
|
|
3730
|
+
master_item = None
|
|
3731
|
+
checkable_children = 0
|
|
3732
|
+
checked_count = 0
|
|
3733
|
+
|
|
3734
|
+
# Find the master item and count checked children
|
|
3735
|
+
for row in range(root.rowCount()):
|
|
3736
|
+
item = root.child(row, 0)
|
|
3737
|
+
if not item or not item.isCheckable():
|
|
3738
|
+
continue
|
|
3739
|
+
|
|
3740
|
+
if item.text().startswith('9876'):
|
|
3741
|
+
master_item = item
|
|
3742
|
+
else:
|
|
3743
|
+
checkable_children += 1
|
|
3744
|
+
if item.checkState() == QtCore.Qt.Checked:
|
|
3745
|
+
checked_count += 1
|
|
3746
|
+
|
|
3747
|
+
if master_item:
|
|
3748
|
+
# Block signals here to prevent this update from causing a new signal
|
|
3749
|
+
model.blockSignals(True)
|
|
3750
|
+
if checked_count == checkable_children and checkable_children > 0:
|
|
3751
|
+
master_item.setCheckState(QtCore.Qt.Checked)
|
|
3752
|
+
else:
|
|
3753
|
+
master_item.setCheckState(QtCore.Qt.Unchecked)
|
|
3754
|
+
model.blockSignals(False)
|
|
3755
|
+
|
|
3756
|
+
def style_all_rows(self, tree):
|
|
3757
|
+
"""Loops through all rows to set the background color."""
|
|
3758
|
+
model = tree.model().sourceModel()
|
|
3759
|
+
root = model.invisibleRootItem()
|
|
3760
|
+
for row in range(root.rowCount()):
|
|
3761
|
+
item = root.child(row, 0)
|
|
3762
|
+
if item:
|
|
3763
|
+
if item.checkState() == QtCore.Qt.Checked:
|
|
3764
|
+
brush = QtGui.QBrush(QtGui.QColor(212, 237, 218, 60))
|
|
3765
|
+
else:
|
|
3766
|
+
brush = QtGui.QBrush(QtCore.Qt.transparent)
|
|
3767
|
+
|
|
3768
|
+
for col in range(model.columnCount()):
|
|
3769
|
+
item_in_row = model.item(row, col)
|
|
3770
|
+
if item_in_row:
|
|
3771
|
+
item_in_row.setBackground(brush)
|
|
3772
|
+
|
|
3757
3773
|
|
|
3758
3774
|
def changeColorPen(self,value): # change color pen
|
|
3759
3775
|
"""
|
|
@@ -3762,7 +3778,6 @@ QToolButton{margin: 2px 2px;}
|
|
|
3762
3778
|
:return: set current color
|
|
3763
3779
|
"""
|
|
3764
3780
|
|
|
3765
|
-
|
|
3766
3781
|
text =''
|
|
3767
3782
|
if type(value)!=str:
|
|
3768
3783
|
colrInds = []
|
|
@@ -3772,15 +3787,24 @@ QToolButton{margin: 2px 2px;}
|
|
|
3772
3787
|
else:
|
|
3773
3788
|
ind = None
|
|
3774
3789
|
text = ''
|
|
3775
|
-
root = self.tree_colors.model().sourceModel().invisibleRootItem()
|
|
3790
|
+
#root = self.tree_colors.model().sourceModel().invisibleRootItem()
|
|
3791
|
+
model = self.tree_colors.model().sourceModel()
|
|
3792
|
+
|
|
3793
|
+
#if len(colrInds)==0:
|
|
3794
|
+
#colrInds = []
|
|
3795
|
+
# ind = 9876
|
|
3796
|
+
# text='Combined'
|
|
3797
|
+
|
|
3798
|
+
|
|
3799
|
+
root = model.invisibleRootItem()
|
|
3800
|
+
|
|
3776
3801
|
for i in range(root.rowCount()):
|
|
3777
3802
|
signal = root.child(i)
|
|
3778
3803
|
if signal.checkState()==Qt.Checked:
|
|
3779
3804
|
colrInds.append(int(float(signal.text())))
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
text='Combined'
|
|
3805
|
+
|
|
3806
|
+
|
|
3807
|
+
|
|
3784
3808
|
|
|
3785
3809
|
|
|
3786
3810
|
try:
|
|
@@ -3832,7 +3856,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
3832
3856
|
self.pixmap_box_label.setText(text)
|
|
3833
3857
|
self.actionColor.setIcon(self._icon_colorX)
|
|
3834
3858
|
#pixmap.fill((QtGui.QColor(colorPen[0] * 255.0, colorPen[1] * 255.0, colorPen[2] * 255.0, 1 * 255.0)))
|
|
3835
|
-
#self._icon_colorX.addPixmap(QtGui.QPixmap(
|
|
3859
|
+
#self._icon_colorX.addPixmap(QtGui.QPixmap(settings.RESOURCE_DIR + "/box.png"), QtGui.QIcon.Normal,
|
|
3836
3860
|
# QtGui.QIcon.On)
|
|
3837
3861
|
#self._icon_colorX.addPixmap()
|
|
3838
3862
|
|
|
@@ -4298,28 +4322,28 @@ QToolButton{margin: 2px 2px;}
|
|
|
4298
4322
|
Create desired cursors
|
|
4299
4323
|
:return:
|
|
4300
4324
|
"""
|
|
4301
|
-
bitmap = QtGui.QPixmap(
|
|
4325
|
+
bitmap = QtGui.QPixmap(settings.RESOURCE_DIR+"/Hand.png")
|
|
4302
4326
|
self.cursorOpenHand = QtGui.QCursor(bitmap)
|
|
4303
4327
|
|
|
4304
4328
|
|
|
4305
|
-
bitmap = QtGui.QPixmap(
|
|
4329
|
+
bitmap = QtGui.QPixmap(settings.RESOURCE_DIR+"/Handsqueezed.png")
|
|
4306
4330
|
self.cursorClosedHand = QtGui.QCursor(bitmap)
|
|
4307
4331
|
|
|
4308
4332
|
|
|
4309
|
-
bitmap = QtGui.QPixmap(
|
|
4333
|
+
bitmap = QtGui.QPixmap(settings.RESOURCE_DIR+"/zoom_in.png")
|
|
4310
4334
|
self.cursorZoomIn = QtGui.QCursor(bitmap)
|
|
4311
4335
|
|
|
4312
4336
|
|
|
4313
|
-
bitmap = QtGui.QPixmap(
|
|
4337
|
+
bitmap = QtGui.QPixmap(settings.RESOURCE_DIR+"/zoom_out.png")
|
|
4314
4338
|
self.cursorZoomOut = QtGui.QCursor(bitmap)
|
|
4315
4339
|
|
|
4316
4340
|
|
|
4317
4341
|
|
|
4318
|
-
bitmap = QtGui.QPixmap(
|
|
4342
|
+
bitmap = QtGui.QPixmap(settings.RESOURCE_DIR+"/rotate.png")
|
|
4319
4343
|
self.cursorRotate = QtGui.QCursor(bitmap)
|
|
4320
4344
|
|
|
4321
4345
|
|
|
4322
|
-
#bitmap = QtGui.QPixmap(
|
|
4346
|
+
#bitmap = QtGui.QPixmap(settings.RESOURCE_DIR+"/arrow.png")
|
|
4323
4347
|
self.cursorArrow = QtGui.QCursor(Qt.ArrowCursor)
|
|
4324
4348
|
|
|
4325
4349
|
self.setCursor(self.cursorArrow)
|
|
@@ -4363,7 +4387,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
4363
4387
|
"""
|
|
4364
4388
|
filters = "BrainNeonatal (*.bn)"
|
|
4365
4389
|
opts =QtWidgets.QFileDialog.DontUseNativeDialog
|
|
4366
|
-
fileObj = QtWidgets.QFileDialog.getSaveFileName( self, "Open File",
|
|
4390
|
+
fileObj = QtWidgets.QFileDialog.getSaveFileName( self, "Open File", settings.DEFAULT_USE_DIR, filters, options=opts)
|
|
4367
4391
|
if fileObj[0] == '':
|
|
4368
4392
|
return
|
|
4369
4393
|
self._basefileSave, _ = os.path.splitext(fileObj[0])
|
|
@@ -4396,7 +4420,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
4396
4420
|
self.saveChanges()
|
|
4397
4421
|
|
|
4398
4422
|
|
|
4399
|
-
status =save_modified_nifti(self.readImECO,
|
|
4423
|
+
status =save_modified_nifti(self.readImECO, settings.DEFAULT_USE_DIR, self.filenameEco)
|
|
4400
4424
|
|
|
4401
4425
|
self.progressBarSaving.setValue(100)
|
|
4402
4426
|
self.setEnabled(True)
|
|
@@ -4417,7 +4441,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
4417
4441
|
|
|
4418
4442
|
filters = "DICOM (*.dcm);;Nifti (*.nia *.nii *.nii.gz *.hdr *.img *.img.gz *.mgz);;NRRD (*.nrrd *.nhdr)"
|
|
4419
4443
|
opts =QtWidgets.QFileDialog.DontUseNativeDialog
|
|
4420
|
-
fileObj = QtWidgets.QFileDialog.getSaveFileName( self, "Open File",
|
|
4444
|
+
fileObj = QtWidgets.QFileDialog.getSaveFileName( self, "Open File", settings.DEFAULT_USE_DIR, filters, options=opts)
|
|
4421
4445
|
|
|
4422
4446
|
if fileObj[1] != '' and hasattr(self, 'readImECO'):
|
|
4423
4447
|
outfile_format = filters.split(';;').index(fileObj[1])
|
|
@@ -4523,7 +4547,8 @@ QToolButton{margin: 2px 2px;}
|
|
|
4523
4547
|
|
|
4524
4548
|
def eventFilter(self, obj, event):
|
|
4525
4549
|
from PyQt5.QtCore import QEvent
|
|
4526
|
-
|
|
4550
|
+
"""
|
|
4551
|
+
|
|
4527
4552
|
if event.type() ==QEvent.Resize: # window resizing
|
|
4528
4553
|
for k in range(12):
|
|
4529
4554
|
name = 'openGLWidget_' + str(k + 1)
|
|
@@ -4531,7 +4556,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
4531
4556
|
if widget.imSlice is not None:
|
|
4532
4557
|
widget.UpdatePaintInfo()
|
|
4533
4558
|
widget.update()
|
|
4534
|
-
|
|
4559
|
+
"""
|
|
4535
4560
|
if event.type() == QEvent.UpdateRequest:
|
|
4536
4561
|
pass
|
|
4537
4562
|
elif event.type() == QEvent.MouseButtonRelease:
|
|
@@ -4555,7 +4580,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
4555
4580
|
HELP MELAGE
|
|
4556
4581
|
:return:
|
|
4557
4582
|
"""
|
|
4558
|
-
url = os.path.join(
|
|
4583
|
+
url = os.path.join(settings.DOCS_DIR, 'README.html')
|
|
4559
4584
|
QtGui.QDesktopServices.openUrl(QtCore.QUrl.fromLocalFile(url))
|
|
4560
4585
|
|
|
4561
4586
|
|
|
@@ -4577,15 +4602,15 @@ QToolButton{margin: 2px 2px;}
|
|
|
4577
4602
|
About MELAGE
|
|
4578
4603
|
:return:
|
|
4579
4604
|
"""
|
|
4580
|
-
from melage.
|
|
4605
|
+
from melage.dialogs import about_dialog
|
|
4581
4606
|
try:
|
|
4582
|
-
dialog = about_dialog(self,
|
|
4607
|
+
dialog = about_dialog(self, settings.RESOURCE_DIR)
|
|
4583
4608
|
dialog.show()
|
|
4584
4609
|
except Exception as e:
|
|
4585
4610
|
print(e)
|
|
4586
4611
|
|
|
4587
4612
|
#MessageBox = QtWidgets.QMessageBox(self)
|
|
4588
|
-
#MessageBox.setText('
|
|
4613
|
+
#MessageBox.setText(' melage \n Hospital Puerta del Mar\n March 2021')
|
|
4589
4614
|
#MessageBox.show()
|
|
4590
4615
|
|
|
4591
4616
|
def main_toolbar_visibility(self, value):
|
|
@@ -4920,298 +4945,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
4920
4945
|
'{} There is something wrong please check the file.'.format(e))
|
|
4921
4946
|
|
|
4922
4947
|
|
|
4923
|
-
def BEDL_back(self, value, forward=1):
|
|
4924
|
-
"""
|
|
4925
|
-
Backtransforming the enhanced image
|
|
4926
|
-
:param value:
|
|
4927
|
-
:return:
|
|
4928
|
-
"""
|
|
4929
|
-
if forward:
|
|
4930
|
-
if value == 0:
|
|
4931
|
-
if not hasattr(self, 'readImECO'):
|
|
4932
|
-
return
|
|
4933
|
-
reader = self.readImECO
|
|
4934
|
-
widgets_num = [0, 1, 2, 10]
|
|
4935
|
-
elif value == 1:
|
|
4936
|
-
if not hasattr(self, 'readImMRI'):
|
|
4937
|
-
return
|
|
4938
|
-
reader = self.readImMRI
|
|
4939
|
-
widgets_num = [3, 4, 5, 10]
|
|
4940
|
-
else:
|
|
4941
|
-
return
|
|
4942
|
-
if not hasattr(reader, 'npImage'):
|
|
4943
|
-
return
|
|
4944
|
-
|
|
4945
|
-
save_var = '_immri_bedl_{}'.format(value)
|
|
4946
|
-
save_var_seg = '_immri_bedl_seg_{}'.format(value)
|
|
4947
|
-
if not hasattr(self, save_var):
|
|
4948
|
-
setattr(self, save_var, reader.im.__class__(reader.im.dataobj[:], reader.im.affine, reader.im.header))
|
|
4949
|
-
setattr(self, save_var_seg, reader.npSeg)
|
|
4950
|
-
reader.im = out
|
|
4951
|
-
reader.set_metadata()
|
|
4952
|
-
reader.read_pars()
|
|
4953
|
-
if value == 0:
|
|
4954
|
-
self.setNewImage.emit(reader.npImage.shape)
|
|
4955
|
-
elif value == 1:
|
|
4956
|
-
self.setNewImage2.emit(reader.npImage.shape)
|
|
4957
|
-
self.tabWidget.setTabVisible(3, True)
|
|
4958
|
-
self.changedTab()
|
|
4959
|
-
for k in widgets_num:
|
|
4960
|
-
name = 'openGLWidget_' + str(k + 1)
|
|
4961
|
-
widget = getattr(self, name)
|
|
4962
|
-
widget.makeObject()
|
|
4963
|
-
widget.update()
|
|
4964
|
-
if value == 0:
|
|
4965
|
-
self.updateDispEco(reader.npImage, reader.npSeg, initialState=True)
|
|
4966
|
-
if self.N4_dialog._shrinkfactor > 1:
|
|
4967
|
-
self.reset_page1_eco()
|
|
4968
|
-
self.toolBar2.setDisabled(False)
|
|
4969
|
-
self._rotationAngleEco_coronal = 0
|
|
4970
|
-
self._rotationAngleEco_axial = 0
|
|
4971
|
-
self._rotationAngleEco_sagittal = 0
|
|
4972
|
-
self.hs_t1_5.setValue(0)
|
|
4973
|
-
|
|
4974
|
-
txt = compute_volume(self.readImECO, self.filenameEco, [9876], in_txt=self.openedFileName.text(),
|
|
4975
|
-
ind_screen=0)
|
|
4976
|
-
self.openedFileName.setText(txt)
|
|
4977
|
-
|
|
4978
|
-
if value == 1:
|
|
4979
|
-
self.updateDispMRI(reader.npImage, reader.npSeg, initialState=True, tract=reader.tract)
|
|
4980
|
-
if self.N4_dialog._shrinkfactor > 1:
|
|
4981
|
-
self.reset_page1_mri()
|
|
4982
|
-
self.hs_t2_5.setValue(0)
|
|
4983
|
-
self.toolBar2.setDisabled(False)
|
|
4984
|
-
txt = compute_volume(reader, self.filenameMRI, [9876], in_txt=self.openedFileName.text(),
|
|
4985
|
-
ind_screen=1)
|
|
4986
|
-
self.openedFileName.setText(txt)
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
self._rotationAngleMRI_coronal = 0
|
|
4990
|
-
self._rotationAngleMRI_axial = 0
|
|
4991
|
-
self._rotationAngleMRI_sagittal = 0
|
|
4992
|
-
self.BE_DL.backbutton.setVisible(True)
|
|
4993
|
-
else:
|
|
4994
|
-
if value == 0:
|
|
4995
|
-
if not hasattr(self, 'readImECO'):
|
|
4996
|
-
return
|
|
4997
|
-
reader = self.readImECO
|
|
4998
|
-
widgets_num = [0, 1, 2, 10]
|
|
4999
|
-
elif value==1:
|
|
5000
|
-
if not hasattr(self, 'readImMRI'):
|
|
5001
|
-
return
|
|
5002
|
-
reader = self.readImMRI
|
|
5003
|
-
widgets_num = [3, 4, 5, 10]
|
|
5004
|
-
else:
|
|
5005
|
-
return
|
|
5006
|
-
if not hasattr(reader, 'npImage'):
|
|
5007
|
-
return
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
save_var = '_immri_bedl_{}'.format(value)
|
|
5011
|
-
save_var_seg = '_immri_bedl_seg_{}'.format(value)
|
|
5012
|
-
if not hasattr(self, save_var):
|
|
5013
|
-
return
|
|
5014
|
-
#reader.im = self._immri_tmp
|
|
5015
|
-
reader.im = getattr(self, save_var)
|
|
5016
|
-
reader.set_metadata()
|
|
5017
|
-
reader.read_pars()
|
|
5018
|
-
self.setNewImage2.emit(reader.npImage.shape)
|
|
5019
|
-
reader.npSeg = getattr(self, save_var_seg)
|
|
5020
|
-
delattr(self, save_var_seg)
|
|
5021
|
-
delattr(self, save_var)
|
|
5022
|
-
|
|
5023
|
-
self.tabWidget.setTabVisible(3, True)
|
|
5024
|
-
|
|
5025
|
-
for k in widgets_num:
|
|
5026
|
-
name = 'openGLWidget_' + str(k + 1)
|
|
5027
|
-
widget = getattr(self, name)
|
|
5028
|
-
widget.makeObject()
|
|
5029
|
-
widget.update()
|
|
5030
|
-
# self.readImMRI.npImage = standardize(self.readImMRI.npImage)
|
|
5031
|
-
if value==0:
|
|
5032
|
-
self.updateDispEco(reader.npImage, reader.npSeg, initialState=True)
|
|
5033
|
-
self._rotationAngleEco_coronal = 0
|
|
5034
|
-
self._rotationAngleEco_axial = 0
|
|
5035
|
-
self._rotationAngleEco_sagittal=0
|
|
5036
|
-
elif value == 1:
|
|
5037
|
-
self.updateDispMRI(reader.npImage, reader.npSeg, initialState=True, tract=reader.tract)
|
|
5038
|
-
self._rotationAngleMRI_coronal = 0
|
|
5039
|
-
self._rotationAngleMRI_axial = 0
|
|
5040
|
-
self._rotationAngleMRI_sagittal=0
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
def N4_back(self, value):
|
|
5044
|
-
"""
|
|
5045
|
-
N4 image processing
|
|
5046
|
-
:param value:
|
|
5047
|
-
:return:
|
|
5048
|
-
"""
|
|
5049
|
-
if value == 0:
|
|
5050
|
-
if not hasattr(self, 'readImECO'):
|
|
5051
|
-
return
|
|
5052
|
-
reader = self.readImECO
|
|
5053
|
-
widgets_num = [0, 1, 2, 10]
|
|
5054
|
-
elif value==1:
|
|
5055
|
-
if not hasattr(self, 'readImMRI'):
|
|
5056
|
-
return
|
|
5057
|
-
reader = self.readImMRI
|
|
5058
|
-
widgets_num = [3, 4, 5, 10]
|
|
5059
|
-
else:
|
|
5060
|
-
return
|
|
5061
|
-
if not hasattr(reader, 'npImage'):
|
|
5062
|
-
return
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
save_var = '_immri_tmp_{}'.format(value)
|
|
5066
|
-
save_var_seg = '_immri_tmp_seg_{}'.format(value)
|
|
5067
|
-
if not hasattr(self, save_var):
|
|
5068
|
-
return
|
|
5069
|
-
#reader.im = self._immri_tmp
|
|
5070
|
-
reader.im = getattr(self, save_var)
|
|
5071
|
-
reader.set_metadata()
|
|
5072
|
-
reader.read_pars()
|
|
5073
|
-
self.setNewImage2.emit(reader.npImage.shape)
|
|
5074
|
-
reader.npSeg = getattr(self, save_var_seg)
|
|
5075
|
-
delattr(self, save_var_seg)
|
|
5076
|
-
delattr(self, save_var)
|
|
5077
|
-
|
|
5078
|
-
self.tabWidget.setTabVisible(3, True)
|
|
5079
|
-
|
|
5080
|
-
for k in widgets_num:
|
|
5081
|
-
name = 'openGLWidget_' + str(k + 1)
|
|
5082
|
-
widget = getattr(self, name)
|
|
5083
|
-
widget.makeObject()
|
|
5084
|
-
widget.update()
|
|
5085
|
-
# self.readImMRI.npImage = standardize(self.readImMRI.npImage)
|
|
5086
|
-
if value==0:
|
|
5087
|
-
self.updateDispEco(reader.npImage, reader.npSeg, initialState=True)
|
|
5088
|
-
self._rotationAngleEco_coronal = 0
|
|
5089
|
-
self._rotationAngleEco_axial = 0
|
|
5090
|
-
self._rotationAngleEco_sagittal=0
|
|
5091
|
-
elif value == 1:
|
|
5092
|
-
self.updateDispMRI(reader.npImage, reader.npSeg, initialState=True, tract=reader.tract)
|
|
5093
|
-
self._rotationAngleMRI_coronal = 0
|
|
5094
|
-
self._rotationAngleMRI_axial = 0
|
|
5095
|
-
self._rotationAngleMRI_sagittal=0
|
|
5096
|
-
|
|
5097
|
-
def print(self):
|
|
5098
|
-
print('salam')
|
|
5099
|
-
|
|
5100
|
-
def N4_correction(self, value):
|
|
5101
|
-
"""
|
|
5102
|
-
N4 correction
|
|
5103
|
-
:param value:
|
|
5104
|
-
:return:
|
|
5105
|
-
"""
|
|
5106
|
-
if value == 0:
|
|
5107
|
-
if not hasattr(self, 'readImECO'):
|
|
5108
|
-
return
|
|
5109
|
-
reader = self.readImECO
|
|
5110
|
-
widgets_num = [0, 1, 2, 10]
|
|
5111
|
-
elif value==1:
|
|
5112
|
-
if not hasattr(self, 'readImMRI'):
|
|
5113
|
-
return
|
|
5114
|
-
reader = self.readImMRI
|
|
5115
|
-
widgets_num = [3, 4, 5, 10]
|
|
5116
|
-
else:
|
|
5117
|
-
return
|
|
5118
|
-
if not hasattr(reader, 'npImage'):
|
|
5119
|
-
return
|
|
5120
|
-
|
|
5121
|
-
save_var = '_immri_tmp_{}'.format(value)
|
|
5122
|
-
save_var_seg = '_immri_tmp_seg_{}'.format(value)
|
|
5123
|
-
if not hasattr(self, save_var):
|
|
5124
|
-
setattr(self, save_var, reader.im.__class__(reader.im.dataobj[:], reader.im.affine, reader.im.header))
|
|
5125
|
-
setattr(self, save_var_seg, reader.npSeg)
|
|
5126
|
-
|
|
5127
|
-
self.setEnabled(False)
|
|
5128
|
-
self.N4_dialog.inputimage = reader.im
|
|
5129
|
-
self.N4_dialog.setEnabled(False)
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
worker = Worker(0)
|
|
5133
|
-
worker.inputimage = reader.im
|
|
5134
|
-
#QtCore.QCoreApplication.processEvents()
|
|
5135
|
-
|
|
5136
|
-
thread = QtCore.QThread()
|
|
5137
|
-
def on_quit():
|
|
5138
|
-
thread.quit()
|
|
5139
|
-
thread.wait()
|
|
5140
|
-
worker.moveToThread(thread)
|
|
5141
|
-
worker.set_params(reader.npImage, self.N4_dialog.params, reader.im.affine)
|
|
5142
|
-
thread.started.connect(worker.run)
|
|
5143
|
-
#worker.finished.connect(worker.deleteLater)
|
|
5144
|
-
worker.finished.connect(on_quit)
|
|
5145
|
-
#thread.finished.connect(thread.deleteLater)
|
|
5146
|
-
thread.start()
|
|
5147
|
-
|
|
5148
|
-
self.N4_dialog.progressBar.setVisible(True)
|
|
5149
|
-
|
|
5150
|
-
self.N4_dialog.progressBar.setValue(10)
|
|
5151
|
-
self.app.processEvents()
|
|
5152
|
-
worker.run()
|
|
5153
|
-
self.setEnabled(True)
|
|
5154
|
-
self.N4_dialog.setEnabled(True)
|
|
5155
|
-
self.N4_dialog.progressBar.setValue(100)
|
|
5156
|
-
self.N4_dialog.progressBar.setVisible(False)
|
|
5157
|
-
if worker.out is not None:
|
|
5158
|
-
out = worker.out
|
|
5159
|
-
else:
|
|
5160
|
-
return
|
|
5161
|
-
|
|
5162
|
-
#out = self.N4_dialog.execute()
|
|
5163
|
-
#self.inputimage = None
|
|
5164
|
-
#self.N4_dialog.setEnabled(True)
|
|
5165
|
-
|
|
5166
|
-
reader.im = out
|
|
5167
|
-
reader.set_metadata()
|
|
5168
|
-
reader.read_pars()
|
|
5169
|
-
if self.N4_dialog._shrinkfactor>1:
|
|
5170
|
-
if value==0:
|
|
5171
|
-
self.setNewImage.emit(reader.npImage.shape)
|
|
5172
|
-
elif value==1:
|
|
5173
|
-
self.setNewImage2.emit(reader.npImage.shape)
|
|
5174
|
-
self.tabWidget.setTabVisible(3, True)
|
|
5175
|
-
self.changedTab()
|
|
5176
|
-
for k in widgets_num:
|
|
5177
|
-
name = 'openGLWidget_' + str(k + 1)
|
|
5178
|
-
widget = getattr(self, name)
|
|
5179
|
-
widget.makeObject()
|
|
5180
|
-
widget.update()
|
|
5181
|
-
if value==0:
|
|
5182
|
-
self.updateDispEco(reader.npImage, reader.npSeg, initialState=True)
|
|
5183
|
-
if self.N4_dialog._shrinkfactor > 1:
|
|
5184
|
-
self.reset_page1_eco()
|
|
5185
|
-
self.toolBar2.setDisabled(False)
|
|
5186
|
-
self._rotationAngleEco_coronal = 0
|
|
5187
|
-
self._rotationAngleEco_axial = 0
|
|
5188
|
-
self._rotationAngleEco_sagittal = 0
|
|
5189
|
-
self.hs_t1_5.setValue(0)
|
|
5190
|
-
# self.openedFileName.setText('Eco: {}, \n MRI: {}'.format(self.filenameEco, self.filenameMRI))
|
|
5191
|
-
#txt = 'File: {}, TV: {}'.format(self.filenameEco,
|
|
5192
|
-
# self.readImECO.npSeg.sum() * self.readImECO.ImSpacing[0] ** 3)
|
|
5193
|
-
#self.openedFileName.setText(txt)
|
|
5194
|
-
txt = compute_volume(self.readImECO, self.filenameEco, [9876], in_txt=self.openedFileName.text(),
|
|
5195
|
-
ind_screen=1)
|
|
5196
|
-
self.openedFileName.setText(txt)
|
|
5197
|
-
|
|
5198
|
-
if value==1:
|
|
5199
|
-
self.updateDispMRI(reader.npImage, reader.npSeg, initialState=True, tract=reader.tract)
|
|
5200
|
-
if self.N4_dialog._shrinkfactor>1:
|
|
5201
|
-
self.reset_page1_mri()
|
|
5202
|
-
self.hs_t2_5.setValue(0)
|
|
5203
|
-
self.toolBar2.setDisabled(False)
|
|
5204
|
-
txt = compute_volume(reader, self.filenameMRI, [9876], in_txt=self.openedFileName.text(),
|
|
5205
|
-
ind_screen=1)
|
|
5206
|
-
self.openedFileName.setText(txt)
|
|
5207
|
-
#self.openedFileName.setText(
|
|
5208
|
-
# 'File: {}, TV: {}'.format(self.filenameMRI,
|
|
5209
|
-
# reader.npSeg.sum() * reader.ImSpacing[0]))
|
|
5210
4948
|
|
|
5211
|
-
self._rotationAngleMRI_coronal = 0
|
|
5212
|
-
self._rotationAngleMRI_axial = 0
|
|
5213
|
-
self._rotationAngleMRI_sagittal=0
|
|
5214
|
-
self.N4_dialog.pushButton_2.setVisible(True)
|
|
5215
4949
|
|
|
5216
4950
|
def retranslateUi(self, Main):
|
|
5217
4951
|
self._translate = QtCore.QCoreApplication.translate
|
|
@@ -5255,31 +4989,25 @@ QToolButton{margin: 2px 2px;}
|
|
|
5255
4989
|
self.actionEraseX.setText(self._translate("Main", "Eraser X times"))
|
|
5256
4990
|
self.actionPaint.setText(self._translate("Main", "Paint"))
|
|
5257
4991
|
self.actionErase.setText(self._translate("Main", "Erase"))
|
|
5258
|
-
self.actionNNventricleGatherIm.setText(self._translate("Main", "Gather Current Segmentation to Image"))
|
|
5259
4992
|
self.actionLazyContour.setText(self._translate("Main", "Zoom Out"))
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
4993
|
+
|
|
4994
|
+
|
|
4995
|
+
|
|
5263
4996
|
self.actionHistImage.setText(self._translate("Main", "Image Histogram"))
|
|
5264
|
-
|
|
5265
|
-
self.actionBET.setText(self._translate("Main", "BET"))
|
|
5266
|
-
self.actionBEDL.setText(self._translate("Main", "DeepBET"))
|
|
4997
|
+
|
|
5267
4998
|
self.actionImageThresholding.setText(self._translate("Main", "Image Thresholding"))
|
|
5268
4999
|
self.actionImageRegistration.setText(self._translate("Main", "Image Registration"))
|
|
5269
5000
|
self.actionImageTransformation.setText(self._translate("Main", "Image Transformation"))
|
|
5270
5001
|
self.actionMasking.setText(self._translate("Main", "Image Masking"))
|
|
5271
5002
|
self.actionOperationMask.setText(self._translate("Main", "Masking Operation"))
|
|
5272
|
-
|
|
5273
|
-
self.actionNNVentriclesSagittal.setText(self._translate("Main", "Sagittal") )
|
|
5274
|
-
self.actionNNVentriclesCoronal.setText( self._translate("Main", "Coronal") )
|
|
5275
|
-
self.actionNNVentriclesAxial.setText( self._translate("Main", "Axial") )
|
|
5003
|
+
|
|
5276
5004
|
self.actionrotate.setText(self._translate("Main", "Rotate"))
|
|
5277
5005
|
self.actionArrow.setText(self._translate("Main", "Arrow"))
|
|
5278
5006
|
self.menuTools.setTitle(self._translate("Main", "Tools"))
|
|
5007
|
+
self.menuPlugins.setTitle(self._translate("Main", "Plugins"))
|
|
5279
5008
|
self.menuBasicInfo.setTitle(self._translate("Main", "Basic Info"))
|
|
5280
5009
|
self.menuCalc.setTitle(self._translate("Main", "Calc"))
|
|
5281
5010
|
self.menuPreprocess.setTitle(self._translate("Main", "Preprocessing"))
|
|
5282
|
-
self.menuSegmentation.setTitle(self._translate("Main", "Segmentation"))
|
|
5283
5011
|
self.menuRegistration.setTitle(self._translate("Main", "Registeration"))
|
|
5284
5012
|
|
|
5285
5013
|
self.menuExport.setTitle(self._translate("Main", "Export"))
|
|
@@ -5321,17 +5049,46 @@ QToolButton{margin: 2px 2px;}
|
|
|
5321
5049
|
#self.actionContourGen.setText(self._translate("Main", "Contour Gen from line"))
|
|
5322
5050
|
manually_check_tree_item(self,'9876')
|
|
5323
5051
|
|
|
5052
|
+
def get_dialog(self, source_dir, filters, opts, title = "Open File"):
|
|
5053
|
+
|
|
5054
|
+
# 1. Create a QFileDialog instance instead of using the static method
|
|
5055
|
+
dialog = QtWidgets.QFileDialog(self, title, source_dir, filters)
|
|
5056
|
+
|
|
5057
|
+
# 2. Set the options you need
|
|
5058
|
+
dialog.setOptions(opts)
|
|
5059
|
+
# Note: If using PyQt5/PySide2, you might need:
|
|
5060
|
+
# dialog.setOption(QtWidgets.QFileDialog.DontUseNativeDialog, True)
|
|
5061
|
+
|
|
5062
|
+
# 3. Get the parent window's size
|
|
5063
|
+
parent_size = self.size()
|
|
5064
|
+
# You can also use self.geometry() for more complex positioning
|
|
5065
|
+
|
|
5066
|
+
# 4. Set the dialog's size relative to the parent's size
|
|
5067
|
+
# For example, 80% of the parent's width and 70% of its height
|
|
5068
|
+
dialog_width = int(parent_size.width() * 0.4)
|
|
5069
|
+
dialog_height = int(parent_size.height() * 0.5)
|
|
5070
|
+
dialog.resize(dialog_width, dialog_height)
|
|
5071
|
+
return dialog
|
|
5324
5072
|
|
|
5325
5073
|
def loadProject(self):
|
|
5326
5074
|
"""
|
|
5327
5075
|
Loading saved project
|
|
5328
5076
|
:return:
|
|
5329
5077
|
"""
|
|
5078
|
+
#filters = "BrainNeonatal (*.bn)"
|
|
5079
|
+
#opts =QtWidgets.QFileDialog.DontUseNativeDialog
|
|
5080
|
+
#fileObj = QtWidgets.QFileDialog.getOpenFileName( self, "Open File", settings.DEFAULT_USE_DIR, filters, options=opts)
|
|
5330
5081
|
filters = "BrainNeonatal (*.bn)"
|
|
5331
|
-
opts =QtWidgets.QFileDialog.DontUseNativeDialog
|
|
5332
|
-
|
|
5333
|
-
if fileObj[0] != '':
|
|
5334
|
-
|
|
5082
|
+
opts = QtWidgets.QFileDialog.DontUseNativeDialog
|
|
5083
|
+
dialog = self.get_dialog(settings.DEFAULT_USE_DIR, filters, opts, title="Open File")
|
|
5084
|
+
#if fileObj[0] != '':
|
|
5085
|
+
if dialog.exec() == QtWidgets.QDialog.Accepted:
|
|
5086
|
+
selected_files = dialog.selectedFiles()
|
|
5087
|
+
if selected_files:
|
|
5088
|
+
# getOpenFileName returns a tuple (filepath, filter)
|
|
5089
|
+
fileObj = (selected_files[0], dialog.selectedNameFilter())
|
|
5090
|
+
else:
|
|
5091
|
+
return
|
|
5335
5092
|
self._basefileSave, _ = os.path.splitext(fileObj[0])
|
|
5336
5093
|
|
|
5337
5094
|
self.dockWidget_3.setVisible(True)
|
|
@@ -5374,8 +5131,18 @@ QToolButton{margin: 2px 2px;}
|
|
|
5374
5131
|
|
|
5375
5132
|
def newProject(self):
|
|
5376
5133
|
opts = QtWidgets.QFileDialog.DontUseNativeDialog
|
|
5377
|
-
fileObj = QtWidgets.QFileDialog.getSaveFileName(self, "Open File",
|
|
5378
|
-
|
|
5134
|
+
#fileObj = QtWidgets.QFileDialog.getSaveFileName(self, "Open File", settings.DEFAULT_USE_DIR, options=opts)
|
|
5135
|
+
|
|
5136
|
+
dialog = self.get_dialog( settings.DEFAULT_USE_DIR, filters=None, opts=opts, title="Open File")
|
|
5137
|
+
#if fileObj[0] != '':
|
|
5138
|
+
if dialog.exec() == QtWidgets.QDialog.Accepted:
|
|
5139
|
+
selected_files = dialog.selectedFiles()
|
|
5140
|
+
if selected_files:
|
|
5141
|
+
# getOpenFileName returns a tuple (filepath, filter)
|
|
5142
|
+
fileObj = (selected_files[0], dialog.selectedNameFilter())
|
|
5143
|
+
else:
|
|
5144
|
+
return
|
|
5145
|
+
#if fileObj[0] != '':
|
|
5379
5146
|
|
|
5380
5147
|
self._basefileSave, _ = os.path.splitext(fileObj[0])
|
|
5381
5148
|
if self._openUSEnabled:
|
|
@@ -5399,8 +5166,113 @@ QToolButton{margin: 2px 2px;}
|
|
|
5399
5166
|
self.Main.setWindowTitle(self._translate("Main", os.path.basename(self._basefileSave)))
|
|
5400
5167
|
self.save()
|
|
5401
5168
|
|
|
5169
|
+
def CloseUS(self, message_box=True):
|
|
5170
|
+
"""
|
|
5171
|
+
Closes the Ultrasound (ECO) image and resets the associated UI elements.
|
|
5172
|
+
|
|
5173
|
+
:param show_confirmation: If True, asks the user for confirmation before closing.
|
|
5174
|
+
:return: True if the view was closed, False if the user cancelled.
|
|
5175
|
+
"""
|
|
5176
|
+
# 1. Check state: Is there anything to close?
|
|
5177
|
+
if not self.readImECO:
|
|
5178
|
+
# print("Ultrasound view is already closed.")
|
|
5179
|
+
return True # Already closed
|
|
5180
|
+
|
|
5181
|
+
proceed = False
|
|
5182
|
+
if message_box:
|
|
5183
|
+
# 2. Ask for confirmation
|
|
5184
|
+
qm = QtWidgets.QMessageBox(self)
|
|
5185
|
+
ret = qm.question(self, 'Confirm Close',
|
|
5186
|
+
"Are you sure you want to close View 1?",
|
|
5187
|
+
qm.Yes | qm.No)
|
|
5188
|
+
if ret == qm.Yes:
|
|
5189
|
+
proceed = True
|
|
5190
|
+
else:
|
|
5191
|
+
# 3. No confirmation needed
|
|
5192
|
+
proceed = True
|
|
5193
|
+
|
|
5194
|
+
# 4. Perform cleanup only if confirmed
|
|
5195
|
+
if proceed:
|
|
5196
|
+
self._perform_us_cleanup()
|
|
5197
|
+
|
|
5198
|
+
return proceed
|
|
5199
|
+
|
|
5200
|
+
def _set_us_widgets_visible(self, is_visible):
|
|
5201
|
+
"""Helper method to show/hide all widgets related to the US view."""
|
|
5202
|
+
|
|
5203
|
+
# Disable actions
|
|
5204
|
+
self.actionImportSegEco.setDisabled(True)
|
|
5205
|
+
self.actionExportImEco.setDisabled(True)
|
|
5206
|
+
self.actionExportSegEco.setDisabled(True)
|
|
5207
|
+
|
|
5208
|
+
# Toggle radio buttons
|
|
5209
|
+
for name in self.US_RADIO_NAMES:
|
|
5210
|
+
radio_button = getattr(self, name)
|
|
5211
|
+
radio_button.setVisible(is_visible)
|
|
5212
|
+
|
|
5213
|
+
# Toggle sliders, labels, and OpenGL widgets
|
|
5214
|
+
for k in self.US_VIEW_INDICES:
|
|
5215
|
+
slider = getattr(self, 'horizontalSlider_' + str(k))
|
|
5216
|
+
label = getattr(self, 'label_' + str(k))
|
|
5217
|
+
widget = getattr(self, 'openGLWidget_' + str(k))
|
|
5218
|
+
|
|
5219
|
+
label.setVisible(is_visible)
|
|
5220
|
+
slider.setVisible(is_visible)
|
|
5221
|
+
widget.setVisible(is_visible)
|
|
5222
|
+
|
|
5223
|
+
if not is_visible:
|
|
5224
|
+
# If hiding, also clear and reset the widget
|
|
5225
|
+
widget.imType = 'eco'
|
|
5226
|
+
widget.clear()
|
|
5227
|
+
widget.resetInit()
|
|
5228
|
+
widget.initialState()
|
|
5229
|
+
|
|
5230
|
+
def _perform_us_cleanup(self):
|
|
5231
|
+
"""Helper method to consolidate all cleanup tasks for closing the US view."""
|
|
5232
|
+
|
|
5233
|
+
# 1. Hide all the main US widgets
|
|
5234
|
+
self._set_us_widgets_visible(False)
|
|
5235
|
+
|
|
5236
|
+
# 2. Reset other related UI elements
|
|
5237
|
+
self.reset_page1_eco()
|
|
5238
|
+
self.openGLWidget_14.clear()
|
|
5239
|
+
self.ImageEnh_view1.setVisible(False)
|
|
5240
|
+
# self.tree_colors.setVisible(False) # Removed commented-out code
|
|
5241
|
+
|
|
5242
|
+
# 3. Clear the image data
|
|
5243
|
+
self.readImECO = []
|
|
5244
|
+
|
|
5245
|
+
# 4. Update tab state
|
|
5246
|
+
self.changedTab()
|
|
5247
|
+
|
|
5248
|
+
# 5. Resize other (MRI) widgets
|
|
5249
|
+
for k in self.MRI_VIEW_INDICES:
|
|
5250
|
+
name = 'openGLWidget_' + str(k)
|
|
5251
|
+
widget = getattr(self, name)
|
|
5252
|
+
event = QtGui.QResizeEvent(widget.size(), widget.size())
|
|
5253
|
+
widget.resizeEvent(event)
|
|
5254
|
+
widget.resize(QtCore.QSize(widget.size().width(), widget.size().height() * 2))
|
|
5255
|
+
|
|
5256
|
+
# 6. Reset the ComboBox
|
|
5257
|
+
self.actionComboBox_visible.setVisible(False)
|
|
5258
|
+
self.actionComboBox_visible.setDisabled(True)
|
|
5259
|
+
self.actionComboBox.setObjectName("View1")
|
|
5260
|
+
|
|
5261
|
+
# 7. Safely disconnect the signal
|
|
5262
|
+
try:
|
|
5263
|
+
self.actionComboBox.currentTextChanged.disconnect(self.changeVolume)
|
|
5264
|
+
except (TypeError, RuntimeError):
|
|
5265
|
+
# Catches specific errors if it's not connected
|
|
5266
|
+
pass
|
|
5402
5267
|
|
|
5403
|
-
|
|
5268
|
+
self.actionComboBox.clear()
|
|
5269
|
+
|
|
5270
|
+
# 8. Call the final cleanup utility
|
|
5271
|
+
clean_parent_image(self, -1, ['View 1'], index_view=0)
|
|
5272
|
+
for plugin in self.plugin_widgets:
|
|
5273
|
+
data_context = self.get_current_image_data()
|
|
5274
|
+
plugin.update_data_context(data_context)
|
|
5275
|
+
def CloseUS2(self, message_box='on'):
|
|
5404
5276
|
def setVisible(val):
|
|
5405
5277
|
|
|
5406
5278
|
self.actionImportSegEco.setDisabled(True)
|
|
@@ -5435,9 +5307,10 @@ QToolButton{margin: 2px 2px;}
|
|
|
5435
5307
|
self.readImECO = []
|
|
5436
5308
|
self.changedTab()
|
|
5437
5309
|
else:
|
|
5438
|
-
qm = QtWidgets.QMessageBox(self)
|
|
5439
|
-
|
|
5440
|
-
|
|
5310
|
+
#qm = QtWidgets.QMessageBox(self)
|
|
5311
|
+
#ret = qm.question(self, '', "Are you sure to close View 1?", qm.Yes | qm.No)
|
|
5312
|
+
cond = True#ret == qm.Yes
|
|
5313
|
+
if cond:
|
|
5441
5314
|
|
|
5442
5315
|
setVisible(False)
|
|
5443
5316
|
self.reset_page1_eco()
|
|
@@ -5469,10 +5342,137 @@ QToolButton{margin: 2px 2px;}
|
|
|
5469
5342
|
#self.changedTab()
|
|
5470
5343
|
return cond
|
|
5471
5344
|
|
|
5345
|
+
# --- Assumed imports ---
|
|
5346
|
+
# from PyQt5 import QtWidgets, QtGui, QtCore
|
|
5347
|
+
|
|
5348
|
+
# --- Assumed base class (for context) ---
|
|
5349
|
+
# class YourMainWindow(QtWidgets.QMainWindow):
|
|
5350
|
+
# def __init__(self):
|
|
5351
|
+
# super().__init__()
|
|
5352
|
+
# # Define widget groups as class attributes for clarity and maintenance
|
|
5353
|
+
# # This is MUCH better than "magic numbers"
|
|
5354
|
+
|
|
5355
|
+
|
|
5356
|
+
# # ... other init setup ...
|
|
5357
|
+
# self.readImMRI = [] # Initialize state
|
|
5358
|
+
|
|
5359
|
+
def CloseMRI(self, message_box=True):
|
|
5360
|
+
"""
|
|
5361
|
+
Closes the MRI image and resets the associated UI elements.
|
|
5362
|
+
|
|
5363
|
+
:param show_confirmation: If True, asks the user for confirmation before closing.
|
|
5364
|
+
:return: True if the view was closed, False if the user cancelled.
|
|
5365
|
+
"""
|
|
5366
|
+
# 1. Check state: Is there anything to close?
|
|
5367
|
+
# (Assuming self.readImMRI = [] is the "closed" state)
|
|
5368
|
+
if not self.readImMRI:
|
|
5369
|
+
# print("MRI view is already closed.")
|
|
5370
|
+
return True # Already closed, operation is "successful"
|
|
5371
|
+
|
|
5372
|
+
proceed = False
|
|
5373
|
+
if message_box:
|
|
5374
|
+
# 2. Ask for confirmation
|
|
5375
|
+
# (Uncommented the MessageBox logic)
|
|
5376
|
+
qm = QtWidgets.QMessageBox(self)
|
|
5377
|
+
ret = qm.question(self, 'Confirm Close',
|
|
5378
|
+
"Are you sure you want to close View 2?",
|
|
5379
|
+
qm.Yes | qm.No)
|
|
5380
|
+
if ret == qm.Yes:
|
|
5381
|
+
proceed = True
|
|
5382
|
+
else:
|
|
5383
|
+
# 3. No confirmation needed, just proceed
|
|
5384
|
+
proceed = True
|
|
5385
|
+
|
|
5386
|
+
# 4. Perform cleanup only if user confirmed or no confirmation was needed
|
|
5387
|
+
if proceed:
|
|
5388
|
+
self._perform_mri_cleanup()
|
|
5389
|
+
|
|
5390
|
+
return proceed
|
|
5391
|
+
|
|
5392
|
+
def _set_mri_widgets_visible(self, is_visible):
|
|
5393
|
+
"""Helper method to show/hide all widgets related to the MRI view."""
|
|
5394
|
+
|
|
5395
|
+
# Disable actions
|
|
5396
|
+
self.actionImportSegMRI.setDisabled(True)
|
|
5397
|
+
self.actionExportImMRI.setDisabled(True)
|
|
5398
|
+
self.actionExportSegMRI.setDisabled(True)
|
|
5399
|
+
|
|
5400
|
+
# Toggle radio buttons
|
|
5401
|
+
for name in self.MRI_RADIO_NAMES:
|
|
5402
|
+
radio_button = getattr(self, name)
|
|
5403
|
+
radio_button.setVisible(is_visible)
|
|
5404
|
+
|
|
5405
|
+
# Clean up the opened file name text
|
|
5406
|
+
txt = self.openedFileName.text()
|
|
5407
|
+
division_ind = txt.find(' ; ')
|
|
5408
|
+
if division_ind != -1:
|
|
5409
|
+
# Use split to robustly get the part before ' ; '
|
|
5410
|
+
kept_part = txt.split(' ; ', 1)[0]
|
|
5411
|
+
self.openedFileName.setText(f'{kept_part} ; ')
|
|
5412
|
+
|
|
5413
|
+
# Toggle sliders, labels, and OpenGL widgets
|
|
5414
|
+
for k in self.MRI_VIEW_INDICES:
|
|
5415
|
+
slider = getattr(self, 'horizontalSlider_' + str(k))
|
|
5416
|
+
label = getattr(self, 'label_' + str(k))
|
|
5417
|
+
widget = getattr(self, 'openGLWidget_' + str(k))
|
|
5418
|
+
|
|
5419
|
+
label.setVisible(is_visible)
|
|
5420
|
+
slider.setVisible(is_visible)
|
|
5421
|
+
widget.setVisible(is_visible)
|
|
5422
|
+
|
|
5423
|
+
if not is_visible:
|
|
5424
|
+
# If hiding, also clear and reset the widget
|
|
5425
|
+
widget.imType = 'mri'
|
|
5426
|
+
widget.clear()
|
|
5427
|
+
widget.resetInit()
|
|
5428
|
+
widget.initialState()
|
|
5429
|
+
|
|
5430
|
+
def _perform_mri_cleanup(self):
|
|
5431
|
+
"""Helper method to consolidate all cleanup tasks for closing the MRI view."""
|
|
5432
|
+
|
|
5433
|
+
# 1. Hide all the main MRI widgets
|
|
5434
|
+
self._set_mri_widgets_visible(False)
|
|
5435
|
+
|
|
5436
|
+
# 2. Reset other related UI elements
|
|
5437
|
+
self.reset_page1_mri()
|
|
5438
|
+
self.openGLWidget_24.clear()
|
|
5439
|
+
self.page1_mri.setVisible(False)
|
|
5440
|
+
# self.tree_colors.setVisible(False) # Removed commented-out code
|
|
5472
5441
|
|
|
5442
|
+
# 3. Clear the image data
|
|
5443
|
+
self.readImMRI = []
|
|
5444
|
+
# self.save() # Removed commented-out code
|
|
5473
5445
|
|
|
5446
|
+
# 4. Resize other widgets
|
|
5447
|
+
for k in self.US_VIEW_INDICES:
|
|
5448
|
+
name = 'openGLWidget_' + str(k)
|
|
5449
|
+
widget = getattr(self, name)
|
|
5450
|
+
event = QtGui.QResizeEvent(widget.size(), widget.size())
|
|
5451
|
+
widget.resizeEvent(event)
|
|
5452
|
+
widget.resize(QtCore.QSize(widget.size().width(), widget.size().height() * 2))
|
|
5453
|
+
|
|
5454
|
+
# 5. Reset the ComboBox
|
|
5455
|
+
self.actionComboBox_visible.setVisible(False)
|
|
5456
|
+
self.actionComboBox_visible.setDisabled(True)
|
|
5457
|
+
self.actionComboBox.setObjectName("View2")
|
|
5458
|
+
|
|
5459
|
+
# 6. Safely disconnect the signal
|
|
5460
|
+
try:
|
|
5461
|
+
self.actionComboBox.currentTextChanged.disconnect(self.changeVolume)
|
|
5462
|
+
except (TypeError, RuntimeError):
|
|
5463
|
+
# This is safer than a bare 'except:'
|
|
5464
|
+
# It catches the specific errors disconnect() might raise
|
|
5465
|
+
pass
|
|
5466
|
+
|
|
5467
|
+
self.actionComboBox.clear()
|
|
5474
5468
|
|
|
5475
|
-
|
|
5469
|
+
# 7. Call the final cleanup utility
|
|
5470
|
+
clean_parent_image(self, -1, ['View 2'], index_view=1)
|
|
5471
|
+
for plugin in self.plugin_widgets:
|
|
5472
|
+
data_context = self.get_current_image_data()
|
|
5473
|
+
plugin.update_data_context(data_context)
|
|
5474
|
+
|
|
5475
|
+
def CloseMRI2(self, message_box='on', dialogue=True):
|
|
5476
5476
|
"""
|
|
5477
5477
|
Closing MRI image
|
|
5478
5478
|
:param message_box:
|
|
@@ -5522,12 +5522,18 @@ QToolButton{margin: 2px 2px;}
|
|
|
5522
5522
|
|
|
5523
5523
|
else:
|
|
5524
5524
|
if dialogue:
|
|
5525
|
-
qm = QtWidgets.QMessageBox(self)
|
|
5526
|
-
ret = qm.question(self, '', "Are you sure to close View 2?", qm.Yes | qm.No)
|
|
5527
|
-
cond = ret==qm.Yes
|
|
5525
|
+
#qm = QtWidgets.QMessageBox(self)
|
|
5526
|
+
#ret = qm.question(self, '', "Are you sure to close View 2?", qm.Yes | qm.No)
|
|
5527
|
+
#cond = ret==qm.Yes
|
|
5528
|
+
cond = True
|
|
5529
|
+
if not cond:
|
|
5530
|
+
return cond
|
|
5528
5531
|
else:
|
|
5529
5532
|
cond = True
|
|
5530
5533
|
if cond:
|
|
5534
|
+
if not hasattr(self.readImMRI, 'npImage'):
|
|
5535
|
+
# message image already closed
|
|
5536
|
+
return
|
|
5531
5537
|
setVisible(False)
|
|
5532
5538
|
self.reset_page1_mri()
|
|
5533
5539
|
self.openGLWidget_24.clear()
|
|
@@ -5580,16 +5586,19 @@ QToolButton{margin: 2px 2px;}
|
|
|
5580
5586
|
:param currentCS:
|
|
5581
5587
|
:return:
|
|
5582
5588
|
"""
|
|
5583
|
-
#fileObj = QtWidgets.QFileDialog.getSaveFileName(self, "Open File",
|
|
5584
|
-
from melage.
|
|
5589
|
+
#fileObj = QtWidgets.QFileDialog.getSaveFileName(self, "Open File", settings.DEFAULT_USE_DIR+'/'+pref, filters, options=opts)
|
|
5590
|
+
from melage.dialogs.helpers import QFileSaveDialogPreview
|
|
5585
5591
|
#from melage.utils.utils import getCurrentCoordSystem
|
|
5586
5592
|
check_save = True
|
|
5587
5593
|
if hasattr(self, '_last_state_save_csv' ):
|
|
5588
5594
|
check_save=self._last_state_save_csv
|
|
5589
|
-
dialg = QFileSaveDialogPreview(self, "Open File",
|
|
5595
|
+
dialg = QFileSaveDialogPreview(self, "Open File", settings.DEFAULT_USE_DIR+'/'+pref, filters, options=opts, check_state_csv=check_save)
|
|
5590
5596
|
|
|
5591
5597
|
dialg.setCS(currentCS)
|
|
5592
|
-
|
|
5598
|
+
parent_size = self.size()
|
|
5599
|
+
dialog_width = int(parent_size.width() * 0.6)
|
|
5600
|
+
dialog_height = int(parent_size.height() * 0.7)
|
|
5601
|
+
dialg.resize(dialog_width, dialog_height)
|
|
5593
5602
|
|
|
5594
5603
|
#if dialg.exec_() == QFileSaveDialogPreview.Accepted:
|
|
5595
5604
|
dialg.exec_()
|
|
@@ -5744,10 +5753,20 @@ QToolButton{margin: 2px 2px;}
|
|
|
5744
5753
|
update_color_s = False # do not update color scheme
|
|
5745
5754
|
if fileObj is None or type(fileObj)==bool:
|
|
5746
5755
|
update_color_s = True
|
|
5747
|
-
opts =QtWidgets.QFileDialog.DontUseNativeDialog
|
|
5748
|
-
|
|
5749
|
-
if
|
|
5756
|
+
opts = QtWidgets.QFileDialog.DontUseNativeDialog
|
|
5757
|
+
dialog = self.get_dialog(settings.DEFAULT_USE_DIR, self._filters, opts, title="Open File")
|
|
5758
|
+
if dialog.exec() == QtWidgets.QDialog.Accepted:
|
|
5759
|
+
selected_files = dialog.selectedFiles()
|
|
5760
|
+
if selected_files:
|
|
5761
|
+
# getOpenFileName returns a tuple (filepath, filter)
|
|
5762
|
+
fileObj = (selected_files[0], dialog.selectedNameFilter())
|
|
5763
|
+
else:
|
|
5764
|
+
return False
|
|
5765
|
+
else:
|
|
5750
5766
|
return False
|
|
5767
|
+
#if not dialog.exec() == QtWidgets.QDialog.Accepted:
|
|
5768
|
+
#if fileObj[0]=='':
|
|
5769
|
+
# return False
|
|
5751
5770
|
|
|
5752
5771
|
if type_image.lower()=='usseg':
|
|
5753
5772
|
if hasattr(self, 'readImECO'):
|
|
@@ -6025,7 +6044,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
6025
6044
|
file_out = 'View 1: {}, View 2: {}'.format(self.filenameEco, self.filenameMRI)
|
|
6026
6045
|
else:
|
|
6027
6046
|
file_out = 'View 2: {}'.format(self.filenameMRI)
|
|
6028
|
-
info1, color1 = [[[self.filenameMRI], "*
|
|
6047
|
+
info1, color1 = [[[self.filenameMRI], "*View 2 (loaded)"],2, 1], [1,1,0]
|
|
6029
6048
|
update_image_sch(self, info=info1, color=color1, loaded=True)
|
|
6030
6049
|
#info1, color1 = [[self.filenameMRI+'_seg', 'MRI_loaded_seg'],5], [0,1,1]
|
|
6031
6050
|
#update_image_sch(self, info=info1, color=color1, loaded=True)
|
|
@@ -6053,7 +6072,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
6053
6072
|
|
|
6054
6073
|
#if not self.dw2_cb.currentText() in self.dw2Text:
|
|
6055
6074
|
#self.dw2_cb.currentTextChanged.disconnect(self.changeColorPen)
|
|
6056
|
-
self.tree_colors.model().sourceModel().itemChanged.disconnect(self.changeColorPen)
|
|
6075
|
+
#self.tree_colors.model().sourceModel().itemChanged.disconnect(self.changeColorPen)
|
|
6057
6076
|
#color_index_rgb = [[key, self.colorsCombinations[key][0], self.colorsCombinations[key][1],
|
|
6058
6077
|
# self.colorsCombinations[key][2], self.colorsCombinations[key][3]] for key in
|
|
6059
6078
|
# self.colorsCombinations.keys() if len(self.colorsCombinations[key]) > 0]
|
|
@@ -6064,7 +6083,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
6064
6083
|
adapt_previous_versions(self)
|
|
6065
6084
|
set_new_color_scheme(self)
|
|
6066
6085
|
update_widget_color_scheme(self)
|
|
6067
|
-
self.tree_colors.model().sourceModel().itemChanged.connect(self.changeColorPen)
|
|
6086
|
+
#self.tree_colors.model().sourceModel().itemChanged.connect(self.changeColorPen)
|
|
6068
6087
|
#self.dw2_cb.currentTextChanged.connect(self.changeColorPen)
|
|
6069
6088
|
#elif abs(len(self.colorsCombinations.keys())-len(self.dw2Text))==1:
|
|
6070
6089
|
# self.colorsCombinations[len(self.dw2Text)] = [1, 0, 0, 1]
|
|
@@ -6097,9 +6116,10 @@ QToolButton{margin: 2px 2px;}
|
|
|
6097
6116
|
self.progressBarSaving.setVisible(False)
|
|
6098
6117
|
self.openGLWidget_14._updatePaint = True
|
|
6099
6118
|
self.openGLWidget_24._updatePaint = True
|
|
6100
|
-
self.expectedTime = self.settingsBN.
|
|
6119
|
+
self.expectedTime = self.settingsBN.auto_save_spinbox.value()*60
|
|
6101
6120
|
self.dw2_s1.setValue(int(self.dw2lb1.text()))
|
|
6102
6121
|
self.dw2_s2.setValue(int(self.dw2lb2.text()))
|
|
6122
|
+
self.current_view = 'horizontal'
|
|
6103
6123
|
#self.changedTab()
|
|
6104
6124
|
except Exception as e:
|
|
6105
6125
|
print('Load changes')
|
|
@@ -6144,10 +6164,16 @@ QToolButton{margin: 2px 2px;}
|
|
|
6144
6164
|
if not isinstance(fileObj, list):
|
|
6145
6165
|
fileObj = ['', '']
|
|
6146
6166
|
opts = QtWidgets.QFileDialog.DontUseNativeDialog
|
|
6147
|
-
dialg = QFileDialogPreview(self, "Open File",
|
|
6167
|
+
dialg = QFileDialogPreview(self, "Open File", settings.DEFAULT_USE_DIR, self._filters, options=opts,
|
|
6148
6168
|
index=self._last_index_select_image_mri, last_state=self._last_state_preview)
|
|
6149
6169
|
dialg.setFileMode(QtWidgets.QFileDialog.ExistingFile)
|
|
6150
6170
|
|
|
6171
|
+
parent_size = self.size()
|
|
6172
|
+
dialog_width = int(parent_size.width() * 0.6)
|
|
6173
|
+
dialog_height = int(parent_size.height() * 0.7)
|
|
6174
|
+
dialg.resize(dialog_width, dialog_height)
|
|
6175
|
+
|
|
6176
|
+
|
|
6151
6177
|
if dialg.exec_() == QFileDialogPreview.Accepted:
|
|
6152
6178
|
fileObj = dialg.getFileSelected()
|
|
6153
6179
|
fileObj[1] = dialg.selectedNameFilter()
|
|
@@ -6277,8 +6303,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
6277
6303
|
widget = getattr(self, widget_name)
|
|
6278
6304
|
widget.resetInit()
|
|
6279
6305
|
widget.initialState()
|
|
6280
|
-
|
|
6281
|
-
widget.affine = self.readImECO.im_metadata['Affine']
|
|
6306
|
+
widget.affine = getattr(self.readImECO, "im_metadata", {}).get("Affine", widget.affine)
|
|
6282
6307
|
|
|
6283
6308
|
|
|
6284
6309
|
self.updateDispEco(self.readImECO.npImage, self.readImECO.npSeg, initialState=True)
|
|
@@ -6287,10 +6312,10 @@ QToolButton{margin: 2px 2px;}
|
|
|
6287
6312
|
self.reset_page1_eco()
|
|
6288
6313
|
|
|
6289
6314
|
if use_dialog:
|
|
6290
|
-
|
|
6315
|
+
|
|
6291
6316
|
self.HistImage.UpdateName(self.filenameEco, None)
|
|
6292
6317
|
self.iminfo_dialog.UpdateName(self.filenameEco, None)
|
|
6293
|
-
info1, color1 = [[[fileObj[0]], fileObj[1]], 2,
|
|
6318
|
+
info1, color1 = [[[fileObj[0]], fileObj[1]], 2, 0], [1, 1, 0]
|
|
6294
6319
|
update_image_sch(self, info=info1, color=color1, loaded=True)
|
|
6295
6320
|
|
|
6296
6321
|
from melage.utils.utils import clean_parent_image2
|
|
@@ -6317,15 +6342,12 @@ QToolButton{margin: 2px 2px;}
|
|
|
6317
6342
|
|
|
6318
6343
|
self.activateGuidelines(self._last_state_guide_lines)
|
|
6319
6344
|
|
|
6320
|
-
if self.BE_DL.isVisible():
|
|
6321
|
-
self.updateDataBEDL(index=0)
|
|
6322
|
-
else:
|
|
6323
|
-
self.BE_DL.clear()
|
|
6324
6345
|
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6346
|
+
# update data context
|
|
6347
|
+
for plugin in self.plugin_widgets:
|
|
6348
|
+
data_context = self.get_current_image_data()
|
|
6349
|
+
plugin.update_data_context(data_context)
|
|
6350
|
+
####
|
|
6329
6351
|
|
|
6330
6352
|
for ind in range(2):
|
|
6331
6353
|
save_var = '_immri_bedl_{}'.format(ind)
|
|
@@ -6350,7 +6372,8 @@ QToolButton{margin: 2px 2px;}
|
|
|
6350
6372
|
return
|
|
6351
6373
|
if fileObj is None or type(fileObj) is bool:
|
|
6352
6374
|
opts =QtWidgets.QFileDialog.DontUseNativeDialog
|
|
6353
|
-
fileObj = QtWidgets.QFileDialog.getOpenFileName( self, "Open File",
|
|
6375
|
+
fileObj = QtWidgets.QFileDialog.getOpenFileName( self, "Open File", settings.DEFAULT_USE_DIR, 'track(*.trk)', options=opts)
|
|
6376
|
+
|
|
6354
6377
|
if fileObj[0]=='':
|
|
6355
6378
|
return
|
|
6356
6379
|
stk, success = load_trk(fileObj[0])
|
|
@@ -6393,7 +6416,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
6393
6416
|
# Browse Fractional Anisotropy
|
|
6394
6417
|
if fileObj is None or type(fileObj) is bool:
|
|
6395
6418
|
opts =QtWidgets.QFileDialog.DontUseNativeDialog
|
|
6396
|
-
fileObj = QtWidgets.QFileDialog.getOpenFileName( self, "Open File",
|
|
6419
|
+
fileObj = QtWidgets.QFileDialog.getOpenFileName( self, "Open File", settings.DEFAULT_USE_DIR, self._filters, options=opts)
|
|
6397
6420
|
if fileObj[0]=='':
|
|
6398
6421
|
return
|
|
6399
6422
|
Img, _ = self.readD(fileObj, type='t1')
|
|
@@ -6428,6 +6451,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
6428
6451
|
widget.makeObject()
|
|
6429
6452
|
widget.update()
|
|
6430
6453
|
|
|
6454
|
+
|
|
6431
6455
|
def browseMRI(self, fileObj=None, use_dialog=True):
|
|
6432
6456
|
"""
|
|
6433
6457
|
Browsing MRI
|
|
@@ -6436,7 +6460,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
6436
6460
|
:return:
|
|
6437
6461
|
"""
|
|
6438
6462
|
|
|
6439
|
-
def setVisible(val):
|
|
6463
|
+
def setVisible(val, imtype="mri"):
|
|
6440
6464
|
self.actionImportSegMRI.setDisabled(False)
|
|
6441
6465
|
self.actionExportImMRI.setDisabled(False)
|
|
6442
6466
|
self.actionExportSegMRI.setDisabled(False)
|
|
@@ -6447,15 +6471,14 @@ QToolButton{margin: 2px 2px;}
|
|
|
6447
6471
|
self.radioButton_21_3.setVisible(val)
|
|
6448
6472
|
|
|
6449
6473
|
for k in [4, 5, 6, 12]:
|
|
6474
|
+
name = 'openGLWidget_' + str(k)
|
|
6450
6475
|
slider = getattr(self, 'horizontalSlider_' + str(k))
|
|
6451
6476
|
label = getattr(self, 'label_' + str(k))
|
|
6452
6477
|
label.setVisible(val)
|
|
6453
6478
|
slider.setVisible(val)
|
|
6454
|
-
|
|
6455
|
-
widget_name = 'openGLWidget_' + str(k)
|
|
6456
|
-
widget = getattr(self, widget_name)
|
|
6479
|
+
widget = getattr(self, name)
|
|
6457
6480
|
widget.setVisible(val)
|
|
6458
|
-
widget.imType =
|
|
6481
|
+
widget.imType = imtype
|
|
6459
6482
|
|
|
6460
6483
|
self.init_state()
|
|
6461
6484
|
|
|
@@ -6463,10 +6486,16 @@ QToolButton{margin: 2px 2px;}
|
|
|
6463
6486
|
if not isinstance(fileObj, list):
|
|
6464
6487
|
fileObj = ['', '']
|
|
6465
6488
|
opts = QtWidgets.QFileDialog.DontUseNativeDialog
|
|
6466
|
-
dialg = QFileDialogPreview(self, "Open File",
|
|
6489
|
+
dialg = QFileDialogPreview(self, "Open File", settings.DEFAULT_USE_DIR, self._filters, options=opts,
|
|
6467
6490
|
index=self._last_index_select_image_mri, last_state=self._last_state_preview)
|
|
6468
6491
|
dialg.setFileMode(QtWidgets.QFileDialog.ExistingFile)
|
|
6469
6492
|
|
|
6493
|
+
parent_size = self.size()
|
|
6494
|
+
dialog_width = int(parent_size.width() * 0.6)
|
|
6495
|
+
dialog_height = int(parent_size.height() * 0.7)
|
|
6496
|
+
dialg.resize(dialog_width, dialog_height)
|
|
6497
|
+
|
|
6498
|
+
|
|
6470
6499
|
if dialg.exec_() == QFileDialogPreview.Accepted:
|
|
6471
6500
|
fileObj = dialg.getFileSelected()
|
|
6472
6501
|
fileObj[1] = dialg.selectedNameFilter()
|
|
@@ -6501,10 +6530,11 @@ QToolButton{margin: 2px 2px;}
|
|
|
6501
6530
|
|
|
6502
6531
|
if hasattr(self, 'readImECO'):
|
|
6503
6532
|
if hasattr(self.readImECO, 'npImage'):
|
|
6504
|
-
for k in
|
|
6505
|
-
|
|
6506
|
-
widget = getattr(self,
|
|
6533
|
+
for k in [0,1,2]:
|
|
6534
|
+
name = 'openGLWidget_' + str(k + 1)
|
|
6535
|
+
widget = getattr(self, name)
|
|
6507
6536
|
widget.setVisible(True)
|
|
6537
|
+
|
|
6508
6538
|
self.updateDispEco(self.readImECO.npImage, self.readImECO.npSeg, initialState=True)
|
|
6509
6539
|
|
|
6510
6540
|
if use_dialog:
|
|
@@ -6587,15 +6617,16 @@ QToolButton{margin: 2px 2px;}
|
|
|
6587
6617
|
if self.readImMRI.npImage is not None:
|
|
6588
6618
|
self.tabWidget.setTabVisible(3, True)
|
|
6589
6619
|
|
|
6590
|
-
|
|
6620
|
+
|
|
6591
6621
|
widgets_num = [4, 5, 6, 11]
|
|
6592
6622
|
for k in widgets_num:
|
|
6593
6623
|
widget_name = 'openGLWidget_' + str(k)
|
|
6594
6624
|
widget = getattr(self, widget_name)
|
|
6595
6625
|
widget.resetInit()
|
|
6596
6626
|
widget.initialState()
|
|
6597
|
-
if 'Affine' in self.readImMRI.im_metadata:
|
|
6598
|
-
|
|
6627
|
+
#if 'Affine' in self.readImMRI.im_metadata:
|
|
6628
|
+
# widget.affine = self.readImMRI.im_metadata['Affine']
|
|
6629
|
+
widget.affine = getattr(self.readImMRI, "im_metadata", {}).get("Affine", widget.affine)
|
|
6599
6630
|
|
|
6600
6631
|
self.updateDispMRI(self.readImMRI.npImage, self.readImMRI.npSeg, initialState=True,
|
|
6601
6632
|
tract=self.readImMRI.tract)
|
|
@@ -6603,7 +6634,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
6603
6634
|
self.reset_page1_mri()
|
|
6604
6635
|
|
|
6605
6636
|
if use_dialog:
|
|
6606
|
-
|
|
6637
|
+
|
|
6607
6638
|
self.HistImage.UpdateName(None, self.filenameMRI)
|
|
6608
6639
|
self.iminfo_dialog.UpdateName(None, self.filenameMRI)
|
|
6609
6640
|
info1, color1 = [[[fileObj[0]], fileObj[1]], 2, 1], [1, 1, 0]
|
|
@@ -6632,16 +6663,10 @@ QToolButton{margin: 2px 2px;}
|
|
|
6632
6663
|
|
|
6633
6664
|
self.activateGuidelines(self._last_state_guide_lines)
|
|
6634
6665
|
|
|
6635
|
-
if self.BE_DL.isVisible():
|
|
6636
|
-
self.updateDataBEDL(index=0)
|
|
6637
|
-
else:
|
|
6638
|
-
self.BE_DL.clear()
|
|
6639
|
-
|
|
6640
|
-
if self.Tissue_Seg.isVisible():
|
|
6641
|
-
self.updateDataBEDL(index=1)
|
|
6642
|
-
else:
|
|
6643
|
-
self.Tissue_Seg.clear()
|
|
6644
6666
|
|
|
6667
|
+
for plugin in self.plugin_widgets:
|
|
6668
|
+
data_context = self.get_current_image_data()
|
|
6669
|
+
plugin.update_data_context(data_context)
|
|
6645
6670
|
for ind in range(2):
|
|
6646
6671
|
save_var = '_immri_bedl_{}'.format(ind)
|
|
6647
6672
|
save_var_seg = '_immri_bedl_seg_{}'.format(ind)
|
|
@@ -6649,7 +6674,7 @@ QToolButton{margin: 2px 2px;}
|
|
|
6649
6674
|
setattr(self, save_var_seg, None)
|
|
6650
6675
|
|
|
6651
6676
|
return True
|
|
6652
|
-
|
|
6677
|
+
|
|
6653
6678
|
def warning_msgbox(self, text= None): # warning message box
|
|
6654
6679
|
if text is None:
|
|
6655
6680
|
text = 'There is an error.'
|
|
@@ -6680,12 +6705,13 @@ QToolButton{margin: 2px 2px;}
|
|
|
6680
6705
|
MessageBox.show()
|
|
6681
6706
|
|
|
6682
6707
|
def readD(self, fileObj, type = 'eco', target_system='IPL'):
|
|
6683
|
-
|
|
6708
|
+
if '_loaded' in fileObj[1]:
|
|
6709
|
+
return [], [False, False, 'No file']
|
|
6684
6710
|
if fileObj[1] != '':
|
|
6685
|
-
|
|
6686
|
-
|
|
6711
|
+
self.settingsBN.update_use_dir(dirname(fileObj[0]))
|
|
6712
|
+
matched_filter = get_filter_for_file(fileObj[0], self._filters)
|
|
6687
6713
|
filters = self._filters.split(';;')
|
|
6688
|
-
index_sel = filters.index(
|
|
6714
|
+
index_sel = filters.index(matched_filter)
|
|
6689
6715
|
outfile_format = self._filters.split(';;')[index_sel].lower()
|
|
6690
6716
|
filters[0], filters[index_sel] = filters[index_sel], filters[0]
|
|
6691
6717
|
self._filters = ';;'.join(filters)
|
|
@@ -6702,16 +6728,16 @@ QToolButton{margin: 2px 2px;}
|
|
|
6702
6728
|
try:
|
|
6703
6729
|
if type == 'eco':
|
|
6704
6730
|
if 'vol' in outfile_format: # Kretz data
|
|
6705
|
-
Info = readIM.readKretz(join(
|
|
6731
|
+
Info = readIM.readKretz(join(settings.DEFAULT_USE_DIR, filename))
|
|
6706
6732
|
format = 'VOL'
|
|
6707
6733
|
elif 'nii' in outfile_format: # read NIFTI
|
|
6708
|
-
Info = readIM.readNIFTI(join(
|
|
6734
|
+
Info = readIM.readNIFTI(join(settings.DEFAULT_USE_DIR, filename), type)
|
|
6709
6735
|
format = 'NIFTI'
|
|
6710
6736
|
elif 'nrrd' in outfile_format: # Read NRRD
|
|
6711
|
-
Info = readIM.readNRRD(join(
|
|
6737
|
+
Info = readIM.readNRRD(join(settings.DEFAULT_USE_DIR, filename), type)
|
|
6712
6738
|
format = 'NRRD'
|
|
6713
6739
|
elif 'dcm' in outfile_format: # READ DICOM
|
|
6714
|
-
Info = readIM.readDICOM(join(
|
|
6740
|
+
Info = readIM.readDICOM(join(settings.DEFAULT_USE_DIR, filename), type)
|
|
6715
6741
|
format = 'DICOM'
|
|
6716
6742
|
else:
|
|
6717
6743
|
Info = [False, False, 'No file']
|
|
@@ -6720,18 +6746,18 @@ QToolButton{margin: 2px 2px;}
|
|
|
6720
6746
|
|
|
6721
6747
|
else:
|
|
6722
6748
|
if 'vol' in outfile_format: # Kretz data
|
|
6723
|
-
Info = readIM.readKretz(join(
|
|
6749
|
+
Info = readIM.readKretz(join(settings.DEFAULT_USE_DIR, filename))
|
|
6724
6750
|
format = 'VOL'
|
|
6725
6751
|
elif 'nii' in outfile_format: # read NIFTI
|
|
6726
|
-
Info = readIM.readNIFTI(join(
|
|
6752
|
+
Info = readIM.readNIFTI(join(settings.DEFAULT_USE_DIR, filename), type)
|
|
6727
6753
|
format = 'NIFTI'
|
|
6728
6754
|
elif 'dicom' in outfile_format: # READ DICOM
|
|
6729
|
-
Info = readIM.readDICOM(join(
|
|
6755
|
+
Info = readIM.readDICOM(join(settings.DEFAULT_USE_DIR, filename), type)
|
|
6730
6756
|
format = 'DICOM'
|
|
6731
6757
|
if hasattr(readIM, '_fileDicom'):
|
|
6732
6758
|
self.filenameMRI = readIM._fileDicom
|
|
6733
6759
|
elif 'nrrd' in outfile_format: # Read NRRD
|
|
6734
|
-
Info = readIM.readNRRD(join(
|
|
6760
|
+
Info = readIM.readNRRD(join(settings.DEFAULT_USE_DIR, filename), type)
|
|
6735
6761
|
format = 'NRRD'
|
|
6736
6762
|
else:
|
|
6737
6763
|
Info = [False, False, 'No file']
|