├── CMakeLists.txt ├── Icons ├── image-dcm.icns ├── image-mhd.icns ├── image-mnc.icns ├── image-vff.icns ├── image-vtk.icns ├── parallax-icon.icns ├── parallax-plugin.icns ├── x-dcm.desktop ├── x-l3d.desktop ├── x-mnc.desktop └── x-vff.desktop ├── LICENSE ├── Linux └── PI-MicroView.desktop ├── MicroView-splash.jpg ├── PI ├── __init__.py └── visualization │ ├── MicroView │ ├── AdaptiveOtsuThresholdDialog.py │ ├── AdaptiveOtsuThresholdDialogC.py │ ├── AnisotropicSmoothingDialog.py │ ├── AnisotropicSmoothingDialogC.py │ ├── ApplicationPreferencesDialog.py │ ├── ApplicationPreferencesDialogC.py │ ├── BackgroundColourSelectorDialog.py │ ├── BackgroundColourSelectorDialogC.py │ ├── BasePlotWindow.py │ ├── ChooseFilterRadiusDialog.py │ ├── ChooseFilterRadiusDialogC.py │ ├── Cursors │ │ ├── __init__.py │ │ ├── pan.gif │ │ ├── rotate.gif │ │ ├── slice.gif │ │ ├── spin.gif │ │ ├── winlev.gif │ │ └── zoom.gif │ ├── DICOMDIRBrowseDialog.py │ ├── DICOMDIRBrowseDialogC.py │ ├── ErodeDilateMorphologyDialog.py │ ├── ErodeDilateMorphologyDialogC.py │ ├── HelpDictionary.py │ ├── HistogramInfoGUI.py │ ├── HistogramInfoGUIC.py │ ├── Icons │ │ ├── MicroView-splash.gif │ │ ├── MicroView-splash.png │ │ ├── anonymize.png │ │ ├── autothreshold-wizard-24.png │ │ ├── autothreshold-wizard.xcf │ │ ├── blank.png │ │ ├── camera.png │ │ ├── cogs.png │ │ ├── copy.png │ │ ├── cursor.png │ │ ├── cut.png │ │ ├── dicom_button.png │ │ ├── document-save-as-3.png │ │ ├── export_wizard_1.png │ │ ├── export_wizard_1.xcf │ │ ├── gaussian-smooth.png │ │ ├── glyphicons_011_camera.png │ │ ├── glyphicons_020_home.png │ │ ├── glyphicons_081_refresh.png │ │ ├── glyphicons_093_crop.png │ │ ├── glyphicons_144_folder_open.png │ │ ├── glyphicons_170_step_backward.png │ │ ├── glyphicons_178_step_forward.png │ │ ├── glyphicons_186_move.png │ │ ├── highlight.png │ │ ├── icon_spreadsheet.png │ │ ├── image-dcm.ico │ │ ├── image-ima.ico │ │ ├── image-mhd.ico │ │ ├── image-vff.ico │ │ ├── image-vtk.ico │ │ ├── left_button.png │ │ ├── line_draw.png │ │ ├── office-chart-line-stacked-with-nearest-data.png │ │ ├── office-chart-line-stacked-with-symbols.png │ │ ├── office-chart-line-stacked.png │ │ ├── pan.png │ │ ├── parallax-innovations.ico │ │ ├── parallax-innovations.png │ │ ├── parallax-logo.png │ │ ├── parallax-plugin.ico │ │ ├── right_button.png │ │ ├── roi.png │ │ ├── rotate.png │ │ ├── scissors9.png │ │ ├── select_histogram_region.png │ │ ├── slice.png │ │ ├── stock_apply.png │ │ ├── stock_arrow_x.png │ │ ├── stock_arrow_y.png │ │ ├── stock_arrow_z.png │ │ ├── stock_copy.png │ │ ├── stock_delete_inside.png │ │ ├── stock_delete_outside.png │ │ ├── stock_export.png │ │ ├── stock_filters.png │ │ ├── stock_help.png │ │ ├── stock_import.png │ │ ├── stock_info.png │ │ ├── stock_invert.png │ │ ├── stock_new.png │ │ ├── stock_open.png │ │ ├── stock_palette.png │ │ ├── stock_plot.png │ │ ├── stock_ruler.png │ │ ├── stock_show_axes.png │ │ ├── stock_show_nearest_data.png │ │ ├── stock_synchronize.png │ │ ├── thumbs-up.png │ │ ├── toggle-markers.png │ │ ├── trash.png │ │ ├── up-down-arrows.png │ │ ├── winlev.png │ │ └── zoom.png │ ├── ImageExportWizard.py │ ├── ImageImportDialog.py │ ├── ImageImportDialogC.py │ ├── LUTSelectionDialog.py │ ├── LUTSelectionDialogC.py │ ├── LineSegmentSelectionFactory.py │ ├── LogWindowGUI.py │ ├── LogWindowGUIC.py │ ├── MicroView.py │ ├── MicroViewIO.py │ ├── MicroViewImageProcessor.py │ ├── MicroViewMain.py │ ├── MicroViewModePalette.py │ ├── MicroViewPlugIn.py │ ├── MicroViewRenderPane.py │ ├── MicroViewSplashScreen.py │ ├── MicroViewStatusBar.py │ ├── ObjectManager.py │ ├── OpenCloseMorphologyDialog.py │ ├── OpenCloseMorphologyDialogC.py │ ├── OrthoView.py │ ├── PageState.py │ ├── PathFactory.py │ ├── PlaneIntersectionFactory.py │ ├── PlotInfoGUI.py │ ├── PlotInfoGUIC.py │ ├── PluginManager.py │ ├── ROIListOutlineFactory.py │ ├── ROIObject.py │ ├── ROIStatistics.py │ ├── ResultsWindowGUI.py │ ├── ResultsWindowGUIC.py │ ├── SliceViewportManager.py │ ├── SpectrumPlotWindow.py │ ├── SphereMarkListFactory.py │ ├── SpreadsheetGUI.py │ ├── SpreadsheetGUIC.py │ ├── SpreadsheetState.py │ ├── StatisticsGUI.py │ ├── StatisticsGUIC.py │ ├── StockItems.py │ ├── SubVolumeSelectionFactory.py │ ├── SynchronizeImageDialog.py │ ├── SynchronizeImageDialogC.py │ ├── URLManager.py │ ├── UpdateAvailableGUI.py │ ├── UpdateAvailableGUIC.py │ ├── UpstreamMessageDialogGUI.py │ ├── VTKPlotWindow.py │ ├── VTKPlotWindowGUI.py │ ├── ViewerState.py │ ├── ViewportManager.py │ ├── VolumeFactory2.py │ ├── WindowLevelDialogGUI.py │ ├── WindowLevelDialogGUIC.py │ ├── WireFrameCubeFactory.py │ ├── _MicroView.py │ ├── about-splash.png │ ├── cacert.pem │ ├── ctrl.py │ ├── data.py │ ├── events.py │ └── interfaces.py │ └── __init__.py ├── Plugins └── public │ ├── PIMicroViewBasePlugins │ ├── ApplicationSettingsGUI.py │ ├── BasicBoneAnalysis.py │ ├── BasicBoneAnalysisAdvancedOptionsDialog.py │ ├── BasicBoneAnalysisGUI.py │ ├── BasicBoneAnalysisGUIC.py │ ├── Icons │ │ ├── bone_analysis.png │ │ ├── bone_analysis_24x24.png │ │ ├── help.png │ │ ├── info.png │ │ ├── info_16x16.png │ │ ├── info_24x24.png │ │ ├── isosurface.png │ │ ├── preferences.png │ │ ├── preferences_24x24.png │ │ ├── standard_roi.png │ │ ├── stock_link_closed.png │ │ ├── stock_link_open.png │ │ ├── stock_resample.png │ │ └── stock_rescale.png │ ├── ImageInfo.py │ ├── IsoSurfaceDisplay.py │ ├── IsosurfaceGUI.py │ ├── IsosurfaceGUIC.py │ ├── MicroView │ │ └── __init__.py │ ├── OptionsDialog.py │ ├── ROIController.py │ ├── ROICubeFactory.py │ ├── ROICylinderFactory.py │ ├── ROIIntersectionsFactory.py │ ├── ROIModel.py │ ├── ROISphereFactory.py │ ├── ResampleImage.py │ ├── ResampleImageGUI.py │ ├── ResampleImageGUIC.py │ ├── RescaleImage.py │ ├── RescaleImageGUI.py │ ├── RescaleImageGUIC.py │ ├── StandardROIGUI.py │ ├── StandardROIGUIC.py │ ├── StandardROITool.py │ └── vtkROIView.py │ ├── __init__.py │ ├── setup.cfg.in │ └── setup.py ├── README.md ├── _config.yml ├── setup.py └── src ├── CMakeLists.txt ├── MicroViewConfigure.h ├── vtkImageInPlaceMirrorFilter.cxx ├── vtkImageInPlaceMirrorFilter.h ├── vtkImageInvertFilter.cxx ├── vtkImageInvertFilter.h ├── vtkImageMagnitude2.cxx ├── vtkImageMagnitude2.h ├── vtkImagePurify.cxx ├── vtkImagePurify.h ├── vtkImageStatistics.cxx ├── vtkImageStatistics.h ├── vtkImageStereology.cxx ├── vtkImageStereology.h ├── vtkImageTextExport.cxx ├── vtkImageTextExport.h ├── vtkInPlaceImageStencil.cxx ├── vtkInPlaceImageStencil.h ├── vtkStderrOutputWindow.cxx └── vtkStderrOutputWindow.h /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(MicroView) 2 | 3 | cmake_minimum_required(VERSION 2.8) 4 | 5 | FIND_PACKAGE(VTK) 6 | FIND_PACKAGE(PythonInterp) 7 | 8 | SUBDIRS(src) 9 | 10 | IF(NOT DEFINED DIST_DIRECTORY) 11 | SET(DIST_DIRECTORY "${PROJECT_SOURCE_DIR}/dist") 12 | MAKE_DIRECTORY(${DIST_DIRECTORY}) 13 | ENDIF(NOT DEFINED DIST_DIRECTORY) 14 | 15 | IF(NOT TARGET packages) 16 | ADD_CUSTOM_TARGET(packages) 17 | ENDIF() 18 | 19 | ADD_DEPENDENCIES(packages MicroView_egg) 20 | ADD_CUSTOM_TARGET(MicroView_egg 21 | ${PYTHON_EXECUTABLE} setup.py bdist_egg --exclude-source-files --dist-dir ${DIST_DIRECTORY} 22 | ) 23 | ADD_DEPENDENCIES(MicroView_egg "${PROJECT_NAME}Python") 24 | 25 | -------------------------------------------------------------------------------- /Icons/image-dcm.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Icons/image-dcm.icns -------------------------------------------------------------------------------- /Icons/image-mhd.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Icons/image-mhd.icns -------------------------------------------------------------------------------- /Icons/image-mnc.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Icons/image-mnc.icns -------------------------------------------------------------------------------- /Icons/image-vff.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Icons/image-vff.icns -------------------------------------------------------------------------------- /Icons/image-vtk.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Icons/image-vtk.icns -------------------------------------------------------------------------------- /Icons/parallax-icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Icons/parallax-icon.icns -------------------------------------------------------------------------------- /Icons/parallax-plugin.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Icons/parallax-plugin.icns -------------------------------------------------------------------------------- /Icons/x-dcm.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Type=MimeType 4 | MimeType=image/x-dcm 5 | Icon=dcm 6 | Patterns=*.dcm; 7 | Comment=DICOM Image 8 | X-KDE-AutoEmbed=true 9 | -------------------------------------------------------------------------------- /Icons/x-l3d.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Comment=Life Imaging L3D image 3 | Hidden=false 4 | Icon=image-l3d 5 | MimeType=image/x-l3d 6 | Patterns=*.l3d;*.L3D 7 | Type=MimeType 8 | -------------------------------------------------------------------------------- /Icons/x-mnc.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Type=MimeType 4 | MimeType=image/x-mnc 5 | Icon=mnc 6 | Patterns=*.mnc; 7 | Comment=MNI MINC Image 8 | X-KDE-AutoEmbed=true 9 | -------------------------------------------------------------------------------- /Icons/x-vff.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Type=MimeType 4 | MimeType=image/x-vff 5 | Icon=vff 6 | Patterns=*.vff; 7 | Comment=VFF Image 8 | X-KDE-AutoEmbed=true 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2000-2001 Enhanced Vision Systems Inc 2 | Copyright (c) 2001-2008 GE Healthcare 3 | Copyright (c) 2011-2015 Parallax Innovations Inc 4 | 5 | Use, modification and redistribution of the software, in source or 6 | binary forms, are permitted provided that the following terms and 7 | conditions are met: 8 | 9 | 1) Redistribution of the source code, in verbatim or modified 10 | form, must retain the above copyright notice, this license, 11 | the following disclaimer, and any notices that refer to this 12 | license and/or the following disclaimer. 13 | 14 | 2) Redistribution in binary form must include the above copyright 15 | notice, a copy of this license and the following disclaimer 16 | in the documentation or with other materials provided with the 17 | distribution. 18 | 19 | 3) Modified copies of the source code must be clearly marked as such, 20 | and must not be misrepresented as verbatim copies of the source code. 21 | 22 | EXCEPT WHEN OTHERWISE STATED IN WRITING BY THE COPYRIGHT HOLDERS AND/OR 23 | OTHER PARTIES, THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE 24 | SOFTWARE "AS IS" WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT 25 | NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | FOR A PARTICULAR PURPOSE. IN NO EVENT UNLESS AGREED TO IN WRITING WILL 27 | ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 28 | THE SOFTWARE UNDER THE TERMS OF THIS LICENSE BE LIABLE FOR ANY DIRECT, 29 | INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 30 | TO, LOSS OF DATA OR DATA BECOMING INACCURATE OR LOSS OF PROFIT OR 31 | BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE OR INABILITY TO 32 | USE THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 33 | -------------------------------------------------------------------------------- /Linux/PI-MicroView.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Value=1.0 4 | Encoding=UTF-8 5 | Name=MicroView 6 | GenericName=Image Viewer 7 | Comment=2D/3D Image Viewer 8 | Exec=/opt/PI/MicroView/MicroView %U 9 | Icon=/opt/PI/MicroView/Icons/parallax-innovations.png 10 | Categories=Application;Graphics;Scientific; 11 | -------------------------------------------------------------------------------- /MicroView-splash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/MicroView-splash.jpg -------------------------------------------------------------------------------- /PI/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['visualization'] 2 | try: 3 | __import__('pkg_resources').declare_namespace(__name__) 4 | except: 5 | __path__ = __import__('pkgutil').extend_path(__path__, __name__) 6 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/AdaptiveOtsuThresholdDialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Nov 6 2013) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class AdaptiveOtsuThresholdDialog 15 | ########################################################################### 16 | 17 | 18 | class AdaptiveOtsuThresholdDialog (wx.Dialog): 19 | 20 | def __init__(self, parent): 21 | wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Adaptive Otsu Threshold", 22 | pos=wx.DefaultPosition, size=wx.Size(263, 186), style=wx.DEFAULT_DIALOG_STYLE) 23 | 24 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 25 | 26 | bSizer164 = wx.BoxSizer(wx.VERTICAL) 27 | 28 | bSizer165 = wx.BoxSizer(wx.VERTICAL) 29 | 30 | sbSizer62 = wx.StaticBoxSizer( 31 | wx.StaticBox(self, wx.ID_ANY, u"Parameters"), wx.VERTICAL) 32 | 33 | fgSizer48 = wx.FlexGridSizer(0, 2, 0, 0) 34 | fgSizer48.SetFlexibleDirection(wx.BOTH) 35 | fgSizer48.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) 36 | 37 | self.m_staticText203 = wx.StaticText( 38 | self, wx.ID_ANY, u"Lower Cutoff:", wx.DefaultPosition, wx.DefaultSize, 0) 39 | self.m_staticText203.Wrap(-1) 40 | fgSizer48.Add( 41 | self.m_staticText203, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.ALL, 5) 42 | 43 | self.m_textCtrlLowerCutoff = wx.TextCtrl( 44 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) 45 | fgSizer48.Add(self.m_textCtrlLowerCutoff, 0, wx.ALL, 5) 46 | 47 | self.m_staticText223 = wx.StaticText( 48 | self, wx.ID_ANY, u"Chunk size:", wx.DefaultPosition, wx.DefaultSize, 0) 49 | self.m_staticText223.Wrap(-1) 50 | fgSizer48.Add( 51 | self.m_staticText223, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.ALL, 5) 52 | 53 | self.m_spinCtrlChunkSize = wx.SpinCtrl( 54 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 1024, 64) 55 | fgSizer48.Add(self.m_spinCtrlChunkSize, 0, wx.ALL, 5) 56 | 57 | sbSizer62.Add(fgSizer48, 0, wx.EXPAND, 5) 58 | 59 | bSizer165.Add(sbSizer62, 0, wx.ALL | wx.EXPAND, 5) 60 | 61 | bSizer164.Add(bSizer165, 1, wx.EXPAND, 5) 62 | 63 | m_sdbSizer13 = wx.StdDialogButtonSizer() 64 | self.m_sdbSizer13OK = wx.Button(self, wx.ID_OK) 65 | m_sdbSizer13.AddButton(self.m_sdbSizer13OK) 66 | self.m_sdbSizer13Cancel = wx.Button(self, wx.ID_CANCEL) 67 | m_sdbSizer13.AddButton(self.m_sdbSizer13Cancel) 68 | m_sdbSizer13.Realize() 69 | 70 | bSizer164.Add(m_sdbSizer13, 0, wx.BOTTOM | wx.EXPAND | wx.TOP, 5) 71 | 72 | self.SetSizer(bSizer164) 73 | self.Layout() 74 | 75 | self.Centre(wx.BOTH) 76 | 77 | def __del__(self): 78 | pass 79 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/AdaptiveOtsuThresholdDialogC.py: -------------------------------------------------------------------------------- 1 | import AdaptiveOtsuThresholdDialog 2 | 3 | 4 | class AdaptiveOtsuThresholdDialogC(AdaptiveOtsuThresholdDialog.AdaptiveOtsuThresholdDialog): 5 | 6 | def __init__(self, parent, **kw): 7 | 8 | AdaptiveOtsuThresholdDialog.AdaptiveOtsuThresholdDialog.__init__( 9 | self, parent, **kw) 10 | 11 | self.m_textCtrlLowerCutoff.SetValue('-1000.0') 12 | self.m_spinCtrlChunkSize.SetValue(64) 13 | 14 | # OS X bug workaround 15 | val = self.m_spinCtrlChunkSize.GetValue() 16 | self.m_spinCtrlChunkSize.SetValue(val) 17 | 18 | def GetResults(self): 19 | 20 | try: 21 | return (float(self.m_textCtrlLowerCutoff.GetValue()), int(self.m_spinCtrlChunkSize.GetValue())) 22 | except ValueError: 23 | return None 24 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/AnisotropicSmoothingDialogC.py: -------------------------------------------------------------------------------- 1 | import AnisotropicSmoothingDialog 2 | import wx 3 | 4 | 5 | class AnisotropicSmoothingDialogC(AnisotropicSmoothingDialog.AnisotropicSmoothingDialog): 6 | 7 | def __init__(self, parent, **kw): 8 | 9 | AnisotropicSmoothingDialog.AnisotropicSmoothingDialog.__init__( 10 | self, parent, **kw) 11 | 12 | # OS X bug workaround 13 | val = self.m_spinCtrlNumIterations.GetValue() 14 | self.m_spinCtrlNumIterations.SetValue(val) 15 | 16 | def GetResults(self): 17 | 18 | try: 19 | return (int(self.m_spinCtrlNumIterations.GetValue()), 20 | float(self.m_textCtrlDiffusionThreshold.GetValue()), 21 | float(self.m_textCtrlDiffusionFactor.GetValue()), 22 | self.m_checkBoxUseFaces.GetValue(), 23 | self.m_checkBoxUseEdges.GetValue(), 24 | self.m_checkBoxUseCorners.GetValue(), 25 | int(self.m_radioBox9.GetSelection())) 26 | except ValueError: 27 | return None 28 | 29 | def set_update_callback(self, callback): 30 | """set up a callback for the update button""" 31 | self.m_buttonUpdate.Bind( 32 | wx.EVT_BUTTON, lambda evt, d=self: callback(evt, d)) 33 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ApplicationPreferencesDialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Oct 8 2012) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class ApplicationPreferencesDialog 15 | ########################################################################### 16 | 17 | 18 | class ApplicationPreferencesDialog (wx.Dialog): 19 | 20 | def __init__(self, parent): 21 | wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Preferences", 22 | pos=wx.DefaultPosition, size=wx.Size(621, 498), style=wx.DEFAULT_DIALOG_STYLE) 23 | 24 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 25 | 26 | bSizer107 = wx.BoxSizer(wx.VERTICAL) 27 | 28 | bSizer105 = wx.BoxSizer(wx.HORIZONTAL) 29 | 30 | bSizer106 = wx.BoxSizer(wx.VERTICAL) 31 | 32 | self.m_treeCtrl1 = wx.TreeCtrl( 33 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_DEFAULT_STYLE) 34 | self.m_treeCtrl1.SetMinSize(wx.Size(175, -1)) 35 | 36 | bSizer106.Add(self.m_treeCtrl1, 1, wx.ALL | wx.EXPAND, 5) 37 | 38 | self.m_searchCtrl2 = wx.SearchCtrl( 39 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER) 40 | self.m_searchCtrl2.ShowSearchButton(True) 41 | self.m_searchCtrl2.ShowCancelButton(True) 42 | bSizer106.Add(self.m_searchCtrl2, 0, wx.ALL | wx.EXPAND, 5) 43 | 44 | bSizer105.Add(bSizer106, 0, wx.EXPAND, 5) 45 | 46 | self.m_panelMainPanel = wx.Panel( 47 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) 48 | self.m_panelMainPanel.SetBackgroundColour( 49 | wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)) 50 | 51 | bSizer105.Add(self.m_panelMainPanel, 1, wx.EXPAND | wx.ALL, 5) 52 | 53 | bSizer107.Add(bSizer105, 1, wx.EXPAND, 5) 54 | 55 | self.m_staticline5 = wx.StaticLine( 56 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) 57 | bSizer107.Add(self.m_staticline5, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 5) 58 | 59 | m_sdbSizer7 = wx.StdDialogButtonSizer() 60 | self.m_sdbSizer7OK = wx.Button(self, wx.ID_OK) 61 | m_sdbSizer7.AddButton(self.m_sdbSizer7OK) 62 | self.m_sdbSizer7Cancel = wx.Button(self, wx.ID_CANCEL) 63 | m_sdbSizer7.AddButton(self.m_sdbSizer7Cancel) 64 | m_sdbSizer7.Realize() 65 | 66 | bSizer107.Add(m_sdbSizer7, 0, wx.ALL | wx.EXPAND, 5) 67 | 68 | self.SetSizer(bSizer107) 69 | self.Layout() 70 | 71 | self.Centre(wx.BOTH) 72 | 73 | def __del__(self): 74 | pass 75 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ApplicationPreferencesDialogC.py: -------------------------------------------------------------------------------- 1 | import wx 2 | import ApplicationPreferencesDialog 3 | 4 | 5 | class ApplicationPreferencesDialogC(ApplicationPreferencesDialog.ApplicationPreferencesDialog): 6 | 7 | def __init__(self, parent): 8 | 9 | # call base class 10 | ApplicationPreferencesDialog.ApplicationPreferencesDialog.__init__( 11 | self, parent) 12 | 13 | # add default settings 14 | self._treeList = [ 15 | ('Display', [ 16 | 'Display option 1', 'Display option 2', 'Display option 3']), 17 | ('Miscellaneous', [ 18 | 'Misc. option 1', 'Misc. option 2', 'Misc. option 3']), 19 | ] 20 | self.treeMap = {} 21 | 22 | # Connect Events 23 | self.m_searchCtrl2.Bind(wx.EVT_TEXT, self.RecreateTree) 24 | self.m_searchCtrl2.Bind( 25 | wx.EVT_SEARCHCTRL_CANCEL_BTN, lambda e: self.m_searchCtrl2.SetValue('')) 26 | self.m_searchCtrl2.Bind(wx.EVT_TEXT_ENTER, self.OnSearch) 27 | 28 | self.RecreateTree() 29 | 30 | self.m_treeCtrl1.ExpandAll() 31 | 32 | def GetValue(self): 33 | return None 34 | 35 | def AddEntry(self, entry): 36 | pass 37 | 38 | def OnSearch(self, evt=None): 39 | pass 40 | 41 | def RecreateTree(self, evt=None): 42 | # Catch the search type (name or content) 43 | 44 | fullSearch = False 45 | 46 | if evt: 47 | if fullSearch: 48 | # Do not`scan all the demo files for every char 49 | # the user input, use wx.EVT_TEXT_ENTER instead 50 | return 51 | 52 | ##expansionState = self.m_treeCtrl1.GetExpansionState() 53 | 54 | current = None 55 | item = self.m_treeCtrl1.GetSelection() 56 | if item: 57 | prnt = self.m_treeCtrl1.GetItemParent(item) 58 | if prnt: 59 | current = (self.m_treeCtrl1.GetItemText(item), 60 | self.m_treeCtrl1.GetItemText(prnt)) 61 | 62 | self.m_treeCtrl1.Freeze() 63 | self.m_treeCtrl1.DeleteAllItems() 64 | self.root = self.m_treeCtrl1.AddRoot("Preferences") 65 | self.m_treeCtrl1.SetItemImage(self.root, 0) 66 | self.m_treeCtrl1.SetItemPyData(self.root, 0) 67 | 68 | treeFont = self.m_treeCtrl1.GetFont() 69 | catFont = self.m_treeCtrl1.GetFont() 70 | 71 | treeFont.SetWeight(wx.BOLD) 72 | catFont.SetWeight(wx.BOLD) 73 | self.m_treeCtrl1.SetItemFont(self.root, treeFont) 74 | 75 | firstChild = None 76 | selectItem = None 77 | filter = self.m_searchCtrl2.GetValue() 78 | count = 0 79 | 80 | for category, items in self._treeList: 81 | count += 1 82 | if filter: 83 | if fullSearch: 84 | items = self.searchItems[category] 85 | else: 86 | items = [ 87 | item for item in items if filter.lower() in item.lower()] 88 | if items: 89 | child = self.m_treeCtrl1.AppendItem( 90 | self.root, category, image=count) 91 | self.m_treeCtrl1.SetItemFont(child, catFont) 92 | self.m_treeCtrl1.SetItemPyData(child, count) 93 | if not firstChild: 94 | firstChild = child 95 | for childItem in items: 96 | image = count 97 | theDemo = self.m_treeCtrl1.AppendItem( 98 | child, childItem, image=image) 99 | self.m_treeCtrl1.SetItemPyData(theDemo, count) 100 | self.treeMap[childItem] = theDemo 101 | if current and (childItem, category) == current: 102 | selectItem = theDemo 103 | 104 | self.m_treeCtrl1.Expand(self.root) 105 | self.m_treeCtrl1.ExpandAll() 106 | if selectItem: 107 | self.skipLoad = True 108 | self.m_treeCtrl1.SelectItem(selectItem) 109 | self.skipLoad = False 110 | 111 | self.m_treeCtrl1.Thaw() 112 | self.searchItems = {} 113 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/BackgroundColourSelectorDialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Apr 10 2012) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class BackgroundColourSelectorDialog 15 | ########################################################################### 16 | 17 | 18 | class BackgroundColourSelectorDialog (wx.Dialog): 19 | 20 | def __init__(self, parent): 21 | wx.Dialog.__init__( 22 | self, parent, id=wx.ID_ANY, title=u"Background Colour", 23 | pos=wx.DefaultPosition, size=wx.Size(352, 225), style=wx.DEFAULT_DIALOG_STYLE) 24 | 25 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 26 | 27 | bSizer96 = wx.BoxSizer(wx.VERTICAL) 28 | 29 | fgSizer27 = wx.FlexGridSizer(0, 3, 0, 0) 30 | fgSizer27.SetFlexibleDirection(wx.BOTH) 31 | fgSizer27.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) 32 | 33 | self.m_staticText114 = wx.StaticText( 34 | self, wx.ID_ANY, u"Top Gradient Colour:", wx.DefaultPosition, wx.DefaultSize, 0) 35 | self.m_staticText114.Wrap(-1) 36 | fgSizer27.Add(self.m_staticText114, 0, 37 | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 38 | 39 | self.m_colourPickerTop = wx.ColourPickerCtrl(self, wx.ID_ANY, wx.Colour( 40 | 0, 58, 117), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE) 41 | fgSizer27.Add(self.m_colourPickerTop, 0, wx.ALL, 5) 42 | 43 | self.m_checkBoxApplyGradient = wx.CheckBox( 44 | self, wx.ID_ANY, u"Apply Gradient", wx.DefaultPosition, wx.DefaultSize, 0) 45 | self.m_checkBoxApplyGradient.SetValue(True) 46 | fgSizer27.Add(self.m_checkBoxApplyGradient, 47 | 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 48 | 49 | self.m_staticText115 = wx.StaticText( 50 | self, wx.ID_ANY, u"Bottom Gradient Colour:", wx.DefaultPosition, wx.DefaultSize, 0) 51 | self.m_staticText115.Wrap(-1) 52 | fgSizer27.Add(self.m_staticText115, 0, 53 | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 54 | 55 | self.m_colourPickerBottom = wx.ColourPickerCtrl(self, wx.ID_ANY, wx.Colour( 56 | 255, 255, 255), wx.DefaultPosition, wx.DefaultSize, wx.CLRP_DEFAULT_STYLE) 57 | fgSizer27.Add(self.m_colourPickerBottom, 0, wx.ALL, 5) 58 | 59 | bSizer96.Add(fgSizer27, 0, wx.EXPAND | wx.LEFT, 5) 60 | 61 | m_radioBoxKeyBindingChoices = [ 62 | u"L-key displays this dialog", u"L-key toggles between grey and black"] 63 | self.m_radioBoxKeyBinding = wx.RadioBox( 64 | self, wx.ID_ANY, u"Keybinding Behaviour", wx.DefaultPosition, wx.DefaultSize, m_radioBoxKeyBindingChoices, 1, wx.RA_SPECIFY_COLS) 65 | self.m_radioBoxKeyBinding.SetSelection(0) 66 | bSizer96.Add(self.m_radioBoxKeyBinding, 0, wx.ALL | wx.EXPAND, 5) 67 | 68 | bSizer96.AddSpacer((0, 0), 1, wx.EXPAND, 5) 69 | 70 | m_sdbSizer6 = wx.StdDialogButtonSizer() 71 | self.m_sdbSizer6OK = wx.Button(self, wx.ID_OK) 72 | m_sdbSizer6.AddButton(self.m_sdbSizer6OK) 73 | self.m_sdbSizer6Cancel = wx.Button(self, wx.ID_CANCEL) 74 | m_sdbSizer6.AddButton(self.m_sdbSizer6Cancel) 75 | m_sdbSizer6.Realize() 76 | 77 | bSizer96.Add( 78 | m_sdbSizer6, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL | wx.EXPAND, 5) 79 | 80 | self.SetSizer(bSizer96) 81 | self.Layout() 82 | 83 | self.Centre(wx.BOTH) 84 | 85 | # Connect Events 86 | self.m_colourPickerTop.Bind( 87 | wx.EVT_COLOURPICKER_CHANGED, self.onTopColourChanged) 88 | self.m_checkBoxApplyGradient.Bind( 89 | wx.EVT_CHECKBOX, self.onApplyGradient) 90 | self.m_colourPickerBottom.Bind( 91 | wx.EVT_COLOURPICKER_CHANGED, self.onBottomColourChanged) 92 | self.m_radioBoxKeyBinding.Bind( 93 | wx.EVT_RADIOBOX, self.onKeyBindingChanged) 94 | 95 | def __del__(self): 96 | pass 97 | 98 | # Virtual event handlers, overide them in your derived class 99 | def onTopColourChanged(self, evt): 100 | evt.Skip() 101 | 102 | def onApplyGradient(self, evt): 103 | evt.Skip() 104 | 105 | def onBottomColourChanged(self, evt): 106 | evt.Skip() 107 | 108 | def onKeyBindingChanged(self, evt): 109 | evt.Skip() 110 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/BackgroundColourSelectorDialogC.py: -------------------------------------------------------------------------------- 1 | import BackgroundColourSelectorDialog 2 | 3 | 4 | class ColourState(object): 5 | 6 | def __init__(self): 7 | self.top_colour = (35, 89, 136) 8 | self.bottom_colour = (127, 127, 127) 9 | self.bGradientOn = True 10 | self.bKeybindingNew = True 11 | 12 | def set(self, obj): 13 | self.top_colour = obj.GetTopColour() 14 | self.bottom_colour = obj.GetBottomColour() 15 | self.bGradientOn = obj.GetGradientState() 16 | self.bKeybindingNew = obj.GetKeybindingState() 17 | 18 | def copy(self): 19 | 20 | c = ColourState() 21 | c.top_colour = self.top_colour 22 | c.bottom_colour = self.bottom_colour 23 | c.bGradientOn = self.bGradientOn 24 | c.bKeybindingNew = self.bKeybindingNew 25 | 26 | return c 27 | 28 | def SetTopColour(self, c): 29 | self.top_colour = c 30 | 31 | def SetBottomColour(self, c): 32 | self.bottom_colour = c 33 | 34 | def SetGradientState(self, state): 35 | self.bGradientOn = state 36 | 37 | def GetTopColour(self): 38 | return self.top_colour 39 | 40 | def GetBottomColour(self): 41 | return self.bottom_colour 42 | 43 | def GetGradientState(self): 44 | return self.bGradientOn 45 | 46 | def GetKeybindingState(self): 47 | return self.bKeybindingNew 48 | 49 | 50 | class BackgroundColourSelectorDialogC(BackgroundColourSelectorDialog.BackgroundColourSelectorDialog): 51 | 52 | def __init__(self, parent, state=None): 53 | 54 | BackgroundColourSelectorDialog.BackgroundColourSelectorDialog.__init__( 55 | self, parent) 56 | 57 | if state is None: 58 | state = ColourState() 59 | self._state = state.copy() 60 | 61 | # initialize values 62 | self.m_colourPickerTop.SetColour(self._state.top_colour) 63 | self.m_colourPickerBottom.SetColour(self._state.bottom_colour) 64 | self.m_checkBoxApplyGradient.SetValue(self._state.bGradientOn) 65 | self.m_staticText115.Enable(self._state.bGradientOn) 66 | self.m_colourPickerBottom.Enable(self._state.bGradientOn) 67 | 68 | self.m_radioBoxKeyBinding.SetSelection({ 69 | True: 0, False: 1}[self._state.bKeybindingNew]) 70 | 71 | # auto layout 72 | self.SetSize(self.GetBestSize()) 73 | 74 | def onApplyGradient(self, evt): 75 | state = evt.IsChecked() 76 | self.m_staticText115.Enable(state) 77 | self.m_colourPickerBottom.Enable(state) 78 | self._state.bGradientOn = state 79 | 80 | def GetState(self): 81 | return self._state 82 | 83 | def onTopColourChanged(self, evt): 84 | self._state.top_colour = evt.GetColour()[0:3] 85 | 86 | def onBottomColourChanged(self, evt): 87 | self._state.bottom_colour = evt.GetColour()[0:3] 88 | 89 | def onKeyBindingChanged(self, evt): 90 | self._state.bKeybindingNew = {0: True, 1: False}[evt.GetSelection()] 91 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ChooseFilterRadiusDialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Nov 6 2013) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class ChooseFilterRadiusDialog 15 | ########################################################################### 16 | 17 | 18 | class ChooseFilterRadiusDialog (wx.Dialog): 19 | 20 | def __init__(self, parent): 21 | wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Filter radius", pos=wx.DefaultPosition, size=wx.Size( 22 | 289, 182), style=wx.CAPTION | wx.DEFAULT_DIALOG_STYLE) 23 | 24 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 25 | 26 | bSizer105 = wx.BoxSizer(wx.VERTICAL) 27 | 28 | self.m_staticTextVersionMessage = wx.StaticText( 29 | self, wx.ID_ANY, u"Enter {0} filter radius:", wx.DefaultPosition, wx.Size(-1, -1), 0) 30 | self.m_staticTextVersionMessage.Wrap(-1) 31 | bSizer105.Add( 32 | self.m_staticTextVersionMessage, 0, wx.ALL | wx.EXPAND | wx.LEFT | wx.TOP, 10) 33 | 34 | self.m_textCtrlRadius = wx.TextCtrl( 35 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0) 36 | bSizer105.Add( 37 | self.m_textCtrlRadius, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 15) 38 | 39 | bSizer105.AddSpacer((0, 0), 0, wx.EXPAND, 5) 40 | 41 | self.m_checkBox3DFilter = wx.CheckBox( 42 | self, wx.ID_ANY, u"Apply as a 3D filter", wx.DefaultPosition, wx.DefaultSize, 0) 43 | self.m_checkBox3DFilter.SetValue(True) 44 | bSizer105.Add( 45 | self.m_checkBox3DFilter, 0, wx.ALL | wx.BOTTOM | wx.TOP, 5) 46 | 47 | bSizer105.AddSpacer((0, 0), 1, wx.EXPAND, 5) 48 | 49 | self.m_staticline12 = wx.StaticLine( 50 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) 51 | bSizer105.Add(self.m_staticline12, 0, wx.EXPAND | wx.ALL, 5) 52 | 53 | m_sdbSizer17 = wx.StdDialogButtonSizer() 54 | self.m_sdbSizer17OK = wx.Button(self, wx.ID_OK) 55 | m_sdbSizer17.AddButton(self.m_sdbSizer17OK) 56 | self.m_sdbSizer17Cancel = wx.Button(self, wx.ID_CANCEL) 57 | m_sdbSizer17.AddButton(self.m_sdbSizer17Cancel) 58 | m_sdbSizer17.Realize() 59 | 60 | bSizer105.Add(m_sdbSizer17, 1, wx.ALL | wx.EXPAND, 5) 61 | 62 | self.SetSizer(bSizer105) 63 | self.Layout() 64 | 65 | self.Centre(wx.BOTH) 66 | 67 | def __del__(self): 68 | pass 69 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ChooseFilterRadiusDialogC.py: -------------------------------------------------------------------------------- 1 | import ChooseFilterRadiusDialog 2 | 3 | 4 | class ChooseFilterRadiusDialogC(ChooseFilterRadiusDialog.ChooseFilterRadiusDialog): 5 | 6 | def __init__(self, parent, filtername, radius, image3d): 7 | ChooseFilterRadiusDialog.ChooseFilterRadiusDialog.__init__( 8 | self, parent) 9 | self.SetFilterName(filtername) 10 | self.SetRadius(radius) 11 | self.Set3DFilterCheckboxState(image3d) 12 | self.Layout() 13 | 14 | def SetFilterName(self, name): 15 | self.m_staticTextVersionMessage.SetLabel( 16 | "Enter {0} filter radius:".format(name)) 17 | 18 | def SetRadius(self, radius): 19 | self.m_textCtrlRadius.SetValue(radius) 20 | 21 | def GetRadius(self): 22 | return self.m_textCtrlRadius.GetValue() 23 | 24 | def Set3DFilterCheckboxState(self, val): 25 | self.m_checkBox3DFilter.SetValue(val) 26 | 27 | def Get3DFilterCheckboxState(self): 28 | return self.m_checkBox3DFilter.GetValue() 29 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/Cursors/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | __import__('pkg_resources').declare_namespace(__name__) 3 | except: 4 | __path__ = __import__('pkgutil').extend_path(__path__, __name__) 5 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/Cursors/pan.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Cursors/pan.gif -------------------------------------------------------------------------------- /PI/visualization/MicroView/Cursors/rotate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Cursors/rotate.gif -------------------------------------------------------------------------------- /PI/visualization/MicroView/Cursors/slice.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Cursors/slice.gif -------------------------------------------------------------------------------- /PI/visualization/MicroView/Cursors/spin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Cursors/spin.gif -------------------------------------------------------------------------------- /PI/visualization/MicroView/Cursors/winlev.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Cursors/winlev.gif -------------------------------------------------------------------------------- /PI/visualization/MicroView/Cursors/zoom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Cursors/zoom.gif -------------------------------------------------------------------------------- /PI/visualization/MicroView/DICOMDIRBrowseDialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | ## Python code generated with wxFormBuilder (version Jun 5 2014) 5 | ## http://www.wxformbuilder.org/ 6 | ## 7 | ## PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | import wx.propgrid as pg 13 | 14 | ########################################################################### 15 | ## Class DICOMDIRBrowseDialog 16 | ########################################################################### 17 | 18 | class DICOMDIRBrowseDialog ( wx.Dialog ): 19 | 20 | def __init__( self, parent ): 21 | wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"DICOMDIR Browser", pos = wx.DefaultPosition, size = wx.Size( 812,602 ), style = wx.DEFAULT_DIALOG_STYLE ) 22 | 23 | self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize ) 24 | 25 | bSizer145 = wx.BoxSizer( wx.VERTICAL ) 26 | 27 | bSizer199 = wx.BoxSizer( wx.HORIZONTAL ) 28 | 29 | self.m_panelMainArea = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) 30 | self.m_panelMainArea.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) ) 31 | 32 | bSizer199.Add( self.m_panelMainArea, 1, wx.EXPAND |wx.ALL, 5 ) 33 | 34 | bSizer197 = wx.BoxSizer( wx.VERTICAL ) 35 | 36 | bSizer197.SetMinSize( wx.Size( -1,180 ) ) 37 | sbSizer77 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Details" ), wx.VERTICAL ) 38 | 39 | self.m_propertyGrid = pg.PropertyGrid(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.propgrid.PG_AUTO_SORT|wx.propgrid.PG_DEFAULT_STYLE) 40 | sbSizer77.Add( self.m_propertyGrid, 1, wx.EXPAND, 5 ) 41 | 42 | self.m_searchCtrl = wx.SearchCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_PROCESS_ENTER ) 43 | self.m_searchCtrl.ShowSearchButton( True ) 44 | self.m_searchCtrl.ShowCancelButton( True ) 45 | sbSizer77.Add( self.m_searchCtrl, 0, wx.BOTTOM|wx.EXPAND|wx.TOP, 5 ) 46 | 47 | 48 | bSizer197.Add( sbSizer77, 1, wx.EXPAND|wx.RIGHT, 5 ) 49 | 50 | sbSizer76 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Preview" ), wx.VERTICAL ) 51 | 52 | sbSizer76.SetMinSize( wx.Size( 260,260 ) ) 53 | self.m_bitmapPreview = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0 ) 54 | sbSizer76.Add( self.m_bitmapPreview, 1, wx.EXPAND, 5 ) 55 | 56 | 57 | bSizer197.Add( sbSizer76, 0, wx.BOTTOM|wx.EXPAND|wx.RIGHT, 5 ) 58 | 59 | 60 | bSizer199.Add( bSizer197, 0, wx.EXPAND, 5 ) 61 | 62 | 63 | bSizer145.Add( bSizer199, 1, wx.EXPAND, 5 ) 64 | 65 | self.m_staticline1 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) 66 | bSizer145.Add( self.m_staticline1, 0, wx.EXPAND |wx.ALL, 5 ) 67 | 68 | m_sdbSizer1 = wx.StdDialogButtonSizer() 69 | self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK ) 70 | m_sdbSizer1.AddButton( self.m_sdbSizer1OK ) 71 | self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL ) 72 | m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel ) 73 | m_sdbSizer1.Realize(); 74 | 75 | bSizer145.Add( m_sdbSizer1, 0, wx.BOTTOM|wx.EXPAND, 5 ) 76 | 77 | 78 | self.SetSizer( bSizer145 ) 79 | self.Layout() 80 | 81 | self.Centre( wx.BOTH ) 82 | 83 | # Connect Events 84 | self.m_searchCtrl.Bind( wx.EVT_SEARCHCTRL_CANCEL_BTN, self.onSearchCancel ) 85 | self.m_searchCtrl.Bind( wx.EVT_SEARCHCTRL_SEARCH_BTN, self.onSearch ) 86 | self.m_searchCtrl.Bind( wx.EVT_TEXT_ENTER, self.onSearch ) 87 | 88 | def __del__( self ): 89 | pass 90 | 91 | 92 | # Virtual event handlers, overide them in your derived class 93 | def onSearchCancel( self, event ): 94 | event.Skip() 95 | 96 | def onSearch( self, event ): 97 | event.Skip() 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ErodeDilateMorphologyDialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Nov 6 2013) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class ErodeDilateMorphologyDialog 15 | ########################################################################### 16 | 17 | 18 | class ErodeDilateMorphologyDialog (wx.Dialog): 19 | 20 | def __init__(self, parent): 21 | wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Erode/Dilate Image", 22 | pos=wx.DefaultPosition, size=wx.Size(372, 152), style=wx.DEFAULT_DIALOG_STYLE) 23 | 24 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 25 | 26 | bSizer161 = wx.BoxSizer(wx.VERTICAL) 27 | 28 | bSizer161.AddSpacer((0, 0), 1, wx.EXPAND, 5) 29 | 30 | bSizer162 = wx.BoxSizer(wx.HORIZONTAL) 31 | 32 | fgSizer46 = wx.FlexGridSizer(0, 2, 0, 0) 33 | fgSizer46.SetFlexibleDirection(wx.BOTH) 34 | fgSizer46.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) 35 | 36 | self.m_staticText198 = wx.StaticText( 37 | self, wx.ID_ANY, u"Number of Iterations:", wx.DefaultPosition, wx.DefaultSize, 0) 38 | self.m_staticText198.Wrap(-1) 39 | fgSizer46.Add( 40 | self.m_staticText198, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 41 | 42 | self.m_spinCtrlNumberIterations = wx.SpinCtrl( 43 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 1, 1000, 1) 44 | self.m_spinCtrlNumberIterations.SetMinSize(wx.Size(70, -1)) 45 | 46 | fgSizer46.Add(self.m_spinCtrlNumberIterations, 0, wx.ALL, 5) 47 | 48 | bSizer162.Add(fgSizer46, 0, 0, 5) 49 | 50 | bSizer161.Add(bSizer162, 0, wx.ALL | wx.EXPAND, 5) 51 | 52 | bSizer161.AddSpacer((0, 0), 1, wx.EXPAND, 5) 53 | 54 | self.m_staticline8 = wx.StaticLine( 55 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) 56 | bSizer161.Add(self.m_staticline8, 0, wx.EXPAND | wx.ALL, 5) 57 | 58 | m_sdbSizer12 = wx.StdDialogButtonSizer() 59 | self.m_sdbSizer12OK = wx.Button(self, wx.ID_OK) 60 | m_sdbSizer12.AddButton(self.m_sdbSizer12OK) 61 | self.m_sdbSizer12Cancel = wx.Button(self, wx.ID_CANCEL) 62 | m_sdbSizer12.AddButton(self.m_sdbSizer12Cancel) 63 | m_sdbSizer12.Realize() 64 | 65 | bSizer161.Add(m_sdbSizer12, 0, wx.BOTTOM | wx.EXPAND | wx.TOP, 5) 66 | 67 | self.SetSizer(bSizer161) 68 | self.Layout() 69 | 70 | self.Centre(wx.BOTH) 71 | 72 | def __del__(self): 73 | pass 74 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ErodeDilateMorphologyDialogC.py: -------------------------------------------------------------------------------- 1 | import ErodeDilateMorphologyDialog 2 | 3 | 4 | class ErodeDilateMorphologyDialogC(ErodeDilateMorphologyDialog.ErodeDilateMorphologyDialog): 5 | 6 | def __init__(self, parent): 7 | ErodeDilateMorphologyDialog.ErodeDilateMorphologyDialog.__init__( 8 | self, parent) 9 | 10 | # OS X bug workaround 11 | val = self.m_spinCtrlNumberIterations.GetValue() 12 | self.m_spinCtrlNumberIterations.SetValue(val) 13 | 14 | def GetNumberIterations(self): 15 | """Gets the number of iterations selected by user""" 16 | return self.m_spinCtrlNumberIterations.GetValue() 17 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/HelpDictionary.py: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # 3 | # Copyright (c) 2000-2008 GE Healthcare 4 | # Copyright (c) 2011-2015 Parallax Innovations Inc. 5 | # 6 | # Use, modification and redistribution of the software, in source or 7 | # binary forms, are permitted provided that the following terms and 8 | # conditions are met: 9 | # 10 | # 1) Redistribution of the source code, in verbatim or modified 11 | # form, must retain the above copyright notice, this license, 12 | # the following disclaimer, and any notices that refer to this 13 | # license and/or the following disclaimer. 14 | # 15 | # 2) Redistribution in binary form must include the above copyright 16 | # notice, a copy of this license and the following disclaimer 17 | # in the documentation or with other materials provided with the 18 | # distribution. 19 | # 20 | # 3) Modified copies of the source code must be clearly marked as such, 21 | # and must not be misrepresented as verbatim copies of the source code. 22 | # 23 | # EXCEPT WHEN OTHERWISE STATED IN WRITING BY THE COPYRIGHT HOLDERS AND/OR 24 | # OTHER PARTIES, THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE 25 | # SOFTWARE "AS IS" WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT 26 | # NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 27 | # FOR A PARTICULAR PURPOSE. IN NO EVENT UNLESS AGREED TO IN WRITING WILL 28 | # ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 29 | # THE SOFTWARE UNDER THE TERMS OF THIS LICENSE BE LIABLE FOR ANY DIRECT, 30 | # INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 31 | # TO, LOSS OF DATA OR DATA BECOMING INACCURATE OR LOSS OF PROFIT OR 32 | # BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE OR INABILITY TO 33 | # USE THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 34 | # 35 | # ========================================================================= 36 | 37 | # 38 | # This file represents a derivative work by Parallax Innovations Inc. 39 | # 40 | 41 | """ 42 | HelpDictionary - utility class, get the correct help page link for a given topic - loads the dictionary from file 43 | """ 44 | 45 | import os 46 | import sys 47 | 48 | 49 | # 50 | # 51 | # HelpDictionary 52 | # 53 | # 54 | class HelpDictionary(object): 55 | 56 | def __init__(self, **kw): 57 | self._helpdict = {} 58 | self._filename = None 59 | 60 | def GetHelpPageLink(self, topic): 61 | if topic in self._helpdict: 62 | return self._helpdict[topic] 63 | return topic 64 | 65 | def SetDictionaryFile(self, filename): 66 | self._filename = filename 67 | if os.path.exists(self._filename): 68 | for line in open(self._filename, 'r'): 69 | key, val = line.split() 70 | self._helpdict[key] = val 71 | else: 72 | print 'Warning: unable to find dictionary file "%s"' % (filename) 73 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/HistogramInfoGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Nov 6 2013) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class HistogramInfoGUI 15 | ########################################################################### 16 | 17 | 18 | class HistogramInfoGUI (wx.Panel): 19 | 20 | def __init__(self, parent): 21 | wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size( 22 | 719, -1), style=wx.TAB_TRAVERSAL) 23 | 24 | bSizer66 = wx.BoxSizer(wx.HORIZONTAL) 25 | 26 | bSizer185 = wx.BoxSizer(wx.HORIZONTAL) 27 | 28 | self.m_staticText58 = wx.StaticText( 29 | self, wx.ID_ANY, u"Nearest Data Value:", wx.DefaultPosition, wx.DefaultSize, 0) 30 | self.m_staticText58.Wrap(-1) 31 | bSizer185.Add(self.m_staticText58, 0, wx.ALL, 5) 32 | 33 | self.m_staticTextNearestDataValue = wx.StaticText( 34 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(150, -1), 0) 35 | self.m_staticTextNearestDataValue.Wrap(-1) 36 | bSizer185.Add(self.m_staticTextNearestDataValue, 0, wx.ALL, 5) 37 | 38 | bSizer66.Add(bSizer185, 0, 0, 0) 39 | 40 | bSizer186 = wx.BoxSizer(wx.HORIZONTAL) 41 | 42 | self.m_staticTextSelectedVolumeLabel = wx.StaticText( 43 | self, wx.ID_ANY, u"Selected Volume:", wx.DefaultPosition, wx.DefaultSize, 0) 44 | self.m_staticTextSelectedVolumeLabel.Wrap(-1) 45 | bSizer186.Add(self.m_staticTextSelectedVolumeLabel, 0, wx.ALL, 5) 46 | 47 | self.m_staticTextSelectedVolume = wx.StaticText( 48 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(100, -1), 0) 49 | self.m_staticTextSelectedVolume.Wrap(-1) 50 | bSizer186.Add(self.m_staticTextSelectedVolume, 0, wx.ALL, 5) 51 | 52 | bSizer66.Add(bSizer186, 0, 0, 0) 53 | 54 | bSizer187 = wx.BoxSizer(wx.HORIZONTAL) 55 | 56 | self.m_staticText62 = wx.StaticText( 57 | self, wx.ID_ANY, u"Volume Fraction:", wx.DefaultPosition, wx.DefaultSize, 0) 58 | self.m_staticText62.Wrap(-1) 59 | bSizer187.Add(self.m_staticText62, 0, wx.ALIGN_RIGHT | wx.ALL, 5) 60 | 61 | self.m_staticTextVolumeFraction = wx.StaticText( 62 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(150, -1), 0) 63 | self.m_staticTextVolumeFraction.Wrap(-1) 64 | bSizer187.Add(self.m_staticTextVolumeFraction, 0, wx.ALL, 5) 65 | 66 | bSizer66.Add(bSizer187, 0, 0, 0) 67 | 68 | self.SetSizer(bSizer66) 69 | self.Layout() 70 | 71 | def __del__(self): 72 | pass 73 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/HistogramInfoGUIC.py: -------------------------------------------------------------------------------- 1 | import wx 2 | import HistogramInfoGUI 3 | 4 | 5 | class HistogramInfoGUIC(HistogramInfoGUI.HistogramInfoGUI): 6 | 7 | """Custom HistogramInfoGUI class that uses a wx.WrapSizer() to give us more flexibility""" 8 | 9 | def __init__(self, *args, **kw): 10 | 11 | HistogramInfoGUI.HistogramInfoGUI.__init__(self, *args, **kw) 12 | 13 | old_sizer = self.GetSizer() 14 | new_sizer = wx.WrapSizer() 15 | 16 | for si in old_sizer.GetChildren(): 17 | sizer = si.GetSizer() 18 | old_sizer.Detach(sizer) 19 | new_sizer.Add(sizer, 0, 0, 0) 20 | 21 | self.SetSizer(new_sizer) 22 | 23 | bSizerLower = wx.BoxSizer(wx.HORIZONTAL) 24 | bSizerUpper = wx.BoxSizer(wx.HORIZONTAL) 25 | 26 | m_staticTextLower = wx.StaticText( 27 | self, wx.ID_ANY, u"Lower:", wx.DefaultPosition, wx.DefaultSize, 0) 28 | m_staticTextLower.Wrap(-1) 29 | bSizerLower.Add( 30 | m_staticTextLower, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 31 | 32 | self.m_spinCtrlLower = wx.SpinCtrlDouble( 33 | self, -1, inc=0.01, name='lower') 34 | self.m_spinCtrlLower.SetDigits(2) 35 | bSizerLower.Add( 36 | self.m_spinCtrlLower, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 37 | 38 | new_sizer.Add(bSizerLower, 0, 0, 5) 39 | 40 | m_staticTextUpper = wx.StaticText( 41 | self, wx.ID_ANY, u"Upper:", wx.DefaultPosition, wx.DefaultSize, 0) 42 | m_staticTextUpper.Wrap(-1) 43 | bSizerUpper.Add( 44 | m_staticTextUpper, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 45 | 46 | self.m_spinCtrlUpper = wx.SpinCtrlDouble( 47 | self, -1, inc=0.01, name='upper') 48 | self.m_spinCtrlUpper.SetDigits(2) 49 | bSizerUpper.Add( 50 | self.m_spinCtrlUpper, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 51 | 52 | new_sizer.Add(bSizerUpper, 0, 0, 5) 53 | 54 | self.Layout() 55 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/MicroView-splash.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/MicroView-splash.gif -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/MicroView-splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/MicroView-splash.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/anonymize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/anonymize.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/autothreshold-wizard-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/autothreshold-wizard-24.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/autothreshold-wizard.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/autothreshold-wizard.xcf -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/blank.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/camera.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/cogs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/cogs.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/copy.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/cursor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/cursor.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/cut.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/dicom_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/dicom_button.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/document-save-as-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/document-save-as-3.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/export_wizard_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/export_wizard_1.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/export_wizard_1.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/export_wizard_1.xcf -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/gaussian-smooth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/gaussian-smooth.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/glyphicons_011_camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/glyphicons_011_camera.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/glyphicons_020_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/glyphicons_020_home.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/glyphicons_081_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/glyphicons_081_refresh.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/glyphicons_093_crop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/glyphicons_093_crop.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/glyphicons_144_folder_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/glyphicons_144_folder_open.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/glyphicons_170_step_backward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/glyphicons_170_step_backward.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/glyphicons_178_step_forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/glyphicons_178_step_forward.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/glyphicons_186_move.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/glyphicons_186_move.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/highlight.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/icon_spreadsheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/icon_spreadsheet.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/image-dcm.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/image-dcm.ico -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/image-ima.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/image-ima.ico -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/image-mhd.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/image-mhd.ico -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/image-vff.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/image-vff.ico -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/image-vtk.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/image-vtk.ico -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/left_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/left_button.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/line_draw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/line_draw.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/office-chart-line-stacked-with-nearest-data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/office-chart-line-stacked-with-nearest-data.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/office-chart-line-stacked-with-symbols.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/office-chart-line-stacked-with-symbols.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/office-chart-line-stacked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/office-chart-line-stacked.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/pan.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/parallax-innovations.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/parallax-innovations.ico -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/parallax-innovations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/parallax-innovations.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/parallax-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/parallax-logo.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/parallax-plugin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/parallax-plugin.ico -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/right_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/right_button.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/roi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/roi.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/rotate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/rotate.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/scissors9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/scissors9.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/select_histogram_region.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/select_histogram_region.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/slice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/slice.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_apply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_apply.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_arrow_x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_arrow_x.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_arrow_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_arrow_y.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_arrow_z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_arrow_z.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_copy.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_delete_inside.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_delete_inside.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_delete_outside.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_delete_outside.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_export.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_filters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_filters.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_help.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_import.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_import.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_info.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_invert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_invert.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_new.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_open.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_palette.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_plot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_plot.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_ruler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_ruler.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_show_axes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_show_axes.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_show_nearest_data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_show_nearest_data.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/stock_synchronize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/stock_synchronize.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/thumbs-up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/thumbs-up.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/toggle-markers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/toggle-markers.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/trash.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/up-down-arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/up-down-arrows.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/winlev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/winlev.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/Icons/zoom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/Icons/zoom.png -------------------------------------------------------------------------------- /PI/visualization/MicroView/LUTSelectionDialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Oct 8 2012) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class LUTSelectionDialog 15 | ########################################################################### 16 | 17 | 18 | class LUTSelectionDialog (wx.Dialog): 19 | 20 | def __init__(self, parent): 21 | wx.Dialog.__init__( 22 | self, parent, id=wx.ID_ANY, title=u"Select Palette", 23 | pos=wx.DefaultPosition, size=wx.Size(332, 205), style=wx.DEFAULT_DIALOG_STYLE) 24 | 25 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 26 | 27 | bSizer126 = wx.BoxSizer(wx.VERTICAL) 28 | 29 | self.m_staticText137 = wx.StaticText( 30 | self, wx.ID_ANY, u"Select Palette from the menu below:", wx.DefaultPosition, wx.DefaultSize, 0) 31 | self.m_staticText137.Wrap(-1) 32 | bSizer126.Add(self.m_staticText137, 0, 33 | wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 34 | 35 | self.m_panelPalette = wx.Panel( 36 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) 37 | bSizer126.Add(self.m_panelPalette, 1, wx.EXPAND | wx.ALL, 5) 38 | 39 | m_sdbSizer8 = wx.StdDialogButtonSizer() 40 | self.m_sdbSizer8OK = wx.Button(self, wx.ID_OK) 41 | m_sdbSizer8.AddButton(self.m_sdbSizer8OK) 42 | self.m_sdbSizer8Cancel = wx.Button(self, wx.ID_CANCEL) 43 | m_sdbSizer8.AddButton(self.m_sdbSizer8Cancel) 44 | m_sdbSizer8.Realize() 45 | 46 | bSizer126.Add(m_sdbSizer8, 0, wx.ALL | wx.EXPAND, 5) 47 | 48 | self.SetSizer(bSizer126) 49 | self.Layout() 50 | 51 | self.Centre(wx.BOTH) 52 | 53 | def __del__(self): 54 | pass 55 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/LUTSelectionDialogC.py: -------------------------------------------------------------------------------- 1 | import LUTSelectionDialog 2 | import ctrl 3 | import data 4 | import wx 5 | import numpy 6 | 7 | 8 | class LUTSelectionDialogC(LUTSelectionDialog.LUTSelectionDialog): 9 | 10 | def __init__(self, parent): 11 | LUTSelectionDialog.LUTSelectionDialog.__init__(self, parent) 12 | 13 | # create remaining GUI 14 | box = box = wx.BoxSizer(wx.VERTICAL) 15 | 16 | self.LD = data.LutData() 17 | 18 | self.lutControl = ctrl.LutCtrl( 19 | self.m_panelPalette, self.LD, 14, style=ctrl.LUT_CHOICE | ctrl.LUT_SPIN) 20 | box.Add(self.lutControl, 0, wx.EXPAND | wx.ALL, 2) 21 | self.m_panelPalette.SetSizer(box) 22 | 23 | def GetLUTIndex(self): 24 | return self.lutControl.GetValue() 25 | 26 | def SetLUTIndex(self, idx): 27 | self.lutControl.SetValue(idx) 28 | 29 | def GetLUT(self): 30 | rgb = self.LD.get_rgb(self.lutControl.GetValue()) 31 | rgb2 = numpy.zeros([len(rgb[0]), 3], dtype='uint8') 32 | for i in range(3): 33 | rgb2[:, i] = numpy.fromstring(rgb[i], dtype='uint8') 34 | return rgb2 35 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/LogWindowGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Apr 10 2012) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | LOG_SAVE = 1000 14 | LOG_CLEAR = 1001 15 | 16 | ########################################################################### 17 | # Class LogWindowGUI 18 | ########################################################################### 19 | 20 | 21 | class LogWindowGUI (wx.Panel): 22 | 23 | def __init__(self, parent): 24 | wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size( 25 | 699, 504), style=wx.TAB_TRAVERSAL) 26 | 27 | bSizer80 = wx.BoxSizer(wx.VERTICAL) 28 | 29 | self.m_toolBar2 = wx.ToolBar( 30 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL) 31 | self.m_toolBar2.AddLabelTool(LOG_SAVE, u"tool", wx.ArtProvider.GetBitmap( 32 | wx.ART_FILE_SAVE_AS,), wx.NullBitmap, wx.ITEM_NORMAL, u"Save As...", u"Save statistics to a file", None) 33 | 34 | self.m_toolBar2.AddLabelTool(LOG_CLEAR, u"tool", wx.ArtProvider.GetBitmap( 35 | wx.ART_CUT,), wx.NullBitmap, wx.ITEM_NORMAL, u"Clear results", u"Clear results", None) 36 | 37 | self.m_toolBar2.Realize() 38 | 39 | bSizer80.Add(self.m_toolBar2, 0, wx.EXPAND, 5) 40 | 41 | self.m_textCtrlLog = wx.TextCtrl( 42 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, 43 | wx.DefaultSize, wx.HSCROLL | wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH | wx.TE_RICH2) 44 | bSizer80.Add(self.m_textCtrlLog, 1, wx.ALL | wx.EXPAND, 0) 45 | 46 | self.SetSizer(bSizer80) 47 | self.Layout() 48 | 49 | # Connect Events 50 | self.Bind(wx.EVT_TOOL, self.onToolClicked, id=LOG_SAVE) 51 | self.Bind(wx.EVT_TOOL, self.onToolClicked, id=LOG_CLEAR) 52 | 53 | def __del__(self): 54 | pass 55 | 56 | # Virtual event handlers, overide them in your derived class 57 | def onToolClicked(self, event): 58 | event.Skip() 59 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/LogWindowGUIC.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import StockItems 3 | import LogWindowGUI 4 | from zope import component 5 | # don't change this 6 | from PI.visualization.MicroView.interfaces import IMicroViewOutput 7 | 8 | 9 | class LogWindowGUIC(LogWindowGUI.LogWindowGUI): 10 | 11 | def __init__(self, parent): 12 | LogWindowGUI.LogWindowGUI.__init__(self, parent) 13 | stockicons = StockItems.StockIconFactory() 14 | 15 | self.m_toolBar2.GetToolByPos(1).SetNormalBitmap( 16 | stockicons.getToolbarBitmap("scissors9")) 17 | self.m_toolBar2.Realize() 18 | self.Layout() 19 | 20 | def WriteText(self, text): 21 | self.m_textCtrlLog.AppendText(text) 22 | 23 | def GetTextControl(self): 24 | return self.m_textCtrlLog 25 | 26 | def onToolClicked(self, event): 27 | 28 | if event.GetId() == LogWindowGUI.LOG_SAVE: 29 | self.onFileSaveAs(event) 30 | elif event.GetId() == LogWindowGUI.LOG_CLEAR: 31 | self.onResultsClear(event) 32 | 33 | def onFileSaveAs(self, event): 34 | 35 | # get a global object that can manage saving logging results to disk 36 | object = component.getUtility(IMicroViewOutput) 37 | object.SaveLogToDisk(self.m_textCtrlLog.GetValue()) 38 | 39 | def onResultsClear(self, event): 40 | 41 | # Clear results 42 | self.m_textCtrlLog.Clear() 43 | logging.info("Log results cleared") 44 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ObjectManager.py: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # 3 | # Copyright (c) 2000-2008 GE Healthcare 4 | # Copyright (c) 2011-2015 Parallax Innovations Inc. 5 | # 6 | # Use, modification and redistribution of the software, in source or 7 | # binary forms, are permitted provided that the following terms and 8 | # conditions are met: 9 | # 10 | # 1) Redistribution of the source code, in verbatim or modified 11 | # form, must retain the above copyright notice, this license, 12 | # the following disclaimer, and any notices that refer to this 13 | # license and/or the following disclaimer. 14 | # 15 | # 2) Redistribution in binary form must include the above copyright 16 | # notice, a copy of this license and the following disclaimer 17 | # in the documentation or with other materials provided with the 18 | # distribution. 19 | # 20 | # 3) Modified copies of the source code must be clearly marked as such, 21 | # and must not be misrepresented as verbatim copies of the source code. 22 | # 23 | # EXCEPT WHEN OTHERWISE STATED IN WRITING BY THE COPYRIGHT HOLDERS AND/OR 24 | # OTHER PARTIES, THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE 25 | # SOFTWARE "AS IS" WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT 26 | # NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 27 | # FOR A PARTICULAR PURPOSE. IN NO EVENT UNLESS AGREED TO IN WRITING WILL 28 | # ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 29 | # THE SOFTWARE UNDER THE TERMS OF THIS LICENSE BE LIABLE FOR ANY DIRECT, 30 | # INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 31 | # TO, LOSS OF DATA OR DATA BECOMING INACCURATE OR LOSS OF PROFIT OR 32 | # BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE OR INABILITY TO 33 | # USE THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 34 | # 35 | # ========================================================================= 36 | 37 | # 38 | # This file represents a derivative work by Parallax Innovations Inc. 39 | # 40 | 41 | """ 42 | ObjectManager is a base class to develop management plugins in MicroView 43 | """ 44 | 45 | import collections 46 | from PI.visualization.MicroView import MicroViewPlugIn 47 | 48 | 49 | class ObjectManager(MicroViewPlugIn.MicroViewPlugIn): 50 | 51 | __classname__ = "ObjectManager" 52 | __label__ = "Object Manager" 53 | __shortname__ = "ObjectManager" 54 | __description__ = "Maintains objects in memory" 55 | __menuentry__ = None 56 | __iconname__ = None 57 | __icon__ = None 58 | __managergroup__ = None 59 | 60 | def __init__(self, parent): 61 | 62 | MicroViewPlugIn.MicroViewPlugIn.__init__(self, parent) 63 | 64 | self._helpLink = 'ObjectManager' 65 | 66 | self._ObjectList = {} 67 | self._counter = 1 68 | self._parent = parent 69 | self._cursel = None 70 | 71 | # Create a file filter 72 | self._wft = collections.OrderedDict() 73 | 74 | # Save a file filter 75 | self._rft = collections.OrderedDict() 76 | 77 | self._filename = None 78 | 79 | # 80 | # basic commands, many to be overridden by derived classes 81 | # 82 | # 83 | def selectionCommand(self, evt): 84 | pass 85 | 86 | def ClearCurrentSelection(self): 87 | self._cursel = None 88 | 89 | def SaveObject(self, evt): 90 | pass 91 | 92 | def LoadObject(self, evt): 93 | pass 94 | 95 | def DeleteObject(self, evt): 96 | pass 97 | 98 | def RenameObject(self, evt): 99 | pass 100 | 101 | def DeleteAllObjects(self, evt): 102 | pass 103 | 104 | # 105 | # MicroView application settings, callbacks, accessors 106 | # 107 | 108 | def OnPluginClose(self): 109 | pass 110 | 111 | def OnApplicationClose(self): 112 | try: 113 | self.DeleteAllObjects(0) 114 | return True 115 | except: 116 | return False 117 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/OpenCloseMorphologyDialogC.py: -------------------------------------------------------------------------------- 1 | import OpenCloseMorphologyDialog 2 | 3 | 4 | class OpenCloseMorphologyDialogC(OpenCloseMorphologyDialog.OpenCloseMorphologyDialog): 5 | 6 | def __init__(self, parent): 7 | 8 | OpenCloseMorphologyDialog.OpenCloseMorphologyDialog.__init__( 9 | self, parent) 10 | # OS X bug workaround 11 | val = self.m_spinCtrlX.GetValue() 12 | self.m_spinCtrlX.SetValue(val) 13 | val = self.m_spinCtrlY.GetValue() 14 | self.m_spinCtrlY.SetValue(val) 15 | val = self.m_spinCtrlZ.GetValue() 16 | self.m_spinCtrlZ.SetValue(val) 17 | 18 | # make sure we fit properly 19 | self.Fit() 20 | 21 | def GetResults(self): 22 | 23 | # return results from dialog 24 | return { 25 | 'KernelSizeX': self.m_spinCtrlX.GetValue(), 26 | 'KernelSizeY': self.m_spinCtrlY.GetValue(), 27 | 'KernelSizeZ': self.m_spinCtrlZ.GetValue(), 28 | 'OpenValue': float(self.m_textCtrlOpenValue.GetValue()), 29 | 'CloseValue': float(self.m_textCtrlCloseValue.GetValue()), 30 | } 31 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/PageState.py: -------------------------------------------------------------------------------- 1 | from zope import interface 2 | from PI.visualization.MicroView.interfaces import IPageState 3 | import cStringIO 4 | 5 | 6 | class PageState(object): 7 | 8 | interface.implements(IPageState) 9 | 10 | def __init__(self): 11 | 12 | self.__filename = None 13 | self._title = None 14 | self._type = None 15 | self._closing = False 16 | 17 | def __str__(self): 18 | s = cStringIO.StringIO() 19 | s.write('{0}:\n'.format(self.__class__)) 20 | s.write('\tFilename: {0}\n'.format(self.__filename)) 21 | s.write('\tTitle: {0}\n'.format(self._title)) 22 | s.write('\tType: {0}\n'.format(self._type)) 23 | return s.getvalue() 24 | 25 | def GetPageType(self): 26 | return self._type 27 | 28 | def SetFileName(self, filename): 29 | self.__filename = filename 30 | 31 | def GetFileName(self): 32 | return self.__filename 33 | 34 | def GetTitle(self): 35 | return self._title 36 | 37 | def SetTitle(self, title): 38 | self._title = title 39 | 40 | # These next two methods allow us to track whether a page is in the process of being closed 41 | # We need this here as a kludge to allow is_page_saveable() to properly determine whether the 42 | # page is saveable or not 43 | def setClosing(self, b): 44 | self._closing = b 45 | 46 | def getClosing(self): 47 | return self._closing 48 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/PathFactory.py: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # 3 | # Copyright (c) 2011-2015 Parallax Innovations Inc. 4 | # 5 | # ========================================================================= 6 | 7 | 8 | """ 9 | A class for showing a 3D path. 10 | 11 | Derived From: 12 | 13 | ActorFactor 14 | 15 | """ 16 | 17 | import math 18 | import vtk 19 | from vtkAtamai import ActorFactory 20 | 21 | 22 | class PathFactory(ActorFactory.ActorFactory): 23 | 24 | def __init__(self): 25 | ActorFactory.ActorFactory.__init__(self) 26 | 27 | # Create a green line 28 | self._Points = vtk.vtkPoints() 29 | self._Lines = vtk.vtkCellArray() 30 | self._Poly = vtk.vtkPolyData() 31 | 32 | self._Poly.SetPoints(self._Points) 33 | self._Poly.SetLines(self._Lines) 34 | 35 | self._PathProperty = vtk.vtkProperty() 36 | self._PathProperty.SetColor(0, 1, 0) 37 | self._PathProperty.SetOpacity(0.0) 38 | 39 | # turn the line into a cylinder 40 | self._tube = vtk.vtkTubeFilter() 41 | 42 | # VTK-6 43 | if vtk.vtkVersion().GetVTKMajorVersion() > 5: 44 | self._tube.SetInputData(self._Poly) 45 | else: 46 | self._tube.SetInput(self._Poly) 47 | 48 | self._tube.SetNumberOfSides(3) 49 | self._tube.SetRadius(2.5) 50 | 51 | def Modified(self): 52 | self._tube.Modified() 53 | ActorFactory.ActorFactory.Modified(self) 54 | 55 | def AddPoint(self, point): 56 | self._Points.InsertNextPoint(*point) 57 | self.updateCellInfo() 58 | 59 | def updateCellInfo(self): 60 | 61 | num = self._Points.GetNumberOfPoints() 62 | 63 | # recreate cell info 64 | self._Lines.Reset() 65 | if num > 1: 66 | self._Lines.InsertNextCell(num) 67 | for i in range(num): 68 | self._Lines.InsertCellPoint(i) 69 | 70 | self.Modified() 71 | 72 | def UpdatePoint(self, index, point): 73 | self._Points.SetPoint(index, *point) 74 | self.Modified() 75 | 76 | def DeletePoint(self, idx): 77 | 78 | # we must recreate things here 79 | points = vtk.vtkPoints() 80 | num = self._Points.GetNumberOfPoints() 81 | for i in range(num): 82 | if i != idx: 83 | point = self._Points.GetPoint(i) 84 | points.InsertNextPoint(point) 85 | 86 | self._Points = points 87 | self._Poly.SetPoints(self._Points) 88 | 89 | self.updateCellInfo() 90 | 91 | def DeleteAll(self): 92 | self._Points.Reset() 93 | self.updateCellInfo() 94 | 95 | def tearDown(self): 96 | 97 | ActorFactory.ActorFactory.tearDown(self) 98 | 99 | self.RemoveAllObservers() 100 | self.RemoveAllEventHandlers() 101 | 102 | del self._Points 103 | del self._Lines 104 | del self._Poly 105 | del self._PathProperty 106 | del self._tube 107 | 108 | # Hide the path. 109 | def ClearPath(self): 110 | self._PathProperty.SetOpacity(0) 111 | self.Modified() 112 | 113 | def SetPathOpacity(self, opacity): 114 | self._PathProperty.SetOpacity(opacity) 115 | self.Modified() 116 | 117 | def GetPathOpacity(self): 118 | return self._PathProperty.GetOpacity() 119 | 120 | def _MakeActors(self): 121 | actor = self._NewActor() 122 | actor.SetProperty(self._PathProperty) 123 | mapper = vtk.vtkPolyDataMapper() 124 | mapper.SetInputConnection(self._tube.GetOutputPort()) 125 | actor.SetMapper(mapper) 126 | return [actor] 127 | 128 | def AddToRenderer(self, renderer): 129 | ActorFactory.ActorFactory.AddToRenderer(self, renderer) 130 | renderer.AddObserver('StartEvent', self.OnRenderEvent) 131 | 132 | def OnRenderEvent(self, renderer, event): 133 | """Update scale for path actor""" 134 | 135 | p1 = [0, 0, 0] 136 | p2 = [1, 1, 1] 137 | x, y, z = (0.5 * (p1[0] + p2[0]), 138 | 0.5 * (p1[1] + p2[1]), 139 | 0.5 * (p1[2] + p2[2])) 140 | camera = renderer.GetActiveCamera() 141 | if camera.GetParallelProjection(): 142 | world_size = camera.GetParallelScale() 143 | else: 144 | cx, cy, cz = camera.GetPosition() 145 | d = math.sqrt((x - cx) ** 2 + (y - cy) ** 2 + (z - cz) ** 2) 146 | world_size = 2 * d * math.tan(0.5 * camera.GetViewAngle() / 57.296) 147 | windowWidth, windowHeight = renderer.GetSize() 148 | 149 | if windowWidth > 0 and windowHeight > 0: 150 | pitch = world_size / windowHeight 151 | self._tube.SetRadius(pitch) 152 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/PlotInfoGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Nov 6 2013) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class PlotInfoGUI 15 | ########################################################################### 16 | 17 | 18 | class PlotInfoGUI (wx.Panel): 19 | 20 | def __init__(self, parent): 21 | wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size( 22 | 617, -1), style=wx.TAB_TRAVERSAL) 23 | 24 | bSizer66 = wx.BoxSizer(wx.HORIZONTAL) 25 | #bSizer66 = wx.WrapSizer() 26 | 27 | bSizer183 = wx.BoxSizer(wx.HORIZONTAL) 28 | 29 | self.m_staticText60 = wx.StaticText( 30 | self, wx.ID_ANY, u"Line Length:", wx.DefaultPosition, wx.DefaultSize, 0) 31 | self.m_staticText60.Wrap(-1) 32 | bSizer183.Add( 33 | self.m_staticText60, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.LEFT, 5) 34 | 35 | self.m_staticTextLineLength = wx.StaticText( 36 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(100, -1), 0) 37 | self.m_staticTextLineLength.Wrap(-1) 38 | bSizer183.Add( 39 | self.m_staticTextLineLength, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 40 | 41 | bSizer66.Add(bSizer183, 0, 0, 0) 42 | 43 | bSizer184 = wx.BoxSizer(wx.HORIZONTAL) 44 | 45 | self.m_staticText58 = wx.StaticText( 46 | self, wx.ID_ANY, u"Nearest Data Value:", wx.DefaultPosition, wx.DefaultSize, 0) 47 | self.m_staticText58.Wrap(-1) 48 | bSizer184.Add( 49 | self.m_staticText58, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, 5) 50 | 51 | self.m_staticTextNearestDataValue = wx.StaticText( 52 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size(260, -1), 0) 53 | self.m_staticTextNearestDataValue.Wrap(-1) 54 | bSizer184.Add( 55 | self.m_staticTextNearestDataValue, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 56 | 57 | bSizer66.Add(bSizer184, 0, 0, 0) 58 | 59 | self.SetSizer(bSizer66) 60 | self.Layout() 61 | 62 | def __del__(self): 63 | pass 64 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/PlotInfoGUIC.py: -------------------------------------------------------------------------------- 1 | import wx 2 | import PlotInfoGUI 3 | 4 | 5 | class PlotInfoGUIC(PlotInfoGUI.PlotInfoGUI): 6 | 7 | """Custom PlotInfoGUI class that uses a wx.WrapSizer() to give us more flexibility""" 8 | 9 | def __init__(self, *args, **kw): 10 | 11 | PlotInfoGUI.PlotInfoGUI.__init__(self, *args, **kw) 12 | 13 | old_sizer = self.GetSizer() 14 | new_sizer = wx.WrapSizer() 15 | 16 | for si in old_sizer.GetChildren(): 17 | sizer = si.GetSizer() 18 | old_sizer.Detach(sizer) 19 | new_sizer.Add(sizer, 0, 0, 0) 20 | 21 | self.SetSizer(new_sizer) 22 | self.Layout() 23 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ROIListOutlineFactory.py: -------------------------------------------------------------------------------- 1 | import vtk 2 | from vtkAtamai import ActorFactory, OutlineFactory 3 | 4 | # 5 | # A collection of rectangular outlines, appropriate for defining multiple ROIs 6 | # 7 | 8 | 9 | class ROIListOutlineFactory(ActorFactory.ActorFactory): 10 | 11 | def __init__(self): 12 | 13 | ActorFactory.ActorFactory.__init__(self) 14 | 15 | self.sourceList = [] # list of cube sources 16 | self.outlineList = [] # outlines of the cubes 17 | 18 | def GetNumberOfROIs(self): 19 | return len(self.sourceList) 20 | 21 | def getROIWidths(self, index): 22 | try: 23 | cube = self.sourceList[index] 24 | return [cube.GetXLength(), cube.GetYLength(), cube.GetZLength()] 25 | except: 26 | return [-1, -1, -1] 27 | 28 | def AddROI(self, position, _size): 29 | """Add a new ROI""" 30 | 31 | cube = vtk.vtkCubeSource() 32 | cube.SetXLength(_size[0]) 33 | cube.SetYLength(_size[1]) 34 | cube.SetZLength(_size[2]) 35 | cube.SetCenter(position) 36 | 37 | outline = OutlineFactory.OutlineFactory() 38 | outline.SetInputData(cube.GetOutput()) 39 | 40 | self.sourceList.append(cube) 41 | self.outlineList.append(outline) 42 | 43 | self.AddChild(outline) 44 | self.Modified() 45 | 46 | def updateROI(self, index, position, _size): 47 | 48 | try: 49 | cube = self.sourceList[index] 50 | except IndexError: 51 | return self.AddROI(position, _size) 52 | 53 | outline = self.outlineList[index] 54 | 55 | cube.SetCenter(position) 56 | cube.SetXLength(_size[0]) 57 | cube.SetYLength(_size[1]) 58 | cube.SetZLength(_size[2]) 59 | 60 | self.Modified() 61 | 62 | def SetROIVisibility(self, visible): 63 | 64 | for outline in self.outlineList: 65 | outline.SetVisibility(visible) 66 | 67 | self.Modified() 68 | 69 | def DeleteAll(self): 70 | 71 | for outline in self.outlineList: 72 | self.RemoveChild(outline) 73 | 74 | self.sourceList = [] 75 | self.outlineList = [] 76 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ResultsWindowGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Apr 10 2012) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | LOG_SAVE = 1000 14 | LOG_CLEAR = 1001 15 | 16 | ########################################################################### 17 | # Class ResultsWindowGUI 18 | ########################################################################### 19 | 20 | 21 | class ResultsWindowGUI (wx.Panel): 22 | 23 | def __init__(self, parent): 24 | wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size( 25 | 573, 307), style=wx.TAB_TRAVERSAL) 26 | 27 | bSizer80 = wx.BoxSizer(wx.VERTICAL) 28 | 29 | self.m_toolBar2 = wx.ToolBar( 30 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL) 31 | self.m_toolBar2.AddLabelTool(LOG_SAVE, u"tool", wx.ArtProvider.GetBitmap( 32 | wx.ART_FILE_SAVE_AS,), wx.NullBitmap, wx.ITEM_NORMAL, u"Save As...", u"Save statistics to a file", None) 33 | 34 | self.m_toolBar2.AddLabelTool(LOG_CLEAR, u"tool", wx.ArtProvider.GetBitmap( 35 | wx.ART_CUT,), wx.NullBitmap, wx.ITEM_NORMAL, u"Clear results", u"Clear results", None) 36 | 37 | self.m_toolBar2.Realize() 38 | 39 | bSizer80.Add(self.m_toolBar2, 0, wx.EXPAND, 5) 40 | 41 | self.m_textCtrlLog = wx.TextCtrl( 42 | self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, 43 | wx.DefaultSize, wx.HSCROLL | wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH | wx.TE_RICH2) 44 | bSizer80.Add(self.m_textCtrlLog, 1, wx.ALL | wx.EXPAND, 0) 45 | 46 | self.SetSizer(bSizer80) 47 | self.Layout() 48 | 49 | # Connect Events 50 | self.Bind(wx.EVT_TOOL, self.onToolClicked, id=LOG_SAVE) 51 | self.Bind(wx.EVT_TOOL, self.onToolClicked, id=LOG_CLEAR) 52 | 53 | def __del__(self): 54 | pass 55 | 56 | # Virtual event handlers, overide them in your derived class 57 | def onToolClicked(self, event): 58 | event.Skip() 59 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ResultsWindowGUIC.py: -------------------------------------------------------------------------------- 1 | import ResultsWindowGUI 2 | import logging 3 | import StockItems 4 | import wx 5 | from zope import interface, component 6 | from PI.visualization.MicroView.interfaces import IResultWindow, IMicroViewOutput 7 | 8 | 9 | class ResultsWindowGUIC(ResultsWindowGUI.ResultsWindowGUI): 10 | 11 | interface.implements(IResultWindow) 12 | 13 | def __init__(self, parent): 14 | 15 | ResultsWindowGUI.ResultsWindowGUI.__init__(self, parent) 16 | 17 | stockicons = StockItems.StockIconFactory() 18 | 19 | self.m_toolBar2.GetToolByPos(1).SetNormalBitmap( 20 | stockicons.getToolbarBitmap("scissors9")) 21 | self.m_toolBar2.Realize() 22 | self.Layout() 23 | 24 | def WriteText(self, text): 25 | 26 | for line in text.split('\n'): 27 | if (line.startswith('=') or line.startswith('#')): 28 | self.m_textCtrlLog.SetDefaultStyle(wx.TextAttr(wx.BLUE)) 29 | else: 30 | self.m_textCtrlLog.SetDefaultStyle(wx.TextAttr(wx.BLACK)) 31 | self.m_textCtrlLog.AppendText(line + '\n') 32 | 33 | def GetTextControl(self): 34 | return self.m_textCtrlLog 35 | 36 | def onToolClicked(self, event): 37 | 38 | if event.GetId() == ResultsWindowGUI.LOG_SAVE: 39 | self.onFileSaveAs(event) 40 | elif event.GetId() == ResultsWindowGUI.LOG_CLEAR: 41 | self.onResultsClear(event) 42 | 43 | def onFileSaveAs(self, event): 44 | 45 | # get a global object that can manage saving logging results to disk 46 | object = component.getUtility(IMicroViewOutput) 47 | object.SaveResultsToDisk(self.m_textCtrlLog.GetValue()) 48 | 49 | def onResultsClear(self, event): 50 | 51 | # Clear results 52 | self.m_textCtrlLog.Clear() 53 | logging.info("Results window cleared") 54 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/SliceViewportManager.py: -------------------------------------------------------------------------------- 1 | import ViewerState 2 | import vtk 3 | from vtk.wx import wxVTKRenderWindow 4 | from PI.visualization.MicroView.interfaces import IViewer 5 | from zope import interface 6 | 7 | 8 | class SliceViewportManager(wxVTKRenderWindow.wxVTKRenderWindow): 9 | 10 | interface.implements(IViewer) 11 | 12 | def Freeze2(self): 13 | # TODO: implement me 14 | pass 15 | 16 | def Thaw2(self): 17 | # TODO: implement me 18 | pass 19 | 20 | def __init__(self, parent, **kw): 21 | self._index = kw.get('index', 0) 22 | self._viewerState = ViewerState.ViewerState() 23 | wxVTKRenderWindow.wxVTKRenderWindow.__init__(self, parent, -1) 24 | 25 | # Add some dummy objects etc. 26 | ren = vtk.vtkRenderer() 27 | self.GetRenderWindow().AddRenderer(ren) 28 | 29 | cone = vtk.vtkConeSource() 30 | cone.SetResolution(8) 31 | 32 | coneMapper = vtk.vtkPolyDataMapper() 33 | coneMapper.SetInputConnection(cone.GetOutputPort()) 34 | 35 | coneActor = vtk.vtkActor() 36 | coneActor.SetMapper(coneMapper) 37 | 38 | ren.AddActor(coneActor) 39 | 40 | def GetImageIndex(self): 41 | return self._index 42 | 43 | def GetPageState(self): 44 | return self._viewerState 45 | 46 | def SetViewTo1Side3(self, *args, **kw): 47 | pass 48 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/SpreadsheetGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | ## Python code generated with wxFormBuilder (version Jun 6 2014) 5 | ## http://www.wxformbuilder.org/ 6 | ## 7 | ## PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | import wx.grid 13 | 14 | ########################################################################### 15 | ## Class SpreadsheetGUI 16 | ########################################################################### 17 | 18 | class SpreadsheetGUI ( wx.Panel ): 19 | 20 | def __init__( self, parent ): 21 | wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 544,416 ), style = wx.TAB_TRAVERSAL ) 22 | 23 | bSizer100 = wx.BoxSizer( wx.VERTICAL ) 24 | 25 | self.m_grid = wx.grid.Grid( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) 26 | 27 | # Grid 28 | self.m_grid.CreateGrid( 1, 26 ) 29 | self.m_grid.EnableEditing( True ) 30 | self.m_grid.EnableGridLines( True ) 31 | self.m_grid.EnableDragGridSize( False ) 32 | self.m_grid.SetMargins( 0, 0 ) 33 | 34 | # Columns 35 | self.m_grid.EnableDragColMove( False ) 36 | self.m_grid.EnableDragColSize( True ) 37 | self.m_grid.SetColLabelSize( 30 ) 38 | self.m_grid.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) 39 | 40 | # Rows 41 | self.m_grid.EnableDragRowSize( True ) 42 | self.m_grid.SetRowLabelSize( 80 ) 43 | self.m_grid.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) 44 | 45 | # Label Appearance 46 | 47 | # Cell Defaults 48 | self.m_grid.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP ) 49 | bSizer100.Add( self.m_grid, 1, wx.ALL|wx.EXPAND, 5 ) 50 | 51 | 52 | self.SetSizer( bSizer100 ) 53 | self.Layout() 54 | 55 | # Connect Events 56 | self.m_grid.Bind( wx.grid.EVT_GRID_CELL_RIGHT_CLICK, self.onGridCellRightClick ) 57 | self.m_grid.Bind( wx.grid.EVT_GRID_LABEL_LEFT_DCLICK, self.onGridLabelLeftDClick ) 58 | self.m_grid.Bind( wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.onGridLabelRightClick ) 59 | 60 | def __del__( self ): 61 | pass 62 | 63 | 64 | # Virtual event handlers, overide them in your derived class 65 | def onGridCellRightClick( self, event ): 66 | event.Skip() 67 | 68 | def onGridLabelLeftDClick( self, event ): 69 | event.Skip() 70 | 71 | def onGridLabelRightClick( self, event ): 72 | event.Skip() 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/SpreadsheetGUIC.py: -------------------------------------------------------------------------------- 1 | import SpreadsheetGUI 2 | import SpreadsheetState 3 | from PI.visualization.MicroView.interfaces import ISpreadsheet 4 | from zope import interface 5 | import wx 6 | 7 | 8 | class SpreadsheetGUIC(SpreadsheetGUI.SpreadsheetGUI): 9 | 10 | interface.implements(ISpreadsheet) 11 | 12 | def __init__(self, parent, **kw): 13 | 14 | self._index = 0 15 | if 'index' in kw: 16 | self._index = kw['index'] 17 | del(kw['index']) 18 | 19 | SpreadsheetGUI.SpreadsheetGUI.__init__(self, parent) 20 | self._viewerState = SpreadsheetState.SpreadsheetState() 21 | 22 | def GetPageState(self): 23 | return self._viewerState 24 | 25 | def GetSpreadsheetIndex(self): 26 | return self._index 27 | 28 | def GetTable(self): 29 | 30 | ncols = self.m_grid.GetNumberCols() 31 | nrows = self.m_grid.GetNumberRows() 32 | 33 | data_table = [] 34 | for j in xrange(nrows): 35 | row = [] 36 | for i in xrange(ncols): 37 | row.append(self.m_grid.GetCellValue(j, i)) 38 | data_table.append(row) 39 | 40 | return data_table 41 | 42 | def onGridLabelLeftDClick( self, event ): 43 | """allow user to edit column label""" 44 | col = event.GetCol() 45 | label = self.m_grid.GetColLabelValue(col) 46 | 47 | if col != -1: 48 | 49 | dlg = wx.TextEntryDialog( 50 | self, 'Column Label:', 51 | 'Enter new column label', 'Column Label') 52 | 53 | dlg.SetValue(label) 54 | try: 55 | if dlg.ShowModal() == wx.ID_OK: 56 | value = dlg.GetValue() 57 | else: 58 | return 59 | finally: 60 | dlg.Destroy() 61 | 62 | self.m_grid.SetColLabelValue(col, value) 63 | 64 | def onGridLabelRightClick( self, event ): 65 | 66 | # present user with a context-sensitive popup menu 67 | rows = self.m_grid.GetSelectedRows() 68 | cols = self.m_grid.GetSelectedCols() 69 | 70 | # display a popenu 71 | menu = wx.Menu() 72 | 73 | if len(rows) > 0: 74 | _id = wx.NewId() 75 | if len(rows) == 1: 76 | menu.Append(_id, "Add Row", "Add a row below the selected row") 77 | self.Bind(wx.EVT_MENU, lambda e, rows=rows: self.AddRow(rows[0]), id=_id) 78 | 79 | # permit deletion only if contiguous 80 | _min = min(rows) 81 | _max = max(rows) 82 | if len(rows) == (_max - _min + 1): 83 | # contiguous 84 | 85 | _id = wx.NewId() 86 | if len(rows) == 1: 87 | menu.Append(_id, "Delete Row", "Delete the selected row") 88 | else: 89 | menu.Append(_id, "Delete Rows", "Delete the selected rows") 90 | self.Bind(wx.EVT_MENU, lambda e, rows=rows: self.DeleteRows(_min, len(rows)), id=_id) 91 | 92 | if len(cols) > 0: 93 | if len(cols) == 1: 94 | _id = wx.NewId() 95 | menu.Append(_id, "Add Column", "Add a column to the right of the selected column") 96 | self.Bind(wx.EVT_MENU, lambda e, cols=cols: self.AddColumn(cols[0]), id=_id) 97 | 98 | # permit deletion only if contiguous 99 | _min = min(cols) 100 | _max = max(cols) 101 | if len(cols) == (_max - _min + 1): 102 | # contiguous 103 | 104 | _id = wx.NewId() 105 | if len(cols) == 1: 106 | menu.Append(_id, "Delete Column", "Delete the selected column") 107 | else: 108 | menu.Append(_id, "Delete Columns", "Delete the selected columns") 109 | self.Bind(wx.EVT_MENU, lambda e, cols=cols: self.DeleteColumns(_min, len(cols)), id=_id) 110 | 111 | self.PopupMenu(menu) 112 | menu.Destroy() 113 | 114 | def AddRow(self, row): 115 | self.m_grid.InsertRows(pos=row+1) 116 | 117 | def DeleteRows(self, row, num): 118 | self.m_grid.DeleteRows(pos=row, numRows=num) 119 | 120 | def AddColumn(self, column): 121 | self.m_grid.InsertCols(pos=column+1) 122 | 123 | def DeleteColumns(self, col, num): 124 | self.m_grid.DeleteCols(pos=col, numCols=num) 125 | 126 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/SpreadsheetState.py: -------------------------------------------------------------------------------- 1 | from zope import interface 2 | from PI.visualization.MicroView.interfaces import ISpreadsheetState 3 | import PageState 4 | 5 | 6 | class SpreadsheetState(PageState.PageState): 7 | 8 | interface.implements(ISpreadsheetState) 9 | 10 | def __init__(self): 11 | 12 | PageState.PageState.__init__(self) 13 | self._type = 'spreadsheet' 14 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/StatisticsGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | ## Python code generated with wxFormBuilder (version Jun 5 2014) 5 | ## http://www.wxformbuilder.org/ 6 | ## 7 | ## PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | import wx.grid 13 | 14 | STATS_SAVE = 1000 15 | STATS_CLEAR = 1001 16 | 17 | ########################################################################### 18 | ## Class StatisticsGUI 19 | ########################################################################### 20 | 21 | class StatisticsGUI ( wx.Panel ): 22 | 23 | def __init__( self, parent ): 24 | wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 927,563 ), style = wx.TAB_TRAVERSAL ) 25 | 26 | bSizer79 = wx.BoxSizer( wx.VERTICAL ) 27 | 28 | self.m_toolBar1 = wx.ToolBar( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL ) 29 | self.m_toolSaveStats = self.m_toolBar1.AddLabelTool( STATS_SAVE, u"tool", wx.ArtProvider.GetBitmap( wx.ART_FILE_SAVE_AS, ), wx.NullBitmap, wx.ITEM_NORMAL, u"Save As...", u"Save statistics to a file", None ) 30 | 31 | self.m_toolClearStats = self.m_toolBar1.AddLabelTool( STATS_CLEAR, u"tool", wx.ArtProvider.GetBitmap( wx.ART_CUT, ), wx.NullBitmap, wx.ITEM_NORMAL, u"Clear results", u"Clear results", None ) 32 | 33 | self.m_toolBar1.Realize() 34 | 35 | bSizer79.Add( self.m_toolBar1, 0, wx.EXPAND, 5 ) 36 | 37 | self.m_gridStatistics = wx.grid.Grid( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 ) 38 | 39 | # Grid 40 | self.m_gridStatistics.CreateGrid( 5, 17 ) 41 | self.m_gridStatistics.EnableEditing( True ) 42 | self.m_gridStatistics.EnableGridLines( True ) 43 | self.m_gridStatistics.EnableDragGridSize( False ) 44 | self.m_gridStatistics.SetMargins( 0, 0 ) 45 | 46 | # Columns 47 | self.m_gridStatistics.SetColSize( 0, 79 ) 48 | self.m_gridStatistics.SetColSize( 1, 92 ) 49 | self.m_gridStatistics.SetColSize( 2, 33 ) 50 | self.m_gridStatistics.SetColSize( 3, 33 ) 51 | self.m_gridStatistics.SetColSize( 4, 33 ) 52 | self.m_gridStatistics.SetColSize( 5, 33 ) 53 | self.m_gridStatistics.SetColSize( 6, 32 ) 54 | self.m_gridStatistics.SetColSize( 7, 32 ) 55 | self.m_gridStatistics.SetColSize( 8, 50 ) 56 | self.m_gridStatistics.SetColSize( 9, 80 ) 57 | self.m_gridStatistics.SetColSize( 10, 41 ) 58 | self.m_gridStatistics.SetColSize( 11, 45 ) 59 | self.m_gridStatistics.SetColSize( 12, 47 ) 60 | self.m_gridStatistics.SetColSize( 13, 67 ) 61 | self.m_gridStatistics.SetColSize( 14, 45 ) 62 | self.m_gridStatistics.SetColSize( 15, 85 ) 63 | self.m_gridStatistics.AutoSizeColumns() 64 | self.m_gridStatistics.EnableDragColMove( False ) 65 | self.m_gridStatistics.EnableDragColSize( True ) 66 | self.m_gridStatistics.SetColLabelSize( 30 ) 67 | self.m_gridStatistics.SetColLabelValue( 0, u"Caption" ) 68 | self.m_gridStatistics.SetColLabelValue( 1, u"Time-stamp" ) 69 | self.m_gridStatistics.SetColLabelValue( 2, u"Filename/Title" ) 70 | self.m_gridStatistics.SetColLabelValue( 3, u"X" ) 71 | self.m_gridStatistics.SetColLabelValue( 4, u"Y" ) 72 | self.m_gridStatistics.SetColLabelValue( 5, u"Z" ) 73 | self.m_gridStatistics.SetColLabelValue( 6, u"ROI-Width-X" ) 74 | self.m_gridStatistics.SetColLabelValue( 7, u"ROI-Width-Y" ) 75 | self.m_gridStatistics.SetColLabelValue( 8, u"ROI-Width-Z" ) 76 | self.m_gridStatistics.SetColLabelValue( 9, u"Chan." ) 77 | self.m_gridStatistics.SetColLabelValue( 10, u"ROI-VoxelCount" ) 78 | self.m_gridStatistics.SetColLabelValue( 11, u"ROI-Min" ) 79 | self.m_gridStatistics.SetColLabelValue( 12, u"ROI-Max" ) 80 | self.m_gridStatistics.SetColLabelValue( 13, u"ROI-Mean" ) 81 | self.m_gridStatistics.SetColLabelValue( 14, u"ROI-Stdev" ) 82 | self.m_gridStatistics.SetColLabelValue( 15, u"ROI-Total" ) 83 | self.m_gridStatistics.SetColLabelValue( 16, u"Comment" ) 84 | self.m_gridStatistics.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) 85 | 86 | # Rows 87 | self.m_gridStatistics.EnableDragRowSize( True ) 88 | self.m_gridStatistics.SetRowLabelSize( 80 ) 89 | self.m_gridStatistics.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE ) 90 | 91 | # Label Appearance 92 | 93 | # Cell Defaults 94 | self.m_gridStatistics.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP ) 95 | bSizer79.Add( self.m_gridStatistics, 0, wx.ALL|wx.EXPAND, 5 ) 96 | 97 | 98 | self.SetSizer( bSizer79 ) 99 | self.Layout() 100 | 101 | # Connect Events 102 | self.Bind( wx.EVT_TOOL, self.onToolClicked, id = self.m_toolSaveStats.GetId() ) 103 | self.Bind( wx.EVT_TOOL, self.onToolClicked, id = self.m_toolClearStats.GetId() ) 104 | 105 | def __del__( self ): 106 | pass 107 | 108 | 109 | # Virtual event handlers, overide them in your derived class 110 | def onToolClicked( self, event ): 111 | event.Skip() 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/StatisticsGUIC.py: -------------------------------------------------------------------------------- 1 | import StatisticsGUI 2 | import logging 3 | import collections 4 | import StockItems 5 | from zope import component 6 | # don't change this 7 | from PI.visualization.MicroView.interfaces import IMicroViewOutput 8 | 9 | 10 | class StatisticsGUIC(StatisticsGUI.StatisticsGUI): 11 | 12 | def __init__(self, parent): 13 | 14 | StatisticsGUI.StatisticsGUI.__init__(self, parent) 15 | stockicons = StockItems.StockIconFactory() 16 | 17 | self.m_toolBar1.GetToolByPos(1).SetNormalBitmap( 18 | stockicons.getToolbarBitmap("scissors9")) 19 | self.m_toolBar1.Realize() 20 | self.Layout() 21 | 22 | # keep track of row insertion point 23 | self.current_row = 0 24 | 25 | # a dictionary of labels 26 | self._field_index = collections.OrderedDict() 27 | 28 | # map header label to column number 29 | for n in xrange(self.m_gridStatistics.GetNumberCols()): 30 | val = self.m_gridStatistics.GetColLabelValue(n) 31 | self._field_index[val] = n 32 | 33 | def insertRow(self, args): 34 | 35 | # add row if we need one 36 | if self.current_row >= 5: 37 | logging.debug('add a row') 38 | self.m_gridStatistics.AppendRows() 39 | 40 | for key in args: 41 | if key not in self._field_index: 42 | # append a column at the end 43 | self.m_gridStatistics.AppendCols() 44 | n = self.m_gridStatistics.GetNumberCols() 45 | self._field_index[key] = n 46 | col = self._field_index[key] 47 | self.m_gridStatistics.SetCellValue( 48 | self.current_row, col, str(args[key])) 49 | if key not in ('Caption', 'Comment'): 50 | self.m_gridStatistics.SetReadOnly(self.current_row, col, True) 51 | 52 | self.m_gridStatistics.AutoSize() 53 | self.m_gridStatistics.SetColSize(self._field_index['Comment'], 500) 54 | 55 | # keep track of row -- first append a blank comment 56 | 57 | self.current_row += 1 58 | 59 | def onToolClicked(self, event): 60 | 61 | if event.GetId() == StatisticsGUI.STATS_SAVE: 62 | self.onFileSaveAs(event) 63 | elif event.GetId() == StatisticsGUI.STATS_CLEAR: 64 | self.onResultsClear(event) 65 | 66 | def onFileSaveAs(self, event): 67 | 68 | # get a global object that can manage saving results to disk 69 | object = component.getUtility(IMicroViewOutput) 70 | data = [] 71 | 72 | nrows = self.m_gridStatistics.GetNumberRows() 73 | ncols = self.m_gridStatistics.GetNumberCols() 74 | 75 | # get header 76 | row = [] 77 | for n in xrange(ncols): 78 | row.append(self.m_gridStatistics.GetColLabelValue(n)) 79 | data.append(row) 80 | 81 | for nrow in xrange(nrows): 82 | row = [] 83 | for ncol in xrange(ncols): 84 | row.append(self.m_gridStatistics.GetCellValue(nrow, ncol)) 85 | data.append(row) 86 | 87 | object.SaveStatisticsToDisk(data) 88 | 89 | def onResultsClear(self, event): 90 | 91 | # Clear results 92 | self.m_gridStatistics.ClearGrid() 93 | self.current_row = 0 94 | self._results = [] 95 | logging.info("Statistical results cleared") 96 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/SynchronizeImageDialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Nov 6 2013) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class SynchronizeImageDialog 15 | ########################################################################### 16 | 17 | 18 | class SynchronizeImageDialog (wx.Dialog): 19 | 20 | def __init__(self, parent): 21 | wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Synchronize Images", 22 | pos=wx.DefaultPosition, size=wx.Size(289, 264), style=wx.DEFAULT_DIALOG_STYLE) 23 | 24 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 25 | 26 | bSizer126 = wx.BoxSizer(wx.VERTICAL) 27 | 28 | sbSizer65 = wx.StaticBoxSizer( 29 | wx.StaticBox(self, wx.ID_ANY, u"Synchronize"), wx.VERTICAL) 30 | 31 | m_listBoxImageListChoices = [] 32 | self.m_listBoxImageList = wx.ListBox( 33 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_listBoxImageListChoices, wx.LB_MULTIPLE) 34 | sbSizer65.Add(self.m_listBoxImageList, 1, wx.ALL | wx.EXPAND, 5) 35 | 36 | bSizer168 = wx.BoxSizer(wx.HORIZONTAL) 37 | 38 | self.m_checkBoxDisableSync = wx.CheckBox( 39 | self, wx.ID_ANY, u"Disable", wx.DefaultPosition, wx.DefaultSize, 0) 40 | bSizer168.Add( 41 | self.m_checkBoxDisableSync, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALL, 5) 42 | 43 | bSizer168.AddSpacer((0, 0), 1, wx.EXPAND, 5) 44 | 45 | self.m_buttonReset = wx.Button( 46 | self, wx.ID_ANY, u"Reset", wx.DefaultPosition, wx.DefaultSize, 0) 47 | bSizer168.Add(self.m_buttonReset, 0, wx.ALL, 5) 48 | 49 | sbSizer65.Add(bSizer168, 0, wx.EXPAND, 5) 50 | 51 | bSizer126.Add(sbSizer65, 1, wx.EXPAND, 5) 52 | 53 | m_sdbSizer8 = wx.StdDialogButtonSizer() 54 | self.m_sdbSizer8OK = wx.Button(self, wx.ID_OK) 55 | m_sdbSizer8.AddButton(self.m_sdbSizer8OK) 56 | self.m_sdbSizer8Cancel = wx.Button(self, wx.ID_CANCEL) 57 | m_sdbSizer8.AddButton(self.m_sdbSizer8Cancel) 58 | m_sdbSizer8.Realize() 59 | 60 | bSizer126.Add(m_sdbSizer8, 0, wx.ALL | wx.EXPAND | wx.RIGHT, 5) 61 | 62 | self.SetSizer(bSizer126) 63 | self.Layout() 64 | 65 | self.Centre(wx.BOTH) 66 | 67 | # Connect Events 68 | self.m_listBoxImageList.Bind( 69 | wx.EVT_LISTBOX_DCLICK, self.onListBoxDoubleClick) 70 | self.m_checkBoxDisableSync.Bind(wx.EVT_CHECKBOX, self.onCheckBox) 71 | self.m_buttonReset.Bind(wx.EVT_BUTTON, self.onButtonReset) 72 | 73 | def __del__(self): 74 | pass 75 | 76 | # Virtual event handlers, overide them in your derived class 77 | def onListBoxDoubleClick(self, event): 78 | event.Skip() 79 | 80 | def onCheckBox(self, event): 81 | event.Skip() 82 | 83 | def onButtonReset(self, event): 84 | event.Skip() 85 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/SynchronizeImageDialogC.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import wx 3 | import SynchronizeImageDialog 4 | 5 | 6 | class SynchronizeImageDialogC(SynchronizeImageDialog.SynchronizeImageDialog): 7 | 8 | def __init__(self, parent): 9 | SynchronizeImageDialog.SynchronizeImageDialog.__init__(self, parent) 10 | 11 | def SetCurrentSyncList(self, current_index, image_list, current_sync_list): 12 | 13 | image_list.sort() 14 | idx_map = [il[0] for il in image_list] 15 | 16 | self.m_listBoxImageList.Clear() 17 | if len(image_list) > 0: 18 | self.m_listBoxImageList.InsertItems([i[1] for i in image_list], 0) 19 | for idx in current_sync_list: 20 | try: 21 | idx2 = idx_map.index(idx) 22 | self.m_listBoxImageList.SetSelection(idx2) 23 | except ValueError: 24 | logging.warning("Couldn't find index {0}".format(idx)) 25 | else: 26 | self.m_checkBoxDisableSync.SetValue(1) 27 | self.m_checkBoxDisableSync.Disable() 28 | 29 | def GetCurrentSyncList(self): 30 | return self.m_listBoxImageList.GetSelections() 31 | 32 | def onCheckBox(self, evt): 33 | self.m_listBoxImageList.Enable(not evt.IsChecked()) 34 | 35 | def onButtonReset(self, evt): 36 | """Reset list of synchronized images""" 37 | self.m_listBoxImageList.SetSelection(wx.NOT_FOUND) 38 | 39 | def onListBoxDoubleClick(self, evt): 40 | self.EndModal(wx.ID_OK) 41 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/URLManager.py: -------------------------------------------------------------------------------- 1 | import os 2 | import urllib2 3 | import tempfile 4 | 5 | try: 6 | import paramiko 7 | import re 8 | use_sftp = 1 9 | 10 | class SFTPBaseHandler(urllib2.BaseHandler): 11 | 12 | """URLLib2 basehandler that handles sftp requests""" 13 | 14 | def sftp_open(self, req): 15 | m = re.compile('(.*):(.*)@(.*)') 16 | s = m.match(req.get_host()) 17 | if (s): 18 | uname, pword, host = s.groups() 19 | else: 20 | uname = '' 21 | pword = '' 22 | host = req.get_host() 23 | t = paramiko.Transport(host) 24 | t.connect(username=uname, password=pword) 25 | self._sftp = paramiko.SFTP.from_transport(t) 26 | s = self._sftp.open(req.get_selector()) 27 | return s 28 | except: 29 | use_sftp = 0 30 | 31 | 32 | class URLManager(object): 33 | 34 | def __init__(self): 35 | global use_sftp 36 | if use_sftp == 1: 37 | o = urllib2.build_opener() 38 | o.add_handler(SFTPBaseHandler()) 39 | urllib2.install_opener(o) 40 | self._tempfiles = [] 41 | 42 | def __del__(self): 43 | """cleanup tempfiles""" 44 | for i in self._tempfiles: 45 | os.unlink(i) 46 | 47 | def getURL(self, url): 48 | """given a single-file URL, get the file, return a local filename version of the url""" 49 | s = tempfile.mkstemp(os.path.splitext(url)[-1]) 50 | self._tempfiles.append(s[1]) 51 | f = os.fdopen(s[0], 'wb') 52 | u = urllib2.urlopen(url) 53 | # copy file here 54 | st = u.read(4096) 55 | while st: 56 | f.write(st) 57 | st = u.read(4096) 58 | f.close() 59 | u.close() 60 | return s[1] 61 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/UpdateAvailableGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Apr 10 2012) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class UpdateAvailableGUI 15 | ########################################################################### 16 | 17 | 18 | class UpdateAvailableGUI (wx.Dialog): 19 | 20 | def __init__(self, parent): 21 | wx.Dialog.__init__( 22 | self, parent, id=wx.ID_ANY, title=u"MicroView Update Available", 23 | pos=wx.DefaultPosition, size=wx.Size(375, 179), style=wx.DEFAULT_DIALOG_STYLE) 24 | 25 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 26 | 27 | bSizer105 = wx.BoxSizer(wx.VERTICAL) 28 | 29 | bSizer106 = wx.BoxSizer(wx.HORIZONTAL) 30 | 31 | self.m_bitmap2 = wx.StaticBitmap(self, wx.ID_ANY, wx.ArtProvider.GetBitmap( 32 | wx.ART_INFORMATION,), wx.DefaultPosition, wx.Size(-1, -1), 0) 33 | bSizer106.Add(self.m_bitmap2, 0, wx.ALL, 5) 34 | 35 | self.m_staticTextVersionMessage = wx.StaticText( 36 | self, wx.ID_ANY, u"A new version of MicroView is available for download!\nVersion %s can be downloaded by using the following link:", wx.DefaultPosition, wx.Size(-1, 50), 0) 37 | self.m_staticTextVersionMessage.Wrap(300) 38 | bSizer106.Add( 39 | self.m_staticTextVersionMessage, 0, wx.ALL | wx.EXPAND, 5) 40 | 41 | bSizer105.Add(bSizer106, 0, wx.EXPAND, 5) 42 | 43 | self.m_hyperlink1 = wx.HyperlinkCtrl( 44 | self, wx.ID_ANY, u"http://www.parallax-innovations.com/microview", 45 | u"http://www.parallax-innovations.com/microview", wx.DefaultPosition, wx.DefaultSize, wx.HL_DEFAULT_STYLE) 46 | bSizer105.Add(self.m_hyperlink1, 0, wx.ALL | wx.BOTTOM | wx.TOP, 10) 47 | 48 | bSizer105.AddSpacer((0, 0), 0, wx.EXPAND, 5) 49 | 50 | self.m_checkBoxShowDialog = wx.CheckBox( 51 | self, wx.ID_ANY, u"Show this dialog at start-up", wx.DefaultPosition, wx.DefaultSize, 0) 52 | self.m_checkBoxShowDialog.SetValue(True) 53 | bSizer105.Add(self.m_checkBoxShowDialog, 0, wx.ALL, 5) 54 | 55 | self.m_buttonOk = wx.Button( 56 | self, wx.ID_OK, u"OK", wx.DefaultPosition, wx.DefaultSize, 0) 57 | bSizer105.Add( 58 | self.m_buttonOk, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5) 59 | 60 | self.SetSizer(bSizer105) 61 | self.Layout() 62 | 63 | self.Centre(wx.BOTH) 64 | 65 | # Connect Events 66 | self.m_buttonOk.Bind(wx.EVT_BUTTON, self.onButtonClick) 67 | 68 | def __del__(self): 69 | pass 70 | 71 | # Virtual event handlers, overide them in your derived class 72 | def onButtonClick(self, event): 73 | event.Skip() 74 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/UpdateAvailableGUIC.py: -------------------------------------------------------------------------------- 1 | import UpdateAvailableGUI 2 | 3 | 4 | class UpdateAvailableGUIC(UpdateAvailableGUI.UpdateAvailableGUI): 5 | 6 | def __init__(self, parent): 7 | 8 | UpdateAvailableGUI.UpdateAvailableGUI.__init__(self, parent) 9 | 10 | def SetVersion(self, version_string): 11 | 12 | s = "A new version of MicroView is available for download!\nVersion %s can be downloaded by using the following link:" % version_string 13 | self.m_staticTextVersionMessage.SetLabel(s) 14 | self.Layout() 15 | 16 | def SetShouldCheck(self, val): 17 | 18 | self.m_checkBoxShowDialog.SetValue(val) 19 | 20 | def getCheckboxState(self): 21 | 22 | return self.m_checkBoxShowDialog.GetValue() 23 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/UpstreamMessageDialogGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Nov 6 2013) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | import wx.html2 as webview 13 | 14 | ########################################################################### 15 | # Class UpstreamMessageDialogGUI 16 | ########################################################################### 17 | 18 | 19 | class UpstreamMessageDialogGUI (wx.Dialog): 20 | 21 | def __init__(self, parent): 22 | wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, 23 | pos=wx.DefaultPosition, size=wx.Size(619, 482), style=wx.DEFAULT_DIALOG_STYLE) 24 | 25 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 26 | 27 | bSizer196 = wx.BoxSizer(wx.VERTICAL) 28 | 29 | self.m_wxHtmlWindow = webview.WebView.New(self) 30 | bSizer196.Add(self.m_wxHtmlWindow, 1, wx.ALL | wx.EXPAND, 5) 31 | 32 | self.m_staticline13 = wx.StaticLine( 33 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) 34 | bSizer196.Add(self.m_staticline13, 0, wx.EXPAND | wx.ALL, 5) 35 | 36 | m_sdbSizer19 = wx.StdDialogButtonSizer() 37 | self.m_sdbSizer19OK = wx.Button(self, wx.ID_OK) 38 | m_sdbSizer19.AddButton(self.m_sdbSizer19OK) 39 | m_sdbSizer19.Realize() 40 | 41 | bSizer196.Add(m_sdbSizer19, 0, wx.BOTTOM | wx.EXPAND, 5) 42 | 43 | self.SetSizer(bSizer196) 44 | self.Layout() 45 | 46 | self.Centre(wx.BOTH) 47 | 48 | def __del__(self): 49 | pass 50 | 51 | 52 | if __name__ == '__main__': 53 | import sys 54 | 55 | app = wx.App() 56 | dlg = UpstreamMessageDialogGUI(None) 57 | dlg.m_wxHtmlWindow.LoadURL("http://google.com") 58 | 59 | if sys.platform == 'darwin': 60 | dlg.Show() 61 | app.MainLoop() 62 | else: 63 | dlg.ShowModal() 64 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/VTKPlotWindowGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Apr 10 2012) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class VTKPlotWindowGUI 15 | ########################################################################### 16 | 17 | 18 | class VTKPlotWindowGUI (wx.Panel): 19 | 20 | def __init__(self, parent): 21 | wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size( 22 | 787, 612), style=wx.TAB_TRAVERSAL) 23 | 24 | bSizer64 = wx.BoxSizer(wx.VERTICAL) 25 | 26 | self.m_panelMatplotPanel = wx.Panel( 27 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) 28 | bSizer64.Add(self.m_panelMatplotPanel, 1, wx.EXPAND | wx.ALL, 5) 29 | 30 | self.SetSizer(bSizer64) 31 | self.Layout() 32 | 33 | def __del__(self): 34 | pass 35 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/ViewerState.py: -------------------------------------------------------------------------------- 1 | from zope import interface 2 | from PI.visualization.MicroView.interfaces import IViewerState 3 | import PageState 4 | import cStringIO 5 | 6 | 7 | class ViewerState(PageState.PageState): 8 | 9 | interface.implements(IViewerState) 10 | 11 | def __init__(self): 12 | 13 | PageState.PageState.__init__(self) 14 | 15 | self.layout = 'All' 16 | self.DisplayAllViews = True 17 | self.table_range = (-249.0, 250.0) 18 | self.lut_index = 0 19 | self._type = 'image' 20 | 21 | def __str__(self): 22 | s = cStringIO.StringIO() 23 | s.write(PageState.PageState.__str__(self)) 24 | s.write('\tLayout: {0}\n'.format(self.layout)) 25 | s.write('\tDisplayAllViews: {0}\n'.format(self.DisplayAllViews)) 26 | s.write('\tTable range: {0}\n'.format(self.table_range)) 27 | return s.getvalue() 28 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/WindowLevelDialogGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Oct 8 2012) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class WindowLevelDialogGUI 15 | ########################################################################### 16 | 17 | 18 | class WindowLevelDialogGUI (wx.Dialog): 19 | 20 | def __init__(self, parent): 21 | wx.Dialog.__init__(self, parent, id=wx.ID_ANY, title=u"Window and Level Settings", 22 | pos=wx.DefaultPosition, size=wx.Size(366, 363), style=wx.DEFAULT_DIALOG_STYLE) 23 | 24 | self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize) 25 | 26 | bSizer69 = wx.BoxSizer(wx.VERTICAL) 27 | 28 | m_radioBoxInteractionModeChoices = [u"Window/Level", u"Min/Max"] 29 | self.m_radioBoxInteractionMode = wx.RadioBox( 30 | self, wx.ID_ANY, u"Interaction mode", wx.DefaultPosition, wx.DefaultSize, m_radioBoxInteractionModeChoices, 2, wx.RA_SPECIFY_COLS) 31 | self.m_radioBoxInteractionMode.SetSelection(0) 32 | bSizer69.Add(self.m_radioBoxInteractionMode, 0, wx.ALL | wx.EXPAND, 5) 33 | 34 | sbSizer64 = wx.StaticBoxSizer( 35 | wx.StaticBox(self, wx.ID_ANY, u"Histogram"), wx.VERTICAL) 36 | 37 | self.m_panelHistogram = wx.Panel( 38 | self, wx.ID_ANY, wx.DefaultPosition, wx.Size(-1, -1), wx.TAB_TRAVERSAL) 39 | self.m_panelHistogram.SetMinSize(wx.Size(-1, 128)) 40 | 41 | sbSizer64.Add(self.m_panelHistogram, 1, wx.EXPAND | wx.ALL, 5) 42 | 43 | bSizer69.Add(sbSizer64, 1, wx.ALL | wx.EXPAND, 5) 44 | 45 | sbSizer33 = wx.StaticBoxSizer( 46 | wx.StaticBox(self, wx.ID_ANY, u"Thresholds"), wx.HORIZONTAL) 47 | 48 | self.m_panelThresholds = wx.Panel( 49 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL) 50 | sbSizer33.Add(self.m_panelThresholds, 1, wx.EXPAND | wx.ALL, 5) 51 | 52 | bSizer69.Add(sbSizer33, 0, wx.ALL | wx.EXPAND, 5) 53 | 54 | self.m_staticline10 = wx.StaticLine( 55 | self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) 56 | bSizer69.Add(self.m_staticline10, 0, wx.EXPAND | wx.ALL, 5) 57 | 58 | m_sdbSizer2 = wx.StdDialogButtonSizer() 59 | self.m_sdbSizer2OK = wx.Button(self, wx.ID_OK) 60 | m_sdbSizer2.AddButton(self.m_sdbSizer2OK) 61 | self.m_sdbSizer2Cancel = wx.Button(self, wx.ID_CANCEL) 62 | m_sdbSizer2.AddButton(self.m_sdbSizer2Cancel) 63 | m_sdbSizer2.Realize() 64 | 65 | bSizer69.Add(m_sdbSizer2, 0, wx.BOTTOM | wx.EXPAND, 5) 66 | 67 | self.SetSizer(bSizer69) 68 | self.Layout() 69 | 70 | self.Centre(wx.BOTH) 71 | 72 | # Connect Events 73 | self.m_radioBoxInteractionMode.Bind( 74 | wx.EVT_RADIOBOX, self.onIteractionModeChange) 75 | self.m_sdbSizer2Cancel.Bind(wx.EVT_BUTTON, self.onCancelButton) 76 | self.m_sdbSizer2OK.Bind(wx.EVT_BUTTON, self.onOkButton) 77 | 78 | def __del__(self): 79 | pass 80 | 81 | # Virtual event handlers, overide them in your derived class 82 | def onIteractionModeChange(self, event): 83 | event.Skip() 84 | 85 | def onCancelButton(self, event): 86 | event.Skip() 87 | 88 | def onOkButton(self, event): 89 | event.Skip() 90 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/WireFrameCubeFactory.py: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # 3 | # Copyright (c) 2000-2008 GE Healthcare 4 | # Copyright (c) 2011-2015 Parallax Innovations Inc. 5 | # 6 | # Use, modification and redistribution of the software, in source or 7 | # binary forms, are permitted provided that the following terms and 8 | # conditions are met: 9 | # 10 | # 1) Redistribution of the source code, in verbatim or modified 11 | # form, must retain the above copyright notice, this license, 12 | # the following disclaimer, and any notices that refer to this 13 | # license and/or the following disclaimer. 14 | 15 | # 2) Redistribution in binary form must include the above copyright 16 | # notice, a copy of this license and the following disclaimer 17 | # in the documentation or with other materials provided with the 18 | # distribution. 19 | # 20 | # 3) Modified copies of the source code must be clearly marked as such, 21 | # and must not be misrepresented as verbatim copies of the source code. 22 | # 23 | # EXCEPT WHEN OTHERWISE STATED IN WRITING BY THE COPYRIGHT HOLDERS AND/OR 24 | # OTHER PARTIES, THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE 25 | # SOFTWARE "AS IS" WITHOUT EXPRESSED OR IMPLIED WARRANTY INCLUDING, BUT 26 | # NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 27 | # FOR A PARTICULAR PURPOSE. IN NO EVENT UNLESS AGREED TO IN WRITING WILL 28 | # ANY COPYRIGHT HOLDER OR OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 29 | # THE SOFTWARE UNDER THE TERMS OF THIS LICENSE BE LIABLE FOR ANY DIRECT, 30 | # INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 31 | # TO, LOSS OF DATA OR DATA BECOMING INACCURATE OR LOSS OF PROFIT OR 32 | # BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE OR INABILITY TO 33 | # USE THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 34 | # 35 | # ========================================================================= 36 | 37 | # 38 | # This file represents a derivative work by Parallax Innovations Inc. 39 | # 40 | 41 | """ 42 | This factory is used to draw a wire frame outline around a cube. 43 | """ 44 | 45 | from vtkAtamai.ActorFactory import * 46 | 47 | 48 | class WireFrameCubeFactory(ActorFactory): 49 | 50 | def __init__(self, UseTubes=1): 51 | 52 | ActorFactory.__init__(self) 53 | 54 | self._Input = None 55 | 56 | self._CubeExists = 0 57 | self.SetRadius(0.3) 58 | self._WireFrameCube = vtk.vtkOutlineSource() 59 | self._WireFrameCubeProperty = vtk.vtkProperty() 60 | 61 | self._UseTubes = UseTubes 62 | 63 | # 64 | # This code is badly broken 65 | # 66 | def SetRadius(self, radius): 67 | self._radius = radius 68 | try: 69 | self._tubes.SetRadius(self.GetRadius()) 70 | except: 71 | pass 72 | 73 | def GetRadius(self): 74 | return self._radius 75 | 76 | def SetInput(self, input): 77 | if input is None: 78 | return 79 | 80 | self._Input = input 81 | 82 | ActorFactory.SetTransform(self, self._Input._Transform) 83 | 84 | self.Modified() 85 | 86 | def GetInput(self): 87 | return self._Input 88 | 89 | def SetBounds(self, x1, x2, y1, y2, z1, z2): 90 | 91 | self._minX = min(x1, x2) 92 | self._minY = min(y1, y2) 93 | self._minZ = min(z1, z2) 94 | self._maxX = max(x1, x2) 95 | self._maxY = max(y1, y2) 96 | self._maxZ = max(z1, z2) 97 | 98 | self._WireFrameCube.SetROIBounds( 99 | self._minX, self._maxX, self._minY, self._maxY, self._minZ, self._maxZ) 100 | 101 | self._CubeExists = 1 102 | 103 | # Return the two coordinate points defining the cube 104 | def GetBounds(self): 105 | if self._CubeExists == 1: 106 | return [self._minX, self._maxX, self._minY, self._maxY, self._minZ, self._maxZ] 107 | else: 108 | return None 109 | 110 | def SetColor(self, *args): 111 | # we don't have to call Modified() because 112 | # ActorFactory.GetMTime() already includes _Property.GetMTime() 113 | if len(args) == 1: 114 | args = args[0] 115 | apply(self._WireFrameCubeProperty.SetColor, args) 116 | 117 | def GetColor(self): 118 | return self._WireFrameCubeProperty.GetColor() 119 | 120 | def SetOpacity(self, opacity): 121 | self._WireFrameCubeProperty.SetOpacity(opacity) 122 | 123 | def GetOpacity(self, opacity): 124 | self._WireFrameCubeProperty.GetOpacity() 125 | 126 | def _MakeActors(self): 127 | actors = [] 128 | 129 | actor = self._NewActor() 130 | actor.PickableOff() 131 | actor.SetProperty(self._WireFrameCubeProperty) 132 | 133 | if (self._UseTubes == 1): 134 | # remove duplicate points 135 | cleaner = vtk.vtkCleanPolyData() 136 | cleaner.SetInput(self._WireFrameCube.GetOutput()) 137 | 138 | self._tubes = vtk.vtkTubeFilter() 139 | self._tubes.SetInput(cleaner.GetOutput()) 140 | self._tubes.SetRadius(self.GetRadius()) 141 | self._tubes.SetNumberOfSides(6) 142 | 143 | mapper = vtk.vtkPolyDataMapper() 144 | mapper.SetInput(self._tubes.GetOutput()) 145 | else: 146 | mapper = vtk.vtkPolyDataMapper() 147 | mapper.SetInput(self._WireFrameCube.GetOutput()) 148 | 149 | actor.SetMapper(mapper) 150 | actors.append(actor) 151 | 152 | return actors 153 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/_MicroView.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | if os.name == 'posix': 4 | from PI.visualization.MicroView.libMicroViewPython import * 5 | else: 6 | from PI.visualization.MicroView.MicroViewPython import * 7 | -------------------------------------------------------------------------------- /PI/visualization/MicroView/about-splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/PI/visualization/MicroView/about-splash.png -------------------------------------------------------------------------------- /PI/visualization/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['MicroView'] 2 | try: 3 | __import__('pkg_resources').declare_namespace(__name__) 4 | except: 5 | __path__ = __import__('pkgutil').extend_path(__path__, __name__) 6 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/BasicBoneAnalysisGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | ## Python code generated with wxFormBuilder (version Jun 5 2014) 5 | ## http://www.wxformbuilder.org/ 6 | ## 7 | ## PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | ## Class BasicBoneAnalysisGUI 15 | ########################################################################### 16 | 17 | class BasicBoneAnalysisGUI ( wx.Panel ): 18 | 19 | def __init__( self, parent ): 20 | wx.Panel.__init__ ( self, parent, id = wx.ID_ANY, pos = wx.DefaultPosition, size = wx.Size( 383,419 ), style = wx.TAB_TRAVERSAL ) 21 | 22 | bSizer6 = wx.BoxSizer( wx.VERTICAL ) 23 | 24 | bSizer98 = wx.BoxSizer( wx.VERTICAL ) 25 | 26 | VOI = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Volume of Interest" ), wx.VERTICAL ) 27 | 28 | bSizer8 = wx.BoxSizer( wx.HORIZONTAL ) 29 | 30 | bSizer8.SetMinSize( wx.Size( 300,-1 ) ) 31 | m_choiceROIPluginChoices = [] 32 | self.m_choiceROIPlugin = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, m_choiceROIPluginChoices, 0 ) 33 | self.m_choiceROIPlugin.SetSelection( 0 ) 34 | bSizer8.Add( self.m_choiceROIPlugin, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) 35 | 36 | self.m_buttonActivateROI = wx.Button( self, wx.ID_ANY, u"Activate ROI", wx.DefaultPosition, wx.DefaultSize, 0 ) 37 | bSizer8.Add( self.m_buttonActivateROI, 0, wx.ALL, 5 ) 38 | 39 | self.m_buttonClearROI = wx.Button( self, wx.ID_ANY, u"Clear ROI", wx.DefaultPosition, wx.DefaultSize, 0 ) 40 | bSizer8.Add( self.m_buttonClearROI, 0, wx.ALL, 5 ) 41 | 42 | 43 | VOI.Add( bSizer8, 1, wx.EXPAND, 5 ) 44 | 45 | 46 | bSizer98.Add( VOI, 0, wx.EXPAND, 5 ) 47 | 48 | Threshold = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Threshold" ), wx.VERTICAL ) 49 | 50 | bSizer9 = wx.BoxSizer( wx.HORIZONTAL ) 51 | 52 | self.m_buttonAutoThreshold = wx.Button( self, wx.ID_ANY, u"Auto Threshold", wx.DefaultPosition, wx.DefaultSize, 0 ) 53 | bSizer9.Add( self.m_buttonAutoThreshold, 0, wx.ALL, 5 ) 54 | 55 | self.m_textCtrlThreshold = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) 56 | self.m_textCtrlThreshold.SetMaxLength( 0 ) 57 | bSizer9.Add( self.m_textCtrlThreshold, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL|wx.EXPAND, 5 ) 58 | 59 | 60 | Threshold.Add( bSizer9, 0, wx.EXPAND, 5 ) 61 | 62 | 63 | bSizer98.Add( Threshold, 0, wx.EXPAND, 5 ) 64 | 65 | BoneParams = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Bone Parameters" ), wx.VERTICAL ) 66 | 67 | bSizer19 = wx.BoxSizer( wx.HORIZONTAL ) 68 | 69 | self.m_checkBoxBMD = wx.CheckBox( self, wx.ID_ANY, u"BMD", wx.DefaultPosition, wx.DefaultSize, 0 ) 70 | self.m_checkBoxBMD.SetValue(True) 71 | bSizer19.Add( self.m_checkBoxBMD, 0, wx.ALL|wx.EXPAND, 5 ) 72 | 73 | self.m_checkBoxStereology = wx.CheckBox( self, wx.ID_ANY, u"Stereology", wx.DefaultPosition, wx.DefaultSize, 0 ) 74 | self.m_checkBoxStereology.SetValue(True) 75 | bSizer19.Add( self.m_checkBoxStereology, 0, wx.ALL|wx.EXPAND, 5 ) 76 | 77 | self.m_buttonAdvancedOptions = wx.Button( self, wx.ID_ANY, u"Advanced Options", wx.DefaultPosition, wx.DefaultSize, 0 ) 78 | bSizer19.Add( self.m_buttonAdvancedOptions, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) 79 | 80 | 81 | BoneParams.Add( bSizer19, 0, wx.EXPAND, 5 ) 82 | 83 | 84 | bSizer98.Add( BoneParams, 0, wx.EXPAND, 5 ) 85 | 86 | sbSizer9 = wx.StaticBoxSizer( wx.StaticBox( self, wx.ID_ANY, u"Output File" ), wx.VERTICAL ) 87 | 88 | bSizer14 = wx.BoxSizer( wx.HORIZONTAL ) 89 | 90 | self.m_checkBoxAppend = wx.CheckBox( self, wx.ID_ANY, u"Append", wx.DefaultPosition, wx.DefaultSize, 0 ) 91 | self.m_checkBoxAppend.SetValue(True) 92 | bSizer14.Add( self.m_checkBoxAppend, 0, wx.ALL|wx.EXPAND, 5 ) 93 | 94 | self.m_filePicker = wx.FilePickerCtrl( self, wx.ID_ANY, wx.EmptyString, u"Select a file", u"Text files (*.txt)|*.txt|All files (*)|*", wx.DefaultPosition, wx.DefaultSize, wx.FLP_OVERWRITE_PROMPT|wx.FLP_SAVE|wx.FLP_USE_TEXTCTRL ) 95 | bSizer14.Add( self.m_filePicker, 1, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) 96 | 97 | 98 | sbSizer9.Add( bSizer14, 0, 0, 5 ) 99 | 100 | 101 | bSizer98.Add( sbSizer9, 0, wx.EXPAND, 5 ) 102 | 103 | bSizer7 = wx.BoxSizer( wx.HORIZONTAL ) 104 | 105 | self.m_buttonRun = wx.Button( self, wx.ID_ANY, u"Run", wx.DefaultPosition, wx.DefaultSize, 0 ) 106 | self.m_buttonRun.Enable( False ) 107 | 108 | bSizer7.Add( self.m_buttonRun, 0, wx.ALL, 5 ) 109 | 110 | self.m_buttonShowResults = wx.Button( self, wx.ID_ANY, u"Show Results", wx.DefaultPosition, wx.DefaultSize, 0 ) 111 | bSizer7.Add( self.m_buttonShowResults, 0, wx.ALL, 5 ) 112 | 113 | 114 | bSizer98.Add( bSizer7, 0, 0, 5 ) 115 | 116 | 117 | bSizer6.Add( bSizer98, 1, 0, 5 ) 118 | 119 | 120 | self.SetSizer( bSizer6 ) 121 | self.Layout() 122 | 123 | def __del__( self ): 124 | pass 125 | 126 | 127 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/BasicBoneAnalysisGUIC.py: -------------------------------------------------------------------------------- 1 | import BasicBoneAnalysisGUI 2 | 3 | 4 | class BasicBoneAnalysisGUIC(BasicBoneAnalysisGUI.BasicBoneAnalysisGUI): 5 | 6 | def __init__(self, parent): 7 | 8 | BasicBoneAnalysisGUI.BasicBoneAnalysisGUI.__init__(self, parent) 9 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/bone_analysis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/bone_analysis.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/bone_analysis_24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/bone_analysis_24x24.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/help.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/info.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/info_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/info_16x16.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/info_24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/info_24x24.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/isosurface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/isosurface.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/preferences.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/preferences_24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/preferences_24x24.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/standard_roi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/standard_roi.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/stock_link_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/stock_link_closed.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/stock_link_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/stock_link_open.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/stock_resample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/stock_resample.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/Icons/stock_rescale.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/parallaxinnovations/MicroView/1e3dce0c72ea3eb5eccc1c3ff8e7a8c32820155e/Plugins/public/PIMicroViewBasePlugins/Icons/stock_rescale.png -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/IsosurfaceGUIC.py: -------------------------------------------------------------------------------- 1 | import IsosurfaceGUI 2 | 3 | 4 | class IsosurfaceGUIC(IsosurfaceGUI.IsosurfaceGUI): 5 | 6 | def __init__(self, parent): 7 | 8 | IsosurfaceGUI.IsosurfaceGUI.__init__(self, parent) 9 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/MicroView/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | __import__('pkg_resources').declare_namespace(__name__) 3 | except: 4 | __path__ = __import__('pkgutil').extend_path(__path__, __name__) 5 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/ROICylinderFactory.py: -------------------------------------------------------------------------------- 1 | import vtk 2 | from vtkAtamai import ActorFactory 3 | 4 | 5 | class ROICylinderFactory(ActorFactory.ActorFactory): 6 | 7 | def __init__(self): 8 | ActorFactory.ActorFactory.__init__(self) 9 | 10 | # share property across all the actors 11 | self._cylinder = vtk.vtkCylinderSource() 12 | self._cylinder.SetResolution(40) 13 | self._cylinder.CappingOn() 14 | 15 | self._Property = vtk.vtkProperty() 16 | self._Property.SetColor(1, 1, 0) 17 | 18 | self._bounds = (-1, 1, -1, 1, -1, 1) 19 | self._orientation = 'z' 20 | # self.GetTransform().RotateX(90) 21 | self._visibility = True 22 | 23 | def SetROIBounds(self, bounds): 24 | """Set the bounds that defines the cylinder.""" 25 | 26 | self._bounds = bounds 27 | self._Update() 28 | 29 | def _Update(self): 30 | """Update cylinder to fit into the new bounding box, 31 | according to the orientation. 32 | """ 33 | x0, x1, y0, y1, z0, z1 = self._bounds 34 | # cylinder parameters 35 | if self._orientation == 'x': 36 | height = (x1 - x0) 37 | radius = (y1 - y0) * 0.5 38 | if y1 - y0 == 0: 39 | return 40 | scale = (z1 - z0) / (y1 - y0) 41 | elif self._orientation == 'y': 42 | height = (y1 - y0) 43 | radius = (x1 - x0) * 0.5 44 | if x1 - x0 == 0: 45 | return 46 | scale = (z1 - z0) / (x1 - x0) 47 | else: 48 | height = (z1 - z0) 49 | radius = (x1 - x0) * 0.5 50 | if x1 - x0 == 0: 51 | return 52 | scale = (y1 - y0) / (x1 - x0) 53 | 54 | self._cylinder.SetRadius(radius) 55 | self._cylinder.SetHeight(height) 56 | self._cylinder.Update() 57 | 58 | # the center of the cylinder 59 | center = ((x1 + x0) * 0.5, 60 | (y1 + y0) * 0.5, 61 | (z1 + z0) * 0.5) 62 | self._UpdateTransform((1, 1, scale), center) 63 | 64 | def GetOrientation(self): 65 | return self._orientation 66 | 67 | def SetOrientationToX(self): 68 | """Set the cylinder axis to align with x axis.""" 69 | self._orientation = 'x' 70 | self.Modified() 71 | 72 | def SetOrientationToY(self): 73 | """Set the cylinder axis to align with y axis, which is 74 | the orientation of vtkCylinderSource. 75 | """ 76 | self._orientation = 'y' 77 | self.Modified() 78 | 79 | def SetOrientationToZ(self): 80 | """Set the cylinder axis to align with z axis.""" 81 | self._orientation = 'z' 82 | self.Modified() 83 | 84 | def _UpdateTransform(self, scale, center): 85 | 86 | self.GetTransform().Identity() 87 | self.GetTransform().Translate(center) 88 | 89 | if self._orientation == 'x': 90 | self.GetTransform().RotateZ(90) 91 | elif self._orientation == 'y': 92 | pass 93 | elif self._orientation == 'z': 94 | self.GetTransform().RotateX(90) 95 | 96 | self.GetTransform().Scale(scale) 97 | self.Modified() 98 | 99 | def GetPolyData(self): 100 | """Return a vtkPolyData that bounding the ROI.""" 101 | 102 | trans = vtk.vtkTransformPolyDataFilter() 103 | trans.SetInput(self._cylinder.GetOutput()) 104 | trans.SetTransform(self.GetTransform()) 105 | return trans.GetOutput() 106 | 107 | def SetVisibility(self, yesno, renderer=None): 108 | 109 | self._visibility = yesno 110 | 111 | if renderer is None: 112 | renderers = self._Renderers 113 | else: 114 | renderers = [renderer, ] 115 | 116 | for ren in renderers: 117 | for actor in self._ActorDict[ren]: 118 | actor.SetVisibility(yesno) 119 | self.Modified() 120 | 121 | def SetOpacity(self, theOpacity): 122 | self._Property.SetOpacity(theOpacity) 123 | self.Modified() 124 | 125 | def GetOpacity(self): 126 | return self._Property.GetOpacity() 127 | 128 | def SetColor(self, *args): 129 | apply(self._Property.SetColor, args) 130 | self.Modified() 131 | 132 | def GetColor(self): 133 | return self._Property.GetColor() 134 | 135 | def GetActor(self): 136 | return self._Actor 137 | 138 | def _MakeActors(self): 139 | actor = self._NewActor() 140 | actor.SetProperty(self._Property) 141 | actor.SetVisibility(self._visibility) 142 | return [actor] 143 | 144 | def _NewActor(self): 145 | actor = ActorFactory.ActorFactory._NewActor(self) 146 | actor.PickableOff() 147 | mapper = vtk.vtkPolyDataMapper() 148 | mapper.SetInputConnection(self._cylinder.GetOutputPort()) 149 | actor.SetMapper(mapper) 150 | self._Actor = actor 151 | return actor 152 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/ROIIntersectionsFactory.py: -------------------------------------------------------------------------------- 1 | import vtk 2 | import math 3 | from vtkAtamai import ActorFactory 4 | 5 | 6 | class ROIIntersectionsFactory(ActorFactory.ActorFactory): 7 | 8 | """ 9 | Intersections to be displayed on 2D renderpanes. 10 | This class has not been used yet, but keep here 11 | for development at next stage. 12 | """ 13 | 14 | def __init__(self): 15 | ActorFactory.ActorFactory.__init__(self) 16 | self._Cutters = [] 17 | self._Cube = None 18 | self._Plane = None 19 | self._properties = [] 20 | 21 | def SetPlanes(self, planes): 22 | """Set a set of SlicePlaneFactory.""" 23 | self._Planes = planes 24 | self._properties = [] 25 | for i in range(len(self._Planes)): 26 | self._properties.append(vtk.vtkProperty()) 27 | self._UpdateIntersections() 28 | 29 | def SetCubeSource(self, cube): 30 | self._Cube = cube 31 | self._UpdateIntersections() 32 | 33 | def _UpdateIntersections(self): 34 | if self._Planes is None: 35 | return 36 | if self._Cube is None: 37 | return 38 | 39 | self._Cutters = [] 40 | for plane in self._Planes: 41 | cutter = vtk.vtkCutter() 42 | cutter.SetCutFunction(plane.GetPlaneEquation()) 43 | cutter.SetInput(self._Cube.GetOutput()) 44 | self._Cutters.append(cutter) 45 | 46 | def AddToRenders(self, renders): 47 | i = 0 48 | for cutter in range(len(self._Cutters)): 49 | mapper = vtk.vtkPolyDataMapper() 50 | mapper.SetInput(cutter.GetOutput()) 51 | actor = self._NewActor() 52 | actor.SetProperty(self._properties[i]) 53 | i += 1 54 | actor.SetMapper(mapper) 55 | self.AddChild(actor) 56 | 57 | def SetColor(self, *args): 58 | apply(self._Property.SetColor, args) 59 | 60 | def GetColor(self): 61 | return self._Property.GetColor() 62 | 63 | def HasChangedSince(self, sinceMTime): 64 | if ActorFactory.ActorFactory.HasChangedSince(self, sinceMTime): 65 | return 1 66 | 67 | for plane in self._Planes: 68 | if plane.HasChangedSince(sinceMTime): 69 | return 1 70 | if self._Property.GetMTime() > sinceMTime: 71 | return 1 72 | return 0 73 | 74 | def SetVisibility(self, yesno, renderer=None): 75 | if renderer is None: 76 | renderers = self._Renderers 77 | else: 78 | renderers = [renderer, ] 79 | 80 | for ren in renderers: 81 | for actor in self._ActorDict[ren]: 82 | actor.SetVisibility(yesno) 83 | 84 | def GetProperty(self): 85 | return self._Property 86 | 87 | def AddToRenderer(self, ren): 88 | ActorFactory.ActorFactory.AddToRenderer(self, ren) 89 | try: 90 | ren.AddObserver('StartEvent', self.OnRenderEvent) 91 | except: 92 | pass 93 | 94 | def OnRenderEvent(self, ren, evt): 95 | camera = ren.GetActiveCamera() 96 | v = camera.GetViewPlaneNormal() 97 | 98 | if camera.GetParallelProjection(): 99 | d = camera.GetParallelScale() / 100 100 | else: 101 | d = camera.GetDistance() * \ 102 | math.sin(camera.GetViewAngle() / 360.0 * math.pi) / \ 103 | 100 104 | 105 | v = self._Transform.GetInverse().TransformVector( 106 | v[0] * d, v[1] * d, v[2] * d) 107 | for actor in self._ActorDict[ren]: 108 | actor.SetPosition(v[0], v[1], v[2]) 109 | 110 | def _MakeActors(self): 111 | actors = [] 112 | 113 | mapper = vtk.vtkPolyDataMapper() 114 | mapper.SetInputConnection(self._Append.GetOutputPort()) 115 | actor = self._NewActor() 116 | actor.SetProperty(self._Property) 117 | actor.SetMapper(mapper) 118 | actors.append(actor) 119 | 120 | return actors 121 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/ROISphereFactory.py: -------------------------------------------------------------------------------- 1 | import vtk 2 | from vtkAtamai import ActorFactory 3 | 4 | 5 | class ROISphereFactory(ActorFactory.ActorFactory): 6 | 7 | def __init__(self): 8 | ActorFactory.ActorFactory.__init__(self) 9 | 10 | # share property across all the actors 11 | self._sphere = vtk.vtkSphereSource() 12 | self._sphere.SetThetaResolution(40) 13 | self._sphere.SetPhiResolution(40) 14 | self._visibility = True 15 | 16 | self._Property = vtk.vtkProperty() 17 | self._Property.SetColor(1, 1, 0) 18 | 19 | self._bounds = (-1, 1, -1, 1, -1, 1) 20 | 21 | def SetROIBounds(self, bounds): 22 | """Set the bounds that defines the ellipsoid.""" 23 | 24 | self._bounds = bounds 25 | self._Update() 26 | 27 | def _Update(self): 28 | """Update ellipsoid to fit into the new bounding box""" 29 | x0, x1, y0, y1, z0, z1 = self._bounds 30 | self._sphere.SetRadius(1.0) 31 | 32 | scale0 = (x1 - x0) / 2.0 33 | scale1 = (y1 - y0) / 2.0 34 | scale2 = (z1 - z0) / 2.0 35 | 36 | self._sphere.Update() 37 | 38 | # the center of the ellipsoid 39 | center = ((x1 + x0) * 0.5, 40 | (y1 + y0) * 0.5, 41 | (z1 + z0) * 0.5) 42 | self._UpdateTransform((scale0, scale1, scale2), center) 43 | 44 | def GetOrientation(self): 45 | return self._orientation 46 | 47 | def _UpdateTransform(self, scale, center): 48 | self.GetTransform().Identity() 49 | self.GetTransform().Translate(center) 50 | self.GetTransform().Scale(scale) 51 | self.Modified() 52 | 53 | def GetPolyData(self): 54 | """Return a vtkPolyData that bounding the ROI.""" 55 | 56 | trans = vtk.vtkTransformPolyDataFilter() 57 | trans.SetInput(self._sphere.GetOutput()) 58 | trans.SetTransform(self.GetTransform()) 59 | return trans.GetOutput() 60 | 61 | def SetVisibility(self, yesno, renderer=None): 62 | 63 | self._visibility = yesno 64 | 65 | if renderer is None: 66 | renderers = self._Renderers 67 | else: 68 | renderers = [renderer, ] 69 | 70 | for ren in renderers: 71 | for actor in self._ActorDict[ren]: 72 | actor.SetVisibility(yesno) 73 | 74 | self.Modified() 75 | 76 | def SetOpacity(self, theOpacity): 77 | self._Property.SetOpacity(theOpacity) 78 | self.Modified() 79 | 80 | def GetOpacity(self): 81 | return self._Property.GetOpacity() 82 | 83 | def SetColor(self, *args): 84 | apply(self._Property.SetColor, args) 85 | self.Modified() 86 | 87 | def GetColor(self): 88 | return self._Property.GetColor() 89 | 90 | def GetActor(self): 91 | return self._Actor 92 | 93 | def _MakeActors(self): 94 | actor = self._NewActor() 95 | actor.SetProperty(self._Property) 96 | actor.SetVisibility(self._visibility) 97 | return [actor] 98 | 99 | def _NewActor(self): 100 | actor = ActorFactory.ActorFactory._NewActor(self) 101 | actor.PickableOff() 102 | mapper = vtk.vtkPolyDataMapper() 103 | mapper.SetInputConnection(self._sphere.GetOutputPort()) 104 | actor.SetMapper(mapper) 105 | self._Actor = actor 106 | return actor 107 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/ResampleImageGUI.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | ########################################################################### 4 | # Python code generated with wxFormBuilder (version Nov 6 2013) 5 | # http://www.wxformbuilder.org/ 6 | ## 7 | # PLEASE DO "NOT" EDIT THIS FILE! 8 | ########################################################################### 9 | 10 | import wx 11 | import wx.xrc 12 | 13 | ########################################################################### 14 | # Class ResampleImageGUI 15 | ########################################################################### 16 | 17 | 18 | class ResampleImageGUI (wx.Panel): 19 | 20 | def __init__(self, parent): 21 | wx.Panel.__init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.Size( 22 | 476, 132), style=wx.TAB_TRAVERSAL) 23 | 24 | fgSizer10 = wx.FlexGridSizer(0, 2, 0, 0) 25 | fgSizer10.SetFlexibleDirection(wx.BOTH) 26 | fgSizer10.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED) 27 | 28 | self.m_staticText50 = wx.StaticText( 29 | self, wx.ID_ANY, u"Resample Factor:", wx.DefaultPosition, wx.DefaultSize, 0) 30 | self.m_staticText50.Wrap(-1) 31 | fgSizer10.Add( 32 | self.m_staticText50, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.ALL, 5) 33 | 34 | self.m_textCtrlResampleFactor = wx.TextCtrl( 35 | self, wx.ID_ANY, u"2.0", wx.DefaultPosition, wx.DefaultSize, 0) 36 | self.m_textCtrlResampleFactor.SetMaxLength(0) 37 | fgSizer10.Add(self.m_textCtrlResampleFactor, 0, wx.ALL, 5) 38 | 39 | self.m_staticText51 = wx.StaticText( 40 | self, wx.ID_ANY, u"Original voxel size:", wx.DefaultPosition, wx.DefaultSize, 0) 41 | self.m_staticText51.Wrap(-1) 42 | fgSizer10.Add(self.m_staticText51, 0, wx.ALIGN_RIGHT | wx.ALL, 5) 43 | 44 | self.m_staticTextOriginalSize = wx.StaticText( 45 | self, wx.ID_ANY, u"100.000 x 100.000 x 100.000", wx.DefaultPosition, wx.Size(-1, -1), 0) 46 | self.m_staticTextOriginalSize.Wrap(-1) 47 | self.m_staticTextOriginalSize.SetMinSize(wx.Size(240, -1)) 48 | 49 | fgSizer10.Add(self.m_staticTextOriginalSize, 0, wx.ALL, 5) 50 | 51 | self.m_staticText53 = wx.StaticText( 52 | self, wx.ID_ANY, u"Resampled voxel size:", wx.DefaultPosition, wx.DefaultSize, 0) 53 | self.m_staticText53.Wrap(-1) 54 | fgSizer10.Add(self.m_staticText53, 0, wx.ALIGN_RIGHT | wx.ALL, 5) 55 | 56 | self.m_staticTextResampledSize = wx.StaticText( 57 | self, wx.ID_ANY, u"200.000 x 200.000 x 200.000", wx.DefaultPosition, wx.Size(-1, -1), 0) 58 | self.m_staticTextResampledSize.Wrap(-1) 59 | self.m_staticTextResampledSize.SetMinSize(wx.Size(240, -1)) 60 | 61 | fgSizer10.Add(self.m_staticTextResampledSize, 0, wx.ALL, 5) 62 | 63 | self.m_buttonResample = wx.Button( 64 | self, wx.ID_ANY, u"Resample...", wx.DefaultPosition, wx.DefaultSize, 0) 65 | fgSizer10.Add(self.m_buttonResample, 0, wx.ALL, 5) 66 | 67 | self.SetSizer(fgSizer10) 68 | self.Layout() 69 | 70 | # Connect Events 71 | self.m_buttonResample.Bind(wx.EVT_BUTTON, self.onResampleButton) 72 | 73 | def __del__(self): 74 | pass 75 | 76 | # Virtual event handlers, overide them in your derived class 77 | def onResampleButton(self, event): 78 | event.Skip() 79 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/ResampleImageGUIC.py: -------------------------------------------------------------------------------- 1 | import wx 2 | import ResampleImageGUI 3 | 4 | 5 | class ResampleImageGUIC(ResampleImageGUI.ResampleImageGUI): 6 | 7 | def __init__(self, parent): 8 | 9 | ResampleImageGUI.ResampleImageGUI.__init__(self, parent) 10 | 11 | self.SetSize(self.GetBestSize()) 12 | 13 | def onResampleButton(self, event): 14 | event.Skip() 15 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/RescaleImageGUIC.py: -------------------------------------------------------------------------------- 1 | import RescaleImageGUI 2 | 3 | 4 | class RescaleImageGUIC(RescaleImageGUI.RescaleImageGUI): 5 | 6 | def __init__(self, parent): 7 | 8 | RescaleImageGUI.RescaleImageGUI.__init__(self, parent) 9 | self.SetSize(self.GetBestSize()) 10 | 11 | def onTextValidate(self, event): 12 | 13 | event.Skip() 14 | 15 | enabled = False 16 | 17 | try: 18 | i = float(self.m_textCtrlOldValue1.GetValue()) 19 | i = float(self.m_textCtrlOldValue2.GetValue()) 20 | i = float(self.m_textCtrlNewValue1.GetValue()) 21 | i = float(self.m_textCtrlNewValue2.GetValue()) 22 | enabled = True 23 | except: 24 | pass 25 | 26 | self.m_buttonRescale.Enable(enabled) 27 | -------------------------------------------------------------------------------- /Plugins/public/PIMicroViewBasePlugins/StandardROIGUIC.py: -------------------------------------------------------------------------------- 1 | import wx 2 | import wx.lib.buttons 3 | import wx.lib.masked 4 | 5 | from zope import component 6 | 7 | import StandardROIGUI 8 | # don't change this 9 | from PI.visualization.MicroView.interfaces import IStockIconProvider 10 | from PI.visualization.common import FloatSlider 11 | 12 | import logging 13 | 14 | 15 | class StandardROIGUIC(StandardROIGUI.StandardROIGUI): 16 | 17 | def __init__(self, parent): 18 | 19 | self.logger = logging.getLogger(__name__) 20 | 21 | StandardROIGUI.StandardROIGUI.__init__(self, parent) 22 | 23 | # erase warning message early 24 | self.m_staticTextErrorMessage1.SetLabel("") 25 | self.m_staticTextErrorMessage2.SetLabel("") 26 | 27 | # get stock icon factory from object registry 28 | stockicons = component.getUtility(IStockIconProvider) 29 | pkg = self.__module__.split('.')[0] + '.Icons' 30 | self._open_icon = stockicons.getBitmap('stock_link_open', package=pkg) 31 | self._closed_icon = stockicons.getBitmap( 32 | 'stock_link_closed', package=pkg) 33 | 34 | # make masked number controls 35 | children = self.GetChildren() 36 | 37 | # iterate over all children looking for things - wxFB has limitations 38 | # that we need to overcome 39 | flex_sizers = [] 40 | x_labels = [] 41 | y_labels = [] 42 | z_labels = [] 43 | sliders = [] 44 | for index in range(len(children)): 45 | name = children[index].GetName() 46 | if name == 'staticText': 47 | label = children[index].GetLabel() 48 | if label == 'X:': 49 | sizer = children[index].GetContainingSizer() 50 | flex_sizers.append(sizer) 51 | x_labels.append(index) 52 | elif label == 'Y:': 53 | y_labels.append(index) 54 | elif label == 'Z:': 55 | z_labels.append(index) 56 | elif name == 'slider': 57 | sliders.append(index) 58 | 59 | # replace 6 sliders with custom FloatSliders 60 | sx = FloatSlider.FloatSlider(self, -1, 50, 0, 100, 1) 61 | sx.SetMinSize(wx.Size(100, -1)) 62 | sy = FloatSlider.FloatSlider(self, -1, 50, 0, 100, 1) 63 | sy.SetMinSize(wx.Size(100, -1)) 64 | sz = FloatSlider.FloatSlider(self, -1, 50, 0, 100, 1) 65 | sz.SetMinSize(wx.Size(100, -1)) 66 | 67 | flex_sizers[0].Replace(self.m_sliderSizeX, sx) 68 | flex_sizers[0].Replace(self.m_sliderSizeY, sy) 69 | flex_sizers[0].Replace(self.m_sliderSizeZ, sz) 70 | 71 | self.m_sliderSizeX.Destroy() 72 | self.m_sliderSizeY.Destroy() 73 | self.m_sliderSizeZ.Destroy() 74 | 75 | self.m_sliderSizeX = sx 76 | self.m_sliderSizeY = sy 77 | self.m_sliderSizeZ = sz 78 | 79 | cx = FloatSlider.FloatSlider(self, -1, 50, 0, 100, 0.5) 80 | cx.SetMinSize(wx.Size(100, -1)) 81 | cy = FloatSlider.FloatSlider(self, -1, 50, 0, 100, 0.5) 82 | cy.SetMinSize(wx.Size(100, -1)) 83 | cz = FloatSlider.FloatSlider(self, -1, 50, 0, 100, 0.5) 84 | cz.SetMinSize(wx.Size(100, -1)) 85 | 86 | flex_sizers[1].Replace(self.m_sliderCenterX, cx) 87 | flex_sizers[1].Replace(self.m_sliderCenterY, cy) 88 | flex_sizers[1].Replace(self.m_sliderCenterZ, cz) 89 | 90 | self.m_sliderCenterX.Destroy() 91 | self.m_sliderCenterY.Destroy() 92 | self.m_sliderCenterZ.Destroy() 93 | 94 | self.m_sliderCenterX = cx 95 | self.m_sliderCenterY = cy 96 | self.m_sliderCenterZ = cz 97 | 98 | flex_sizers[0].Layout() 99 | 100 | def DisablePlugin(self, reason_string=''): 101 | 102 | # we don't really do anything with this 103 | self.logger.warning(reason_string) 104 | -------------------------------------------------------------------------------- /Plugins/public/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | __import__('pkg_resources').declare_namespace(__name__) 3 | except: 4 | __path__ = __import__('pkgutil').extend_path(__path__, __name__) 5 | -------------------------------------------------------------------------------- /Plugins/public/setup.cfg.in: -------------------------------------------------------------------------------- 1 | [install_lib] 2 | compile = 0 3 | optimize = 2 4 | 5 | [bdist_egg] 6 | exclude_source_files = 1 7 | -------------------------------------------------------------------------------- /Plugins/public/setup.py: -------------------------------------------------------------------------------- 1 | # ========================================================================= 2 | # 3 | # Copyright (c) 2011-2015 Parallax Innovations Inc. 4 | # 5 | # ========================================================================= 6 | 7 | import sys 8 | import os 9 | import base64 10 | import glob 11 | from setuptools import setup, find_packages 12 | 13 | desc = """MicroView base plugins: 14 | 15 | ImageInfo : Displays a property grid for the loaded image 16 | IsoSurfaceDisplay : Create and save isosurfaces 17 | OptionsDialog : General applications options 18 | RescaleImage : Perform linear rescaling of image values 19 | ResampleImage : Perform spatial resampling of image 20 | StandardROITool : Standard ROI tool - various basic shapes 21 | """ 22 | 23 | fname = os.path.join(os.path.dirname(sys.argv[0]), 'setup.cfg.in') 24 | s = open(fname, 'rt').read().replace( 25 | '@RELEASE@', "2.5.0") 26 | open(fname[:-3], 'wt').write(s) 27 | 28 | __init__py = """ 29 | try: 30 | __import__('pkg_resources').declare_namespace(__name__) 31 | except: 32 | __path__ = __import__('pkgutil').extend_path(__path__, __name__) 33 | 34 | PACKAGE_VERSION = "2.5.0" 35 | PACKAGE_SHA1 = "NA" 36 | """ 37 | print >> open(os.path.join(os.path.dirname( 38 | sys.argv[0]), 'PIMicroViewBasePlugins', '__init__.py'), 'wt'), __init__py.strip() 39 | 40 | # Add Icons 41 | icondir = os.path.join( 42 | os.path.dirname(sys.argv[0]), 'PIMicroViewBasePlugins', 'Icons') 43 | if os.path.exists(icondir): 44 | init_name = os.path.join(icondir, '__init__.py') 45 | _file = open(init_name, 'wt') 46 | print >> _file, __init__py.strip() 47 | print >> _file, '' 48 | icon_glob = glob.glob(os.path.join(icondir, '*.png')) 49 | icon_glob.sort() 50 | for g in icon_glob: 51 | bn = os.path.splitext(os.path.basename(g))[0].replace('-', '_') 52 | s = open(g, 'rb').read() 53 | print >> _file, "%s = \"%s\"" % (bn, base64.b64encode(s)) 54 | _file.close() 55 | 56 | 57 | setup(name='MicroView-base-plugins', 58 | version="2.5.0", 59 | description="MicroView base plugins", 60 | long_description=desc, 61 | author="Jeremy D. Gill", 62 | author_email="jgill@parallax-innovations.com", 63 | maintainer="Jeremy D. Gill", 64 | maintainer_email="jgill@parallax-innovations.com", 65 | url="http://parallax-innovations.com/microview", 66 | packages=find_packages(), 67 | package_data={'': ['*.gif', '*.png', '*.ico']}, 68 | zip_safe=True, 69 | entry_points=""" 70 | [PI.MicroView.MicroViewPlugIn.v1] 71 | BasicBoneAnalysis = PIMicroViewBasePlugins.BasicBoneAnalysis:BasicBoneAnalysis 72 | ImageInfo = PIMicroViewBasePlugins.ImageInfo:ImageInfo 73 | IsoSurfaceDisplay = PIMicroViewBasePlugins.IsoSurfaceDisplay:IsoSurfaceDisplay 74 | OptionsDialog = PIMicroViewBasePlugins.OptionsDialog:OptionsDialog 75 | RescaleImage = PIMicroViewBasePlugins.RescaleImage:RescaleImage 76 | ResampleImage = PIMicroViewBasePlugins.ResampleImage:ResampleImage 77 | StandardROITool = PIMicroViewBasePlugins.StandardROITool:StandardROITool 78 | """ 79 | ) 80 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Microview 2 | ========== 3 | 4 | MicroView is a 3D image viewer and analysis tool. It is written in Python and C++ and leverages a variety of open source tools 5 | including [VTK](http://www.vtk.org), and [wxPython](http://www.wxpython.org). 6 | 7 | Build Instructions 8 | ------------------ 9 | 10 | 1. Download and install [python](http://www.python.org) 11 | 12 | 2. Install [pip](http://www.pip-installer.org/en/latest/) 13 | 14 | 3. Install [virtualenv](http://www.virtualenv.org/) 15 | 16 | 4. Create a virtualenv environment: 17 | ```bash 18 | virtualenv MV 19 | ``` 20 | 5. Activate the newly created virtualenv environment. 21 | 22 | 6. On Windows, set needed environment variables: 23 | 24 | - if compiling with VS2010 or higher, read and follow [this](http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat) link 25 | - set language variable: 26 | ```bash 27 | export LANG='eng_US.UTF-8' 28 | ``` 29 | 30 | 6. Download MicroView dependencies that aren't easily installed with pip. For each of the following packages, 31 | download the installer and place in an accessible folder: 32 | 33 | - [numpy](http://www.numpy.org) 34 | - [scipy](http://www.scipy.org) 35 | - [matplotlib](http://www.matplotlib.org) 36 | - [scikit-image](http://scikit-image.org) 37 | - [pywin32](http://sourceforge.net/projects/pywin32) 38 | - [Pillow](https://github.com/python-imaging/Pillow) 39 | - [wxPython](http://www.wxpython.org) 40 | 41 | Christoph Gohlke's [repository](http://www.lfd.uci.edu/~gohlke/pythonlibs) is an excellent resource 42 | for Windows installers, especially for 64-bit architectures 43 | 44 | 7. Next, for each downloaded installer, run: 45 | ```bash 46 | easy_install PACKAGE 47 | ``` 48 | 49 | [Pillow](pillow.readthedocs.io) may not install correctly unless an environment variable is set. Under [cygwin](http://www.cygwin.com>), for instance, the following command must be executed before attempting to install:: 50 | ```bash 51 | export LANG='eng_US.UTF-8' 52 | ``` 53 | 8. Install MicroView dependencies: 54 | ```bash 55 | pip install -r microview.git/MicroView/requirements.txt 56 | ``` 57 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT(MicroView) 2 | 3 | cmake_minimum_required(VERSION 2.8) 4 | 5 | # # Mac needs hand holding 6 | LINK_DIRECTORIES(/usr/local/lib) 7 | INCLUDE_DIRECTORIES(/usr/local/include/vtk-6.1) 8 | 9 | FIND_PACKAGE(PythonInterp) 10 | FIND_PACKAGE(PythonLibs) 11 | FIND_PACKAGE(VTK) 12 | FIND_PACKAGE(OpenGL REQUIRED) 13 | 14 | MESSAGE("VTK_LIBRARIES=${VTK_LIBRARIES}") 15 | 16 | IF(VTK_FOUND) 17 | INCLUDE(${VTK_USE_FILE}) 18 | ENDIF(VTK_FOUND) 19 | 20 | ###################################################################################### 21 | 22 | INCLUDE(${VTK_CMAKE_DIR}/vtkWrapPython.cmake) 23 | 24 | SET(VISUALIZATION_ROOT ${Visualization_SOURCE_DIR}) 25 | 26 | 27 | # Your c++ class files. They must be accompanied by 28 | # a header file of the same name in order for the 29 | # VTK Python wrapper to work. 30 | SET(srcs 31 | vtkImageInPlaceMirrorFilter.cxx 32 | vtkImageInvertFilter.cxx 33 | vtkImagePurify.cxx 34 | vtkImageStatistics.cxx 35 | vtkImageStereology.cxx 36 | vtkInPlaceImageStencil.cxx 37 | vtkStderrOutputWindow.cxx 38 | vtkImageMagnitude2.cxx 39 | ) 40 | 41 | # The libraries that your classes use. If you need 42 | # libraries that aren't VTK kits (e.g., zlib or netcdf), 43 | # then use CMake's FIND_LIBRARY command and add the result 44 | # to this list. 45 | SET(libs 46 | ${VTK_LIBRARIES} 47 | ) 48 | 49 | # The VTK Python libraries that the automatically-generated 50 | # Python wrappers for your classes will use. This should only 51 | # be vtkCommonPython, but some VTK installations require each 52 | # vtk(some VTK kit)Python to be listed. 53 | 54 | IF("${VTK_MAJOR_VERSION}" EQUAL 5) 55 | SET(py_libs 56 | vtkCommonPythonD 57 | vtkImagingPythonD 58 | vtkIOPythonD 59 | vtkFilteringPythonD 60 | vtkGraphicsPythonD 61 | vtkHybridPythonD 62 | vtkImagingPythonD 63 | vtkVolumeRenderingPythonD 64 | vtkWidgetsPythonD 65 | ) 66 | ELSE("${VTK_MAJOR_VERSION}" EQUAL 5) 67 | SET(py_libs 68 | vtkWrappingPython27Core-6.1 69 | vtkInteractionWidgetsPython27D-6.1 70 | vtkCommonCorePython27D-6.1 71 | vtkImagingGeneralPython27D-6.1 72 | vtkImagingStatisticsPython27D-6.1 73 | vtkCommonExecutionModelPython27D-6.1 74 | vtkIOImagePython27D-6.1 75 | vtkCommonDataModelPython27D-6.1 76 | ) 77 | ENDIF("${VTK_MAJOR_VERSION}" EQUAL 5) 78 | 79 | ###################################################### 80 | # You do not need to change anything beyond this point. 81 | ###################################################### 82 | 83 | INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}) 84 | INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) 85 | INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_DIRS}) 86 | 87 | OPTION(BUILD_SHARED_LIBS "Build with shared libraries." 88 | ${VTK_BUILD_SHARED_LIBS}) 89 | 90 | IF(BUILD_SHARED_LIBS) 91 | SET(VTKLOCAL_BUILD_SHARED_LIBS_CONFIG 1) 92 | ELSE(BUILD_SHARED_LIBS) 93 | SET(VTKLOCAL_BUILD_SHARED_LIBS_CONFIG 0) 94 | ENDIF(BUILD_SHARED_LIBS) 95 | 96 | VTK_WRAP_PYTHON3("${PROJECT_NAME}Python" python_srcs "${srcs}") 97 | ADD_LIBRARY("${PROJECT_NAME}Python" MODULE ${python_srcs} ${srcs} ${POISSON_SURFACE_RECONSTRUCTION_SOURCES} "${PROJECT_NAME}PythonInit.cxx") 98 | TARGET_LINK_LIBRARIES("${PROJECT_NAME}Python" ${py_libs} ${libs} ${OPENGL_LIBRARIES} ${OPENGL_glu_LIBRARY} ${GLEW_LIBRARY}) 99 | -------------------------------------------------------------------------------- /src/MicroViewConfigure.h: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | This source has no copyright. It is intended to be copied by users 3 | wishing to create their own VTK classes locally. 4 | =========================================================================*/ 5 | #ifndef __Configure_h 6 | #define __Configure_h 7 | 8 | #if 1 9 | # define MicroView_SHARED 10 | #endif 11 | 12 | #if defined(_MSC_VER) && defined(MicroView_SHARED) 13 | # pragma warning ( disable : 4275 ) 14 | #endif 15 | 16 | #if defined(_WIN32) && defined(MicroView_SHARED) 17 | # define VTK_MicroView_EXPORT __declspec( dllexport ) 18 | #else 19 | # define VTK_MicroView_EXPORT 20 | #endif 21 | 22 | #endif // __MicroViewConfigure_h 23 | -------------------------------------------------------------------------------- /src/vtkImageInPlaceMirrorFilter.cxx: -------------------------------------------------------------------------------- 1 | #include "vtkImageInPlaceMirrorFilter.h" 2 | 3 | #include "vtkImageData.h" 4 | #include "vtkInformation.h" 5 | #include "vtkInformationVector.h" 6 | #include "vtkObjectFactory.h" 7 | #include "vtkStreamingDemandDrivenPipeline.h" 8 | 9 | vtkCxxRevisionMacro(vtkImageInPlaceMirrorFilter, "$Revision: 1.3 $"); 10 | vtkStandardNewMacro(vtkImageInPlaceMirrorFilter); 11 | 12 | //---------------------------------------------------------------------------- 13 | void vtkImageInPlaceMirrorFilter::PrintSelf(ostream& os, vtkIndent indent) 14 | { 15 | this->Superclass::PrintSelf(os,indent); 16 | } 17 | 18 | //---------------------------------------------------------------------------- 19 | vtkImageInPlaceMirrorFilter::vtkImageInPlaceMirrorFilter() 20 | { 21 | this->Axis = 0; // default is to flip in x axis 22 | } 23 | 24 | template 25 | void vtkImageInPlaceMirrorFilterExecute(vtkImageInPlaceMirrorFilter *self, 26 | vtkImageData *outData, T *ptr) 27 | { 28 | int min0, max0, min1, max1, min2, max2, numC; 29 | int x0, x1, y0, y1, z0, z1; 30 | int j; 31 | vtkIdType outInc0, outInc1, outInc2; 32 | T *tempdata; 33 | int axis = self->GetAxis(); 34 | 35 | outData->GetExtent(min0, max0, min1, max1, min2, max2); 36 | outData->GetIncrements(outInc0, outInc1, outInc2); 37 | numC = outData->GetNumberOfScalarComponents(); 38 | 39 | // allocate space for scratch area 40 | tempdata = new T[numC]; 41 | 42 | self->UpdateProgress(0.0); 43 | 44 | switch (axis) { 45 | case 0: // flip in x-axis 46 | 47 | for (z0 = min2; z0 <= max2; z0++) 48 | { 49 | /* update progress */ 50 | if (max2 != min2) 51 | self->UpdateProgress(z0 / (float)(max2-min2)); 52 | #pragma omp parallel 53 | for (y0 = min1; y0 <= max1; y0++) 54 | { 55 | ptr = static_cast(outData->GetScalarPointer(min0, y0, z0)); 56 | x0 = min0*numC; x1 = max0*numC; 57 | while (x0 <= x1) 58 | { 59 | // copy end point into temp array 60 | for (j = 0; j < numC; j++) 61 | tempdata[j] = ptr[x1+j]; 62 | 63 | // over-write end point 64 | for (j = 0; j < numC; j++) 65 | ptr[x1+j] = ptr[x0+j]; 66 | 67 | // over-write start point 68 | for (j = 0; j < numC; j++) 69 | ptr[x0+j] = tempdata[j]; 70 | x0 += numC; x1 -= numC; 71 | } 72 | } 73 | } 74 | break; 75 | 76 | case 1: // flip in y-axis 77 | 78 | for (z0 = min2; z0 <= max2; z0++) 79 | { 80 | /* update progress */ 81 | if (max1 != min1) 82 | self->UpdateProgress(z0 / (float)(max1-min1)); 83 | ptr = (T *) (outData->GetScalarPointer(min0, min1, z0)); // pointer to beginning of z-slice 84 | for (x0 = min0; x0 <= max0; x0++) 85 | { 86 | y0 = min1; y1 = max1; 87 | while (y0 <= y1) 88 | { 89 | for (j = 0; j < numC; j++) 90 | tempdata[j] = ptr[x0*outInc0 + y1*outInc1 + j]; 91 | for (j = 0; j < numC; j++) 92 | ptr[x0*outInc0 + y1*outInc1 + j] = ptr[x0*outInc0 + y0*outInc1 + j]; 93 | for (j = 0; j < numC; j++) 94 | ptr[x0*outInc0 + y0*outInc1 + j] = tempdata[j]; 95 | y0++; y1--; 96 | } 97 | } 98 | } 99 | break; 100 | 101 | case 2: // flip in z-axis 102 | ptr = (T *) (outData->GetScalarPointer(min0, min1, min2)); // pointer to entire volume 103 | for (y0 = min1; y0 <= max1; y0++) 104 | { 105 | /* update progress */ 106 | if (max1 != min1) 107 | self->UpdateProgress(y0 / (float)(max1-min1)); 108 | for (x0 = min0; x0 <= max0; x0++) 109 | { 110 | z0 = min2; z1 = max2; 111 | while (z0 <= z1) 112 | { 113 | for (j = 0; j < numC; j++) 114 | tempdata[j] = ptr[x0*outInc0 + y0*outInc1 + z1*outInc2 + j]; 115 | for (j = 0; j < numC; j++) 116 | ptr[x0*outInc0 + y0*outInc1 + z1*outInc2 + j] = ptr[x0*outInc0 + y0*outInc1 + z0*outInc2 + j]; 117 | for (j = 0; j < numC; j++) 118 | ptr[x0*outInc0 + y0*outInc1 + z0*outInc2 + j] = tempdata[j]; 119 | z0++; z1--; 120 | } 121 | } 122 | } 123 | break; 124 | 125 | default: 126 | break; 127 | } 128 | self->UpdateProgress(1.0); 129 | delete [] tempdata; 130 | } 131 | 132 | //---------------------------------------------------------------------------- 133 | // Split up into finished and border datas. Fill the border datas. 134 | int vtkImageInPlaceMirrorFilter::RequestData( 135 | vtkInformation* request, 136 | vtkInformationVector** inputVector, 137 | vtkInformationVector* outputVector) 138 | { 139 | void *ptr = NULL; 140 | 141 | // let superclass allocate data 142 | this->vtkImageInPlaceFilter::RequestData(request, inputVector, outputVector); 143 | 144 | // get the data object 145 | vtkInformation *outInfo = outputVector->GetInformationObject(0); 146 | vtkImageData *output = 147 | vtkImageData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); 148 | 149 | switch (output->GetScalarType()) 150 | { 151 | vtkTemplateMacro( 152 | vtkImageInPlaceMirrorFilterExecute(this, output, static_cast(ptr))); 153 | default: 154 | vtkErrorMacro(<< "Execute: Unknown ScalarType"); 155 | return 1; 156 | } 157 | 158 | return 1; 159 | } 160 | 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /src/vtkImageInPlaceMirrorFilter.h: -------------------------------------------------------------------------------- 1 | #ifndef __vtkImageInPlaceMirrorFilter_h 2 | #define __vtkImageInPlaceMirrorFilter_h 3 | 4 | #include "vtkImageInPlaceFilter.h" 5 | #include "MicroViewConfigure.h" 6 | 7 | class VTK_MicroView_EXPORT vtkImageInPlaceMirrorFilter : public vtkImageInPlaceFilter 8 | { 9 | public: 10 | static vtkImageInPlaceMirrorFilter *New(); 11 | vtkTypeRevisionMacro(vtkImageInPlaceMirrorFilter,vtkImageInPlaceFilter); 12 | void PrintSelf(ostream& os, vtkIndent indent); 13 | 14 | // Get/Set macros 15 | vtkSetMacro(Axis, int); // 0=x, 1=y, 2=z 16 | vtkGetMacro(Axis, int); // 0=x, 1=y, 2=z 17 | 18 | protected: 19 | vtkImageInPlaceMirrorFilter(); 20 | ~vtkImageInPlaceMirrorFilter() {}; 21 | int Axis; 22 | 23 | virtual int RequestData(vtkInformation *request, 24 | vtkInformationVector** inputVector, 25 | vtkInformationVector* outputVector); 26 | 27 | private: 28 | vtkImageInPlaceMirrorFilter(const vtkImageInPlaceMirrorFilter&); // Not implemented. 29 | void operator=(const vtkImageInPlaceMirrorFilter&); // Not implemented. 30 | }; 31 | 32 | 33 | 34 | #endif 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/vtkImageInvertFilter.cxx: -------------------------------------------------------------------------------- 1 | #include "vtkImageInvertFilter.h" 2 | 3 | #include "vtkImageData.h" 4 | #include "vtkInformation.h" 5 | #include "vtkInformationVector.h" 6 | #include "vtkObjectFactory.h" 7 | #include "vtkStreamingDemandDrivenPipeline.h" 8 | 9 | vtkCxxRevisionMacro(vtkImageInvertFilter, "$Revision: 1.4 $"); 10 | vtkStandardNewMacro(vtkImageInvertFilter); 11 | 12 | //---------------------------------------------------------------------------- 13 | void vtkImageInvertFilter::PrintSelf(ostream& os, vtkIndent indent) 14 | { 15 | this->Superclass::PrintSelf(os,indent); 16 | } 17 | 18 | //---------------------------------------------------------------------------- 19 | vtkImageInvertFilter::vtkImageInvertFilter() 20 | { 21 | } 22 | 23 | template 24 | void vtkImageInvertFilterExecute(vtkImageInvertFilter *self, 25 | vtkImageData *outData, T *ptr) 26 | { 27 | int min0, max0, min1, max1, min2, max2; 28 | int x, y, z, numC, j; 29 | float range[2]; 30 | T tempdata; 31 | 32 | outData->GetExtent(min0, max0, min1, max1, min2, max2); 33 | numC = outData->GetNumberOfScalarComponents(); 34 | 35 | range[0] = outData->GetScalarRange()[0]; 36 | range[1] = outData->GetScalarRange()[1]; 37 | 38 | self->UpdateProgress(0.0); 39 | 40 | for (z = min2; z <= max2; z++) 41 | { 42 | /* update progress */ 43 | if (min2 != max2) 44 | self->UpdateProgress(z / (float)(max2-min2)); 45 | for (y = min1; y <= max1; y++) 46 | { 47 | ptr = static_cast(outData->GetScalarPointer(min0, y, z)); 48 | for (x = min0; x <= max0; x++) 49 | { 50 | for (j = 0; j < numC; j++) 51 | { 52 | tempdata = *ptr; 53 | /* modify data */ 54 | tempdata = range[1] - (tempdata - range[0]); 55 | *ptr++ = tempdata; 56 | } 57 | } 58 | } 59 | } 60 | self->UpdateProgress(1.0); 61 | } 62 | 63 | //---------------------------------------------------------------------------- 64 | // Split up into finished and border datas. Fill the border datas. 65 | int vtkImageInvertFilter::RequestData( 66 | vtkInformation* request, 67 | vtkInformationVector** inputVector, 68 | vtkInformationVector* outputVector) 69 | { 70 | void *ptr = NULL; 71 | 72 | // let superclass allocate data 73 | this->vtkImageInPlaceFilter::RequestData(request, inputVector, outputVector); 74 | 75 | // get the data object 76 | vtkInformation *outInfo = outputVector->GetInformationObject(0); 77 | vtkImageData *output = 78 | vtkImageData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); 79 | 80 | switch (output->GetScalarType()) 81 | { 82 | vtkTemplateMacro( 83 | vtkImageInvertFilterExecute(this, output, static_cast(ptr))); 84 | default: 85 | vtkErrorMacro(<< "Execute: Unknown ScalarType"); 86 | return 1; 87 | } 88 | 89 | return 1; 90 | } 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /src/vtkImageInvertFilter.h: -------------------------------------------------------------------------------- 1 | #ifndef __vtkImageInvertFilter_h 2 | #define __vtkImageInvertFilter_h 3 | 4 | #include "vtkImageInPlaceFilter.h" 5 | #include "MicroViewConfigure.h" 6 | 7 | class VTK_MicroView_EXPORT vtkImageInvertFilter : public vtkImageInPlaceFilter 8 | { 9 | public: 10 | static vtkImageInvertFilter *New(); 11 | vtkTypeRevisionMacro(vtkImageInvertFilter,vtkImageInPlaceFilter); 12 | void PrintSelf(ostream& os, vtkIndent indent); 13 | 14 | protected: 15 | vtkImageInvertFilter(); 16 | ~vtkImageInvertFilter() {}; 17 | 18 | virtual int RequestData(vtkInformation *request, 19 | vtkInformationVector** inputVector, 20 | vtkInformationVector* outputVector); 21 | 22 | private: 23 | vtkImageInvertFilter(const vtkImageInvertFilter&); // Not implemented. 24 | void operator=(const vtkImageInvertFilter&); // Not implemented. 25 | }; 26 | 27 | 28 | 29 | #endif 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/vtkImageMagnitude2.cxx: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | 3 | Program: Visualization Toolkit 4 | Module: vtkImageMagnitude2.cxx 5 | 6 | Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 | All rights reserved. 8 | See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 | 10 | This software is distributed WITHOUT ANY WARRANTY; without even 11 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 | PURPOSE. See the above copyright notice for more information. 13 | 14 | =========================================================================*/ 15 | #include "vtkImageMagnitude2.h" 16 | 17 | #include "vtkDataArray.h" 18 | #include "vtkImageData.h" 19 | #include "vtkImageProgressIterator.h" 20 | #include "vtkInformation.h" 21 | #include "vtkInformationVector.h" 22 | #include "vtkObjectFactory.h" 23 | #include "vtkPointData.h" 24 | #include "vtkStreamingDemandDrivenPipeline.h" 25 | 26 | #include 27 | 28 | vtkStandardNewMacro(vtkImageMagnitude2); 29 | 30 | //---------------------------------------------------------------------------- 31 | vtkImageMagnitude2::vtkImageMagnitude2() 32 | { 33 | this->SetNumberOfInputPorts(1); 34 | this->SetNumberOfOutputPorts(1); 35 | } 36 | 37 | int vtkImageMagnitude2::RequestInformation ( 38 | vtkInformation * vtkNotUsed( request ), 39 | vtkInformationVector ** vtkNotUsed( inputVector ), 40 | vtkInformationVector * outputVector) 41 | { 42 | vtkDataObject::SetPointDataActiveScalarInfo( 43 | outputVector->GetInformationObject(0), -1, 1); 44 | return 1; 45 | } 46 | 47 | //---------------------------------------------------------------------------- 48 | // This execute method handles boundaries. 49 | // it handles boundaries. Pixels are just replicated to get values 50 | // out of extent. 51 | template 52 | void vtkImageMagnitude2Execute(vtkImageMagnitude2 *self, 53 | vtkImageData *inData, 54 | vtkImageData *outData, 55 | int outExt[6], int id, T *) 56 | { 57 | vtkImageIterator inIt(inData, outExt); 58 | vtkImageProgressIterator outIt(outData, outExt, self, id); 59 | float sum; 60 | 61 | // find the region to loop over 62 | int maxC = inData->GetNumberOfScalarComponents(); 63 | int idxC; 64 | 65 | // Loop through ouput pixels 66 | while (!outIt.IsAtEnd()) 67 | { 68 | T* inSI = inIt.BeginSpan(); 69 | T* outSI = outIt.BeginSpan(); 70 | T* outSIEnd = outIt.EndSpan(); 71 | while (outSI != outSIEnd) 72 | { 73 | // now process the components 74 | sum = 0.0; 75 | for (idxC = 0; idxC < maxC; idxC++) 76 | { 77 | sum += static_cast(*inSI); 78 | ++inSI; 79 | } 80 | *outSI = static_cast(sum / maxC); 81 | ++outSI; 82 | } 83 | inIt.NextSpan(); 84 | outIt.NextSpan(); 85 | } 86 | } 87 | 88 | 89 | //---------------------------------------------------------------------------- 90 | // This method contains a switch statement that calls the correct 91 | // templated function for the input data type. The output data 92 | // must match input type. This method does handle boundary conditions. 93 | void vtkImageMagnitude2::ThreadedExecute (vtkImageData *inData, 94 | vtkImageData *outData, 95 | int outExt[6], int id) 96 | { 97 | // This is really meta data and should be set in ExecuteInformation, 98 | // but there are some issues to solve first. 99 | if (id == 0 && outData->GetPointData()->GetScalars()) 100 | { 101 | outData->GetPointData()->GetScalars()->SetName("Magnitude"); 102 | } 103 | vtkDebugMacro(<< "Execute: inData = " << inData 104 | << ", outData = " << outData); 105 | 106 | // this filter expects that input is the same type as output. 107 | if (inData->GetScalarType() != outData->GetScalarType()) 108 | { 109 | vtkErrorMacro(<< "Execute: input ScalarType, " << inData->GetScalarType() 110 | << ", must match out ScalarType " << outData->GetScalarType()); 111 | return; 112 | } 113 | 114 | switch (inData->GetScalarType()) 115 | { 116 | vtkTemplateMacro( 117 | vtkImageMagnitude2Execute( this, inData, outData, 118 | outExt, id, static_cast(0))); 119 | default: 120 | vtkErrorMacro(<< "Execute: Unknown ScalarType"); 121 | return; 122 | } 123 | } 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /src/vtkImageMagnitude2.h: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | 3 | Program: Visualization Toolkit 4 | Module: vtkImageMagnitude2.h 5 | 6 | Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 | All rights reserved. 8 | See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 | 10 | This software is distributed WITHOUT ANY WARRANTY; without even 11 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 | PURPOSE. See the above copyright notice for more information. 13 | 14 | =========================================================================*/ 15 | // .NAME vtkImageMagnitude2 - Colapses components with magnitude function.. 16 | // .SECTION Description 17 | // vtkImageMagnitude2 takes the magnitude of the components. 18 | 19 | 20 | #ifndef __vtkImageMagnitude2_h 21 | #define __vtkImageMagnitude2_h 22 | 23 | 24 | #include "vtkThreadedImageAlgorithm.h" 25 | #include "MicroViewConfigure.h" 26 | 27 | class VTK_MicroView_EXPORT vtkImageMagnitude2 : public vtkThreadedImageAlgorithm 28 | { 29 | public: 30 | static vtkImageMagnitude2 *New(); 31 | vtkTypeMacro(vtkImageMagnitude2,vtkThreadedImageAlgorithm); 32 | 33 | protected: 34 | vtkImageMagnitude2(); 35 | ~vtkImageMagnitude2() {}; 36 | 37 | virtual int RequestInformation (vtkInformation *, vtkInformationVector**, 38 | vtkInformationVector *); 39 | 40 | void ThreadedExecute (vtkImageData *inData, vtkImageData *outData, 41 | int outExt[6], int id); 42 | 43 | private: 44 | vtkImageMagnitude2(const vtkImageMagnitude2&); // Not implemented. 45 | void operator=(const vtkImageMagnitude2&); // Not implemented. 46 | }; 47 | 48 | #endif 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/vtkImagePurify.h: -------------------------------------------------------------------------------- 1 | #ifndef __vtkImagePurify_h 2 | #define __vtkImagePurify_h 3 | 4 | #include "vtkSimpleImageToImageFilter.h" 5 | #include "MicroViewConfigure.h" 6 | 7 | class VTK_MicroView_EXPORT vtkImagePurify : public vtkSimpleImageToImageFilter 8 | { 9 | public: 10 | static vtkImagePurify *New(); 11 | vtkTypeRevisionMacro(vtkImagePurify,vtkSimpleImageToImageFilter); 12 | vtkSetMacro(Threshold, float); 13 | vtkGetMacro(Threshold, float); 14 | void PrintSelf(ostream& os, vtkIndent indent); 15 | vtkGetMacro(PurifyError, int); 16 | vtkSetMacro(PurifyError, int); 17 | 18 | protected: 19 | float Threshold; 20 | 21 | vtkImagePurify() {}; 22 | ~vtkImagePurify() {}; 23 | 24 | int PurifyError; 25 | 26 | virtual void SimpleExecute(vtkImageData* input, vtkImageData* output); 27 | private: 28 | vtkImagePurify(const vtkImagePurify&); // Not implemented. 29 | void operator=(const vtkImagePurify&); // Not implemented. 30 | }; 31 | 32 | #endif 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/vtkImageStatistics.h: -------------------------------------------------------------------------------- 1 | // .NAME vtkImageStatistics - Generalized histograms up to 4 dimensions. 2 | // .SECTION Description 3 | // vtkImageStatistics - This filter divides component space into 4 | // discrete bins. It then counts the number of pixels associated 5 | // with each bin. The output is this "scatter plot" (histogram values for 1D). 6 | // The dimensionality of the output depends on how many components the 7 | // input pixels have. Input pixels with one component generate a 1D histogram. 8 | // This filter can only handle images with 1 to 3 scalar components. 9 | // The input can be any type, but the output is always int. 10 | // Some statistics are computed on the pixel values at the same time. 11 | // The SetStencilFunction, SetClippingExtents and ReverseStencil 12 | // functions allow the statistics to be computed on an arbitrary 13 | // portion of the input data. 14 | // See the documentation for vtkImageStencil for more information. 15 | 16 | 17 | #ifndef __vtkImageStatistics_h 18 | #define __vtkImageStatistics_h 19 | 20 | 21 | #include "vtkImageAccumulate.h" 22 | #include "MicroViewConfigure.h" 23 | 24 | class vtkImageStencilData; 25 | 26 | class VTK_MicroView_EXPORT vtkImageStatistics : public vtkImageAccumulate 27 | { 28 | public: 29 | static vtkImageStatistics *New(); 30 | vtkTypeRevisionMacro(vtkImageStatistics,vtkImageAccumulate); 31 | void PrintSelf(ostream& os, vtkIndent indent); 32 | 33 | // Description: 34 | // Get the statistics information for the data. 35 | vtkGetVector3Macro(Total, double); 36 | vtkSetMacro(BVFThreshold, double); 37 | vtkGetMacro(BVFThreshold, double); 38 | vtkSetMacro(BoneValue, double); 39 | vtkGetMacro(BoneValue, double); 40 | vtkSetMacro(WaterValue, double); 41 | vtkGetMacro(WaterValue, double); 42 | vtkSetMacro(LowerExclusionValue, double); 43 | vtkGetMacro(LowerExclusionValue, double); 44 | vtkSetMacro(UpperExclusionValue, double); 45 | vtkGetMacro(UpperExclusionValue, double); 46 | vtkSetMacro(BoneMineralConst, double); 47 | vtkGetMacro(BoneMineralConst, double); 48 | 49 | vtkSetVector3Macro(MaxValuePosition, int); 50 | vtkGetVector3Macro(MaxValuePosition, int); 51 | 52 | long int BoneVoxelCount; 53 | long int GetBoneVoxelCount() { return BoneVoxelCount; } 54 | double BoneMineralMass; 55 | double ThresholdedBoneMineralMass; 56 | double GetBMD() { if (GetVolume() != 0.0) return BoneMineralMass / GetVolume(); else return 0.0;} 57 | double GetThresholdedBMD() { if (GetVolume() != 0.0) return ThresholdedBoneMineralMass / GetThresholdedVolume(); else return 0.0;} 58 | double GetBoneMass() { return BoneMineralMass; } 59 | double GetThresholdedBoneMass() { return ThresholdedBoneMineralMass; } 60 | double GetVolume(); 61 | double GetThresholdedVolume(); 62 | 63 | protected: 64 | vtkImageStatistics(); 65 | ~vtkImageStatistics(); 66 | 67 | int RequestData(vtkInformation* request, 68 | vtkInformationVector** inputVector, 69 | vtkInformationVector* outputVector); 70 | 71 | virtual int FillInputPortInformation(int, vtkInformation*); 72 | 73 | double Total[3]; 74 | int MaxValuePosition[3]; 75 | double BVFThreshold; 76 | double BoneValue; 77 | double WaterValue; 78 | double LowerExclusionValue; 79 | double UpperExclusionValue; 80 | double BoneMineralConst; 81 | 82 | private: 83 | vtkImageStatistics(const vtkImageStatistics&); // Not implemented. 84 | void operator=(const vtkImageStatistics&); // Not implemented. 85 | }; 86 | 87 | #endif 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /src/vtkImageStereology.h: -------------------------------------------------------------------------------- 1 | #ifndef __vtkImageStereology_h 2 | #define __vtkImageStereology_h 3 | 4 | #include 5 | #include "MicroViewConfigure.h" 6 | #include "vtkImageInPlaceFilter.h" 7 | #include "vtkImageData.h" 8 | 9 | class VTK_MicroView_EXPORT vtkImageStereology : public vtkImageInPlaceFilter 10 | { 11 | public: 12 | static vtkImageStereology *New(); 13 | vtkTypeMacro(vtkImageStereology,vtkImageInPlaceFilter); 14 | void PrintSelf(ostream& os, vtkIndent indent); 15 | 16 | // Get/Set macros 17 | vtkSetMacro(Threshold, double); 18 | vtkGetMacro(Threshold, double); 19 | vtkSetMacro(Euler3D, double); 20 | vtkGetMacro(Euler3D, double); 21 | vtkSetMacro(Pp, double); 22 | vtkGetMacro(Pp, double); 23 | vtkSetMacro(Pl, double); 24 | vtkGetMacro(Pl, double); 25 | 26 | vtkSetMacro(IntX, long); 27 | vtkGetMacro(IntX, long); 28 | vtkSetMacro(IntY, long); 29 | vtkGetMacro(IntY, long); 30 | vtkSetMacro(IntZ, long); 31 | vtkGetMacro(IntZ, long); 32 | 33 | vtkSetMacro(IntXO, long); 34 | vtkGetMacro(IntXO, long); 35 | vtkSetMacro(IntYO, long); 36 | vtkGetMacro(IntYO, long); 37 | vtkSetMacro(IntZO, long); 38 | vtkGetMacro(IntZO, long); 39 | 40 | 41 | vtkSetMacro(PlX, double); 42 | vtkGetMacro(PlX, double); 43 | vtkSetMacro(PlY, double); 44 | vtkGetMacro(PlY, double); 45 | vtkSetMacro(PlZ, double); 46 | vtkGetMacro(PlZ, double); 47 | 48 | vtkSetMacro(numVoxels, long); 49 | vtkGetMacro(numVoxels, long); 50 | 51 | double GetBVTV() { return Pp; } 52 | 53 | double GetxTbN() { return PlX; } 54 | double GetyTbN() { return PlY; } 55 | double GetzTbN() { return PlZ; } 56 | double GetTbN() { return Pl; } 57 | 58 | double GetxTbTh() { return Pp/PlX; } 59 | double GetyTbTh() { return Pp/PlY; } 60 | double GetzTbTh() { return Pp/PlZ; } 61 | double GetTbTh() { return Pp/Pl; } 62 | 63 | double GetxTbSp() { return (1.0 - Pp) / PlX; } 64 | double GetyTbSp() { return (1.0 - Pp) / PlY; } 65 | double GetzTbSp() { return (1.0 - Pp) / PlZ; } 66 | double GetTbSp() { return (1.0 - Pp) / Pl; } 67 | 68 | double GetxBSBV() { return 2.0 * (PlX / Pp); } 69 | double GetyBSBV() { return 2.0 * (PlY / Pp); } 70 | double GetzBSBV() { return 2.0 * (PlZ / Pp); } 71 | double GetBSBV() { return 2.0 * (Pl / Pp); } 72 | 73 | void SetImageMask(vtkImageData *mask) { this->mask = mask; } 74 | vtkImageData *GetImageMask() { return this->mask; } 75 | 76 | protected: 77 | double Threshold; 78 | double Pp; 79 | double Pl; 80 | double PlX; 81 | double PlY; 82 | double PlZ; 83 | double Euler3D; 84 | long IntX; 85 | long IntY; 86 | long IntZ; 87 | long IntXO; 88 | long IntYO; 89 | long IntZO; 90 | long numVoxels; 91 | vtkImageData *mask; 92 | 93 | vtkImageStereology(); 94 | ~vtkImageStereology(); 95 | vtkImageStereology(const vtkImageStereology&) {}; 96 | void operator=(const vtkImageStereology&) {}; 97 | 98 | void ExecuteData (vtkDataObject *); 99 | }; 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /src/vtkImageTextExport.h: -------------------------------------------------------------------------------- 1 | // 2 | // A class to dump a stenciled image to a text file 3 | // 4 | 5 | #ifndef __vtkImageTextExport_h 6 | #define __vtkImageTextExport_h 7 | 8 | 9 | #include "vtkImageToImageFilter.h" 10 | #include "MicroViewConfigure.h" 11 | 12 | class vtkImageStencilData; 13 | 14 | class VTK_MicroView_EXPORT vtkImageTextExport : public vtkImageToImageFilter 15 | { 16 | public: 17 | static vtkImageTextExport *New(); 18 | vtkTypeRevisionMacro(vtkImageTextExport,vtkImageToImageFilter); 19 | void PrintSelf(ostream& os, vtkIndent indent); 20 | 21 | // Description: 22 | // Use a stencil to specify which voxels to accumulate. 23 | void SetStencil(vtkImageStencilData *stencil); 24 | vtkImageStencilData *GetStencil(); 25 | 26 | // Rewrite this filter as an image output class at some point... 27 | vtkSetStringMacro(FileName); 28 | vtkGetStringMacro(FileName); 29 | 30 | protected: 31 | vtkImageTextExport(); 32 | ~vtkImageTextExport(); 33 | char *FileName; 34 | 35 | void ExecuteInformation(vtkImageData *input, vtkImageData *output); 36 | void ComputeInputUpdateExtent(int inExt[6], int outExt[6]); 37 | void ExecuteInformation(){this->vtkImageToImageFilter::ExecuteInformation();}; 38 | void ExecuteData(vtkDataObject *out); 39 | 40 | private: 41 | vtkImageTextExport(const vtkImageTextExport&); // Not implemented. 42 | void operator=(const vtkImageTextExport&); // Not implemented. 43 | }; 44 | 45 | #endif 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/vtkInPlaceImageStencil.cxx: -------------------------------------------------------------------------------- 1 | #include "vtkInPlaceImageStencil.h" 2 | 3 | #include "vtkImageData.h" 4 | #include "vtkInformation.h" 5 | #include "vtkInformationVector.h" 6 | #include "vtkObjectFactory.h" 7 | #include "vtkImageStencilData.h" 8 | #include "vtkPointData.h" 9 | #include "vtkStreamingDemandDrivenPipeline.h" 10 | 11 | vtkStandardNewMacro(vtkInPlaceImageStencil); 12 | 13 | //---------------------------------------------------------------------------- 14 | void vtkInPlaceImageStencil::PrintSelf(ostream& os, vtkIndent indent) 15 | { 16 | this->Superclass::PrintSelf(os,indent); 17 | } 18 | 19 | //---------------------------------------------------------------------------- 20 | vtkInPlaceImageStencil::vtkInPlaceImageStencil() 21 | { 22 | this->ReverseStencil = 0; 23 | this->MaskValue = 0.0; 24 | this->Stencil = NULL; 25 | this->SetNumberOfInputPorts(1); 26 | } 27 | 28 | 29 | 30 | template 31 | void vtkInPlaceImageStencilExecute(vtkInPlaceImageStencil *self, 32 | vtkImageData *outData, T *ptr) 33 | { 34 | int min0, max0, min1, max1, min2, max2; 35 | int pmin0, pmax0; 36 | int x, y, z, iter, numC, idxC; 37 | vtkIdType inInc0, inInc1, inInc2; 38 | T *tempPtr; 39 | double outVal; 40 | 41 | vtkImageStencilData *stencil = self->GetStencil(); 42 | 43 | outData->GetExtent(min0, max0, min1, max1, min2, max2); 44 | 45 | outData->GetIncrements(inInc0, inInc1, inInc2); 46 | numC = outData->GetNumberOfScalarComponents(); 47 | outVal = self->GetMaskValue(); 48 | 49 | self->UpdateProgress(0.0); 50 | 51 | for (z = min2; z <= max2; z++) 52 | { 53 | /* update progress */ 54 | if (min2 != max2) 55 | self->UpdateProgress((z-min2) / (float)(max2-min2)); 56 | for (y = min1; y <= max1; y++) 57 | { 58 | 59 | // loop over stencil sub-extents 60 | iter = 0; 61 | if (self->GetReverseStencil()) 62 | { // flag that we want the complementary extents 63 | iter = -1; 64 | } 65 | pmin0 = min0; 66 | pmax0 = max0; 67 | 68 | ptr = static_cast(outData->GetScalarPointer(min0, y, z)); 69 | 70 | while ((stencil != 0 && 71 | stencil->GetNextExtent(pmin0,pmax0,min0,max0,y,z,iter)) || 72 | (stencil == 0 && iter++ == 0)) 73 | { 74 | tempPtr = ptr + (numC*(pmin0 - min0)); 75 | for (x = pmin0; x <= pmax0; x++) 76 | for (idxC = 0; idxC < numC; ++idxC) 77 | *tempPtr++ = static_cast(outVal); 78 | } 79 | // ugly hack -- remove this once Hua has his class completed 80 | if (self->GetReverseStencil() && (stencil != 0)) { 81 | pmin0 = min0; 82 | pmax0 = max0; 83 | iter = -1; 84 | if (!stencil->GetNextExtent(pmin0,pmax0,min0,max0,y,z,iter)) 85 | { 86 | pmin0 = min0; 87 | pmax0 = max0; 88 | // set up pointer for sub extent 89 | tempPtr = ptr + (inInc2*(z - min2) + 90 | inInc1*(y - min1) + 91 | numC*(pmin0 - min0)); 92 | for (x = pmin0; x <= pmax0; x++) 93 | for (idxC = 0; idxC < numC; ++idxC) 94 | *tempPtr++ = static_cast(outVal); 95 | } 96 | } 97 | // end of ugly hack 98 | } 99 | } 100 | self->UpdateProgress(1.0); 101 | } 102 | 103 | //---------------------------------------------------------------------------- 104 | // Split up into finished and border datas. Fill the border datas. 105 | int vtkInPlaceImageStencil::RequestData( 106 | vtkInformation* request, 107 | vtkInformationVector** inputVector, 108 | vtkInformationVector* outputVector) 109 | { 110 | void *ptr = NULL; 111 | 112 | // get the data object 113 | vtkInformation *outInfo = outputVector->GetInformationObject(0); 114 | vtkImageData *output = 115 | vtkImageData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); 116 | int *outExt = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT()); 117 | 118 | vtkInformation *inInfo = inputVector[0]->GetInformationObject(0); 119 | vtkImageData *input = 120 | vtkImageData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); 121 | 122 | 123 | // always pass input straight through to output 124 | output->GetPointData()->PassData(input->GetPointData()); 125 | output->SetExtent(outExt); 126 | 127 | switch (output->GetScalarType()) 128 | { 129 | vtkTemplateMacro( 130 | vtkInPlaceImageStencilExecute(this, output, static_cast(ptr))); 131 | default: 132 | vtkErrorMacro(<< "Execute: Unknown ScalarType"); 133 | return 1; 134 | } 135 | 136 | return 1; 137 | } 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /src/vtkInPlaceImageStencil.h: -------------------------------------------------------------------------------- 1 | #ifndef __vtkInPlaceImageStencil_h 2 | #define __vtkInPlaceImageStencil_h 3 | 4 | #include "vtkImageInPlaceFilter.h" 5 | #include "MicroViewConfigure.h" 6 | 7 | class vtkImageStencilData; 8 | 9 | class VTK_MicroView_EXPORT vtkInPlaceImageStencil : public vtkImageInPlaceFilter 10 | { 11 | public: 12 | static vtkInPlaceImageStencil *New(); 13 | vtkTypeMacro(vtkInPlaceImageStencil,vtkImageInPlaceFilter); 14 | void PrintSelf(ostream& os, vtkIndent indent); 15 | 16 | 17 | // Description: 18 | void SetStencil(vtkImageStencilData *stencil) { this->Stencil = stencil; }; 19 | vtkImageStencilData *GetStencil() { return this->Stencil; }; 20 | vtkSetMacro(ReverseStencil, int); 21 | vtkBooleanMacro(ReverseStencil, int); 22 | vtkGetMacro(ReverseStencil, int); 23 | vtkSetMacro(MaskValue, double); 24 | vtkGetMacro(MaskValue, double); 25 | 26 | 27 | protected: 28 | 29 | int ReverseStencil; 30 | double MaskValue; 31 | vtkImageStencilData *Stencil; 32 | 33 | vtkInPlaceImageStencil(); 34 | ~vtkInPlaceImageStencil() {}; 35 | 36 | virtual int RequestData(vtkInformation *request, 37 | vtkInformationVector** inputVector, 38 | vtkInformationVector* outputVector); 39 | 40 | private: 41 | vtkInPlaceImageStencil(const vtkInPlaceImageStencil&); // Not implemented. 42 | void operator=(const vtkInPlaceImageStencil&); // Not implemented. 43 | }; 44 | 45 | 46 | 47 | #endif 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/vtkStderrOutputWindow.cxx: -------------------------------------------------------------------------------- 1 | #include "vtkStderrOutputWindow.h" 2 | #include "vtkObjectFactory.h" 3 | 4 | #include 5 | 6 | vtkCxxRevisionMacro(vtkStderrOutputWindow, "$Revision: 1.3 $"); 7 | vtkStandardNewMacro(vtkStderrOutputWindow); 8 | 9 | void vtkStderrOutputWindow::Initialize() 10 | { 11 | } 12 | 13 | 14 | void vtkStderrOutputWindow::DisplayText(const char* text) 15 | { 16 | std::cerr << "Text: " << text << "\n"; 17 | } 18 | 19 | void vtkStderrOutputWindow::DisplayErrorText(const char* text) 20 | { 21 | std::cerr << "Error: " << text << "\n"; 22 | } 23 | 24 | void vtkStderrOutputWindow::DisplayWarningText(const char* text) 25 | { 26 | std::cerr << "Warning: " << text << "\n"; 27 | } 28 | 29 | void vtkStderrOutputWindow::DisplayGenericWarningText(const char* text) 30 | { 31 | std::cerr << "GenericWarning: " << text << "\n"; 32 | } 33 | 34 | void vtkStderrOutputWindow::DisplayDebugText(const char* text) 35 | { 36 | std::cerr << "Debug: " << text << "\n"; 37 | } 38 | -------------------------------------------------------------------------------- /src/vtkStderrOutputWindow.h: -------------------------------------------------------------------------------- 1 | /*========================================================================= 2 | 3 | Program: Visualization Toolkit 4 | Module: $RCSfile: vtkStderrOutputWindow.h,v $ 5 | 6 | Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 7 | All rights reserved. 8 | See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 9 | 10 | This software is distributed WITHOUT ANY WARRANTY; without even 11 | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 12 | PURPOSE. See the above copyright notice for more information. 13 | 14 | =========================================================================*/ 15 | // .NAME vtkStderrOutputWindow - pipe warnings to stderr 16 | // .SECTION Description 17 | // Writes debug/warning/error output to stderr. 18 | // 19 | 20 | #ifndef __vtkStderrOutputWindow_h 21 | #define __vtkStderrOutputWindow_h 22 | 23 | #include "vtkFileOutputWindow.h" 24 | 25 | 26 | class VTK_EXPORT vtkStderrOutputWindow : public vtkFileOutputWindow 27 | { 28 | public: 29 | vtkTypeRevisionMacro(vtkStderrOutputWindow, vtkFileOutputWindow); 30 | 31 | static vtkStderrOutputWindow* New(); 32 | 33 | virtual void DisplayText(const char*); 34 | virtual void DisplayErrorText(const char*); 35 | virtual void DisplayWarningText(const char*); 36 | virtual void DisplayGenericWarningText(const char*); 37 | virtual void DisplayDebugText(const char*); 38 | 39 | protected: 40 | vtkStderrOutputWindow() {}; 41 | virtual ~vtkStderrOutputWindow() {}; 42 | 43 | void Initialize(); 44 | private: 45 | vtkStderrOutputWindow(const vtkStderrOutputWindow&); // Not implemented. 46 | void operator=(const vtkStderrOutputWindow&); // Not implemented. 47 | }; 48 | 49 | 50 | 51 | #endif 52 | --------------------------------------------------------------------------------