# Add a SUBDIRS command for each of your libraries
SUBDIRS(maracasVisuLib)
-SUBDIRS(doxygen)
+#SUBDIRS(doxygen)
#----------------------------------------------------------------------------
# SET THE NAME OF YOUR LIBRARY
+
+
SET ( LIBRARY_NAME creaMaracasVisu )
#----------------------------------------------------------------------------
# EITHER LIST ALL .h IN CURRENT DIR USING NEXT LINE:
#FILE(GLOB ${LIBRARY_NAME}_HEADERS "*.h")
# OR MANUALLY LIST YOUR HEADERS WITH NEXT COMMAND
+
+ FILE(GLOB ${LIBRARY_NAME}_HEADERS_WXWIN "src/interface/wxWindows/*.h")
+ FILE(GLOB ${LIBRARY_NAME}_SOURCES_WXWIN src/interface/wxWindows/*.cxx src/interface/wxWindows/*.cpp src/interface/wxWindows/*.cc)
+
+ FILE(GLOB ${LIBRARY_NAME}_HEADERS_CONTOUR "src/interface/wxWindows/Contour/*.h")
+ FILE(GLOB ${LIBRARY_NAME}_SOURCES_CONTOUR src/interface/wxWindows/Contour/*.cxx src/interface/wxWindows/Contour/*.cpp src/interface/wxWindows/Contour/*.cc)
+
+ FILE(GLOB ${LIBRARY_NAME}_HEADERS_WIDGETS "src/interface/wxWindows/widgets/*.h")
+ FILE(GLOB ${LIBRARY_NAME}_SOURCES_WIDGETS src/interface/wxWindows/widgets/*.cxx src/interface/wxWindows/widgets/*.cpp src/interface/wxWindows/widgets/*.cc)
+
+ FILE(GLOB ${LIBRARY_NAME}_HEADERS_PPLOTTER "src/interface/wxWindows/widgets/pPlotter/*.h")
+ FILE(GLOB ${LIBRARY_NAME}_SOURCES_PPLOTTER src/interface/wxWindows/widgets/pPlotter/*.cxx src/interface/wxWindows/widgets/pPlotter/*.cpp src/interface/wxWindows/widgets/pPlotter/*.cc)
+
+ FILE(GLOB ${LIBRARY_NAME}_HEADERS_KERNEL "src/kernel/*.h")
+ FILE(GLOB ${LIBRARY_NAME}_SOURCES_KERNEL src/kernel/*.cxx src/kernel/*.cpp src/kernel/*.cc)
+
+
SET ( ${LIBRARY_NAME}_HEADERS
- src/interface/wxWindows/manualContour.h
- src/interface/wxWindows/Contour/ContourCrownWidget.h
- src/interface/wxWindows/Contour/ContourExtractData.h
- src/interface/wxWindows/Contour/ContourVOIWidget.h
- src/interface/wxWindows/Contour/Propagation.h
- src/interface/wxWindows/Contour/ExtractControlPoints2D.h
- src/interface/wxWindows/Contour/AutoControlPoints.h
- src/interface/wxWindows/Contour/ContourPropagation.h
- src/interface/wxWindows/Contour/contoursIntersection.h
- src/interface/wxWindows/Contour/vectorFunctions.h
+ #src/interface/wxWindows/manualContour.h
+ #src/interface/wxWindows/wxMaracasMPR.h
+ #src/interface/wxWindows/wxMaracas_ManualTree_MPR.h
+ ${${LIBRARY_NAME}_HEADERS_WXWIN}
+ #src/interface/wxWindows/Contour/AutoControlPoints.h
+ #src/interface/wxWindows/Contour/ContourCrownWidget.h
+ #src/interface/wxWindows/Contour/ContourExtractData.h
+ #src/interface/wxWindows/Contour/ContourPropagation.h
+ #src/interface/wxWindows/Contour/contoursIntersection.h
+ #src/interface/wxWindows/Contour/ContourVOIWidget.h
+ #src/interface/wxWindows/Contour/ExtractControlPoints2D.h
+ #src/interface/wxWindows/Contour/Propagation.h
+ #src/interface/wxWindows/Contour/vectorFunctions.h
+ ${${LIBRARY_NAME}_HEADERS_CONTOUR}
## src/interface/wxWindows/wxMaracasImageBrowser02.h
## src/interface/wxWindows/widgets/wxReadingPriorityPanel.h
- src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h
- src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.h
- src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.h
- src/interface/wxWindows/widgets/vtkClosePolyData.h
- src/interface/wxWindows/wxMaracasMPR.h
- src/interface/wxWindows/widgets/wxMPRWidget.h
- src/interface/wxWindows/widgets/wxMPRBaseData.h
- src/interface/wxWindows/widgets/wxVtkBaseView.h
- src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h
- src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h
-
- src/interface/wxWindows/widgets/wxMaracasIRMView.h
- src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
-
- src/interface/wxWindows/wxMaracas_ManualTree_MPR.h
- src/interface/wxWindows/widgets/wxManualTree_MPRWidget.h
- src/interface/wxWindows/widgets/ContourView.h
- src/interface/wxWindows/widgets/PointView.h
- src/interface/wxWindows/widgets/LineView.h
- src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.h
- src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h
- src/interface/wxWindows/widgets/pPlotter/HistogramWidget.h
- src/interface/wxWindows/widgets/pPlotter/pHistogram.h
- src/interface/wxWindows/widgets/pPlotter/mBarRange.h
- src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.h
- src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.h
- src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.h
- src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.h
- src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h
- src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.h
- src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.h
- src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.h
- src/interface/wxWindows/widgets/pPlotter/pColorBar.h
- src/interface/wxWindows/widgets/pPlotter/pFigure.h
- src/interface/wxWindows/widgets/pPlotter/pColorPoint.h
- src/interface/wxWindows/widgets/pPlotter/pPlotter.h
- src/interface/wxWindows/widgets/pPlotter/mathplot.h
- src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.h
- src/interface/wxWindows/widgets/pPlotter/Histogram.h
- src/interface/wxWindows/widgets/wxSTLWidget_03.h
+ #src/interface/wxWindows/widgets/ContourView.h
+ #src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.h
+ #src/interface/wxWindows/widgets/LineView.h
+ #src/interface/wxWindows/widgets/PointView.h
+ #src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.h
+ #src/interface/wxWindows/widgets/vtkClosePolyData.h
+ #src/interface/wxWindows/widgets/wxMaracasIRMView.h
+ #src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
+ #src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h
+ #src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h
+ #src/interface/wxWindows/widgets/wxManualTree_MPRWidget.h
+ #src/interface/wxWindows/widgets/wxMPRBaseData.h
+ #src/interface/wxWindows/widgets/wxMPRWidget.h
+ #src/interface/wxWindows/widgets/wxSTLWidget_03.h
+ #src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h
+ #src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.h
+ #src/interface/wxWindows/widgets/wxVtkBaseView.h
+ ${${LIBRARY_NAME}_HEADERS_WIDGETS}
+ #src/interface/wxWindows/widgets/pPlotter/Histogram.h
+ #src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h
+ #src/interface/wxWindows/widgets/pPlotter/HistogramWidget.h
+ #src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.h
+ #src/interface/wxWindows/widgets/pPlotter/mBarRange.h
+ #src/interface/wxWindows/widgets/pPlotter/mathplot.h
+ #src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.h
+ #src/interface/wxWindows/widgets/pPlotter/pColorBar.h
+ #src/interface/wxWindows/widgets/pPlotter/pColorPoint.h
+ #src/interface/wxWindows/widgets/pPlotter/pFigure.h
+ #src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.h
+ #src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.h
+ #src/interface/wxWindows/widgets/pPlotter/pHistogram.h
+ #src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.h
+ #src/interface/wxWindows/widgets/pPlotter/pPlotter.h
+ #src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.h
+ #src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.h
+ #src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.h
+ #src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h
+ ${${LIBRARY_NAME}_HEADERS_PPLOTTER}
+
include/matrix.h
- src/kernel/marImageData.h
- src/kernel/marDicomBase.h
- # src/kernel/marGdcmDicom.h
- src/kernel/marObject.h
- src/kernel/volume.hxx
- src/kernel/marTypes.h
- src/kernel/marParameters.h
- src/kernel/marDynData.h
- src/kernel/creaMaracasVisu_EXPORT.h
- src/kernel/vtkSTLExtractor.h
+
+ #src/kernel/marImageData.h
+ #src/kernel/marDicomBase.h
+ #src/kernel/marObject.h
+ #src/kernel/volume.hxx
+ #src/kernel/marTypes.h
+ #src/kernel/marParameters.h
+ #src/kernel/marDynData.h
+ #src/kernel/creaMaracasVisu_EXPORT.h
+ #src/kernel/vtkSTLExtractor.h
+ ${${LIBRARY_NAME}_HEADERS_KERNEL}
)
#----------------------------------------------------------------------------
# EITHER LIST ALL .cxx, *.cpp, *.cc IN CURRENT DIR USING NEXT LINE:
#FILE(GLOB ${LIBRARY_NAME}_SOURCES *.cxx *.cpp *.cc)
# OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION)
+
SET ( ${LIBRARY_NAME}_SOURCES
- src/interface/wxWindows/manualContour.cpp
- src/interface/wxWindows/Contour/ContourCrownWidget.cxx
- src/interface/wxWindows/Contour/ContourExtractData.cxx
- src/interface/wxWindows/Contour/ContourVOIWidget.cxx
- src/interface/wxWindows/Contour/Propagation.cxx
- src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx
- src/interface/wxWindows/Contour/AutoControlPoints.cxx
- src/interface/wxWindows/Contour/ContourPropagation.cxx
- src/interface/wxWindows/Contour/contoursIntersection.cxx
- src/interface/wxWindows/Contour/vectorFunctions.cxx
+ #src/interface/wxWindows/manualContour.cpp
+ #src/interface/wxWindows/wxMaracasMPR.cxx
+ #src/interface/wxWindows/wxMaracas_ManualTree_MPR.cxx
+ ${${LIBRARY_NAME}_SOURCES_WXWIN}
+ #src/interface/wxWindows/Contour/AutoControlPoints.cxx
+ #src/interface/wxWindows/Contour/ContourCrownWidget.cxx
+ #src/interface/wxWindows/Contour/ContourExtractData.cxx
+ #src/interface/wxWindows/Contour/ContourPropagation.cxx
+ #src/interface/wxWindows/Contour/contoursIntersection.cxx
+ #src/interface/wxWindows/Contour/ContourVOIWidget.cxx
+ #src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx
+ #src/interface/wxWindows/Contour/Propagation.cxx
+ #src/interface/wxWindows/Contour/vectorFunctions.cxx
+ ${${LIBRARY_NAME}_SOURCES_CONTOUR}
# src/interface/wxWindows/wxMaracasImageBrowser02.cxx
# src/interface/wxWindows/widgets/wxReadingPriorityPanel.cpp
+ #src/interface/wxWindows/widgets/ContourView.cxx
+ #src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.cxx
+ #src/interface/wxWindows/widgets/LineView.cxx
+ #src/interface/wxWindows/widgets/PointView.cxx
+ #src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.cxx
+ #src/interface/wxWindows/widgets/vtkClosePolyData.cxx
+ #src/interface/wxWindows/widgets/wxManualTree_MPRWidget.cxx
+ #src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
+ #src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
+ #src/interface/wxWindows/widgets/wxMaracasIRMView.cxx
+ #src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx
+ #src/interface/wxWindows/widgets/wxMPRWidget.cxx
+ #src/interface/wxWindows/widgets/wxMPRBaseData.cxx
+ #src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
+ #src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx
+ #src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.cxx
+ #src/interface/wxWindows/widgets/wxVtkBaseView.cxx
+ ${${LIBRARY_NAME}_SOURCES_WIDGETS}
+ #src/interface/wxWindows/widgets/pPlotter/Histogram.cxx
+ #src/interface/wxWindows/widgets/pPlotter/HistogramDialog.cxx
+ #src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
+ #src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.cxx
+ #src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx
+ #src/interface/wxWindows/widgets/pPlotter/mathplot.cxx
+ #src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pColorBar.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pColorPoint.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pFigure.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.cxx
+ #src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx
+ ${${LIBRARY_NAME}_SOURCES_PPLOTTER}
- src/interface/wxWindows/widgets/wxMaracasIRMView.cxx
- src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx
-
- src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx
- src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.cxx
- src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.cxx
- src/interface/wxWindows/widgets/vtkClosePolyData.cxx
- src/interface/wxWindows/wxMaracasMPR.cxx
- src/interface/wxWindows/widgets/wxMPRWidget.cxx
- src/interface/wxWindows/widgets/wxMPRBaseData.cxx
- src/interface/wxWindows/widgets/wxVtkBaseView.cxx
- src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
- src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
- src/interface/wxWindows/wxMaracas_ManualTree_MPR.cxx
- src/interface/wxWindows/widgets/wxManualTree_MPRWidget.cxx
- src/interface/wxWindows/res/wxInterface.rc
- src/interface/wxWindows/widgets/ContourView.cxx
- src/interface/wxWindows/widgets/PointView.cxx
- src/interface/wxWindows/widgets/LineView.cxx
- src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.cxx
-#####pPlotter classes
- src/interface/wxWindows/widgets/pPlotter/HistogramDialog.cxx
- src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
- src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx
- src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx
- src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx
- src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.cxx
- src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx
- src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.cxx
- src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx
- src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.cxx
- src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.cxx
- src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.cxx
- src/interface/wxWindows/widgets/pPlotter/pColorBar.cxx
- src/interface/wxWindows/widgets/pPlotter/pFigure.cxx
- src/interface/wxWindows/widgets/pPlotter/pColorPoint.cxx
- src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx
- src/interface/wxWindows/widgets/pPlotter/mathplot.cxx
- src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.cxx
- src/interface/wxWindows/widgets/pPlotter/Histogram.cxx
- src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
###
- src/kernel/marImageData.cpp
- src/kernel/marDicomBase.cpp
+ #src/kernel/marImageData.cpp
+ #src/kernel/marDicomBase.cpp
# src/kernel/marGdcmDicom.cpp
- src/kernel/marObject.cpp
- src/kernel/volume.cxx
- src/kernel/marParameters.cpp
- src/kernel/marDynData.cpp
- src/kernel/vtkSTLExtractor.cpp
+ #src/kernel/marObject.cpp
+ #src/kernel/volume.cxx
+ #src/kernel/marParameters.cpp
+ #src/kernel/marDynData.cpp
+ #src/kernel/vtkSTLExtractor.cpp
+ ${${LIBRARY_NAME}_SOURCES_KERNEL}
)
#----------------------------------------------------------------------------
#jhcl-Start===========================================================================
- # CREATE THE TARGET
- ADD_LIBRARY(${LIBRARY_NAME} ${${LIBRARY_NAME}_SHARED} ${${LIBRARY_NAME}_SOURCES} ${${LIBRARY_NAME}_HEADERS})
+ # CREATE THE TARGET
+ ADD_LIBRARY (${LIBRARY_NAME} ${${LIBRARY_NAME}_SHARED} ${${LIBRARY_NAME}_SOURCES} ${${LIBRARY_NAME}_HEADERS})
# LINK
TARGET_LINK_LIBRARIES(${LIBRARY_NAME} ${${LIBRARY_NAME}_LINK_LIBRARIES})
--- /dev/null
+SUBDIRS(wxWindows)
Program: wxMaracas
Module: $RCSfile: manualContourContainer.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: manualContourContainer.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas3DBrowser.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas3DBrowser.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasApp.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasApp.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasApp02.cxx,v $
Language: C++
- Date: $Date: 2008/11/21 17:24:42 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/05/14 13:54:54 $
+ Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: wxMaracasApp02.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasEmptyPanel.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasEmptyPanel.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasEmptyPanel_2.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasEmptyPanel_2.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:09 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasFrame.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasFrame.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasHelpDialog.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasHelpDialog.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasImageBrowser.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasImageBrowser.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasImageBrowser02.cxx,v $
Language: C++
- Date: $Date: 2008/11/21 14:15:17 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/05/14 13:54:54 $
+ Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: wxMaracasImageBrowser02.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasParametersDialog.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasParametersDialog.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasPathology_01.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasPathology_01.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:10 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasProcessingCT.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasProcessingCT.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasQuantification.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasQuantification.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasQuantificationCT.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracasQuantificationCT.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas_ManualContour_Panel.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas_ManualContour_Panel.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas_ManualSegmentation_MPR.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas_ManualSegmentation_MPR.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas_ManualTree_MPRDlg.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas_ManualTree_MPRDlg.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas_SegmentationFM3D.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxMaracas_SegmentationFM3D.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
+ Date: $Date: 2009/05/14 13:54:54 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
#include "wxVTKRenderWindowInteractor.h"
-
+#include "InteractorStyleMaracas.h"
//--
#include <vector>
--- /dev/null
+
+#include "InteractorStyleMaracas.h"
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+
+InteractorStyleMaracas::InteractorStyleMaracas()
+{
+ _active = true;
+ _vtkInteractorStyleBaseView = NULL;
+}
+//---------------------------------------------------------------------------
+InteractorStyleMaracas::~InteractorStyleMaracas()
+{
+}
+
+// ----------------------------------------------------------------------------
+InteractorStyleMaracas * InteractorStyleMaracas :: Clone() // virtual
+{
+ InteractorStyleMaracas * clone = new InteractorStyleMaracas();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void InteractorStyleMaracas::CopyAttributesTo( InteractorStyleMaracas * cloneObject)
+{
+ // Fathers object
+ //<FATHERCLASS>::CopyAttributesTo(cloneObject);
+
+ cloneObject->SetActive( this->GetActive() );
+}
+
+
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnChar()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnMouseMove()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnLeftButtonDown()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnLeftButtonUp()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnLeftDClick()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnMiddleButtonDown()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnMiddleButtonUp()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnMiddleDClick()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnRightButtonDown()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnRightButtonUp()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnRightDClick()
+{
+ return true;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::OnMouseWheel()
+{
+ return true;
+}
+
+//---------------------------------------------------------------------------
+
+ void InteractorStyleMaracas::SetVtkInteractorStyleBaseView(vtkInteractorStyleBaseView* vtkInteractorStyleBaseView)
+{
+ _vtkInteractorStyleBaseView = vtkInteractorStyleBaseView;
+}
+
+
+//---------------------------------------------------------------------------
+void InteractorStyleMaracas::RemoveVtkInteractorStyleBaseView()
+{
+ _vtkInteractorStyleBaseView = NULL;
+}
+//---------------------------------------------------------------------------
+void InteractorStyleMaracas::SetActive(bool active)
+{
+ _active = active;
+}
+//---------------------------------------------------------------------------
+bool InteractorStyleMaracas::GetActive()
+{
+ return _active;
+}
+
+
--- /dev/null
+#ifndef INTERACTORSTYLEMARACAS_H_
+#define INTERACTORSTYLEMARACAS_H_
+
+
+#include "marTypes.h"
+//------------------------------------------------------------------
+
+#include "vtkInteractorStyleBaseView.h"
+
+//class vtkInteractorStyleBaseView;
+
+
+class creaMaracasVisu_EXPORT InteractorStyleMaracas
+{
+public:
+ InteractorStyleMaracas();
+ virtual ~InteractorStyleMaracas();
+
+ virtual InteractorStyleMaracas * Clone();
+ void CopyAttributesTo( InteractorStyleMaracas *cloneObject );
+
+
+ virtual bool OnChar();
+ virtual bool OnMouseMove();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnLeftButtonUp();
+ virtual bool OnMiddleButtonDown();
+ virtual bool OnMiddleButtonUp();
+ virtual bool OnRightButtonDown();
+ virtual bool OnRightButtonUp();
+
+ virtual bool OnLeftDClick();
+ virtual bool OnRightDClick();
+ virtual bool OnMiddleDClick();
+ virtual bool OnMouseWheel();
+
+ void SetVtkInteractorStyleBaseView(vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView);
+ void RemoveVtkInteractorStyleBaseView();
+
+ void SetActive(bool active);
+ bool GetActive();
+
+protected:
+
+ vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView;
+ //vtkInteractorStyleImage* _vtkInteractorStyleBaseView;
+
+private:
+ bool _active;
+};
+
+#endif /*INTERACTORSTYLEMARACAS_H_*/
Program: wxMaracas
Module: $RCSfile: InterfaceVtkPanelWidgets.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:40 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:34 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: InterfaceVtkPanelWidgets.h,v $
Language: C++
- Date: $Date: 2008/11/14 15:57:07 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/05/14 13:54:34 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: UtilVtk3DGeometriSelection.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:34 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: UtilVtk3DGeometriSelection.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:34 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
--- /dev/null
+
+#include "boxSurfaceObserver.h"
+#include "vtkBoxWidget.h"
+
+void boxSurfaceObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual
+ vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
+ boxwidget->GetPlanes(_planes);
+
+ if ( _vtkVolumeRayCastMapper != NULL )
+ {
+ _vtkVolumeRayCastMapper->RemoveAllClippingPlanes();
+// vtkPlanes *planes = vtkPlanes::New();
+// boxwidget->GetPlanes(planes);
+// _vtkVolumeRayCastMapper->SetClippingPlanes(planes);
+ _vtkVolumeRayCastMapper->SetClippingPlanes(_planes);
+ }
+
+// _actor->VisibilityOn();
+
+}
+//-------------------------------------------------------------------
+void boxSurfaceObserver::SetPlanes(vtkPlanes *planes){
+ _planes = planes;
+}
+//-------------------------------------------------------------------
+void boxSurfaceObserver::SetActor(vtkProp *actor){
+ _actor = actor;
+}
+
+//-------------------------------------------------------------------
+void boxSurfaceObserver::SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper)
+{
+ _vtkVolumeRayCastMapper = vtkvolumeraycastmapper;
+}
--- /dev/null
+#ifndef BOXSURFACEOBSERVER_H_
+#define BOXSURFACEOBSERVER_H_
+
+#include "vtkPlanes.h"
+#include "vtkProp.h"
+#include "vtkVolumeRayCastMapper.h"
+#include "vtkObject.h"
+#include "vtkCommand.h"
+
+
+// Callback for the interaction
+class boxSurfaceObserver : public vtkCommand
+{
+ public:
+ vtkPlanes *_planes;
+ vtkProp *_actor;
+ vtkVolumeRayCastMapper *_vtkVolumeRayCastMapper;
+
+ boxSurfaceObserver()
+ {
+ _vtkVolumeRayCastMapper = NULL;
+ }
+
+ virtual char const *GetClassName() const { return "boxSurfaceObserver";}
+
+ static boxSurfaceObserver *New(){
+ boxSurfaceObserver * result;
+ result = new boxSurfaceObserver();
+ return result;
+ }
+
+ virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
+ void SetPlanes(vtkPlanes *planes);
+ void SetActor(vtkProp *actor);
+ void SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper);
+};
+
+
+
+#endif /*BOXSURFACEOBSERVER_H_*/
--- /dev/null
+
+#include "figureCuttingCubeModel.h"
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+figureCuttingCubeModel::figureCuttingCubeModel()
+{
+}
+//----------------------------------------------------------------------------
+figureCuttingCubeModel::~figureCuttingCubeModel() // virtual
+{
+}
+//----------------------------------------------------------------------------
+bool figureCuttingCubeModel::IfPointInside(double x, double y, double z) // virtual
+{
+ double in[4],out[4];
+ in[0]=x;
+ in[1]=y;
+ in[2]=z;
+ in[3]=1;
+ _inversModel->MultiplyPoint (in, out);
+
+ bool result=false;
+ if ((out[0]>-0.5) && (out[0]<0.5) && (out[1]>-0.5) && (out[1]<0.5) && (out[2]>-0.5) && (out[2]<0.5) )
+ {
+ result=true;
+ }
+ return result;
+}
+//----------------------------------------------------------------------------
+double figureCuttingCubeModel::GetTheoricVolume() // virtual
+{
+ return _sx * _sy * _sz;
+}
+
+//----------------------------------------------------------------------------
+char *figureCuttingCubeModel::GetName() // virtual
+{
+ return "Cube";
+}
--- /dev/null
+#ifndef FIGURECUTTINGCUBEMODEL_H_
+#define FIGURECUTTINGCUBEMODEL_H_
+
+#include "figureCuttingModel.h"
+
+
+class figureCuttingCubeModel : public figureCuttingModel
+{
+public:
+ figureCuttingCubeModel();
+ virtual ~figureCuttingCubeModel();
+ virtual bool IfPointInside(double x, double y, double z);
+ virtual double GetTheoricVolume();
+ virtual char *GetName();
+private:
+protected:
+};
+
+#endif /*FIGURECUTTINGCUBEMODEL_H_*/
--- /dev/null
+
+#include "figureCuttingCylinderModel.h"
+
+figureCuttingCylinderModel::figureCuttingCylinderModel()
+{
+}
+//----------------------------------------------------------------------------
+figureCuttingCylinderModel::~figureCuttingCylinderModel() // virtual
+{
+}
+//----------------------------------------------------------------------------
+bool figureCuttingCylinderModel::IfPointInside(double x, double y, double z) // virtual
+{
+ double in[4],out[4];
+ in[0]=x;
+ in[1]=y;
+ in[2]=z;
+ in[3]=1;
+ _inversModel->MultiplyPoint (in, out);
+
+ bool result=false;
+ if ((sqrt( out[0]*out[0] + out[2]*out[2] )<0.5 ) && (out[1]>-0.5) && (out[1]<0.5) )
+ {
+ result=true;
+ }
+ return result;
+}
+//----------------------------------------------------------------------------
+double figureCuttingCylinderModel::GetTheoricVolume() // virtual
+{
+ double piTMP=3.14159265;
+ return piTMP*(_sx/2)*(_sz/2)*_sy;
+}
+//----------------------------------------------------------------------------
+char *figureCuttingCylinderModel::GetName() // virtual
+{
+ return "Cylinder";
+}
+//----------------------------------------------------------------------------
--- /dev/null
+#ifndef FIGURECUTTINGCYLINDERMODEL_H_
+#define FIGURECUTTINGCYLINDERMODEL_H_
+
+#include "figureCuttingModel.h"
+
+class figureCuttingCylinderModel : public figureCuttingModel
+{
+public:
+ figureCuttingCylinderModel();
+ virtual ~figureCuttingCylinderModel();
+ virtual bool IfPointInside(double x, double y, double z);
+ virtual double GetTheoricVolume();
+ virtual char *GetName();
+private:
+protected:
+};
+
+#endif /*FIGURECUTTINGCYLINDERMODEL_H_*/
--- /dev/null
+
+#include "figureCuttingModel.h"
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+figureCuttingModel::figureCuttingModel()
+{
+ _inversModel = vtkTransform::New();
+ _matrixModel = vtkTransform::New();
+ _matrixVisual = vtkTransform::New();
+
+ _spcX=1;
+ _spcY=1;
+ _spcZ=1;
+}
+//----------------------------------------------------------------------------
+figureCuttingModel::~figureCuttingModel() // virtual
+{
+ _inversModel->Delete();
+}
+//----------------------------------------------------------------------------
+void figureCuttingModel::SetPosition(double x,double y, double z)
+{
+ _px=x;
+ _py=y;
+ _pz=z;
+}
+//----------------------------------------------------------------------------
+void figureCuttingModel::SetScale(double sx,double sy, double sz)
+{
+ _sx=sx;
+ _sy=sy;
+ _sz=sz;
+}
+//----------------------------------------------------------------------------
+void figureCuttingModel::SetRotation(double alfa,double beta, double teta)
+{
+ _alfa=alfa;
+ _beta=beta;
+ _teta=teta;
+}
+
+//----------------------------------------------------------------------------
+void figureCuttingModel::CalculeMatrix()
+{
+ _matrixModel->Identity();
+ _matrixModel->Translate(_px,_py,_pz);
+ _matrixModel->RotateY(_beta);
+ _matrixModel->RotateX(_alfa);
+ _matrixModel->RotateY(_teta);
+ _matrixModel->Scale(_sx,_sy,_sz);
+
+ _matrixVisual->Identity();
+ _matrixVisual->Translate( _px*_spcX , _py*_spcY , _pz*_spcZ );
+ _matrixVisual->RotateY(_beta);
+ _matrixVisual->RotateX(_alfa);
+ _matrixVisual->RotateY(_teta);
+ _matrixVisual->Scale( _sx*_spcX , _sy*_spcY , _sz*_spcZ );
+
+}
+
+
+//----------------------------------------------------------------------------
+void figureCuttingModel::CalculeInversMatrix()
+{
+ _inversModel->Identity ();
+ _inversModel->Concatenate ( _matrixModel );
+ _inversModel->Inverse();
+}
+//----------------------------------------------------------------------------
+bool figureCuttingModel::IfPointInside(double x, double y, double z) // virtual
+{
+ return true;
+}
+
+//----------------------------------------------------------------------------
+vtkTransform *figureCuttingModel::GetVtkTransform()
+{
+ return _matrixVisual;
+}
+
+//----------------------------------------------------------------------------
+//void figureCuttingModel::SetVtkTransform(vtkTransform *matrix)
+//{
+// _matrixModel = matrix;
+//}
+
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetTheoricVolume() // virtual
+{
+ return 0;
+}
+
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetPositionX()
+{
+ return _px;
+}
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetPositionY()
+{
+ return _py;
+}
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetPositionZ()
+{
+ return _pz;
+}
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetScaleX()
+{
+ return _sx;
+}
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetScaleY()
+{
+ return _sy;
+}
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetScaleZ()
+{
+ return _sz;
+}
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetAngleAlfa()
+{
+ return _alfa;
+}
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetAngleBeta()
+{
+ return _beta;
+}
+//----------------------------------------------------------------------------
+double figureCuttingModel::GetAngleTeta()
+{
+ return _teta;
+}
+//----------------------------------------------------------------------------
+char *figureCuttingModel::GetName() // virtual
+{
+ return "--";
+}
+
+//----------------------------------------------------------------------------
+void figureCuttingModel::SetSpacing(double spcX,double spcY, double spcZ)
+{
+ _spcX = spcX;
+ _spcY = spcY;
+ _spcZ = spcZ;
+}
\ No newline at end of file
--- /dev/null
+#ifndef FIGURECUTTINGMODEL_H_
+#define FIGURECUTTINGMODEL_H_
+
+#include "vtkTransform.h"
+
+class figureCuttingModel
+{
+public:
+ figureCuttingModel();
+ virtual ~figureCuttingModel();
+
+ void SetPosition(double x,double y, double z);
+ double GetPositionX();
+ double GetPositionY();
+ double GetPositionZ();
+
+ void SetScale(double sx,double sy, double sz);
+ double GetScaleX();
+ double GetScaleY();
+ double GetScaleZ();
+
+ void SetRotation(double alfa,double beta, double teta);
+ double GetAngleAlfa();
+ double GetAngleBeta();
+ double GetAngleTeta();
+
+ void SetSpacing(double spcX,double spcY, double spcZ);
+
+ void CalculeMatrix();
+ void CalculeInversMatrix();
+ virtual bool IfPointInside(double x, double y, double z);
+ vtkTransform *GetVtkTransform();
+// void SetVtkTransform(vtkTransform *matrix);
+ virtual double GetTheoricVolume();
+ virtual char *GetName();
+
+private:
+ double _px;
+ double _py;
+ double _pz;
+ double _alfa;
+ double _beta;
+ double _teta;
+ double _spcX;
+ double _spcY;
+ double _spcZ;
+protected:
+ double _sx;
+ double _sy;
+ double _sz;
+ vtkTransform *_inversModel;
+ vtkTransform *_matrixModel;
+ vtkTransform *_matrixVisual;
+
+};
+
+#endif /*FIGURECUTTINGMODEL_H_*/
--- /dev/null
+#include "figureCuttingSphereModel.h"
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+figureCuttingSphereModel::figureCuttingSphereModel()
+{
+}
+//----------------------------------------------------------------------------
+figureCuttingSphereModel::~figureCuttingSphereModel() // virtual
+{
+}
+//----------------------------------------------------------------------------
+bool figureCuttingSphereModel::IfPointInside(double x, double y, double z) // virtual
+{
+ double in[4],out[4];
+ in[0]=x;
+ in[1]=y;
+ in[2]=z;
+ in[3]=1;
+ _inversModel->MultiplyPoint (in, out);
+
+ bool result=false;
+ if (sqrt( out[0]*out[0] + out[1]*out[1] + out[2]*out[2] )<0.5 )
+ {
+ result=true;
+ }
+ return result;
+}
+//----------------------------------------------------------------------------
+double figureCuttingSphereModel::GetTheoricVolume() // virtual
+{
+ double piTMP=3.14159265;
+ return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2);
+}
+//----------------------------------------------------------------------------
+char *figureCuttingSphereModel::GetName() // virtual
+{
+ return "Sphere";
+}
--- /dev/null
+#ifndef FIGURECUTTINGSPHEREMODEL_H_
+#define FIGURECUTTINGSPHEREMODEL_H_
+
+#include "figureCuttingModel.h"
+
+class figureCuttingSphereModel : public figureCuttingModel
+{
+public:
+ figureCuttingSphereModel();
+ virtual ~figureCuttingSphereModel();
+ virtual bool IfPointInside(double x, double y, double z);
+ virtual double GetTheoricVolume();
+ virtual char *GetName();
+private:
+protected:
+};
+
+#endif /*FIGURECUTTINGSPHEREMODEL_H_*/
--- /dev/null
+
+#include "idAlBeRa.h"
+
+idAlBeRa::idAlBeRa(int id, double radio,int deltavoxel)
+{
+ _id = id;
+ _radio = radio;
+ _deltavoxel = deltavoxel;
+}
\ No newline at end of file
--- /dev/null
+#ifndef IDALBERA_H_
+#define IDALBERA_H_
+
+class idAlBeRa
+{
+public:
+ int _id;
+ double _radio;
+ int _deltavoxel;
+ idAlBeRa(int id, double radio,int deltavoxel);
+};
+
+#endif /*IDALBERA_H_*/
Program: wxMaracas
Module: $RCSfile: vtk2DQuantSliceWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: vtk2DQuantSliceWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: vtk3DQuantSurfaceWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: vtk3DQuantSurfaceWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: vtk3DSurfaceSTLWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: vtk3DSurfaceSTLWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: vtk3DSurfaceWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: vtk3DSurfaceWidget.h,v $
Language: C++
- Date: $Date: 2009/03/24 10:49:21 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/05/14 13:54:57 $
+ Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: vtkImagePolyDataSeedConnectivity.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: vtkImagePolyDataSeedConnectivity.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
--- /dev/null
+
+#include "vtkImageViewer2_XYZ.h"
+
+
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+vtkImageViewer2_XYZ::vtkImageViewer2_XYZ()
+{
+ _vtkimageviewer2= vtkImageViewer2::New();
+}
+//-------------------------------------------------------------------
+vtkImageViewer2_XYZ::~vtkImageViewer2_XYZ()
+{
+ _vtkimageviewer2->Delete();
+}
+//-------------------------------------------------------------------
+void vtkImageViewer2_XYZ::SetExtentDimension(int x1,int x2,
+ int y1,int y2,
+ int z1,int z2)
+{
+ _x1=x1;
+ _x2=x2;
+ _y1=y1;
+ _y2=y2;
+ _z1=z1;
+ _z2=z2;
+}
+//-------------------------------------------------------------------
+void vtkImageViewer2_XYZ::SetXSlice(int slice)
+{
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ imageActor->SetDisplayExtent(slice, slice, _y1, _y2, _z1, _z2 );
+}
+//-------------------------------------------------------------------
+void vtkImageViewer2_XYZ::SetYSlice(int slice)
+{
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ imageActor->SetDisplayExtent(_x1, _x2, slice, slice, _z1, _z2 );
+}
+//-------------------------------------------------------------------
+void vtkImageViewer2_XYZ::SetZSlice(int slice)
+{
+#if (VTK_MAJOR_VERSION >= 5)
+// _vtkimageviewer2->SetSlice( slice );
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ imageActor->SetDisplayExtent(_x1, _x2, _y1, _y2, slice, slice );
+#else
+ _vtkimageviewer2->SetZSlice( slice );
+#endif
+
+
+}
+//-------------------------------------------------------------------
+int vtkImageViewer2_XYZ::GetXSlice()
+{
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ return imageActor->GetDisplayExtent()[0];
+}
+//-------------------------------------------------------------------
+int vtkImageViewer2_XYZ::GetYSlice()
+{
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ return imageActor->GetDisplayExtent()[2];
+}
+//-------------------------------------------------------------------
+int vtkImageViewer2_XYZ::GetZSlice()
+{
+
+ int result;
+#if (VTK_MAJOR_VERSION >= 5)
+ result= _vtkimageviewer2->GetSlice( );
+#else
+ result= _vtkimageviewer2->GetZSlice( );
+#endif
+
+
+ return result;
+}
+//-------------------------------------------------------------------
+vtkImageViewer2 *vtkImageViewer2_XYZ::GetVtkImageViewer2()
+{
+ return _vtkimageviewer2;
+}
+
+
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
--- /dev/null
+#ifndef VTKIMAGEVIEWER2_XYZ_H_
+#define VTKIMAGEVIEWER2_XYZ_H_
+
+
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+
+
+class creaMaracasVisu_EXPORT vtkImageViewer2_XYZ{
+public:
+ vtkImageViewer2_XYZ();
+ ~vtkImageViewer2_XYZ();
+
+ void SetExtentDimension(int x1,int x2, int y1,int y2, int z1,int z2);
+ void SetXSlice(int slice);
+ void SetYSlice(int slice);
+ void SetZSlice(int slice);
+ int GetXSlice();
+ int GetYSlice();
+ int GetZSlice();
+ vtkImageViewer2 *GetVtkImageViewer2();
+
+private:
+ int _x1,_x2,_y1,_y2,_z1,_z2;
+ vtkImageViewer2 *_vtkimageviewer2;
+protected:
+};
+
+
+#endif /*VTKIMAGEVIEWER2_XYZ_H_*/
Program: Visualization Toolkit
Module: $RCSfile: vtkInteractorStyleCutter.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
Program: Visualization Toolkit
Module: $RCSfile: vtkInteractorStyleCutter.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
Program: wxMaracas
Module: $RCSfile: wxChart.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxChart.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxImageViewerWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxImageViewerWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxManualRegistration3D.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxManualRegistration3D.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxManualSegmentation_MPRWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxManualSegmentation_MPRWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxQuantificationWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxQuantificationWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxQuantificationWidgetCT.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxQuantificationWidgetCT.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxQuantificationWidget_base.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxQuantificationWidget_base.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxSegmentationFM3DWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxSegmentationFM3DWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxSurfaceSTLWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxSurfaceSTLWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxSurfaceWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:57 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: wxSurfaceWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:43 $
+ Date: $Date: 2009/05/14 13:54:58 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
--- /dev/null
+
+#include "manualInteractorWindowLevel.h"
+#include "wxVtk2DBaseView.h"
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+manualInteractorWindowLevel::manualInteractorWindowLevel()
+{
+ _stateWindowLevel = false;
+ _backPx = 0;
+ _backPy = 0;
+ _backWindow = -1;
+ _backLevel = -1;
+}
+
+//-------------------------------------------------------------------
+
+manualInteractorWindowLevel::~manualInteractorWindowLevel()
+{
+}
+
+//-------------------------------------------------------------------
+
+bool manualInteractorWindowLevel::OnMouseMove() // virtual
+{
+
+ if (_stateWindowLevel==true)
+ {
+ int tmpPx,tmpPy;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition( tmpPx , tmpPy );
+ int colorWin=_backWindow - 2*( _backPx - tmpPx );
+ int colorLev=_backLevel + 2*( _backPy - tmpPy );
+
+ if (colorWin<0)
+ {
+ colorWin=0;
+ }
+ if (colorWin>100000)
+ {
+ colorWin=100000;
+ }
+
+ if (colorLev<0)
+ {
+ colorLev=0;
+ }
+ if (colorLev>100000)
+ {
+ colorLev=100000;
+ }
+ vtkImageViewer2 *vtkimageviewer2;
+ vtkimageviewer2=((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2();
+ vtkimageviewer2->SetColorWindow(colorWin);
+ vtkimageviewer2->SetColorLevel(colorLev);
+// vtkimageviewer2->Render();
+ }
+ return true;
+}
+
+//-------------------------------------------------------------------
+
+bool manualInteractorWindowLevel::OnMiddleButtonDown() // virtual
+{
+ if ((_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
+ (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ){
+
+ _stateWindowLevel = true;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition( _backPx , _backPy );
+
+ _backWindow = (int)(((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2()->GetColorWindow());
+ _backLevel = (int)(((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2()->GetColorLevel());
+ }
+ return true;
+}
+
+//-------------------------------------------------------------------
+
+bool manualInteractorWindowLevel::OnMiddleButtonUp() // virtual
+{
+ if (_stateWindowLevel==true)
+ {
+ _stateWindowLevel=false;
+ }
+ return true;
+}
--- /dev/null
+#ifndef MANUALINTERACTORWINDOWLEVEL_H_
+#define MANUALINTERACTORWINDOWLEVEL_H_
+
+#include "InteractorStyleMaracas.h"
+
+class creaMaracasVisu_EXPORT manualInteractorWindowLevel : public InteractorStyleMaracas {
+public:
+ manualInteractorWindowLevel();
+ virtual ~manualInteractorWindowLevel();
+protected:
+
+ bool _stateWindowLevel;
+ int _backPx;
+ int _backPy;
+ int _backWindow;
+ int _backLevel;
+
+ virtual bool OnMouseMove();
+ virtual bool OnMiddleButtonDown();
+ virtual bool OnMiddleButtonUp();
+};
+
+
+
+#endif /*MANUALINTERACTORWINDOWLEVEL_H_*/
--- /dev/null
+
+#include "manualViewPerpPlaneContour.h"
+
+#include "vtkPlane2DView.h"
+
+manualViewPerpPlaneContour::manualViewPerpPlaneContour()
+{
+}
+// ----------------------------------------------------------------------------
+manualViewPerpPlaneContour::~manualViewPerpPlaneContour()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualViewPerpPlaneContour * manualViewPerpPlaneContour :: Clone()
+{
+ manualViewPerpPlaneContour * clone = new manualViewPerpPlaneContour();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualViewPerpPlaneContour::CopyAttributesTo( manualViewPerpPlaneContour * cloneObject)
+{
+ // Fathers object
+ manualViewContour::CopyAttributesTo(cloneObject);
+}
+
+
+
+
+// ----------------------------------------------------------------------------
+void manualViewPerpPlaneContour::UpdateViewPoint(int id)
+{ // virtual
+ double x,y,z;
+ manualPoint *mp = _manContModel->GetManualPoint(id);
+ x = mp->GetX();
+ y = mp->GetY();
+ z = mp->GetZ();
+ FilterCordinateXYZ(x,y,z);
+
+ _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
+ if ((z>=-1) && (z<=1))
+ {
+ _lstViewPoints[id]->GetVtkActor()->VisibilityOn();
+ } else {
+ _lstViewPoints[id]->GetVtkActor()->VisibilityOff();
+ }
+}
+// ----------------------------------------------------------------------------
+void manualViewPerpPlaneContour::FilterCordinateXYZ (double &x, double &y, double &z)
+{
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)( this->GetWxVtkBaseView() );
+ vtkMPRBaseData *vtkmprbasedata = vtkplane2Dview->GetVtkmprbasedata();
+ vtkTransform *transf1 = vtkTransform::New();
+ vtkTransform *transf2 = vtkmprbasedata->GetTransformOrientation();
+ transf1->SetMatrix( transf2->GetMatrix() );
+ transf1->Inverse();
+
+ double in[4], out[4];
+ double center = vtkplane2Dview->GetImgSize() / 2;
+
+ in[0] = x - vtkmprbasedata->GetX();
+ in[1] = y - vtkmprbasedata->GetY();
+ in[2] = z - vtkmprbasedata->GetZ();
+ in[3] = 0;
+
+ transf1->MultiplyPoint(in,out);
+ z = out[0];
+ x = out[1]+center;
+ y = out[2]+center;
+
+ double spc[3];
+ this->GetWxVtkBaseView()->GetSpacing(spc);
+ x = x / spc[0];
+ y = y / spc[1];
+ z = z / spc[2];
+
+ transf1->Delete();
+}
+
+// ----------------------------------------------------------------------------
+void manualViewPerpPlaneContour::TransfromeCoordViewWorld( double &X,double &Y,double &Z,int type )
+{
+ Z = 0;
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)( this->GetWxVtkBaseView() );
+ vtkplane2Dview->TransfromeCoordViewWorld2(X,Y,Z);
+}
+
+
+// ----------------------------------------------------------------------------
+void manualViewPerpPlaneContour::RefreshContour() // virtual
+{
+// manualViewContour::RefreshContour();
+
+ double pp1[3];
+ double pp2[3];
+ double u;
+
+// JSTG 25-02-08 ----------------------------------------------------------
+// tt;
+//--------------------------------------------------------
+
+ double pp[3];
+ double ppB[3];
+ double ppC[3];
+ ppB[0] = 999999;
+ double dist,distMin = 99999999;
+
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)( this->GetWxVtkBaseView() );
+ double center = vtkplane2Dview->GetImgSize() / 2;
+
+ int i,np,nps;
+ np = GetNumberOfPoints( );
+
+//JSTG 25-02-08 ------------------------------------------
+ //double t,delta;
+ //nps = GetNumberOfPointsSpline();
+ nps = _manContModel->GetNumberOfPointsSpline();
+ //delta = ( double ) ( np ) / ( double ) ( nps-1 );
+ _manContModel->UpdateSpline();
+//--------------------------------------------------------
+
+ if ( np >= 2 )
+ {
+ for( i = 0; i < nps; i++ )
+ {
+// JSTG 25-02-08 ----------------------------------------------------------
+ //t = delta * (double)i ;
+ //tt = delta * (double)(i+1) ;
+ //_manContModel->GetSplinePoint(t ,pp1[0],pp1[1],pp1[2]);
+ //_manContModel->GetSplinePoint(tt,pp2[0],pp2[1],pp2[2]);
+ _manContModel->GetSpline_i_Point(i ,&pp1[0],&pp1[1],&pp1[2]);
+ _manContModel->GetSpline_i_Point(i+1,&pp2[0],&pp2[1],&pp2[2]);
+//--------------------------------------------------------------------------
+ FilterCordinateXYZ(pp1[0],pp1[1],pp1[2]);
+ FilterCordinateXYZ(pp2[0],pp2[1],pp2[2]);
+ if (pp2[2]*pp1[2]<=0)
+ {
+ if (pp1[2]-pp2[2]!=0) {
+ u = -pp2[2] / (pp1[2]-pp2[2]);
+ } else {
+ u=9999999;
+ }
+ pp[0] = ( pp1[0]-pp2[0] )*u + pp2[0];
+ pp[1] = ( pp1[1]-pp2[1] )*u + pp2[1];
+ pp[2] = ( pp1[2]-pp2[2] )*u + pp2[2];
+ ppC[0] = pp[0] - center;
+ ppC[1] = pp[1] - center;
+ ppC[2] = pp[2] ;
+ dist = sqrt( ppC[0]*ppC[0] + ppC[1]*ppC[1] + ppC[2]*ppC[2] );
+ if (dist<distMin)
+ {
+ distMin=dist;
+ ppB[0] = pp[0];
+ ppB[1] = pp[1];
+ ppB[2] = pp[2];
+ }
+ }
+
+ }// for
+ } else {
+ _pts->SetPoint(0, 0 , 0 , 0);
+ _pts->SetPoint(1, 0 , 0 , 0);
+ } // if
+
+//EED 27 sep 2006
+ ppB[0]=ppB[0]*_spc[0];
+ ppB[1]=ppB[1]*_spc[1];
+
+ _pts->SetPoint( 0, ppB[0] , ppB[1]+1 , 1 );
+ _pts->SetPoint( 1, ppB[0] , ppB[1]-1 , 1 );
+ _pts->SetPoint( 2, ppB[0] , ppB[1] , 1 );
+ _pts->SetPoint( 3, ppB[0]-1 , ppB[1] , 1 );
+ _pts->SetPoint( 4, ppB[0]+1 , ppB[1] , 1 );
+
+
+ for( i = 5; i < nps; i++ )
+ {
+ _pts->SetPoint( i, ppB[0] , ppB[1] , 1 );
+ }
+
+}
+
+//---------------------------------------------------------------------------
+bool manualViewPerpPlaneContour::ifTouchContour( int x, int y, int z)
+{
+ bool ok=false;
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)( this->GetWxVtkBaseView() );
+ double X=x;
+ double Y=y;
+ double Z=z;
+ vtkplane2Dview->TransfromeCoordScreenToWorld(X,Y,Z);
+ double ppA[3];
+ _pts->GetPoint(0, ppA);
+ if (sqrt( (ppA[0]-X)*(ppA[0]-X) + (ppA[1]-Y)*(ppA[1]-Y) ) <=2)
+ {
+ ok = true;
+ }
+ return ok;
+}
\ No newline at end of file
--- /dev/null
+#ifndef MANUALVIEWPERPPLANECONTOUR_H_
+#define MANUALVIEWPERPPLANECONTOUR_H_
+
+#include "manualContour.h"
+
+class manualViewPerpPlaneContour : public manualViewContour
+{
+public:
+ manualViewPerpPlaneContour();
+ ~manualViewPerpPlaneContour();
+ virtual manualViewPerpPlaneContour * Clone();
+ void CopyAttributesTo( manualViewPerpPlaneContour *cloneObject );
+
+ virtual void UpdateViewPoint(int id);
+ virtual void RefreshContour();
+ virtual void TransfromeCoordViewWorld( double &X,double &Y,double &Z,int type );
+ virtual bool ifTouchContour( int x, int y, int z);
+
+protected:
+private:
+ void FilterCordinateXYZ (double &x, double &y, double &z);
+};
+
+#endif /*MANUALVIEWPERPPLANECONTOUR_H_*/
--- /dev/null
+#ifndef VTKBASEDATA_H_
+#define VTKBASEDATA_H_
+
+class creaMaracasVisu_EXPORT vtkBaseData {
+public:
+ vtkBaseData();
+ virtual ~vtkBaseData();
+ vtkImageData* GetImageData();
+ marImageData* GetMarImageData();
+ void SetMarImageData(marImageData *marimagedata);
+ virtual void Configure();
+ double GetZ();
+ void SetZ(double z);
+
+ int GetT();
+ void SetT(double t);
+
+protected:
+ marImageData *_marImageData;
+ double _z;
+ int _t;
+};
+
+#endif /*VTKBASEDATA_H_*/
--- /dev/null
+#ifndef VTKCLIPPING3DDATAVIEWER_H_
+#define VTKCLIPPING3DDATAVIEWER_H_
+
+#include "wxMPRBaseData.h"
+
+class vtkClipping3DDataViewer {
+public:
+ //----------------------
+ //Constructo-Destructor
+ //----------------------
+ vtkClipping3DDataViewer();
+ virtual ~vtkClipping3DDataViewer();
+
+// vtkImageActor* GetImageActor(int id);
+ vtkActor* GetOutlineActor();
+ vtkClipPolyData* GetTissueClipper(int id);
+ vtkPolyDataMapper* GetTissueMapper(int id);
+ vtkPlanes* GetTissuePlanes(int id);
+ vtkStripper* GetTissueStripper(int id);
+// vtkGlyph3D* GetGlyph(int id);
+ vtkLODActor* GetMaceActor(int id);
+
+ vtkMarchingCubes *GetMCubes(int idTissue);
+
+ virtual void Refresh();
+ void RefreshSurface();
+
+ virtual void Configure();
+ void Configure_Tissue();
+ void Configure_Volume();
+
+ void SetIsovalue(int idTissue, int isoValue);
+ double GetIsovalue(int idTissue);
+
+ vtkVolume *GetVolumeActor();
+ vtkVolumeRayCastMapper *GetVolumeMapper();
+ vtkPlanes *GetVolumePlanes();
+
+ void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
+ vtkMPRBaseData* GetVtkMPRBaseData();
+
+ vtkActor *GetTissueActor(int id);
+ void SetVisibleTissue(int idTissue, bool visible);
+ bool GetVisibleTissue(int idTissue);
+ bool GetVisibleVolume();
+ void SetVisibleVolume(bool visibleVolume);
+
+ void SetRepresentationType(int idTissue, bool representationType);
+ bool GetRepresentationType(int idTissue);
+
+ boxSurfaceObserver *GetObserverS(int idObserverS);
+ boxSurfaceObserver *GetObserverV();
+
+ //void ReadVolumeFunctions(char *namefile);
+ void ReadVolumeFunctions();
+ void ReadMeshVTK(char *namefile);
+
+
+ //-------------------
+ //Getters Vectors
+ //-------------------
+
+ std::vector<double>* GetGreyValuesTransferenceFVector();
+ std::vector<double>* GetIntensityValuesTransferenceFVector();
+ std::vector<double>* GetRedColorsOfColorTransferenceFVector();
+ std::vector<double>* GetGreenColorsOfColorTransferenceFVector();
+ std::vector<double>* GetBlueColorsOfColorTransferenceFVector();
+ std::vector<double>* GetGreyValueColorsOfColorTransferenceFVector();
+
+ //--------------------------------------
+ //Getters transference function
+ //and color of the transference function
+ //---------------------------------------
+ vtkPiecewiseFunction *GetTransferencefunction();
+ vtkColorTransferFunction *GetColorTransferenceFunction();
+
+
+
+private:
+
+ vtkMarchingCubes *_mCubes[ VTKMPRDATA_MAXTISSUE ];
+ vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
+ vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
+ vtkPlanes *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
+ vtkClipPolyData *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
+
+ // outline
+ vtkOutlineFilter *_outlineData;
+ vtkPolyDataMapper *_mapOutline;
+ vtkActor *_outline;
+
+ /// Volume
+ vtkPiecewiseFunction *_tfun;
+ vtkColorTransferFunction *_ctfun;
+ vtkVolumeRayCastCompositeFunction *_compositeFunction;
+ vtkPlanes *_volumePlanes;
+ vtkVolumeRayCastMapper *_volumeMapper;
+ vtkVolumeProperty *_volumeProperty;
+ vtkVolume *_newvol;
+
+ vtkMPRBaseData *_vtkmprbasedata;
+
+ bool _visibleVolume;
+ bool _representationType[VTKMPRDATA_MAXTISSUE];
+ bool _visibleTissue[VTKMPRDATA_MAXTISSUE];
+ vtkActor *_tissue[VTKMPRDATA_MAXTISSUE];
+ boxSurfaceObserver *_observerV;
+ boxSurfaceObserver *_observerS[VTKMPRDATA_MAXTISSUE];
+
+ std::vector<double> greyValuesTransferenceFVector;
+ std::vector<double> intensityValuesTransferenceFVector;
+ std::vector<double> redColorsOfColorTransferenceFVector;
+ std::vector<double> greenColorsOfColorTransferenceFVector;
+ std::vector<double> blueColorsOfColorTransferenceFVector;
+ std::vector<double> greyValueColorsOfColorTransferenceFVector;
+};
+
+#endif /*VTKCLIPPING3DDATAVIEWER_H_*/
Program: Visualization Toolkit
Module: $RCSfile: vtkClosePolyData.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:34 $
+ Version: $Revision: 1.2 $
Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
#include "vtkAppendPolyData.h"
#include "vtkCleanPolyData.h"
-vtkCxxRevisionMacro(vtkClosePolyData, "$Revision: 1.1 $");
+vtkCxxRevisionMacro(vtkClosePolyData, "$Revision: 1.2 $");
vtkStandardNewMacro(vtkClosePolyData);
//----------------------------------------------------------------------------
Program: Visualization Toolkit
Module: $RCSfile: vtkClosePolyData.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:41 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:34 $
+ Version: $Revision: 1.2 $
Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
--- /dev/null
+#include "vtkImageViewer2_XYZ.h"
+
+#include "vtkImageActor.h"
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+vtkImageViewer2_XYZ::vtkImageViewer2_XYZ()
+{
+ _vtkimageviewer2= vtkImageViewer2::New();
+}
+//-------------------------------------------------------------------
+vtkImageViewer2_XYZ::~vtkImageViewer2_XYZ()
+{
+ //_vtkimageviewer2->Delete();
+}
+//-------------------------------------------------------------------
+void vtkImageViewer2_XYZ::SetExtentDimension(int x1,int x2,
+ int y1,int y2,
+ int z1,int z2)
+{
+ _x1=x1;
+ _x2=x2;
+ _y1=y1;
+ _y2=y2;
+ _z1=z1;
+ _z2=z2;
+}
+//-------------------------------------------------------------------
+void vtkImageViewer2_XYZ::SetXSlice(int slice)
+{
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ imageActor->SetDisplayExtent(slice, slice, _y1, _y2, _z1, _z2 );
+}
+//-------------------------------------------------------------------
+void vtkImageViewer2_XYZ::SetYSlice(int slice)
+{
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ imageActor->SetDisplayExtent(_x1, _x2, slice, slice, _z1, _z2 );
+}
+//-------------------------------------------------------------------
+void vtkImageViewer2_XYZ::SetZSlice(int slice)
+{
+#if (VTK_MAJOR_VERSION >= 5)
+// _vtkimageviewer2->SetSlice( slice );
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ imageActor->SetDisplayExtent(_x1, _x2, _y1, _y2, slice, slice );
+#else
+ _vtkimageviewer2->SetZSlice( slice );
+#endif
+
+
+}
+//-------------------------------------------------------------------
+int vtkImageViewer2_XYZ::GetXSlice()
+{
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ return imageActor->GetDisplayExtent()[0];
+}
+//-------------------------------------------------------------------
+int vtkImageViewer2_XYZ::GetYSlice()
+{
+ vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
+ return imageActor->GetDisplayExtent()[2];
+}
+//-------------------------------------------------------------------
+int vtkImageViewer2_XYZ::GetZSlice()
+{
+
+ int result;
+#if (VTK_MAJOR_VERSION >= 5)
+ result= _vtkimageviewer2->GetSlice( );
+#else
+ result= _vtkimageviewer2->GetZSlice( );
+#endif
+
+
+ return result;
+}
+//-------------------------------------------------------------------
+vtkImageViewer2 *vtkImageViewer2_XYZ::GetVtkImageViewer2()
+{
+ return _vtkimageviewer2;
+}
--- /dev/null
+#ifndef VTKIMAGEVIEWER2_XYZ_H_
+#define VTKIMAGEVIEWER2_XYZ_H_
+
+
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+#include "marTypes.h"
+#include "vtkImageViewer2.h"
+
+class creaMaracasVisu_EXPORT vtkImageViewer2_XYZ{
+public:
+ vtkImageViewer2_XYZ();
+ ~vtkImageViewer2_XYZ();
+
+ void SetExtentDimension(int x1,int x2, int y1,int y2, int z1,int z2);
+ void SetXSlice(int slice);
+ void SetYSlice(int slice);
+ void SetZSlice(int slice);
+ int GetXSlice();
+ int GetYSlice();
+ int GetZSlice();
+ vtkImageViewer2 *GetVtkImageViewer2();
+
+private:
+ int _x1,_x2,_y1,_y2,_z1,_z2;
+ vtkImageViewer2 *_vtkimageviewer2;
+protected:
+};
+
+
+#endif /*VTKIMAGEVIEWER2_XYZ_H_*/
--- /dev/null
+#include "vtkInfoTextImage.h"
+
+#include "vtkTextProperty.h"
+#include <vtkImageMapToWindowLevelColors.h>
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+vtkInfoTextImage::vtkInfoTextImage()
+{
+ _vtkText_WindowLevel = NULL;
+ _vtkText_ColorLevel = NULL;
+ _vtkText_position = NULL;
+ _vtkText_pixelIntensity = NULL;
+ _marimagedata = NULL;
+}
+
+//-------------------------------------------------------------------
+
+vtkInfoTextImage::~vtkInfoTextImage()
+{
+}
+
+//-------------------------------------------------------------------
+
+void vtkInfoTextImage::Configure()
+{
+ _vtkText_WindowLevel = Create_Text_Label( 10 , 55 );
+ _vtkText_ColorLevel = Create_Text_Label( 10 , 40 );
+ _vtkText_position = Create_Text_Label( 10 , 25 );
+ _vtkText_pixelIntensity = Create_Text_Label( 10 , 10 );
+}
+
+
+//-------------------------------------------------------------------
+
+void vtkInfoTextImage::SetMarImageData(marImageData *marimagedata)
+{
+ _marimagedata=marimagedata;
+}
+
+//-------------------------------------------------------------------
+
+void vtkInfoTextImage::SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview)
+{
+ _wxvtk2Dbaseview=wxvtk2Dbaseview;
+}
+
+//-------------------------------------------------------------------
+
+vtkTextActor *vtkInfoTextImage::Create_Text_Label(int px, int py )
+{
+ // Text Window Level
+ vtkTextActor *textActor = vtkTextActor::New();
+ textActor->SetDisplayPosition(px, py);
+ textActor->SetInput("0");
+
+ // Set coordinates to match the old vtkScaledTextActor default value
+ textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
+ textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
+
+ vtkTextProperty *tprop = textActor->GetTextProperty();
+ tprop->SetFontSize(14);
+ tprop->SetFontFamilyToArial();
+ tprop->SetColor(1, 1, 0);
+ _wxvtk2Dbaseview->GetRenderer()->AddActor2D(textActor);
+
+ return textActor;
+}
+
+//-------------------------------------------------------------------
+
+void vtkInfoTextImage::PutWindowLevel()
+{
+ int value = (int)( _wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->GetWindow() );
+ char zTzxt[20];
+ char resultText[50];
+
+ strcpy(resultText,"w:");
+
+
+ //ltoa ( (long)value , zTzxt , 10 );
+ sprintf(zTzxt,"%d",value);
+
+ strcat(resultText,zTzxt);
+ _vtkText_WindowLevel -> SetInput(resultText);
+}
+
+//-------------------------------------------------------------------
+
+void vtkInfoTextImage::PutColorLevel()
+{
+ int value = (int)(_wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->GetLevel());
+ char zTzxt[20];
+ char resultText[50];
+
+ strcpy(resultText,"c:");
+
+// itoa (value,zTzxt,10);
+ sprintf(zTzxt,"%d",value);
+
+ strcat(resultText,zTzxt);
+ _vtkText_ColorLevel -> SetInput(resultText);
+}
+
+//-------------------------------------------------------------------
+
+void vtkInfoTextImage::PutPosition(int xx,int yy, int zz)
+{
+
+//EEDx7
+// double spa[3];
+// _imagedata->GetSpacing(spa);
+// xx=xx*(1/spa[0]);
+// yy=yy*(1/spa[1]);
+
+
+ char zTzxt[50];
+ char resultText[50];
+ strcpy(resultText,"p: ");
+// itoa ((int)xx,zTzxt,10);
+ sprintf(zTzxt,"%d",xx);
+
+ strcat(resultText,zTzxt);
+ strcat(resultText," , ");
+
+// itoa ((int)yy,zTzxt,10);
+ sprintf(zTzxt,"%d",yy);
+
+ strcat(resultText,zTzxt);
+ strcat(resultText," , ");
+
+// itoa ((int)zz,zTzxt,10);
+ sprintf(zTzxt,"%d",zz);
+
+ strcat(resultText,zTzxt);
+
+
+
+ int nX = _marimagedata->GetXOriginal(xx);
+ int nY = _marimagedata->GetYOriginal(yy);
+ int nZ = _marimagedata->GetZOriginal(zz);
+
+ strcat(resultText," (");
+// ltoa ((int)nX,zTzxt,10);
+ sprintf(zTzxt,"%d",nX);
+
+ strcat(resultText,zTzxt);
+ strcat(resultText,",");
+
+// ltoa ((int)nY,zTzxt,10);
+ sprintf(zTzxt,"%d",nY);
+
+ strcat(resultText,zTzxt);
+ strcat(resultText,",");
+
+// ltoa ((int)nZ,zTzxt,10);
+ sprintf(zTzxt,"%d",nZ);
+
+ strcat(resultText,zTzxt);
+ strcat(resultText,")");
+
+
+
+
+ _vtkText_position -> SetInput(resultText);
+}
+
+//-------------------------------------------------------------------
+
+void vtkInfoTextImage::PutPixelIntensity(int xx, int yy, int zz)
+{
+
+//EEDx2
+ bool ok=true;
+
+ int dim[3];
+ double spa[3];
+ vtkImageData *imagedata = _marimagedata->GetImageData();
+ imagedata->GetDimensions(dim);
+ imagedata->GetSpacing(spa);
+
+// EEDx7
+// xx=xx*(1/spa[0]);
+// yy=yy*(1/spa[1]);
+// zz=xx*spa[2];
+
+ if ( (xx<0) || (xx>=dim[0]) || (yy<0) || (yy>=dim[1]) || (zz<0) || (zz>=dim[2]) )
+ {
+ ok=false;
+ }
+
+
+ char zTzxt[20];
+ char resultText[50];
+ strcpy(resultText,"GL: ");
+ if (ok==true)
+ {
+ if (imagedata->GetScalarType()==VTK_BIT)
+ {
+ char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ if(*pOrg==0)
+ {
+ sprintf(zTzxt,"%d",0);
+ }
+ else
+ {
+ sprintf(zTzxt,"%d",1);
+ }
+ }
+
+ if (imagedata->GetScalarType()==VTK_CHAR)
+ {
+ char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ int tmp=*pOrg;
+ sprintf(zTzxt,"%d",tmp);
+ }
+
+ if (imagedata->GetScalarType()==VTK_SIGNED_CHAR)
+ {
+ signed char *pOrg=(signed char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ int tmp=*pOrg;
+ sprintf(zTzxt,"%d",tmp);
+ }
+
+ if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR)
+ {
+ unsigned char *pOrg=(unsigned char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ int tmp=*pOrg;
+ sprintf(zTzxt,"%d",tmp);
+ }
+
+ if (imagedata->GetScalarType()==VTK_SHORT)
+ {
+ short *pOrg=(short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ int tmp=*pOrg;
+ sprintf(zTzxt,"%d",tmp);
+ }
+
+ if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT)
+ {
+ unsigned short *pOrg=(unsigned short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ int tmp=*pOrg;
+ sprintf(zTzxt,"%d",tmp);
+ }
+
+ if (imagedata->GetScalarType()==VTK_INT)
+ {
+ int *pOrg=(int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ sprintf(zTzxt,"%d",*pOrg);
+ }
+
+ if (imagedata->GetScalarType()==VTK_UNSIGNED_INT)
+ {
+ unsigned int *pOrg=(unsigned int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ int tmp=*pOrg;
+ sprintf(zTzxt,"%d",tmp);
+ }
+
+ if (imagedata->GetScalarType()==VTK_LONG)
+ {
+ long *pOrg=(long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ double tmp=*pOrg;
+ sprintf(zTzxt,"%3.2f",tmp);
+ }
+
+ if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG)
+ {
+ unsigned long *pOrg=(unsigned long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ double tmp=*pOrg;
+ sprintf(zTzxt,"%3.2f",tmp);
+ }
+
+ if (imagedata->GetScalarType()==VTK_FLOAT)
+ {
+ long *pOrg=(long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ double tmp=*pOrg;
+ sprintf(zTzxt,"%3.2f",tmp);
+ }
+
+ if (imagedata->GetScalarType()==VTK_DOUBLE)
+ {
+ double *pOrg=(double*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
+ // itoa (*pOrg,zTzxt,10);
+ double tmp=*pOrg;
+ sprintf(zTzxt,"%3.2f",tmp);
+ }
+ }
+ else
+ {
+ strcpy(zTzxt,"---");
+ }
+ strcat(resultText,zTzxt);
+ _vtkText_pixelIntensity -> SetInput(resultText);
+}
--- /dev/null
+#ifndef VTKINFOTEXTIMAGE_H_
+#define VTKINFOTEXTIMAGE_H_
+
+
+#include "wxVtk2DBaseView.h"
+
+class vtkInfoTextImage{
+public:
+ vtkInfoTextImage();
+ ~vtkInfoTextImage();
+ void SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview);
+ void SetMarImageData(marImageData *marimagedata);
+ void Configure();
+ void PutPixelIntensity(int x, int y, int z);
+ void PutPosition(int x, int y, int z);
+ void PutColorLevel();
+ void PutWindowLevel();
+
+
+protected:
+private:
+
+ marImageData *_marimagedata;
+ wxVtk2DBaseView *_wxvtk2Dbaseview;
+ vtkTextActor *_vtkText_WindowLevel;
+ vtkTextActor *_vtkText_ColorLevel;
+ vtkTextActor *_vtkText_position;
+ vtkTextActor *_vtkText_pixelIntensity;
+
+ vtkTextActor *Create_Text_Label(int px, int py);
+};
+
+
+#endif /*VTKINFOTEXTIMAGE_H_*/
--- /dev/null
+#include "vtkInfoTextImageInteractor.h"
+
+#include "wxVtk2DBaseView.h"
+
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+vtkInfoTextImageInteractor::vtkInfoTextImageInteractor()
+{
+}
+
+//-------------------------------------------------------------------
+vtkInfoTextImageInteractor::~vtkInfoTextImageInteractor()
+{
+}
+
+//-------------------------------------------------------------------
+
+void vtkInfoTextImageInteractor::SetModelVtkInfoTextImage(vtkInfoTextImage *vtkinfotextimage)
+{
+ _vtkinfotextimage = vtkinfotextimage;
+}
+
+//-------------------------------------------------------------------
+bool vtkInfoTextImageInteractor::OnMouseMove()
+{
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+
+ /*JCP 14/05/2009
+ * int z = (int)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetVtkBaseData()->GetZ());*/
+
+ int z = (int)((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetZ();
+ double xx=X,yy=Y,zz=z;
+ _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->TransfromeCoordScreenToWorld(xx,yy,zz);
+
+
+ GetVtkInfoTextImage()->PutWindowLevel();
+ GetVtkInfoTextImage()->PutColorLevel();
+ GetVtkInfoTextImage()->PutPosition( (int)xx , (int)yy , (int)zz );
+ GetVtkInfoTextImage()->PutPixelIntensity( (int)xx , (int)yy , (int)zz );
+
+ this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+ return true;
+}
+
+//-------------------------------------------------------------------
+vtkInfoTextImage *vtkInfoTextImageInteractor::GetVtkInfoTextImage()
+{
+ return _vtkinfotextimage;
+}
--- /dev/null
+#ifndef VTKINFOTEXTIMAGEINTERACTOR_H_
+#define VTKINFOTEXTIMAGEINTERACTOR_H_
+
+
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+#include "vtkInfoTextImage.h"
+#include "InteractorStyleMaracas.h"
+
+class vtkInfoTextImageInteractor : public InteractorStyleMaracas{
+public:
+ vtkInfoTextImageInteractor();
+ virtual ~vtkInfoTextImageInteractor();
+ void SetModelVtkInfoTextImage(vtkInfoTextImage *vtkinfotextimage);
+ vtkInfoTextImage *GetVtkInfoTextImage();
+
+protected:
+
+ virtual bool OnMouseMove();
+
+private:
+ vtkInfoTextImage *_vtkinfotextimage;
+};
+
+
+#endif /*VTKINFOTEXTIMAGEINTERACTOR_H_*/
--- /dev/null
+#include "vtkInfoTextImageInteractorPlane2D.h"
+
+#include "vtkPlane2DView.h"
+#include "wxVtk2DBaseView.h"
+
+vtkInfoTextImageInteractorPlane2D::vtkInfoTextImageInteractorPlane2D()
+{
+}
+//-------------------------------------------------------------------
+vtkInfoTextImageInteractorPlane2D::~vtkInfoTextImageInteractorPlane2D()
+{
+}
+//-------------------------------------------------------------------
+bool vtkInfoTextImageInteractorPlane2D::OnMouseMove()
+{
+ int X,Y;
+ wxVTKRenderWindowInteractor *wxVTKiren;
+ wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
+ wxVTKiren->GetEventPosition(X,Y);
+
+ int z = (int) ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetZ();
+ double xx=X,yy=Y,zz=z;
+
+// --> dif
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
+ vtkplane2Dview->TransfromeCoordViewWorld2(xx,yy,zz);
+
+ GetVtkInfoTextImage()->PutWindowLevel();
+ GetVtkInfoTextImage()->PutColorLevel();
+ GetVtkInfoTextImage()->PutPosition( (int)xx , (int)yy , (int)zz );
+ GetVtkInfoTextImage()->PutPixelIntensity( (int)xx , (int)yy , (int)zz );
+
+ this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
+ return true;
+}
--- /dev/null
+#ifndef VTKINFOTEXTIMAGEINTERACTORPLANE2D_H_
+#define VTKINFOTEXTIMAGEINTERACTORPLANE2D_H_
+
+#include "vtkInfoTextImageInteractor.h"
+
+class vtkInfoTextImageInteractorPlane2D : public vtkInfoTextImageInteractor{
+public:
+ vtkInfoTextImageInteractorPlane2D();
+ ~vtkInfoTextImageInteractorPlane2D();
+
+protected:
+
+ virtual bool OnMouseMove();
+
+private:
+};
+
+#endif /*VTKINFOTEXTIMAGEINTERACTORPLANE2D_H_*/
--- /dev/null
+
+#include "vtkInteractorScrollZ.h"
+#include "wxVtk2DBaseView.h"
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+
+vtkInteractorScrollZ::vtkInteractorScrollZ()
+{
+ _stateFordware=false;
+}
+//---------------------------------------------------------------------------
+vtkInteractorScrollZ::~vtkInteractorScrollZ()
+{
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorScrollZ::OnRightButtonDown()
+{
+ vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
+ if ((interactor->GetControlKey()==0) && (interactor->GetShiftKey()==0) ){
+ _stateFordware = true;
+ _fordwareX = interactor->GetEventPosition()[0];
+ _fordwareY = interactor->GetEventPosition()[1];
+ /*JCP 14/05/2009
+ _sliceZ = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetActualSlice();
+ */
+ _sliceZ = ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetActualSlice();
+ }
+ return true;
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorScrollZ::OnRightButtonUp()
+{
+ _stateFordware=false;
+ return true;
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorScrollZ::OnMouseMove ()
+{
+ if (_stateFordware==true){
+ //int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0]; // JPRx
+ int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ int delta = (_fordwareY - fy)/3;
+ /*JCP 14/05/2009
+ _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->SetActualSlice( _sliceZ + delta);
+ */
+ ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->SetActualSlice( _sliceZ + delta);
+
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+
+ // wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);
+ // _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent);
+
+ //_wxvtk2Dbaseview->Refresh();
+ }
+ return true;
+}
+
+
+
--- /dev/null
+#ifndef VTKINTERACTORSCROLLZ_H_
+#define VTKINTERACTORSCROLLZ_H_
+
+#include "InteractorStyleMaracas.h"
+
+class vtkInteractorScrollZ : public InteractorStyleMaracas {
+public:
+ vtkInteractorScrollZ();
+ virtual ~vtkInteractorScrollZ();
+
+ virtual bool OnMouseMove();
+ virtual bool OnRightButtonDown();
+ virtual bool OnRightButtonUp();
+
+
+
+protected:
+ bool _stateFordware;
+ int _fordwareX;
+ int _fordwareY;
+ int _sliceZ;
+
+private:
+
+};
+
+
+#endif /*VTKINTERACTORSCROLLZ_H_*/
--- /dev/null
+#include "vtkInteractorStyle3DView.h"
+#include "matrix.h"
+#include "vtkPointPicker.h"
+#include "UtilVtk3DGeometriSelection.h"
+
+vtkInteractorStyle3DView::vtkInteractorStyle3DView()
+{
+}
+//---------------------------------------------------------------------------
+vtkInteractorStyle3DView::~vtkInteractorStyle3DView()
+{
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorStyle3DView::OnLeftDClick()
+{
+ SelectMarchibCubePoint();
+ return true;
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorStyle3DView::SelectMarchibCubePoint()
+{
+ bool ok=false;
+ gtm::TVector< double > pO( 3 ), pF( 3 ), pp( 3 ), cp( 3 );
+ gtm::TVector< double > xc( 3 );
+ gtm::TVector< double > x1( 3 ), n1( 3 );
+ gtm::TVector< double > x2( 3 ), n2( 3 );
+
+ double pickPoint[ 3 ], cameraPos[ 3 ];
+ int eventrwi[2];
+ vtkPointPicker* picker = vtkPointPicker::New( );
+ eventrwi[0]= _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ eventrwi[1]= _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ vtkRenderer *pRenderer = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetRenderer();
+ picker->Pick( eventrwi[0], eventrwi[1], 0.0, pRenderer );
+ pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
+ picker->GetPickPosition( pickPoint );
+ picker->Delete( );
+
+ pp( 0 ) = pickPoint[ 0 ]; pp( 1 ) = pickPoint[ 1 ]; pp( 2 ) = pickPoint[ 2 ];
+ cp( 0 ) = cameraPos[ 0 ]; cp( 1 ) = cameraPos[ 1 ]; cp( 2 ) = cameraPos[ 2 ];
+
+
+//EED 27 sep 2006 (1/2)
+// wxVtkMPR3DView *wxvtkmpr3Dview = (wxVtkMPR3DView *)_vtkInteractorStyleBaseView->GetWxVtk3DBaseView();
+// double spc[3];
+// wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetSpacing(spc);
+
+
+ vtkImageData *imageData = GetWxVtkMPR3DView()->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+ int dim[3];
+ double spc[3];
+ imageData->GetDimensions(dim);
+ imageData->GetSpacing(spc);
+
+
+ vtkMarchingCubes *mcubes = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetMCubes(0);
+
+
+ UtilVtk3DGeometriSelection utilVtk3DGeometriSelection;
+ utilVtk3DGeometriSelection.SetDimentions(dim[0],dim[1],dim[2]);
+
+ utilVtk3DGeometriSelection.SetMarchingCube(mcubes);
+
+ double fac;
+ fac = GTM_MAX( dim[0], dim[2] );
+
+
+ if( utilVtk3DGeometriSelection.FindCubePointsFromPoints(
+ pO.GetAnsiRef( ), pF.GetAnsiRef( ),
+ pp.GetAnsiRef( ), cp.GetAnsiRef( ) ) )
+ {
+
+ if( utilVtk3DGeometriSelection.GetPointAndNormalIntersection(
+ x1.GetAnsiRef( ), n1.GetAnsiRef( ),
+ pO.GetAnsiRef( ), pF.GetAnsiRef( ) ) )
+ {
+ if( utilVtk3DGeometriSelection.GetPointAndNormalIntersection(
+ x2.GetAnsiRef( ), n2.GetAnsiRef( ),
+ ( x1 - n1 ).GetAnsiRef( ), ( x1 - ( n1 * fac ) ).GetAnsiRef( ) ) )
+ {
+ xc = ( x2 + x1 ) * 0.5;
+//EED 27 sep 2006 (2/2)
+ this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX(xc(0)/spc[0]);
+ this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY(xc(1)/spc[1]);
+ this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ(xc(2)/spc[2]);
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ this->_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ ok=true;
+ }
+ }
+ }
+
+
+ return ok;
+}
+//-------------------------------------------------------------------
+void vtkInteractorStyle3DView::SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview )
+{
+ _wxvtkmpr3Dview = wxvtkmpr3Dview;
+}
+//-------------------------------------------------------------------
+wxVtkMPR3DView *vtkInteractorStyle3DView::GetWxVtkMPR3DView()
+{
+ return _wxvtkmpr3Dview;
+}
+//-------------------------------------------------------------------
+wxVtkClipping3DView *vtkInteractorStyle3DView::GetWxVtkClipping3DView()
+{
+ return _wxvtkclipping3Dview;
+}
+//-------------------------------------------------------------------
+void vtkInteractorStyle3DView::SetWxVtkClipping3DView( wxVtkClipping3DView *wxvtkclipping3Dview)
+{
+ _wxvtkclipping3Dview = wxvtkclipping3Dview;
+}
+
--- /dev/null
+#ifndef VTKINTERACTORSTYLE3DVIEW_H_
+#define VTKINTERACTORSTYLE3DVIEW_H_
+
+#include "InteractorStyleMaracas.h"
+#include "wxVtkMPR3DView.h"
+#include "wxVtkClipping3DView.h"
+
+class vtkInteractorStyle3DView : public InteractorStyleMaracas
+{
+public:
+ vtkInteractorStyle3DView();
+ ~vtkInteractorStyle3DView();
+
+ virtual bool OnLeftDClick();
+ bool SelectMarchibCubePoint();
+
+
+ wxVtkMPR3DView *GetWxVtkMPR3DView();
+ void SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview );
+
+ wxVtkClipping3DView *GetWxVtkClipping3DView();
+ void SetWxVtkClipping3DView( wxVtkClipping3DView *wxvtkclipping3Dview);
+
+protected:
+private:
+ wxVtkMPR3DView *_wxvtkmpr3Dview;
+ wxVtkClipping3DView *_wxvtkclipping3Dview;
+};
+
+
+#endif /*VTKINTERACTORSTYLE3DVIEW_H_*/
--- /dev/null
+#include "vtkInteractorStyleBaseView.h"
+
+#include "wxVtk3DBaseView.h"
+#include "wxVtk2DBaseView.h"
+
+#include "vtkObjectFactory.h"
+
+#include "InteractorStyleMaracas.h"
+
+vtkStandardNewMacro(vtkInteractorStyleBaseView);
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+
+vtkInteractorStyleBaseView::vtkInteractorStyleBaseView()
+{
+ _refresh_waiting = false;
+ _parent_refresh_waiting = false;
+ _blockRefresh = false;
+}
+//---------------------------------------------------------------------------
+vtkInteractorStyleBaseView::~vtkInteractorStyleBaseView()
+{
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnMouseMove() // virtual
+{
+ CallLstInteractorStyleMaracas(3);
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnLeftButtonDown() // virtual
+{
+ CallLstInteractorStyleMaracas(4);
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnLeftButtonUp() // virtual
+{
+ CallLstInteractorStyleMaracas(5);
+}
+
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnLeftDClick() // virtual
+{
+ CallLstInteractorStyleMaracas( 11 );
+}
+
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnMiddleButtonDown() // virtual
+{
+ CallLstInteractorStyleMaracas(6);
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnMiddleButtonUp() // virtual
+{
+ CallLstInteractorStyleMaracas(7);
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnMiddleDClick() // virtual
+{
+ CallLstInteractorStyleMaracas( 13 );
+}
+
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnRightButtonDown() // virtual
+{
+ CallLstInteractorStyleMaracas(1);
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnRightButtonUp() // virtual
+{
+ CallLstInteractorStyleMaracas(2);
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnRightDClick() // virtual
+{
+ CallLstInteractorStyleMaracas( 12 );
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnMouseWheel() // virtual
+{
+ CallLstInteractorStyleMaracas( 14 );
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::AddInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas)
+{
+ interactorStyleMaracas->SetVtkInteractorStyleBaseView(this);
+ _lstInteractorStyleMaracas.push_back(interactorStyleMaracas);
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::RemoveInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas)
+{
+ interactorStyleMaracas->RemoveVtkInteractorStyleBaseView();
+ int i, size = _lstInteractorStyleMaracas.size();
+ std::vector< InteractorStyleMaracas* >::iterator iter = _lstInteractorStyleMaracas.begin();
+ bool removed = false;
+ for (i=0; !removed && i<size; i++)
+ {
+ if ( _lstInteractorStyleMaracas[i] == interactorStyleMaracas )
+ {
+ _lstInteractorStyleMaracas.erase(iter);
+ removed = true;
+ }
+ iter++;
+ }
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::InsertInteractorStyleMaracas(int pos, InteractorStyleMaracas* interactorStyleMaracas)
+{
+ interactorStyleMaracas->SetVtkInteractorStyleBaseView(this);
+ _lstInteractorStyleMaracas.insert(_lstInteractorStyleMaracas.begin()+pos,interactorStyleMaracas);
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas(int type)
+{
+
+ InteractorStyleMaracas *intStyMar;
+
+ int i,size=_lstInteractorStyleMaracas.size();
+
+//EED Borrame
+//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
+//fprintf(ff,"EED vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas \n" );
+//for (i=0;i<size;i++)
+//{
+//fprintf(ff," %p\n" , _lstInteractorStyleMaracas[i] );
+//}
+//fclose(ff);
+
+
+
+ for (i=0;i<size;i++)
+ {
+ intStyMar = _lstInteractorStyleMaracas[i];
+ if (intStyMar->GetActive()==true){
+ if (type ==1)
+ { // OnRightButtonDown
+ if (intStyMar->OnRightButtonDown()==false)
+ {
+ i=size;
+ }
+ }
+ if (type ==2)
+ { // OnRightButtonUp
+ if (intStyMar->OnRightButtonUp()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==3)
+ { // OnMouseMouve
+ if (intStyMar->OnMouseMove()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==4)
+ { // OnLeftButtonDown
+ if (intStyMar->OnLeftButtonDown()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==5)
+ { // OnLeftButtonUp
+ if (intStyMar->OnLeftButtonUp()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==6)
+ { // OnMiddleButtonDown
+ if (intStyMar->OnMiddleButtonDown()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==7)
+ { // OnMiddleButtonUp
+ if (intStyMar->OnMiddleButtonUp()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==10)
+ { // OnMiddleButtonUp
+ if (intStyMar->OnChar()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==11)
+ { // OnLeftDClick
+ if (intStyMar->OnLeftDClick()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==12)
+ { // OnRightDClick
+ if (intStyMar->OnRightDClick()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==13)
+ { // OnMiddleDClick
+ if (intStyMar-> OnMiddleDClick()==false)
+ {
+ i=size;
+ }
+ }
+ if (type==14)
+ { // OnMouseWheel
+ if (intStyMar->OnMouseWheel()==false)
+ {
+ i=size;
+ }
+ }
+ } // if active
+ } // for
+
+ EvaluateToRefresh();
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::OnChar() // virtual
+{
+// char a=GetInteractor()->GetKeyCode();
+ CallLstInteractorStyleMaracas(10);
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::TransformCoordinate(double &X, double &Y, double &Z)
+{
+ vtkImageViewer2 *imageViewer = ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2();
+
+ imageViewer->GetRenderer()->SetDisplayPoint((int)X, (int)Y, (int)Z);
+ imageViewer->GetRenderer()->DisplayToWorld();
+ double fP[4];
+ imageViewer->GetRenderer()->GetWorldPoint( fP );
+
+ if ( fP[3] ){
+ fP[0] /= fP[3];
+ fP[1] /= fP[3];
+ fP[2] /= fP[3];
+ }
+
+// EEDx5
+ ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->TransformCoordinate_spacing_ViewToModel(fP[0],fP[1],fP[2]);
+
+ X=fP[0];
+ Y=fP[1];
+ Z=fP[2];
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::SetwxVtkBaseView(wxVtkBaseView *wxvtkbaseview)
+{
+ _wxvtkbaseview = wxvtkbaseview;
+}
+//---------------------------------------------------------------------------
+/*JCP 13/05/2009
+wxVtk2DBaseView* vtkInteractorStyleBaseView::GetWxVtk2DBaseView()
+{
+ return (wxVtk2DBaseView*)_wxvtkbaseview;
+}
+//---------------------------------------------------------------------------
+wxVtk3DBaseView* vtkInteractorStyleBaseView::GetWxVtk3DBaseView()
+{
+ return (wxVtk3DBaseView*)_wxvtkbaseview;
+}JCP 13/05/2009*/
+wxVtkBaseView* vtkInteractorStyleBaseView::GetWxVtk2DBaseView()
+{
+ return _wxvtkbaseview;
+}
+//---------------------------------------------------------------------------
+wxVtkBaseView* vtkInteractorStyleBaseView::GetWxVtk3DBaseView()
+{
+ return _wxvtkbaseview;
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::SetActiveAllInteractors(bool ok)
+{
+ InteractorStyleMaracas *intStyMar;
+ int i,size=_lstInteractorStyleMaracas.size();
+ for (i=0;i<size;i++)
+ {
+ intStyMar = _lstInteractorStyleMaracas[i];
+ intStyMar->SetActive(ok);
+ }
+
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::SetRefresh_waiting()
+{
+ _refresh_waiting=true;
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorStyleBaseView::GetRefresh_waiting()
+{
+ return _refresh_waiting;
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::SetParent_refresh_waiting()
+{
+ _parent_refresh_waiting=true;
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorStyleBaseView::GetParent_refresh_waiting()
+{
+ return _parent_refresh_waiting;
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::EvaluateToRefresh()
+{
+
+ if ( _blockRefresh==false )
+ {
+ if ( (_refresh_waiting==true) && (_parent_refresh_waiting==false))
+ {
+ _refresh_waiting = false;
+ this->_wxvtkbaseview->Refresh();
+ }
+ if (_parent_refresh_waiting==true)
+ {
+ _parent_refresh_waiting = false;
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ this->_wxvtkbaseview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ }
+ }
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::BlockRefresh()
+{
+ _blockRefresh=true;
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView::UnBlockRefresh()
+{
+ _blockRefresh=false;
+}
\ No newline at end of file
--- /dev/null
+#ifndef VTKINTERACTORSTYLEBASEVIEW_H_
+#define VTKINTERACTORSTYLEBASEVIEW_H_
+
+
+#include "wxVtkBaseView.h"
+
+
+//class InteractorStyleMaracas;
+//#include "InteractorStyleMaracas.h"
+class InteractorStyleMaracas;
+
+
+class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView : public vtkInteractorStyleImage
+{
+public:
+ vtkInteractorStyleBaseView();
+ ~vtkInteractorStyleBaseView();
+ static vtkInteractorStyleBaseView *New();
+ virtual void OnChar();
+ virtual void OnMouseMove();
+ virtual void OnLeftButtonDown();
+ virtual void OnLeftButtonUp();
+ virtual void OnMiddleButtonDown();
+ virtual void OnMiddleButtonUp();
+ virtual void OnRightButtonDown();
+ virtual void OnRightButtonUp();
+
+ virtual void OnLeftDClick();
+ virtual void OnRightDClick();
+ virtual void OnMiddleDClick();
+ virtual void OnMouseWheel();
+
+ virtual void TransformCoordinate(double &X, double &Y, double &Z);
+
+ void AddInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
+ void RemoveInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
+ void InsertInteractorStyleMaracas(int pos, InteractorStyleMaracas* interactorStyleMaracas);
+ void CallLstInteractorStyleMaracas(int type);
+//JCP 13/05/2009
+ //wxVtk2DBaseView *GetWxVtk2DBaseView();
+ //wxVtk3DBaseView *GetWxVtk3DBaseView();
+ wxVtkBaseView *GetWxVtk2DBaseView();
+ wxVtkBaseView *GetWxVtk3DBaseView();
+//JCP 13/05/2009
+ void SetwxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
+ void SetActiveAllInteractors(bool ok);
+
+ void SetRefresh_waiting();
+ void SetParent_refresh_waiting();
+
+ bool GetRefresh_waiting();
+ bool GetParent_refresh_waiting();
+
+
+ void EvaluateToRefresh();
+ void BlockRefresh();
+ void UnBlockRefresh();
+
+protected:
+ std::vector< InteractorStyleMaracas* > _lstInteractorStyleMaracas;
+
+private:
+ bool _blockRefresh;
+ bool _refresh_waiting;
+ bool _parent_refresh_waiting;
+ wxVtkBaseView *_wxvtkbaseview;
+};
+
+#endif /*VTKINTERACTORSTYLEBASEVIEW_H_*/
--- /dev/null
+
+
+#include "vtkInteractorStyleBaseView2D.h"
+#include <vtkObjectFactory.h>
+
+vtkStandardNewMacro(vtkInteractorStyleBaseView2D);
+
+//---------------------------------------------------------------------------
+vtkInteractorStyleBaseView2D::vtkInteractorStyleBaseView2D()
+{
+ _manualinteractorwindowlevel= new manualInteractorWindowLevel();
+ AddInteractorStyleMaracas( _manualinteractorwindowlevel );
+
+ _vtkInteractorScrollZ = new vtkInteractorScrollZ();
+ AddInteractorStyleMaracas(_vtkInteractorScrollZ);
+
+}
+//---------------------------------------------------------------------------
+vtkInteractorStyleBaseView2D::~vtkInteractorStyleBaseView2D()
+{
+}
+
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView2D::OnRightButtonDown() // virtual
+{
+ vtkInteractorStyleBaseView::OnRightButtonDown();
+
+ if ((GetInteractor()->GetControlKey()==1) && (GetInteractor()->GetShiftKey()==0) ){
+ this->vtkInteractorStyleImage::OnRightButtonDown();
+ }
+
+}
+
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView2D::OnRightButtonUp() // virtual
+{
+ vtkInteractorStyleBaseView::OnRightButtonUp();
+ this->vtkInteractorStyleImage::OnRightButtonUp();
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView2D::OnMouseMove () // virtual
+{
+ vtkInteractorStyleBaseView::OnMouseMove();
+ this->vtkInteractorStyleImage::OnMouseMove();
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView2D::OnLeftButtonDown() // virtual
+{
+ vtkInteractorStyleBaseView::OnLeftButtonDown();
+
+ if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) )
+ {
+ this->vtkInteractorStyleImage::OnLeftButtonDown();
+ }
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView2D::OnLeftButtonUp () // virtual
+{
+ vtkInteractorStyleBaseView::OnLeftButtonUp();
+
+ this->vtkInteractorStyleImage::OnLeftButtonUp();
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView2D::OnMiddleButtonDown () // virtual
+{
+ vtkInteractorStyleBaseView::OnMiddleButtonDown();
+
+ if ((GetInteractor()->GetControlKey()==1) || (GetInteractor()->GetShiftKey()==1) )
+ {
+ this->vtkInteractorStyleImage::OnLeftButtonDown();
+ }
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView2D::OnMiddleButtonUp () // virtual
+{
+ vtkInteractorStyleBaseView::OnMiddleButtonUp();
+
+ if ((GetInteractor()->GetControlKey()==1) || (GetInteractor()->GetShiftKey()==1) )
+ {
+ this->vtkInteractorStyleImage::OnLeftButtonUp();
+ }
+}
+
--- /dev/null
+#ifndef VTKINTERACTORSTYLEBASEVIEW2D_H_
+#define VTKINTERACTORSTYLEBASEVIEW2D_H_
+
+#include "vtkInteractorScrollZ.h"
+
+#include "manualInteractorWindowLevel.h"
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView2D : public vtkInteractorStyleBaseView{
+public:
+ vtkInteractorStyleBaseView2D();
+ ~vtkInteractorStyleBaseView2D();
+ static vtkInteractorStyleBaseView2D *New();
+ virtual void OnMouseMove();
+ virtual void OnLeftButtonDown();
+ virtual void OnLeftButtonUp();
+ virtual void OnMiddleButtonDown();
+ virtual void OnMiddleButtonUp();
+ virtual void OnRightButtonDown();
+ virtual void OnRightButtonUp();
+
+
+protected:
+
+private:
+ manualInteractorWindowLevel *_manualinteractorwindowlevel;
+ vtkInteractorScrollZ *_vtkInteractorScrollZ;
+
+};
+
+
+#endif /*VTKINTERACTORSTYLEBASEVIEW2D_H_*/
--- /dev/null
+
+#include "vtkInteractorStyleBaseView3D.h"
+
+#include "vtkObjectFactory.h"
+
+vtkStandardNewMacro(vtkInteractorStyleBaseView3D);
+
+//---------------------------------------------------------------------------
+vtkInteractorStyleBaseView3D::vtkInteractorStyleBaseView3D(){
+}
+//---------------------------------------------------------------------------
+vtkInteractorStyleBaseView3D::~vtkInteractorStyleBaseView3D(){
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView3D::OnRightButtonDown ()
+{
+ vtkInteractorStyleBaseView::OnRightButtonDown();
+
+/*
+ if (GetInteractor()->GetControlKey()==1 ){
+ this->vtkInteractorStyleTrackballCamera::OnRightButtonDown();
+ }
+*/
+ this->FindPokedRenderer(this->Interactor->GetEventPosition()[0],
+ this->Interactor->GetEventPosition()[1]);
+
+ if (this->CurrentRenderer == NULL)
+ {
+ return;
+ }
+
+ if (this->Interactor->GetControlKey()) {
+ this->StartDolly();
+ }
+
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView3D::OnRightButtonUp ()
+{
+ vtkInteractorStyleBaseView::OnRightButtonUp();
+
+/*
+ if (GetInteractor()->GetControlKey()==1 ){
+ this->vtkInteractorStyleTrackballCamera::OnRightButtonUp();
+ }
+*/
+
+
+ switch (this->State)
+ {
+ case VTKIS_DOLLY:
+ this->EndDolly();
+ break;
+ }
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView3D::OnMouseMove ()
+{
+ vtkInteractorStyleBaseView::OnMouseMove();
+
+// this->vtkInteractorStyleTrackballCamera::OnMouseMove();
+
+ // int x = this->Interactor->GetEventPosition()[0]; // JPRx
+ // int y = this->Interactor->GetEventPosition()[1]; // JPRx
+
+
+ // vtkRenderWindowInteractor *rwi = this->Interactor;
+
+ // int lx = rwi->GetLastEventPosition()[0]; // JPRx
+ // int ly = rwi->GetLastEventPosition()[1]; // JPRx
+ // int dx = rwi->GetEventPosition()[0] ; // JPRx
+ // int dy = rwi->GetEventPosition()[1] ; // JPRx
+
+
+ switch (this->State)
+ {
+ case VTKIS_ROTATE:
+ // this->FindPokedRenderer(x, y);
+ this->Rotate();
+ // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
+ break;
+
+ case VTKIS_PAN:
+ // this->FindPokedRenderer(x, y);
+ this->Pan();
+ // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
+ break;
+
+ case VTKIS_DOLLY:
+ // this->FindPokedRenderer(x, y);
+ this->Dolly();
+ // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
+ break;
+
+ case VTKIS_SPIN:
+ // this->FindPokedRenderer(x, y);
+ this->Spin();
+ // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
+ break;
+ }
+
+
+
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView3D::OnLeftButtonDown ()
+{
+ vtkInteractorStyleBaseView::OnLeftButtonDown();
+/*
+ if (GetInteractor()->GetControlKey()==1 ){
+ this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
+ } else {
+ this->vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
+ }
+*/
+
+
+ this->FindPokedRenderer(this->Interactor->GetEventPosition()[0],
+ this->Interactor->GetEventPosition()[1]);
+ if (this->CurrentRenderer == NULL)
+ {
+ return;
+ }
+
+ if (this->Interactor->GetControlKey()) {
+ this->StartPan();
+ } else {
+ this->StartRotate();
+ }
+
+ /*
+ if (this->Interactor->GetShiftKey())
+ {
+ if (this->Interactor->GetControlKey())
+ {
+ this->StartDolly();
+ }
+ else
+ {
+ this->StartPan();
+ }
+ }
+ else
+ {
+ if (this->Interactor->GetControlKey())
+ {
+ this->StartSpin();
+ }
+ else
+ {
+ this->StartRotate();
+ }
+ }
+*/
+
+
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView3D::OnLeftButtonUp ()
+{
+ vtkInteractorStyleBaseView::OnLeftButtonUp();
+
+/*
+ if (GetInteractor()->GetControlKey()==1 ){
+ this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
+ } else {
+ this->vtkInteractorStyleTrackballCamera::OnLeftButtonUp();
+ }
+*/
+ switch (this->State)
+ {
+
+ case VTKIS_PAN:
+ this->EndPan();
+ break;
+
+ case VTKIS_ROTATE:
+ this->EndRotate();
+ break;
+ }
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView3D::OnMiddleButtonDown ()
+{
+ vtkInteractorStyleBaseView::OnMiddleButtonDown();
+ // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
+}
+//---------------------------------------------------------------------------
+void vtkInteractorStyleBaseView3D::OnMiddleButtonUp ()
+{
+ vtkInteractorStyleBaseView::OnMiddleButtonUp();
+
+ // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
+}
--- /dev/null
+#ifndef VTKINTERACTORSTYLEBASEVIEW3D_H_
+#define VTKINTERACTORSTYLEBASEVIEW3D_H_
+
+
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+#include "vtkInteractorStyleBaseView.h"
+
+class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView3D : public vtkInteractorStyleBaseView {
+public:
+ vtkInteractorStyleBaseView3D();
+ ~vtkInteractorStyleBaseView3D();
+ static vtkInteractorStyleBaseView3D *New();
+
+ virtual void OnMouseMove () ;
+ virtual void OnLeftButtonDown ();
+ virtual void OnLeftButtonUp () ;
+ virtual void OnMiddleButtonDown ();
+ virtual void OnMiddleButtonUp () ;
+ virtual void OnRightButtonDown () ;
+ virtual void OnRightButtonUp () ;
+
+private:
+
+};
+
+#endif /*VTKINTERACTORSTYLEBASEVIEW3D_H_*/
--- /dev/null
+#include "vtkInteractorStyleMPRView.h"
+
+#include "wxVtkMPR2DView.h"
+
+vtkInteractorStyleMPRView::vtkInteractorStyleMPRView()
+{
+ _stateMoveAxisX = false;
+ _stateMoveAxisY = false;
+ _stateMoveAxisZ = false;
+}
+//---------------------------------------------------------------------------
+vtkInteractorStyleMPRView::~vtkInteractorStyleMPRView()
+{
+}
+
+
+//---------------------------------------------------------------------------
+bool vtkInteractorStyleMPRView::OnLeftDClick () // virtual
+{
+ wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+ double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ double z = 1;
+ _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
+ wxvtkmpr2Dview->MoveX(x,y,z);
+ wxvtkmpr2Dview->MoveY(x,y,z);
+ wxvtkmpr2Dview->MoveZ(x,y,z);
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ wxCommandEvent newevent2(wxEVT_COMMAND_MENU_SELECTED,12122); // Doble click
+ wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent2);
+
+ return true;
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorStyleMPRView::OnLeftButtonDown ()
+{
+ wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+ double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ double z = 1;
+ //double xx = x; // JPRx
+ //double yy = y; // JPRx
+ _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
+
+/*EED Borrame
+ if ((_xBack==xx) && (_yBack==yy))
+ {
+ wxvtkmpr2Dview->MoveX(x,y,z);
+ wxvtkmpr2Dview->MoveY(x,y,z);
+ wxvtkmpr2Dview->MoveZ(x,y,z);
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ wxCommandEvent newevent2(wxEVT_COMMAND_MENU_SELECTED,12122); // Doble click
+ wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent2);
+ }
+
+ _xBack=xx;
+ _yBack=yy;
+*/
+
+ _stateMoveAxisX = wxvtkmpr2Dview->IfMouseTouchX(x,y,z);
+ _stateMoveAxisY = wxvtkmpr2Dview->IfMouseTouchY(x,y,z);
+ _stateMoveAxisZ = wxvtkmpr2Dview->IfMouseTouchZ(x,y,z);
+
+ return true;
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorStyleMPRView::OnLeftButtonUp ()
+{
+ if (_stateMoveAxisX==true)
+ {
+ _stateMoveAxisX=false;
+ }
+ if (_stateMoveAxisY==true)
+ {
+ _stateMoveAxisY=false;
+ }
+ if (_stateMoveAxisZ==true)
+ {
+ _stateMoveAxisZ=false;
+ }
+ return true;
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorStyleMPRView::OnMouseMove ()
+{
+ double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+
+ double z=1;
+ _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
+ wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+// wxvtkmpr2Dview->TransfromeCoordViewWorld(x,y,z);
+
+ wxvtkmpr2Dview->ChangeAxisColor(x,y,z);
+
+ if ((_stateMoveAxisX==true) || (_stateMoveAxisY==true) || (_stateMoveAxisZ==true) )
+ {
+ if (_stateMoveAxisX==true)
+ {
+ wxvtkmpr2Dview-> MoveX(x,y,z);
+ }
+ if (_stateMoveAxisY==true)
+ {
+ wxvtkmpr2Dview->MoveY(x,y,z);
+ }
+ if (_stateMoveAxisZ==true)
+ {
+ wxvtkmpr2Dview->MoveZ(x,y,z);
+ }
+
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+ }
+ return true;
+}
\ No newline at end of file
--- /dev/null
+#ifndef VTKINTERACTORSTYLEMPRVIEW_H_
+#define VTKINTERACTORSTYLEMPRVIEW_H_
+
+#include "InteractorStyleMaracas.h"
+
+class vtkInteractorStyleMPRView : public InteractorStyleMaracas
+{
+public:
+ vtkInteractorStyleMPRView();
+ ~vtkInteractorStyleMPRView();
+
+ virtual bool OnMouseMove();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnLeftButtonUp();
+ virtual bool OnLeftDClick();
+
+protected:
+/*EED Borrame
+ double _xBack;
+ double _yBack;
+*/
+ bool _stateMoveAxisX;
+ bool _stateMoveAxisY;
+ bool _stateMoveAxisZ;
+};
+
+#endif /*VTKINTERACTORSTYLEMPRVIEW_H_*/
--- /dev/null
+
+
+#include "vtkInteractorStylePlane2D.h"
+#include "vtkPlane2DView.h"
+
+vtkInteractorStylePlane2D::vtkInteractorStylePlane2D()
+{
+ _stateRotate=false;
+}
+//---------------------------------------------------------------------------
+vtkInteractorStylePlane2D::~vtkInteractorStylePlane2D()
+{
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorStylePlane2D::GetStateRotate()
+{
+ return _stateRotate;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorStylePlane2D::OnLeftButtonDown() // vitual
+{
+ _stateRotate = true;
+ _fordwareX = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+ vtkplane2Dview->RotationStart();
+
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorStylePlane2D::OnLeftButtonUp() // virtual
+{
+ if (_stateRotate==true)
+ {
+ _stateRotate = false;
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+ vtkplane2Dview->ResetBack();
+// this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+ }
+
+ return true;
+}
+
+//---------------------------------------------------------------------------
+bool vtkInteractorStylePlane2D::OnRightButtonUp() // virtual
+{
+ if (_stateRotate==true){
+ //vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()); // JPRx
+
+// EED Borrame
+// vtkplane2Dview->RotationEnd();
+
+ _stateRotate = false;
+ }
+
+ return true;
+}
+//---------------------------------------------------------------------------
+bool vtkInteractorStylePlane2D::OnMouseMove () // virtual
+{
+ bool ok_v, ok_ang;
+ if (_stateRotate==true){
+ ok_v=false;
+ ok_ang=false;
+ if (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==1)
+ {
+ ok_v=true;
+ }
+ if (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==1)
+ {
+ ok_ang=true;
+ }
+ int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+ vtkplane2Dview->RotationDrag( fx - _fordwareX , fy - _fordwareY , ok_v , ok_ang);
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+ }
+ return true;
+}
+//-------------------------------------------------------------------
+bool vtkInteractorStylePlane2D::OnLeftDClick() // virtual
+{
+ int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ double xx=fx;
+ double yy=fy;
+ double zz=0;
+
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+ vtkMPRBaseData *vtkmprbasedata = vtkplane2Dview->GetVtkmprbasedata();
+
+ vtkplane2Dview->TransfromeCoordViewWorld2(xx,yy,zz);
+
+ vtkmprbasedata->SetX( xx );
+ vtkmprbasedata->SetY( yy );
+ vtkmprbasedata->SetZ( zz );
+ this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
+
+ return true;
+}
\ No newline at end of file
--- /dev/null
+#ifndef VTKINTERACTORSTYLEPLANE2D_H_
+#define VTKINTERACTORSTYLEPLANE2D_H_
+
+#include "InteractorStyleMaracas.h"
+
+class vtkInteractorStylePlane2D : public InteractorStyleMaracas
+{
+public:
+ vtkInteractorStylePlane2D();
+ ~vtkInteractorStylePlane2D();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnLeftButtonUp();
+ virtual bool OnMouseMove();
+ virtual bool OnRightButtonUp();
+ virtual bool OnLeftDClick();
+ bool GetStateRotate();
+
+private:
+ bool _stateRotate;
+
+ int _fordwareX;
+ int _fordwareY;
+};
+
+#endif /*VTKINTERACTORSTYLEPLANE2D_H_*/
--- /dev/null
+
+#include "vtkInteractorStyleSphere.h"
+
+#include "wxSphereView.h"
+
+vtkInteractorStyleSphere::vtkInteractorStyleSphere()
+{
+ _stateRadio = false;
+ _stateRotate = false;
+}
+
+//---------------------------------------------------------------------------
+
+vtkInteractorStyleSphere::~vtkInteractorStyleSphere()
+{
+}
+
+
+//---------------------------------------------------------------------------
+
+bool vtkInteractorStyleSphere::OnRightButtonDown()
+{
+ if ((_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) && (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) )
+ {
+ _stateRadio = true;
+ //_fordwareX = this->Interactor->GetEventPosition()[0];
+ _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+
+ wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+
+ _radio = wxsphereview->GetRadio();
+ }
+
+ return true;
+}
+
+//---------------------------------------------------------------------------
+
+bool vtkInteractorStyleSphere::OnRightButtonUp()
+{
+ if (_stateRadio==true)
+ {
+ wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+ wxsphereview->SetDeltaVoxel(1);
+ double radio=wxsphereview->GetRadio();
+ wxsphereview->GetIdOfImage(radio+0.1);
+ wxsphereview->GetIdOfImage(radio+0.2);
+ wxsphereview->GetIdOfImage(radio-0.1);
+ wxsphereview->GetIdOfImage(radio-0.2);
+
+ wxsphereview->RefreshView();
+ _stateRadio = false;
+ }
+
+ return true;
+}
+//---------------------------------------------------------------------------
+
+bool vtkInteractorStyleSphere::OnLeftButtonDown()
+{
+ _stateRotate = true;
+ _fordwareX = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ return true;
+}
+
+
+//---------------------------------------------------------------------------
+
+bool vtkInteractorStyleSphere::OnLeftButtonUp()
+{
+ wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+ if (_stateRotate==true){
+ int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+
+ if ((_fordwareX==fx)&&(_fordwareY==fy)){
+ double x=fx,y=fy,z=1;
+ _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
+ wxsphereview->SetXYZtoParent(x,y);
+ wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);
+ wxsphereview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent);
+ } else {
+ wxsphereview->RotationEnd();
+ }
+ wxsphereview->RefreshView();
+ _stateRotate = false;
+ }
+
+ return true;
+}
+
+
+//---------------------------------------------------------------------------
+
+bool vtkInteractorStyleSphere::OnMouseMove ()
+{
+ wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
+ if (_stateRotate==true)
+ {
+ bool ok_v, ok_ang;
+ ok_v=false;
+ ok_ang=false;
+ if (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==1)
+ {
+ ok_v = true;
+ }
+ if (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==1)
+ {
+ ok_ang = true;
+ }
+ int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
+ int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ wxsphereview->RotationStart( fx - _fordwareX , -(fy - _fordwareY) , ok_v, ok_ang);
+ wxsphereview->RefreshView();
+ }
+ if (_stateRadio==true)
+ {
+ //int fx = this->Interactor->GetEventPosition()[0];
+ int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
+ double dif=(fy-_fordwareY) / 10.0;
+ wxsphereview->SetRadio( _radio + dif );
+ wxsphereview->SetDeltaVoxel(3);
+ wxsphereview->RefreshView();
+ }
+
+ return true;
+}
--- /dev/null
+#ifndef VTKINTERACTORSTYLESPHERE_H_
+#define VTKINTERACTORSTYLESPHERE_H_
+
+#include "InteractorStyleMaracas.h"
+
+class vtkInteractorStyleSphere : public InteractorStyleMaracas
+{
+public:
+ vtkInteractorStyleSphere();
+ ~vtkInteractorStyleSphere();
+ virtual bool OnLeftButtonUp();
+ virtual bool OnLeftButtonDown();
+ virtual bool OnMouseMove();
+ virtual bool OnRightButtonUp();
+ virtual bool OnRightButtonDown();
+
+private:
+ bool _stateRotate;
+ bool _stateRadio;
+ int _fordwareX;
+ int _fordwareY;
+
+ double _radio;
+};
+
+#endif /*VTKINTERACTORSTYLESPHERE_H_*/
--- /dev/null
+#ifndef VTKMPR3DDATAVIEWER_H_
+#define VTKMPR3DDATAVIEWER_H_
+
+#include "wxMPRBaseData.h"
+
+class creaMaracasVisu_EXPORT vtkMPR3DDataViewer {
+public:
+ vtkMPR3DDataViewer();
+ virtual ~vtkMPR3DDataViewer();
+ vtkImageActor* GetImageActor(int id);
+ vtkActor* GetOutlineActor();
+ virtual void Refresh();
+ virtual void Configure();
+ void SetVisiblePosition(int idPosition, bool visible);
+ bool GetVisiblePosition(int idPosition);
+ vtkImageActor* GetvtkActor_saggital();
+ vtkImageActor* GetvtkActor_axial();
+ vtkImageActor* GetvtkActor_coronal();
+ void SetPositionX(int pos);
+ void SetPositionY(int pos);
+ void SetPositionZ(int pos);
+ void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
+ vtkMPRBaseData* GetVtkMPRBaseData();
+
+ vtkColorTransferFunction *GetvtkColorTransferFunction();
+ std::vector<double > *GetctFunVectorPoint();
+ std::vector<double > *GetctFunVectorRed();
+ std::vector<double > *GetctFunVectorGreen();
+ std::vector<double > *GetctFunVectorBlue();
+
+private:
+
+ bool _visiblePosition[3];
+
+ // outline
+ vtkOutlineFilter *_outlineData;
+ vtkPolyDataMapper *_mapOutline;
+ vtkActor *_outline;
+
+ //
+ vtkColorTransferFunction *_ctfun;
+ std::vector<double> _ctFunVectorPoint;
+ std::vector<double> _ctFunVectorRed;
+ std::vector<double> _ctFunVectorGreen;
+ std::vector<double> _ctFunVectorBlue;
+
+// vtkLookupTable *_bwLut;
+// vtkLookupTable *_hueLut;
+// vtkLookupTable *_satLut;
+
+ vtkImageMapToColors *_saggitalColors;
+ vtkImageActor *_saggital;
+ vtkImageMapToColors *_axialColors;
+ vtkImageActor *_axial;
+ vtkImageMapToColors *_coronalColors;
+ vtkImageActor *_coronal;
+ vtkMPRBaseData *_vtkmprbasedata;
+
+
+};
+
+#endif /*VTKMPR3DDATAVIEWER_H_*/
--- /dev/null
+#include "vtkPlane2DView.h"
+
+#include "vtkCellArray.h"
+
+#include "vtkInteractorStyleBaseView2D.h"
+#include "vtkPointData.h"
+
+
+vtkPlane2DView::vtkPlane2DView( wxWindow *parent)
+: wxVtk2DBaseView(parent)
+{
+
+ _backX = -99999;
+ _backY = -99999;
+ _backZ = -99999;
+
+ _backOrient[0] = -99999;
+ _backOrient[1] = -99999;
+ _backOrient[2] = -99999;
+ _backOrient[3] = -99999;
+
+ _active = true;
+ _mip_visualization = true;
+ _mip_width = 2;
+
+ _transform1 = vtkTransform::New();
+ _transform2 = vtkTransform::New();
+ _transform1->Identity();
+ _transform2->Identity();
+
+ _sizeIma = 200;
+
+ _pSource = NULL;
+ _3Dslices = NULL;
+ _stPoints = NULL;
+ _change = NULL;
+ _imageResult = NULL;
+
+ // line horizontal
+ _pts = NULL;
+ _lineActor = NULL;
+ _lineMapper = NULL;
+ _pd = NULL;
+
+ _interactorstyleplane2D = false;
+}
+//-------------------------------------------------------------------
+vtkPlane2DView::~vtkPlane2DView()
+{
+ ResetPlane();
+
+ // Horizontal Line
+ if (_pts != NULL) { _pts -> Delete(); }
+ if (_lineActor != NULL) { _lineActor -> Delete(); }
+ if (_lineMapper != NULL) { _lineMapper -> Delete(); }
+ if (_pd != NULL) { _pd -> Delete(); }
+
+ _transform1 -> Delete();
+ _transform2 -> Delete();
+}
+
+//-------------------------------------------------------------------
+void vtkPlane2DView::ResetBack()
+{
+ _backX=-1;
+ _backY=-1;
+ _backZ=-1;
+ _backOrient[0]=-1;
+ _backOrient[1]=-1;
+ _backOrient[2]=-1;
+ _backOrient[3]=-1;
+}
+
+//-------------------------------------------------------------------
+void vtkPlane2DView::ResetPlane(){
+ if (_pSource !=NULL) { _pSource -> Delete(); }
+ if (_3Dslices !=NULL) { _3Dslices -> Delete(); }
+ if (_stPoints !=NULL) { _stPoints -> Delete(); }
+ if (_change !=NULL) { _change -> Delete(); }
+}
+//-------------------------------------------------------------------
+vtkMPRBaseData *vtkPlane2DView::GetVtkmprbasedata()
+{
+ return (vtkMPRBaseData*)GetVtkBaseData();
+}
+
+//-------------------------------------------------------------------
+void vtkPlane2DView::SetPSource(int sizeIma){
+ int dimIma = sizeIma;
+
+ double x = GetVtkmprbasedata()->GetX();
+ double y = GetVtkmprbasedata()->GetY();
+ double z = GetVtkmprbasedata()->GetZ();
+
+ double spc[3];
+ vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
+ imagedata->GetSpacing(spc);
+ x=x*spc[0];
+ y=y*spc[1];
+ z=z*spc[2];
+
+
+ vtkMPRBaseData *mprbasedata = (vtkMPRBaseData*)this->GetVtkBaseData();
+ vtkTransform *transform = mprbasedata->GetTransformOrientation();
+
+ double in[3]; // temp
+ double pA[3];
+ double pB[3];
+ in[0]=1; in[1]=0; in[2]=0;
+ transform->TransformPoint(in,_n);
+
+ in[0]=0; in[1]=dimIma-1; in[2] = 0;
+ transform->TransformPoint(in,pA);
+
+ in[0]=0; in[1]=0; in[2]=dimIma-1;
+ transform->TransformPoint(in,pB);
+
+ _pSource -> SetPoint1( pA );
+ _pSource -> SetPoint2( pB );
+
+ _pSource -> SetOrigin( 0 , 0 , 0 );
+ _pSource -> SetResolution( sizeIma-1 , sizeIma -1 );
+ _pSource -> Update();
+ _pSource -> SetCenter( x, y, z );
+ _pSource -> SetNormal( _n );
+ _pSource -> Update( );
+
+// EED Borrame
+// transform->Delete();
+
+}
+
+//-------------------------------------------------------------------
+void vtkPlane2DView::ExtractPlane()
+{
+
+ double x = GetVtkmprbasedata()->GetX();
+ double y = GetVtkmprbasedata()->GetY();
+ double z = GetVtkmprbasedata()->GetZ();
+
+ double spc[3];
+ vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
+ imagedata->GetSpacing(spc);
+ x=x*spc[0];
+ y=y*spc[1];
+ z=z*spc[2];
+
+ vtkTransform *transform = GetVtkmprbasedata()->GetTransformOrientation();
+ double orientation[4];
+ transform->GetOrientationWXYZ(orientation);
+
+ bool okOrientation=true;
+ if ((orientation[0]!=_backOrient[0]) || (orientation[1]!=_backOrient[1]) ||
+ (orientation[2]!=_backOrient[2]) || (orientation[3]!=_backOrient[3]))
+ {
+ okOrientation=false;
+ }
+
+ bool okPosicion=true;
+ if ( (x!=_backX) || (y!=_backY) || (z!=_backZ) )
+ {
+ okPosicion=false;
+ }
+
+ if ((okPosicion==false) || (okOrientation==false) ) {
+ if (_active==true){
+
+ bool ok = false;
+
+ if ( _mip_visualization==true )
+ {
+ if (_interactorstyleplane2D!=NULL)
+ {
+ if (_interactorstyleplane2D->GetStateRotate()==false )
+ {
+ ok=true;
+ }
+ }
+ }
+// ok=true;
+
+ if (ok==true)
+ {
+ Extract_MIP_PlaneVTK();
+ } else {
+ Extract_One_PlaneVTK();
+ } // ok
+
+ } // active
+ _backX=x;
+ _backY=y;
+ _backZ=z;
+ _backOrient[0]=orientation[0];
+ _backOrient[1]=orientation[1];
+ _backOrient[2]=orientation[2];
+ _backOrient[3]=orientation[3];
+ } //okPosition okOrientation
+}
+
+//-------------------------------------------------------------------
+
+void vtkPlane2DView::Extract_One_PlaneVTK()
+{
+ vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
+ SetPSource(_sizeIma);
+ _3Dslices -> SetInput( ( vtkDataSet* )_pSource->GetOutput( ) );
+ _3Dslices -> SetSource( imagedata );
+ _3Dslices -> Update( );
+ _stPoints -> GetPointData( )->SetScalars( _3Dslices->GetOutput()->GetPointData()->GetScalars() );
+ _stPoints -> SetDimensions( _sizeIma, _sizeIma, 1 );
+ _stPoints -> SetScalarType( imagedata->GetScalarType() );
+ _stPoints -> SetScalarTypeToShort();
+ _stPoints -> Update();
+// _change -> SetInput( _stPoints );
+// _change -> Update(); //important
+ _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _stPoints );
+// _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _change->GetOutput() );
+ // vtkImageActor *imageActor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor();
+}
+
+//-------------------------------------------------------------------
+
+void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ )
+{
+
+ int mipWidth;
+ double sp;
+ int sizeWidth = (_mip_width*2)+1 ;
+ int deltaPixel;
+ int iWidth,itmp,tmpSizeWith;
+
+ double spc[3];
+ vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
+ SetPSource(_sizeIma);
+ imagedata->GetSpacing(spc);
+
+ bool heightDefinition=false;
+ if (_mip_width<3)
+ {
+ heightDefinition=true;
+ }
+
+ if (heightDefinition==true)
+ {
+ mipWidth = _mip_width;
+ sp = spc[0];
+ deltaPixel = 1;
+ } else {
+ mipWidth = 2;
+ tmpSizeWith = (mipWidth*2) + 1;
+ sp = (spc[0]*sizeWidth)/tmpSizeWith;
+ sizeWidth = tmpSizeWith;
+ deltaPixel = 4;
+ }
+
+
+
+ std::vector< vtkProbeFilter* > slicesLST;
+
+ _pSource->Push( -mipWidth * sp );
+ _pSource->Update();
+
+ for ( iWidth=0 ; iWidth<sizeWidth ; iWidth++ )
+ {
+ vtkProbeFilter *slice = vtkProbeFilter::New();
+ slice -> SetInput( ( vtkDataSet* )_pSource->GetOutput( ) );
+ slice -> SetSource( imagedata );
+ slice -> Update( );
+ slicesLST.push_back( slice );
+ _pSource->Push( sp );
+ }
+
+ if (_imageResult ==NULL)
+ {
+ _imageResult = vtkImageData::New();
+ _imageResult -> SetDimensions(_sizeIma,_sizeIma,1);
+ _imageResult -> SetSpacing(1,1,1);
+ _imageResult -> SetScalarType( imagedata->GetScalarType() );
+ _imageResult -> SetExtent(0,_sizeIma-1,0,_sizeIma-1,0,0);
+ _imageResult -> SetWholeExtent(0,_sizeIma-1,0,_sizeIma-1,0,0);
+ _imageResult -> AllocateScalars();
+ _imageResult -> Update();
+ }
+
+ unsigned short *pTemp;
+ unsigned short *pResult;
+ pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 );
+
+ int iPixels , sizePixels = _sizeIma*_sizeIma;
+ for(iPixels=0 ; iPixels<sizePixels ; iPixels=iPixels+deltaPixel)
+ {
+
+ pTemp = (unsigned short*)slicesLST[0]->GetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0);
+
+ pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 );
+ pResult[iPixels] = pTemp[iPixels];
+
+ for (iWidth=1;iWidth<sizeWidth;iWidth++)
+ {
+ pTemp = (unsigned short*)slicesLST[iWidth]->GetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0);
+
+ if (pResult[iPixels]< pTemp[iPixels])
+ {
+ pResult[iPixels] = pTemp[iPixels];
+ }
+ }
+
+ if (deltaPixel!=1)
+ {
+ for (itmp=1;itmp<deltaPixel;itmp++)
+ {
+ pResult[iPixels+itmp] = pResult[iPixels];
+ }
+ }
+
+ }
+
+ for (iWidth=0;iWidth<sizeWidth;iWidth++)
+ {
+ slicesLST[iWidth]->Delete();
+ }
+
+ _imageResult->Modified();
+ _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _imageResult );
+
+}
+
+//-------------------------------------------------------------------
+void vtkPlane2DView::Configure( )
+{
+ wxVtk2DBaseView::Configure(false);
+
+ HorizontalLine();
+// Borrame
+// CircleLine();
+
+ _pSource = vtkPlaneSource::New( );
+ _3Dslices = vtkProbeFilter::New( ) ;
+ _stPoints = vtkStructuredPoints::New( );
+ _change = vtkImageChangeInformation::New();
+
+ wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
+ ExtractPlane();
+// SetActive(false);
+ _imageViewer2XYZ -> GetVtkImageViewer2() -> SetupInteractor ( iren );
+
+ SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
+
+ _interactorstyleplane2D = new vtkInteractorStylePlane2D();
+ ((vtkInteractorStyleBaseView*)GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _interactorstyleplane2D );
+
+ vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
+
+ camera->SetViewUp ( 0 , 1 , 0 );
+ camera->SetPosition ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 10000 );
+
+ camera->SetFocalPoint ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 0 );
+ camera->SetClippingRange(0.01, 100000);
+ camera->ComputeViewPlaneNormal();
+ camera->SetParallelScale( _sizeIma/3.0 );
+
+ // text information over the graphic window
+ _vtkInfoTextImage = new vtkInfoTextImage();
+ _vtkInfoTextImageInteractorPlane2D = new vtkInfoTextImageInteractorPlane2D();
+ _vtkInfoTextImage->SetWxVtk2DBaseView(this);
+ _vtkInfoTextImage->SetMarImageData( GetVtkmprbasedata()->GetMarImageData() );
+ _vtkInfoTextImageInteractorPlane2D->SetModelVtkInfoTextImage(_vtkInfoTextImage);
+ _vtkInfoTextImage->Configure();
+ ((vtkInteractorStyleBaseView*)this->GetInteractorStyleBaseView())->AddInteractorStyleMaracas(_vtkInfoTextImageInteractorPlane2D);
+
+
+}
+
+//-------------------------------------------------------------------
+void vtkPlane2DView::HorizontalLine()
+{
+// Axe Horizontal
+ _pts = vtkPoints::New();
+ _pts->SetNumberOfPoints(2);
+ _pts->SetPoint(0, -1000 , -1000 , -1000 );
+ _pts->SetPoint(1, 1000 , 1000 , 1000 );
+ vtkCellArray *lines = vtkCellArray::New();
+ lines->InsertNextCell(2);
+ lines->InsertCellPoint(0);
+ lines->InsertCellPoint(1);
+ _pd = vtkPolyData::New();
+ _pd->SetPoints( _pts );
+ _pd->SetLines( lines );
+ lines->Delete(); //do not delete lines ??
+ _lineActor = vtkActor::New();
+ _lineMapper = vtkPolyDataMapper::New();
+ _lineMapper->SetInput(_pd);
+ _lineMapper->ImmediateModeRenderingOn();
+ _lineActor->SetMapper(_lineMapper);
+ _lineActor->GetProperty()->BackfaceCullingOn();
+ _lineActor->GetProperty()->SetDiffuseColor(0,0,1);
+ _lineActor->GetProperty()->SetLineWidth(2);
+ _lineActor->GetProperty()->SetOpacity(0);
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineActor );
+}
+
+//-------------------------------------------------------------------
+void vtkPlane2DView::RotationStart()
+{
+ vtkMPRBaseData *mprbasedata = (vtkMPRBaseData*)this->GetVtkBaseData();
+ vtkTransform *transform = mprbasedata->GetTransformOrientation();
+ _transform1->SetMatrix( transform->GetMatrix() );
+}
+//-------------------------------------------------------------------
+void vtkPlane2DView::RotationDrag(double vx, double vy, bool ok_v, bool ok_ang)
+{
+ if (ok_ang==false)
+ {
+ _ang =sqrt( vx*vx + vy*vy ) / 1.5;
+ }
+
+ if (ok_v==false){
+ _vxb=-vy;
+ _vyb=vx;
+ }
+ _transform2->Identity();
+ _transform2->RotateWXYZ(_ang,0,_vxb,_vyb);
+
+ vtkMPRBaseData *mprbasedata = (vtkMPRBaseData*)this->GetVtkBaseData();
+ vtkTransform *transform = vtkTransform::New();
+ transform->Identity();
+ transform->Concatenate(_transform1);
+ transform->Concatenate(_transform2);
+ mprbasedata->InitTransformOrientation(transform);
+ transform->Delete();
+
+ // Refresh Horizontal Line
+ _pts->SetPoint( 0 , (_sizeIma/2) - _vxb*2 , (_sizeIma/2) - _vyb*2 , 1 );
+ _pts->SetPoint( 1 , (_sizeIma/2) + _vxb*2 , (_sizeIma/2) + _vyb*2 , 1 );
+// RefreshCircleLine();
+}
+
+//-------------------------------------------------------------------
+void vtkPlane2DView::Refresh( )
+{
+ ExtractPlane();
+ wxVtkBaseView::Refresh();
+}
+//-------------------------------------------------------------------
+void vtkPlane2DView::SetImgSize( int imgSize )
+{
+ _sizeIma = imgSize;
+}
+//-------------------------------------------------------------------
+int vtkPlane2DView::GetImgSize()
+{
+ return _sizeIma;
+}
+//-------------------------------------------------------------------
+int vtkPlane2DView::GetActualSlice() // virtual
+{
+ _cx = GetVtkmprbasedata()->GetX();
+ _cy = GetVtkmprbasedata()->GetY();
+ _cz = GetVtkmprbasedata()->GetZ();
+ return 0;
+}
+
+//-------------------------------------------------------------------
+
+bool vtkPlane2DView::GetMipVisualization()
+{
+ return _mip_visualization;
+}
+
+//-------------------------------------------------------------------
+int vtkPlane2DView::GetMipWidth()
+{
+ return _mip_width;
+}
+
+//-------------------------------------------------------------------
+void vtkPlane2DView::SetActualSlice(int slice) // Virtual
+{
+ double dir=(double)slice/3.0;
+ GetVtkmprbasedata()->SetX( _cx + (_n[0]*dir) );
+ GetVtkmprbasedata()->SetY( _cy + (_n[1]*dir) );
+ GetVtkmprbasedata()->SetZ( _cz + (_n[2]*dir) );
+}
+//---------------------------------------------------------------------------
+vtkInteractorStylePlane2D *vtkPlane2DView::GetInteractorstyleplane2D()
+{
+ return this->_interactorstyleplane2D;
+}
+//---------------------------------------------------------------------------
+void vtkPlane2DView::SetActive(bool active)
+{
+ _active = active;
+}
+
+//---------------------------------------------------------------------------
+
+void vtkPlane2DView::SetMipVisualization(bool ok)
+{
+ _mip_visualization=ok;
+}
+
+//---------------------------------------------------------------------------
+
+void vtkPlane2DView::SetMipWidth(int value)
+{
+ _mip_width=value;
+}
+
+//---------------------------------------------------------------------------
+void vtkPlane2DView::SetVisibleLine(bool ok)
+{
+ double opacity;
+ if (ok==true)
+ {
+ opacity=1;
+ } else {
+ opacity=0;
+ }
+ _lineActor->GetProperty()->SetOpacity(opacity);
+}
+// ----------------------------------------------------------------------------
+void vtkPlane2DView::TransfromeCoordViewWorld2(double &X, double &Y, double &Z)
+{
+ double spc[3];
+ GetVtkmprbasedata()->GetImageData()->GetSpacing(spc);
+
+ double xx = X;
+ double yy = Y;
+ double zz = 0;
+
+ TransfromeCoordScreenToWorld(xx,yy,zz);
+
+
+ vtkTransform *transf1 = vtkTransform::New();
+ transf1->Identity();
+ vtkTransform *transf2 = GetVtkmprbasedata()->GetTransformOrientation();
+ transf1->Concatenate(transf2->GetMatrix());
+ double in[4], out[4];
+ double center = GetImgSize() / 2;
+ in[0] = 0;
+ in[1] = xx - center;
+ in[2] = yy - center;
+ in[3] = 0;
+
+ transf1->MultiplyPoint(in,out);
+ transf1->Delete();
+
+ X = out[0] + GetVtkmprbasedata()->GetX() ;
+ Y = out[1] + GetVtkmprbasedata()->GetY() ;
+ Z = out[2] + GetVtkmprbasedata()->GetZ() ;
+
+}
\ No newline at end of file
--- /dev/null
+#ifndef VTKPLANE2DVIEW_H_
+#define VTKPLANE2DVIEW_H_
+
+#include "vtkInteractorStylePlane2D.h"
+#include "vtkInfoTextImageInteractorPlane2D.h"
+#include "vtkInfoTextImage.h"
+
+#include "wxVtk2DBaseView.h"
+
+#include "vtkTransform.h"
+#include "vtkImageChangeInformation.h"
+#include "vtkStructuredPoints.h"
+#include "vtkPlaneSource.h"
+#include "vtkProbeFilter.h"
+
+class vtkPlane2DView : public wxVtk2DBaseView
+{
+public:
+ vtkPlane2DView(wxWindow *parent);
+ ~vtkPlane2DView();
+ void Configure();
+ void ExtractPlane();
+ int GetImgSize();
+ void SetImgSize( int imgSize );
+
+ void RotationStart();
+ void RotationDrag(double vx, double vy, bool ok_v, bool ok_ang);
+
+ virtual int GetActualSlice();
+ virtual void SetActualSlice(int slice);
+
+ virtual void Refresh( );
+
+ vtkMPRBaseData *GetVtkmprbasedata();
+ vtkInteractorStylePlane2D *GetInteractorstyleplane2D();
+
+ void SetActive(bool active);
+ void SetVisibleLine(bool ok);
+
+ void TransfromeCoordViewWorld2(double &X, double &Y, double &Z);
+
+ int GetMipWidth();
+ void SetMipWidth(int value);
+ bool GetMipVisualization();
+ void SetMipVisualization(bool ok);
+
+ void ResetBack();
+
+private:
+ bool _active;
+ int _mip_width;
+ bool _mip_visualization;
+
+ double _backX;
+ double _backY;
+ double _backZ;
+ double _backOrient[4];
+
+ double _ang;
+ double _vxb;
+ double _vyb;
+ double _n[3]; // Normal
+
+ double _cx;
+ double _cy;
+ double _cz;
+
+ int _sizeIma;
+
+ vtkImageData * _imageResult;
+
+ // Horizontal line
+ vtkPoints *_pts;
+ vtkActor *_lineActor;
+ vtkPolyDataMapper *_lineMapper;
+ vtkPolyData *_pd;
+
+ vtkProbeFilter *_3Dslices;
+ vtkPlaneSource *_pSource;
+ vtkStructuredPoints *_stPoints;
+ vtkImageChangeInformation *_change;
+ vtkTransform *_transform1;
+ vtkTransform *_transform2;
+
+ vtkInteractorStylePlane2D *_interactorstyleplane2D;
+
+ vtkInfoTextImage *_vtkInfoTextImage;
+ vtkInfoTextImageInteractorPlane2D *_vtkInfoTextImageInteractorPlane2D;
+
+
+ void SetPSource(int sizeIma);
+ void HorizontalLine();
+ void ResetPlane();
+ void Extract_One_PlaneVTK();
+ void Extract_MIP_PlaneVTK();
+
+protected:
+};
+
+#endif /*VTKPLANE2DVIEW_H_*/
--- /dev/null
+#include "vtkmyPWCallback_3DPointWidget.h"
+#include "vtkInteractorStyleBaseView.h"
+
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+void vtkmyPWCallback_3DPointWidget::Execute(vtkObject *caller, unsigned long, void*)
+{
+ double n[3];
+ double p[3];
+ double delta = 0.000000001;
+
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetInteractorStyleBaseView();
+
+ if (caller==_pointWidget)
+ {
+ _pointWidget->GetPosition(p);
+ }
+ if (caller==_planeWidget)
+ {
+ _planeWidget->GetCenter(p);
+ _planeWidget->GetNormal(n);
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetNormal(n[0],n[1],n[2]);
+ }
+
+ double spc[3];
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc);
+ p[0]=p[0]/spc[0];
+ p[1]=p[1]/spc[1];
+ p[2]=p[2]/spc[2];
+
+ // Orientation change
+ if ( (fabs(n[0]-_backNormal[0])>delta) || (fabs(n[1]-_backNormal[1])>delta) || (fabs(n[2]-_backNormal[2])>delta) )
+ {
+ _backNormal[0] = n[0];
+ _backNormal[1] = n[1];
+ _backNormal[2] = n[2];
+ isbv->SetParent_refresh_waiting();
+ }
+
+ // ----------
+
+ double tx = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
+ double ty = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
+ double tz = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
+
+ // Position Change
+ if ( (fabs(tx-p[0])>delta) || (fabs(ty-p[1])>delta) || (fabs(tz-p[2])>delta) )
+ {
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX( p[0] );
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY( p[1] );
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ( p[2] );
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetInteractorStyleBaseView();
+ isbv->BlockRefresh();
+ isbv->vtkInteractorStyleBaseView::OnLeftButtonDown();
+ isbv->SetParent_refresh_waiting();
+ isbv->vtkInteractorStyleBaseView::OnMouseMove();
+ isbv->UnBlockRefresh();
+ }
+ isbv->EvaluateToRefresh();
+}
+//-------------------------------------------------------------------
+void vtkmyPWCallback_3DPointWidget::SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview )
+{
+ _wxvtkmpr3Dview=wxvtkmpr3Dview;
+}
+//-------------------------------------------------------------------
+void vtkmyPWCallback_3DPointWidget::SetVtkPointWidget( vtkPointWidget *pointWidget )
+{
+ _pointWidget=pointWidget;
+}
+//-------------------------------------------------------------------
+void vtkmyPWCallback_3DPointWidget::SetVtkPlaneWidget( vtkPlaneWidget *planeWidget )
+{
+ _planeWidget=planeWidget;
+}
\ No newline at end of file
--- /dev/null
+#ifndef VTKMYPWCALLBACK_3DPOINTWIDGET_H_
+#define VTKMYPWCALLBACK_3DPOINTWIDGET_H_
+
+//#include "wxVtkMPR3DView.h"
+#include "vtkPlaneWidget.h"
+#include "vtkCommand.h"
+#include "vtkPointWidget.h"
+
+#include "wxVtkMPR3DView.h"
+
+class vtkmyPWCallback_3DPointWidget : public vtkCommand
+{
+public:
+ static vtkmyPWCallback_3DPointWidget *New()
+ { return new vtkmyPWCallback_3DPointWidget; }
+ virtual void Execute(vtkObject *caller, unsigned long, void*);
+ vtkmyPWCallback_3DPointWidget(){}
+ void SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview );
+ void SetVtkPointWidget( vtkPointWidget *pointWidget );
+ void SetVtkPlaneWidget( vtkPlaneWidget *planeWidget );
+private:
+
+ double _backNormal[3];
+ vtkPlaneWidget *_planeWidget;
+ vtkPointWidget *_pointWidget;
+ wxVtkMPR3DView *_wxvtkmpr3Dview;
+};
+
+
+#endif /*VTKMYPWCALLBACK_3DPOINTWIDGET_H_*/
int x = (int)(_vtkmprbasedata->GetX());
int y = (int)(_vtkmprbasedata->GetY());
int z = (int)(_vtkmprbasedata->GetZ());
+ std::cout<<" vtkMPR3DDataViewer::Refresh() x="<<x<<" y= "<<y<<" z= "<<z;
SetPositionX( x );
SetPositionY( y );
SetPositionZ( z );
//------------------------------------------------------------------
//------------------------------------------------------------------
-class creaMaracasVisu_EXPORT vtkBaseData {
-public:
- vtkBaseData();
- virtual ~vtkBaseData();
- vtkImageData* GetImageData();
- marImageData* GetMarImageData();
- void SetMarImageData(marImageData *marimagedata);
- virtual void Configure();
- double GetZ();
- void SetZ(double z);
-
- int GetT();
- void SetT(double t);
-
-protected:
- marImageData *_marImageData;
- double _z;
- int _t;
-};
-
+#include "vtkBaseData.h"
+#include "boxSurfaceObserver.h"
//------------------------------------------------------------------
//------------------------------------------------------------------
//------------------------------------------------------------------
//------------------------------------------------------------------
-class creaMaracasVisu_EXPORT vtkMPR3DDataViewer {
-public:
- vtkMPR3DDataViewer();
- virtual ~vtkMPR3DDataViewer();
- vtkImageActor* GetImageActor(int id);
- vtkActor* GetOutlineActor();
- virtual void Refresh();
- virtual void Configure();
- void SetVisiblePosition(int idPosition, bool visible);
- bool GetVisiblePosition(int idPosition);
- vtkImageActor* GetvtkActor_saggital();
- vtkImageActor* GetvtkActor_axial();
- vtkImageActor* GetvtkActor_coronal();
- void SetPositionX(int pos);
- void SetPositionY(int pos);
- void SetPositionZ(int pos);
- void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
- vtkMPRBaseData* GetVtkMPRBaseData();
-
- vtkColorTransferFunction *GetvtkColorTransferFunction();
- std::vector<double > *GetctFunVectorPoint();
- std::vector<double > *GetctFunVectorRed();
- std::vector<double > *GetctFunVectorGreen();
- std::vector<double > *GetctFunVectorBlue();
-
-private:
-
- bool _visiblePosition[3];
-
- // outline
- vtkOutlineFilter *_outlineData;
- vtkPolyDataMapper *_mapOutline;
- vtkActor *_outline;
-
- //
- vtkColorTransferFunction *_ctfun;
- std::vector<double> _ctFunVectorPoint;
- std::vector<double> _ctFunVectorRed;
- std::vector<double> _ctFunVectorGreen;
- std::vector<double> _ctFunVectorBlue;
-
-// vtkLookupTable *_bwLut;
-// vtkLookupTable *_hueLut;
-// vtkLookupTable *_satLut;
-
- vtkImageMapToColors *_saggitalColors;
- vtkImageActor *_saggital;
- vtkImageMapToColors *_axialColors;
- vtkImageActor *_axial;
- vtkImageMapToColors *_coronalColors;
- vtkImageActor *_coronal;
- vtkMPRBaseData *_vtkmprbasedata;
-
-
-};
//------------------------------------------------------------------
//------------------------------------------------------------------
-// Callback for the interaction
-class boxSurfaceObserver : public vtkCommand
-{
- public:
- vtkPlanes *_planes;
- vtkProp *_actor;
- vtkVolumeRayCastMapper *_vtkVolumeRayCastMapper;
-
- boxSurfaceObserver()
- {
- _vtkVolumeRayCastMapper = NULL;
- }
-
- virtual char const *GetClassName() const { return "boxSurfaceObserver";}
-
- static boxSurfaceObserver *New(){
- boxSurfaceObserver * result;
- result = new boxSurfaceObserver();
- return result;
- }
-
- virtual void Execute(vtkObject *wdg, unsigned long eventId, void* calldata) ;
- void SetPlanes(vtkPlanes *planes);
- void SetActor(vtkProp *actor);
- void SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper);
-};
-
-
//------------------------------------------------------------------
//------------------------------------------------------------------
//------------------------------------------------------------------
-class vtkClipping3DDataViewer {
-public:
- //----------------------
- //Constructo-Destructor
- //----------------------
- vtkClipping3DDataViewer();
- virtual ~vtkClipping3DDataViewer();
-
-// vtkImageActor* GetImageActor(int id);
- vtkActor* GetOutlineActor();
- vtkClipPolyData* GetTissueClipper(int id);
- vtkPolyDataMapper* GetTissueMapper(int id);
- vtkPlanes* GetTissuePlanes(int id);
- vtkStripper* GetTissueStripper(int id);
-// vtkGlyph3D* GetGlyph(int id);
- vtkLODActor* GetMaceActor(int id);
-
- vtkMarchingCubes *GetMCubes(int idTissue);
-
- virtual void Refresh();
- void RefreshSurface();
-
- virtual void Configure();
- void Configure_Tissue();
- void Configure_Volume();
-
- void SetIsovalue(int idTissue, int isoValue);
- double GetIsovalue(int idTissue);
-
- vtkVolume *GetVolumeActor();
- vtkVolumeRayCastMapper *GetVolumeMapper();
- vtkPlanes *GetVolumePlanes();
-
- void SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata);
- vtkMPRBaseData* GetVtkMPRBaseData();
-
- vtkActor *GetTissueActor(int id);
- void SetVisibleTissue(int idTissue, bool visible);
- bool GetVisibleTissue(int idTissue);
- bool GetVisibleVolume();
- void SetVisibleVolume(bool visibleVolume);
-
- void SetRepresentationType(int idTissue, bool representationType);
- bool GetRepresentationType(int idTissue);
-
- boxSurfaceObserver *GetObserverS(int idObserverS);
- boxSurfaceObserver *GetObserverV();
-
- //void ReadVolumeFunctions(char *namefile);
- void ReadVolumeFunctions();
- void ReadMeshVTK(char *namefile);
-
-
- //-------------------
- //Getters Vectors
- //-------------------
-
- std::vector<double>* GetGreyValuesTransferenceFVector();
- std::vector<double>* GetIntensityValuesTransferenceFVector();
- std::vector<double>* GetRedColorsOfColorTransferenceFVector();
- std::vector<double>* GetGreenColorsOfColorTransferenceFVector();
- std::vector<double>* GetBlueColorsOfColorTransferenceFVector();
- std::vector<double>* GetGreyValueColorsOfColorTransferenceFVector();
-
- //--------------------------------------
- //Getters transference function
- //and color of the transference function
- //---------------------------------------
- vtkPiecewiseFunction *GetTransferencefunction();
- vtkColorTransferFunction *GetColorTransferenceFunction();
-
-
-
-private:
-
- vtkMarchingCubes *_mCubes[ VTKMPRDATA_MAXTISSUE ];
- vtkStripper *_tissueStripper[ VTKMPRDATA_MAXTISSUE ];
- vtkPolyDataMapper *_tissueMapper[ VTKMPRDATA_MAXTISSUE ];
- vtkPlanes *_tissuePlanes[ VTKMPRDATA_MAXTISSUE ];
- vtkClipPolyData *_tissueClipper[ VTKMPRDATA_MAXTISSUE ];
-
- // outline
- vtkOutlineFilter *_outlineData;
- vtkPolyDataMapper *_mapOutline;
- vtkActor *_outline;
-
- /// Volume
- vtkPiecewiseFunction *_tfun;
- vtkColorTransferFunction *_ctfun;
- vtkVolumeRayCastCompositeFunction *_compositeFunction;
- vtkPlanes *_volumePlanes;
- vtkVolumeRayCastMapper *_volumeMapper;
- vtkVolumeProperty *_volumeProperty;
- vtkVolume *_newvol;
-
- vtkMPRBaseData *_vtkmprbasedata;
-
- bool _visibleVolume;
- bool _representationType[VTKMPRDATA_MAXTISSUE];
- bool _visibleTissue[VTKMPRDATA_MAXTISSUE];
- vtkActor *_tissue[VTKMPRDATA_MAXTISSUE];
- boxSurfaceObserver *_observerV;
- boxSurfaceObserver *_observerS[VTKMPRDATA_MAXTISSUE];
-
- std::vector<double> greyValuesTransferenceFVector;
- std::vector<double> intensityValuesTransferenceFVector;
- std::vector<double> redColorsOfColorTransferenceFVector;
- std::vector<double> greenColorsOfColorTransferenceFVector;
- std::vector<double> blueColorsOfColorTransferenceFVector;
- std::vector<double> greyValueColorsOfColorTransferenceFVector;
-};
#endif // __WX__MPR__BASE__DATA__H
Program: wxMaracas
Module: $RCSfile: wxMPRWidget.cxx,v $
Language: C++
- Date: $Date: 2009/05/07 15:35:46 $
- Version: $Revision: 1.13 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.14 $
Copyright: (c) 2002, 2003
License:
#include "pPlotter/HistogramDialog.h"
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-idAlBeRa::idAlBeRa(int id, double radio,int deltavoxel)
-{
- _id = id;
- _radio = radio;
- _deltavoxel = deltavoxel;
-}
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-vtkInteractorStyleSphere::vtkInteractorStyleSphere()
-{
- _stateRadio = false;
- _stateRotate = false;
-}
-
-//---------------------------------------------------------------------------
-
-vtkInteractorStyleSphere::~vtkInteractorStyleSphere()
-{
-}
-
-
-//---------------------------------------------------------------------------
-
-bool vtkInteractorStyleSphere::OnRightButtonDown()
-{
- if ((_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) && (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) )
- {
- _stateRadio = true;
- //_fordwareX = this->Interactor->GetEventPosition()[0];
- _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
-
- wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
-
- _radio = wxsphereview->GetRadio();
- }
-
- return true;
-}
-
-//---------------------------------------------------------------------------
-
-bool vtkInteractorStyleSphere::OnRightButtonUp()
-{
- if (_stateRadio==true)
- {
- wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
- wxsphereview->SetDeltaVoxel(1);
- double radio=wxsphereview->GetRadio();
- wxsphereview->GetIdOfImage(radio+0.1);
- wxsphereview->GetIdOfImage(radio+0.2);
- wxsphereview->GetIdOfImage(radio-0.1);
- wxsphereview->GetIdOfImage(radio-0.2);
-
- wxsphereview->RefreshView();
- _stateRadio = false;
- }
-
- return true;
-}
-//---------------------------------------------------------------------------
-
-bool vtkInteractorStyleSphere::OnLeftButtonDown()
-{
- _stateRotate = true;
- _fordwareX = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- return true;
-}
-
-
-//---------------------------------------------------------------------------
-
-bool vtkInteractorStyleSphere::OnLeftButtonUp()
-{
- wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
- if (_stateRotate==true){
- int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
-
- if ((_fordwareX==fx)&&(_fordwareY==fy)){
- double x=fx,y=fy,z=1;
- _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
- wxsphereview->SetXYZtoParent(x,y);
- wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);
- wxsphereview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent);
- } else {
- wxsphereview->RotationEnd();
- }
- wxsphereview->RefreshView();
- _stateRotate = false;
- }
-
- return true;
-}
-
-
-//---------------------------------------------------------------------------
-
-bool vtkInteractorStyleSphere::OnMouseMove ()
-{
- wxSphereView *wxsphereview = (wxSphereView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
- if (_stateRotate==true)
- {
- bool ok_v, ok_ang;
- ok_v=false;
- ok_ang=false;
- if (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==1)
- {
- ok_v = true;
- }
- if (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==1)
- {
- ok_ang = true;
- }
- int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- wxsphereview->RotationStart( fx - _fordwareX , -(fy - _fordwareY) , ok_v, ok_ang);
- wxsphereview->RefreshView();
- }
- if (_stateRadio==true)
- {
- //int fx = this->Interactor->GetEventPosition()[0];
- int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- double dif=(fy-_fordwareY) / 10.0;
- wxsphereview->SetRadio( _radio + dif );
- wxsphereview->SetDeltaVoxel(3);
- wxsphereview->RefreshView();
- }
-
- return true;
-}
-
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-wxSphereView::wxSphereView( wxWindow *parent, vtkMPRBaseData *vtkmprbasedata, vtkImageData *imageData )
-: wxVtk2DBaseView(parent)
-{
- _delta = 1;
- _vtkmprbasedata = vtkmprbasedata;
- _imageDataOriginal = imageData;
-
- _imageSphere = vtkImageData::New();
- _imageSphere->SetDimensions (150,150,500);
- _imageSphere->SetScalarTypeToUnsignedShort();
- _imageSphere->AllocateScalars();
- _imageSphere->Update();
-
-
- vtkBaseData *vtkbasedata = new vtkBaseData();
- vtkbasedata->SetMarImageData( new marImageData(_imageSphere) );
- this->SetVtkBaseData(vtkbasedata);
-
- _transform = vtkTransform::New();
- _transform1 = vtkTransform::New();
- _transform2 = vtkTransform::New();
- _transform ->Identity();
- _transform1->Identity();
- _transform2->Identity();
-
- _radio=25;
-}
-
-//-------------------------------------------------------------------
-
-wxSphereView::~wxSphereView()
-{
- _transform -> Delete();
- _transform1 -> Delete();
- _transform2 -> Delete();
- ResetlstId();
-}
-
-//----------------------------------------------------------------------------
-
-double wxSphereView::GetRadio()
-{
- return _radio;
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::SetRadio(double radio)
-{
- if (radio<0)
- {
- radio=0;
- }
- _radio=radio;
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::Configure()
-{
- wxVtk2DBaseView::Configure();
-
- _vtkinteractorstylesphere = new vtkInteractorStyleSphere();
- GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _vtkinteractorstylesphere );
- double points[4][3];
-
-// EED purify 12/sep/2006
- int i,j;
- for (i=0;i<4;i++)
- {
- for (j=0;j<3;j++)
- {
- points[i][j]=0;
- }
- }
-
- InitSphere(points);
- DefineImageSphere();
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::RefreshPoint()
-{
- double x = _vtkmprbasedata->GetX() - _centerX;
- double y = _vtkmprbasedata->GetY() - _centerY;
- double z = _vtkmprbasedata->GetZ() - _centerZ;
- double alpha= atan2(x,z);
- double beta = atan2( y , sqrt(z*z+x*x) );
-
- alpha = alpha*180/3.1416;
- beta = beta*180/3.1416;
-
- _transform1->Identity();
- _transform1->RotateY(alpha);
- _transform1->RotateX(-beta);
-
- _radio= sqrt(x*x + y*y +z*z);
-
- RefreshView();
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::RefreshView()
-{
- DefineImageSphere();
- wxVtk2DBaseView::Refresh();
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::RotationEnd()
-{
- _transform1->RotateWXYZ(_ang,_vxb,_vyb,0);
- _transform2->Identity();
- SetDeltaVoxel(1);
- ResetlstId();
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::RotationStart(double vx, double vy, bool ok_v, bool ok_ang)
-{
- if (ok_ang==false)
- {
- _ang = -sqrt( vx*vx + vy*vy ) / 1.0;
- }
-
- if (ok_v==false){
- _vxb=-vy;
- _vyb=vx;
- }
-
- _transform2->Identity();
- _transform2->RotateWXYZ(_ang,_vxb,_vyb,0);
- SetDeltaVoxel(3);
- ResetlstId();
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::GetPointSphere(double p[3],double r1,double angA,double angB)
-{
- double in[3],out[3];
- in[0]=0;
- in[1]=r1;
- in[2]=0;
- vtkTransform *transform = vtkTransform::New();
- transform->Identity();
- transform->RotateX(angB);
- transform->RotateZ(angA);
- transform->TransformPoint(in,out);
- p[0]=out[0];
- p[1]=out[1];
- p[2]=out[2];
- transform->Delete();
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::RotatePointOverTheSphere( double pp[3], double p[3],double cc[3])
-{
-
- double out[3];
- _transform->TransformPoint(p,out);
- pp[0] = out[0] + cc[0];
- pp[1] = out[1] + cc[1];
- pp[2] = out[2] + cc[2];
-
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::TransferePoints(double pp1[3],double pp2[3],double AngX,double AngY,vtkImageData *image)
-{
- double t;
- double difX = pp2[0]-pp1[0];
- double difY = pp2[1]-pp1[1];
- double difZ = pp2[2]-pp1[2];
-
- double max = 200;
-
- int dimOrg[3];
- int dimRes[3];
- int z;
- _imageDataOriginal->GetDimensions(dimOrg);
- image->GetDimensions(dimRes);
-
- int i;
- double x1=pp1[0];
- double y1=pp1[1];
- double z1=pp1[2];
- int xx=-1,yy=-1,zz=-1;
-
- for (i=0;i<max;i++)
- {
- t = i/max;
- xx = (int) (x1+t*difX);
- yy = (int) (y1+t*difY);
- zz = (int) (z1+t*difZ);
-
- z=i;
- if ((xx>=0) && (xx<dimOrg[0]) && (yy>=0) && (yy<dimOrg[1]) && (zz>=0) && (zz<dimOrg[2]) &&
- (AngX>=0) && (AngX<dimRes[0]) && (AngY>=0) && (AngY<dimRes[1]) && (z>=0) && (z<dimRes[2]) )
- {
- unsigned short *pOrg=(unsigned short*)_imageDataOriginal->GetScalarPointer (xx,yy,zz);
- unsigned short *pRes=(unsigned short*)image->GetScalarPointer( (int)AngX , (int)AngY , z );
- *pRes=*pOrg;
- }
- }
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::ResetlstId()
-{
- int i,size=_lstId.size();
- for (i=size-1;i>=0;i--)
- {
- delete _lstId[i];
- }
- _lstId.clear();
-}
-
-//----------------------------------------------------------------------------
-
-int wxSphereView::GetIdOfImage(double radio)
-{
- int id=0;
- int dim[3];
- _imageSphere->GetDimensions(dim);
- int sizeMaxList = dim[2];
- // Search in list >> alpha beta radio
- int i,size=_lstId.size();
- for (i=0; i<size;i++)
- {
- //idAlBeRa *tmp=_lstId[i]; // JPRx
- if ((_lstId[i]->_radio==radio) && (_lstId[i]->_deltavoxel==_delta))
- {
- return _lstId[i]->_id;
- }
- }
- if (size>sizeMaxList)
- {
- delete _lstId[size-1];
- _lstId.pop_back();
- }
- if (size!=0){
- id=_lstId[0]->_id+1;
- id = id % sizeMaxList;
- } else {
- id = 0;
- }
-
- FiltreImage(id,radio);
- _lstId.insert(_lstId.begin(),1,new idAlBeRa(id,radio,_delta) );
-
- return id;
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::DefineImageSphere()
-{
- int id;
- id=GetIdOfImage( _radio );
- GetVtkBaseData()->SetZ( id );
-}
-
-
-//----------------------------------------------------------------------------
-void wxSphereView::SetDeltaVoxel(int delta)
-{
- _delta=delta;
-}
-
-//----------------------------------------------------------------------------
-void wxSphereView::SetVoxel(double i, double j, int delta,double id, unsigned short gris)
-{
- int ii,jj,delta2;
- unsigned short *pRes;
- int dimRes[3];
- _imageSphere->GetDimensions(dimRes);
-
- delta2=delta-1;
- for ( ii=(int)(i-delta2) ; ii<=(int)(i+delta2) ; ii++ )
- {
- for ( jj=(int)(j-delta2) ; jj<=(int)(j+delta2) ; jj++ )
- {
- if ( (ii>=0)&&(ii<dimRes[0]) &&
- (jj>=0)&&(jj<dimRes[1]) )
- {
- pRes = (unsigned short*)_imageSphere->GetScalarPointer( ii , jj , (int)id );
- *pRes=gris;
- }
- }
- }
-
-}
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::SetXYZtoParent(double i, double j)
-{
-
- double factor = 0.75;
- double radio2 = _radio*_radio;
- double pxx,pyy,d2x,d2y;
- double cc[3],p[3],pp[3];
- cc[0]=_centerX;
- cc[1]=_centerY;
- cc[2]=_centerZ;
- double aa;
- int dimRes[3],dimOrig[3];
- _imageSphere->GetDimensions(dimRes);
- d2x=dimRes[0]/2;
- d2y=dimRes[1]/2;
- _imageDataOriginal->GetDimensions(dimOrig);
-
- p[0] = (i - d2x)*factor;
- pxx=p[0]*p[0];
- p[1] = (j - d2y)*factor;
- pyy=p[1]*p[1];
- aa = pxx + pyy;
- if (radio2>aa){
- aa=radio2-aa;
- p[2] = sqrt(aa);
- RotatePointOverTheSphere( pp, p,cc);
- if ( (pp[0]>=0) && (pp[0]<dimOrig[0]) &&
- (pp[1]>=0) && (pp[1]<dimOrig[1]) &&
- (pp[2]>=0) && (pp[2]<dimOrig[2]) )
- {
- if (_vtkmprbasedata){
- _vtkmprbasedata->SetX(pp[0]);
- _vtkmprbasedata->SetY(pp[1]);
- _vtkmprbasedata->SetZ(pp[2]);
- }
- }
- }
-}
-
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::FiltreImageB(int id, double radio, bool ok,int deltaTMP)
-{
- double factor = 0.75;
- double radioB = radio/3;
- double radio2 = radio*radio;
- double pxx,pyy,d2x,d2y;
- double cc[3],p[3],pp[3];
- cc[0]=_centerX;
- cc[1]=_centerY;
- cc[2]=_centerZ;
- double aa;
- unsigned short *pOrig;
- int dimRes[3],dimOrig[3];
- double i,j;
- int ext[6];
- _imageSphere->GetExtent(ext);
- _imageSphere->GetDimensions(dimRes);
- //JCP 24 - 04 -09
- //_imageSphere->SetExtent(0,dimRes[0]-1,0,dimRes[1]-1,0,dimRes[2]-1);
- _imageSphere->SetExtent(ext);
- //JCP 24 - 04 -09
- d2x=dimRes[0]/2;
- d2y=dimRes[1]/2;
-// double deltaTMP=_delta;
- _imageDataOriginal->GetDimensions(dimOrig);
-
- int start,end;
- int limitA,limitB;
- limitA = (int) ( (-radioB/factor)+d2x );
- limitB = (int) ( (radioB/factor)+d2x );
- if (ok==true){
- start = limitA;
- end = limitB;
- } else {
- start=0;
- end=dimRes[0];
- }
-
- for ( i=start ; i<end ; i=i+deltaTMP )
- {
- p[0] = (i - d2x)*factor;
- pxx=p[0]*p[0];
- for (j=start;j<end;j=j+deltaTMP)
- {
- p[1] = (j - d2y)*factor;
- pyy=p[1]*p[1];
- aa = pxx + pyy;
-
- if (( ((ok==false) && (!((i>limitA) && (i<limitB) && (j>limitA) && (j<limitB)))) )
- ||
- (ok==true))
- {
- if (radio2>aa){
- aa=radio2-aa;
- p[2] = sqrt(aa);
- RotatePointOverTheSphere( pp, p,cc);
- if ( (pp[0]>=0) && (pp[0]<dimOrig[0]) &&
- (pp[1]>=0) && (pp[1]<dimOrig[1]) &&
- (pp[2]>=0) && (pp[2]<dimOrig[2]) )
- {
- pOrig=(unsigned short*)_imageDataOriginal->GetScalarPointer( (int)(pp[0]) , (int)(pp[1]) , (int)(pp[2]) );
- SetVoxel(i,j,deltaTMP,id,*pOrig);
- } else {
- SetVoxel(i,j,deltaTMP,id,2000);
- }
- } else {
- SetVoxel(i,j,deltaTMP,id,0);
- }
- }
- }
- }
-
- _imageSphere->Modified();
- _imageSphere->Update();
-}
-
-
-
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::FiltreImage(int id, double radio)
-{
-
- _transform -> Identity();
- _transform -> Concatenate(_transform1);
- _transform -> Concatenate(_transform2);
-
- FiltreImageB(id,radio,false, _delta);
- FiltreImageB(id,radio,true, 1);
-}
-
-
-//----------------------------------------------------------------------------
-
-/*
-void wxSphereView::FiltreImage(int id, double radio)
-{
- double radio2 = radio*radio;
- double radio2TMP= (radio/2)*(radio/2);
- double pxx,pyy,d2x,d2y;
- double cc[3],p[3],pp[3];
- cc[0]=_centerX;
- cc[1]=_centerY;
- cc[2]=_centerZ;
- double aa;
- unsigned short *pOrig;
- int dimRes[3],dimOrig[3];
- double i,j;
- _imageSphere->GetDimensions(dimRes);
- _imageSphere->SetExtent(0,dimRes[0]-1,0,dimRes[1]-1,0,dimRes[2]-1);
- d2x=dimRes[0]/2;
- d2y=dimRes[1]/2;
- double deltaTMP=_delta;
- _imageDataOriginal->GetDimensions(dimOrig);
-
- for ( i=0 ; i<dimRes[0] ; i=i+deltaTMP )
- {
- p[0] = (i - d2x)*0.75;
- pxx=p[0]*p[0];
- for (j=0;j<dimRes[1];j=j+deltaTMP)
- {
- p[1] = (j - d2y)*0.75;
- pyy=p[1]*p[1];
- aa = pxx + pyy;
-
- if (aa>radio2TMP)
- {
- if (radio2>aa){
- aa=radio2-aa;
- p[2] = sqrt(aa);
- RotatePointOverTheSphere( pp, p,cc);
- if ( (pp[0]>=0) && (pp[0]<dimOrig[0]) &&
- (pp[1]>=0) && (pp[1]<dimOrig[1]) &&
- (pp[2]>=0) && (pp[2]<dimOrig[2]) )
- {
- pOrig=(unsigned short*)_imageDataOriginal->GetScalarPointer( pp[0] , pp[1] , pp[2] );
- SetVoxel(i,j,deltaTMP,id,*pOrig);
- } else {
- SetVoxel(i,j,deltaTMP,id,2000);
- }
- } else {
- SetVoxel(i,j,deltaTMP,id,0);
- }
- }
- }
- }
-
-
- deltaTMP=1;
- for ( i=0 ; i<dimRes[0] ; i=i+deltaTMP )
- {
- p[0] = (i - d2x)*0.75;
- pxx=p[0]*p[0];
- for (j=0;j<dimRes[1];j=j+deltaTMP)
- {
- p[1] = (j - d2y)*0.75;
- pyy=p[1]*p[1];
- aa = pxx + pyy;
- if (aa<=radio2TMP)
- {
- if (radio2>aa){
- aa=radio2-aa;
- p[2] = sqrt(aa);
- RotatePointOverTheSphere( pp, p,cc);
- if ( (pp[0]>=0) && (pp[0]<dimOrig[0]) &&
- (pp[1]>=0) && (pp[1]<dimOrig[1]) &&
- (pp[2]>=0) && (pp[2]<dimOrig[2]) )
- {
- pOrig=(unsigned short*)_imageDataOriginal->GetScalarPointer( pp[0] , pp[1] , pp[2] );
- SetVoxel(i,j,deltaTMP,id,*pOrig);
- } else {
- SetVoxel(i,j,deltaTMP,id,2000);
- }
- } else {
- SetVoxel(i,j,deltaTMP,id,0);
- }
- }
- }
- }
-
- _imageSphere->Modified();
- _imageSphere->Update();
-}
-*/
-/*
-void wxSphereView::FiltreImage(vtkImageData *imageSphere)
-{
- int dim[3],i,j,k;
- imageSphere->GetDimensions(dim);
- for (i=0;i<dim[0];i++)
- {
- for (j=0;j<dim[1];j++)
- {
- for (k=0;k<dim[2];k++)
- {
- unsigned short *pRes=(unsigned short*)imageSphere->GetScalarPointer (i,j,k);
- *pRes=0;
- }
- }
- }
-
- double deltaA=90;
- double cc[3],p1[3],p2[3],pp1[3],pp2[3];
- cc[0]=_centerX;
- cc[1]=_centerY;
- cc[2]=_centerZ;
- double r1 = _sl_radio->GetValue() - _sl_thickness->GetValue()/2;
- double r2 = _sl_radio->GetValue() + _sl_thickness->GetValue()/2;
- if (r1<10)
- {
- r1=10;
- }
- double alpha= _sl_alpha->GetValue();
- double beta = _sl_beta->GetValue();
-
- double angA,angB;
- for (angA=-deltaA;angA<deltaA;angA++)
- {
- for (angB=-deltaA;angB<deltaA;angB++)
- {
- GetPointSphere(p1,r1,angA,angB);
- GetPointSphere(p2,r2,angA,angB);
- RotatePointOverTheSphere( pp1, alpha, beta, p1 ,cc );
- RotatePointOverTheSphere( pp2, alpha, beta, p2 ,cc );
- TransferePoints(pp1,pp2,angA+alpha+180,angB+beta+90,imageSphere);
- }
- }
-}
-*/
-
-
-//----------------------------------------------------------------------------
-
-void wxSphereView::InitSphere(double points[4][3])
-{
- double cc[3];
- double r = SphereFindCenter(points,cc); // 4-points , center
- if (r > 0)
- {
- _centerX = (int)(cc[0]);
- _centerY = (int)(cc[1]);
- _centerZ = (int)(cc[2]);
- } else {
- int dim[3];
- _imageDataOriginal->GetDimensions(dim);
- _centerX = (int)(dim[0]/2);
- _centerY = (int)(dim[1]/2);
- _centerZ = (int)(dim[2]/2);
- }
-}
-
-//----------------------------------------------------------------------------
-
-// Calculate center and radius of sphere given four points
-// http://home.att.net/~srschmitt/script_sphere_solver.html
-// source code HTML <script language=JavaScript>
-double wxSphereView::SphereFindCenter(double P[4][3], double cc[3])
-{
- int i;
- double r, m11, m12, m13, m14, m15;
- double a[4][4];
-
- for (i = 0; i < 4; i++) // find minor 11
- {
- a[i][0] = P[i][0];
- a[i][1] = P[i][1];
- a[i][2] = P[i][2];
- a[i][3] = 1;
- }
- m11 = determinant( a, 4 );
-
- for (i = 0; i < 4; i++) // find minor 12
- {
- a[i][0] = P[i][0]*P[i][0] + P[i][1]*P[i][1] + P[i][2]*P[i][2];
- a[i][1] = P[i][1];
- a[i][2] = P[i][2];
- a[i][3] = 1;
- }
- m12 = determinant( a, 4 );
-
- for (i = 0; i < 4; i++) // find minor 13
- {
- a[i][0] = P[i][0]*P[i][0] + P[i][1]*P[i][1] + P[i][2]*P[i][2];
- a[i][1] = P[i][0];
- a[i][2] = P[i][2];
- a[i][3] = 1;
- }
- m13 = determinant( a, 4 );
-
- for (i = 0; i < 4; i++) // find minor 14
- {
- a[i][0] = P[i][0]*P[i][0] + P[i][1]*P[i][1] + P[i][2]*P[i][2];
- a[i][1] = P[i][0];
- a[i][2] = P[i][1];
- a[i][3] = 1;
- }
- m14 = determinant( a, 4 );
-
-
- for (i = 0; i < 4; i++) // find minor 15
- {
- a[i][0] = P[i][0]*P[i][0] + P[i][1]*P[i][1] + P[i][2]*P[i][2];
- a[i][1] = P[i][0];
- a[i][2] = P[i][1];
- a[i][3] = P[i][2];
- }
- m15 = determinant( a, 4 );
-
- if (m11 == 0)
- {
- r = 0;
- }
- else
- {
- // center of sphere
- cc[0] = 0.5*m12/m11; //cx
- cc[1] = -0.5*m13/m11; //cy
- cc[2] = 0.5*m14/m11; //cz
- // Sphere radio
- r = sqrt( cc[0]*cc[0] + cc[1]*cc[1] + cc[2]*cc[2] - m15/m11 );
- }
-
- return r; // the radius
-}
-//----------------------------------------------------------------------------
-
-// Recursive definition of determinate using expansion by minors.
-double wxSphereView::determinant(double a[4][4], int n)
-{
- int i, j, j1, j2;
- double d;
- double m[4][4];
-
- for (i=0;i<4;i++)
- {
- for (j=0;j<4;j++)
- {
- m[i][j]=0;
- }
- }
-
- if (n == 2) // terminate recursion
- {
- d = a[0][0]*a[1][1] - a[1][0]*a[0][1];
- }
- else
- {
- d = 0;
- for (j1 = 0; j1 < n; j1++ ) // do each column
- {
- for (i = 1; i < n; i++) // create minor
- {
- j2 = 0;
- for (j = 0; j < n; j++)
- {
- if (j == j1) continue;
- m[i-1][j2] = a[i][j];
- j2++;
- }
- }
-
- // sum (+/-)cofactor * minor
- d = d + pow(-1.0, j1)*a[0][j1]*determinant( m, n-1 );
- }
- }
-
- return d;
-}
-
-
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-vtkInteractorStylePlane2D::vtkInteractorStylePlane2D()
-{
- _stateRotate=false;
-}
-//---------------------------------------------------------------------------
-vtkInteractorStylePlane2D::~vtkInteractorStylePlane2D()
-{
-}
-
-//---------------------------------------------------------------------------
-bool vtkInteractorStylePlane2D::GetStateRotate()
-{
- return _stateRotate;
-}
-
-//---------------------------------------------------------------------------
-bool vtkInteractorStylePlane2D::OnLeftButtonDown() // vitual
-{
- _stateRotate = true;
- _fordwareX = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- _fordwareY = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
- vtkplane2Dview->RotationStart();
-
- return true;
-}
-
-//---------------------------------------------------------------------------
-bool vtkInteractorStylePlane2D::OnLeftButtonUp() // virtual
-{
- if (_stateRotate==true)
- {
- _stateRotate = false;
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
- vtkplane2Dview->ResetBack();
-// this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
- }
-
- return true;
-}
-
-//---------------------------------------------------------------------------
-bool vtkInteractorStylePlane2D::OnRightButtonUp() // virtual
-{
- if (_stateRotate==true){
- //vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()); // JPRx
-
-// EED Borrame
-// vtkplane2Dview->RotationEnd();
-
- _stateRotate = false;
- }
-
- return true;
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorStylePlane2D::OnMouseMove () // virtual
-{
- bool ok_v, ok_ang;
- if (_stateRotate==true){
- ok_v=false;
- ok_ang=false;
- if (_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==1)
- {
- ok_v=true;
- }
- if (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==1)
- {
- ok_ang=true;
- }
- int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
- vtkplane2Dview->RotationDrag( fx - _fordwareX , fy - _fordwareY , ok_v , ok_ang);
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
- }
- return true;
-}
-//-------------------------------------------------------------------
-bool vtkInteractorStylePlane2D::OnLeftDClick() // virtual
-{
- int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- double xx=fx;
- double yy=fy;
- double zz=0;
-
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
- vtkMPRBaseData *vtkmprbasedata = vtkplane2Dview->GetVtkmprbasedata();
-
- vtkplane2Dview->TransfromeCoordViewWorld2(xx,yy,zz);
-
- vtkmprbasedata->SetX( xx );
- vtkmprbasedata->SetY( yy );
- vtkmprbasedata->SetZ( zz );
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
- return true;
-}
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-vtkPlane2DView::vtkPlane2DView( wxWindow *parent)
-: wxVtk2DBaseView(parent)
-{
-
- _backX = -99999;
- _backY = -99999;
- _backZ = -99999;
-
- _backOrient[0] = -99999;
- _backOrient[1] = -99999;
- _backOrient[2] = -99999;
- _backOrient[3] = -99999;
-
- _active = true;
- _mip_visualization = true;
- _mip_width = 2;
-
- _transform1 = vtkTransform::New();
- _transform2 = vtkTransform::New();
- _transform1->Identity();
- _transform2->Identity();
-
- _sizeIma = 200;
-
- _pSource = NULL;
- _3Dslices = NULL;
- _stPoints = NULL;
- _change = NULL;
- _imageResult = NULL;
-
- // line horizontal
- _pts = NULL;
- _lineActor = NULL;
- _lineMapper = NULL;
- _pd = NULL;
-
- _interactorstyleplane2D = false;
-}
-//-------------------------------------------------------------------
-vtkPlane2DView::~vtkPlane2DView()
-{
- ResetPlane();
-
- // Horizontal Line
- if (_pts != NULL) { _pts -> Delete(); }
- if (_lineActor != NULL) { _lineActor -> Delete(); }
- if (_lineMapper != NULL) { _lineMapper -> Delete(); }
- if (_pd != NULL) { _pd -> Delete(); }
-
- _transform1 -> Delete();
- _transform2 -> Delete();
-}
-
-//-------------------------------------------------------------------
-void vtkPlane2DView::ResetBack()
-{
- _backX=-1;
- _backY=-1;
- _backZ=-1;
- _backOrient[0]=-1;
- _backOrient[1]=-1;
- _backOrient[2]=-1;
- _backOrient[3]=-1;
-}
-
-//-------------------------------------------------------------------
-void vtkPlane2DView::ResetPlane(){
- if (_pSource !=NULL) { _pSource -> Delete(); }
- if (_3Dslices !=NULL) { _3Dslices -> Delete(); }
- if (_stPoints !=NULL) { _stPoints -> Delete(); }
- if (_change !=NULL) { _change -> Delete(); }
-}
-//-------------------------------------------------------------------
-vtkMPRBaseData *vtkPlane2DView::GetVtkmprbasedata()
-{
- return (vtkMPRBaseData*)GetVtkBaseData();
-}
-
-//-------------------------------------------------------------------
-void vtkPlane2DView::SetPSource(int sizeIma){
- int dimIma = sizeIma;
-
- double x = GetVtkmprbasedata()->GetX();
- double y = GetVtkmprbasedata()->GetY();
- double z = GetVtkmprbasedata()->GetZ();
-
- double spc[3];
- vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
- imagedata->GetSpacing(spc);
- x=x*spc[0];
- y=y*spc[1];
- z=z*spc[2];
-
-
- vtkMPRBaseData *mprbasedata = (vtkMPRBaseData*)this->GetVtkBaseData();
- vtkTransform *transform = mprbasedata->GetTransformOrientation();
-
- double in[3]; // temp
- double pA[3];
- double pB[3];
- in[0]=1; in[1]=0; in[2]=0;
- transform->TransformPoint(in,_n);
-
- in[0]=0; in[1]=dimIma-1; in[2] = 0;
- transform->TransformPoint(in,pA);
-
- in[0]=0; in[1]=0; in[2]=dimIma-1;
- transform->TransformPoint(in,pB);
-
- _pSource -> SetPoint1( pA );
- _pSource -> SetPoint2( pB );
-
- _pSource -> SetOrigin( 0 , 0 , 0 );
- _pSource -> SetResolution( sizeIma-1 , sizeIma -1 );
- _pSource -> Update();
- _pSource -> SetCenter( x, y, z );
- _pSource -> SetNormal( _n );
- _pSource -> Update( );
-
-// EED Borrame
-// transform->Delete();
-
-}
-
-//-------------------------------------------------------------------
-void vtkPlane2DView::ExtractPlane()
-{
-
- double x = GetVtkmprbasedata()->GetX();
- double y = GetVtkmprbasedata()->GetY();
- double z = GetVtkmprbasedata()->GetZ();
-
- double spc[3];
- vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
- imagedata->GetSpacing(spc);
- x=x*spc[0];
- y=y*spc[1];
- z=z*spc[2];
-
- vtkTransform *transform = GetVtkmprbasedata()->GetTransformOrientation();
- double orientation[4];
- transform->GetOrientationWXYZ(orientation);
-
- bool okOrientation=true;
- if ((orientation[0]!=_backOrient[0]) || (orientation[1]!=_backOrient[1]) ||
- (orientation[2]!=_backOrient[2]) || (orientation[3]!=_backOrient[3]))
- {
- okOrientation=false;
- }
-
- bool okPosicion=true;
- if ( (x!=_backX) || (y!=_backY) || (z!=_backZ) )
- {
- okPosicion=false;
- }
-
- if ((okPosicion==false) || (okOrientation==false) ) {
- if (_active==true){
-
- bool ok = false;
-
- if ( _mip_visualization==true )
- {
- if (_interactorstyleplane2D!=NULL)
- {
- if (_interactorstyleplane2D->GetStateRotate()==false )
- {
- ok=true;
- }
- }
- }
-// ok=true;
-
- if (ok==true)
- {
- Extract_MIP_PlaneVTK();
- } else {
- Extract_One_PlaneVTK();
- } // ok
-
- } // active
- _backX=x;
- _backY=y;
- _backZ=z;
- _backOrient[0]=orientation[0];
- _backOrient[1]=orientation[1];
- _backOrient[2]=orientation[2];
- _backOrient[3]=orientation[3];
- } //okPosition okOrientation
-}
-
-//-------------------------------------------------------------------
-
-void vtkPlane2DView::Extract_One_PlaneVTK()
-{
- vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
- SetPSource(_sizeIma);
- _3Dslices -> SetInput( ( vtkDataSet* )_pSource->GetOutput( ) );
- _3Dslices -> SetSource( imagedata );
- _3Dslices -> Update( );
- _stPoints -> GetPointData( )->SetScalars( _3Dslices->GetOutput()->GetPointData()->GetScalars() );
- _stPoints -> SetDimensions( _sizeIma, _sizeIma, 1 );
- _stPoints -> SetScalarType( imagedata->GetScalarType() );
- _stPoints -> SetScalarTypeToShort();
- _stPoints -> Update();
-// _change -> SetInput( _stPoints );
-// _change -> Update(); //important
- _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _stPoints );
-// _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _change->GetOutput() );
- // vtkImageActor *imageActor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor();
-}
-
-//-------------------------------------------------------------------
-
-void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ )
-{
-
- int mipWidth;
- double sp;
- int sizeWidth = (_mip_width*2)+1 ;
- int deltaPixel;
- int iWidth,itmp,tmpSizeWith;
-
- double spc[3];
- vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
- SetPSource(_sizeIma);
- imagedata->GetSpacing(spc);
-
- bool heightDefinition=false;
- if (_mip_width<3)
- {
- heightDefinition=true;
- }
-
- if (heightDefinition==true)
- {
- mipWidth = _mip_width;
- sp = spc[0];
- deltaPixel = 1;
- } else {
- mipWidth = 2;
- tmpSizeWith = (mipWidth*2) + 1;
- sp = (spc[0]*sizeWidth)/tmpSizeWith;
- sizeWidth = tmpSizeWith;
- deltaPixel = 4;
- }
-
-
-
- std::vector< vtkProbeFilter* > slicesLST;
-
- _pSource->Push( -mipWidth * sp );
- _pSource->Update();
-
- for ( iWidth=0 ; iWidth<sizeWidth ; iWidth++ )
- {
- vtkProbeFilter *slice = vtkProbeFilter::New();
- slice -> SetInput( ( vtkDataSet* )_pSource->GetOutput( ) );
- slice -> SetSource( imagedata );
- slice -> Update( );
- slicesLST.push_back( slice );
- _pSource->Push( sp );
- }
-
- if (_imageResult ==NULL)
- {
- _imageResult = vtkImageData::New();
- _imageResult -> SetDimensions(_sizeIma,_sizeIma,1);
- _imageResult -> SetSpacing(1,1,1);
- _imageResult -> SetScalarType( imagedata->GetScalarType() );
- _imageResult -> SetExtent(0,_sizeIma-1,0,_sizeIma-1,0,0);
- _imageResult -> SetWholeExtent(0,_sizeIma-1,0,_sizeIma-1,0,0);
- _imageResult -> AllocateScalars();
- _imageResult -> Update();
- }
-
- unsigned short *pTemp;
- unsigned short *pResult;
- pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 );
-
- int iPixels , sizePixels = _sizeIma*_sizeIma;
- for(iPixels=0 ; iPixels<sizePixels ; iPixels=iPixels+deltaPixel)
- {
-
- pTemp = (unsigned short*)slicesLST[0]->GetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0);
-
- pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 );
- pResult[iPixels] = pTemp[iPixels];
-
- for (iWidth=1;iWidth<sizeWidth;iWidth++)
- {
- pTemp = (unsigned short*)slicesLST[iWidth]->GetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0);
-
- if (pResult[iPixels]< pTemp[iPixels])
- {
- pResult[iPixels] = pTemp[iPixels];
- }
- }
-
- if (deltaPixel!=1)
- {
- for (itmp=1;itmp<deltaPixel;itmp++)
- {
- pResult[iPixels+itmp] = pResult[iPixels];
- }
- }
-
- }
-
- for (iWidth=0;iWidth<sizeWidth;iWidth++)
- {
- slicesLST[iWidth]->Delete();
- }
-
- _imageResult->Modified();
- _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _imageResult );
-
-}
-
-//-------------------------------------------------------------------
-void vtkPlane2DView::Configure( )
-{
- wxVtk2DBaseView::Configure(false);
-
- HorizontalLine();
-// Borrame
-// CircleLine();
-
- _pSource = vtkPlaneSource::New( );
- _3Dslices = vtkProbeFilter::New( ) ;
- _stPoints = vtkStructuredPoints::New( );
- _change = vtkImageChangeInformation::New();
-
- wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
- ExtractPlane();
-// SetActive(false);
- _imageViewer2XYZ -> GetVtkImageViewer2() -> SetupInteractor ( iren );
-
- SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
-
- _interactorstyleplane2D = new vtkInteractorStylePlane2D();
- GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _interactorstyleplane2D );
-
- vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
-
- camera->SetViewUp ( 0 , 1 , 0 );
- camera->SetPosition ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 10000 );
-
- camera->SetFocalPoint ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 0 );
- camera->SetClippingRange(0.01, 100000);
- camera->ComputeViewPlaneNormal();
- camera->SetParallelScale( _sizeIma/3.0 );
-
- // text information over the graphic window
- _vtkInfoTextImage = new vtkInfoTextImage();
- _vtkInfoTextImageInteractorPlane2D = new vtkInfoTextImageInteractorPlane2D();
- _vtkInfoTextImage->SetWxVtk2DBaseView(this);
- _vtkInfoTextImage->SetMarImageData( GetVtkmprbasedata()->GetMarImageData() );
- _vtkInfoTextImageInteractorPlane2D->SetModelVtkInfoTextImage(_vtkInfoTextImage);
- _vtkInfoTextImage->Configure();
- this->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(_vtkInfoTextImageInteractorPlane2D);
-
-
-}
-
-//-------------------------------------------------------------------
-void vtkPlane2DView::HorizontalLine()
-{
-// Axe Horizontal
- _pts = vtkPoints::New();
- _pts->SetNumberOfPoints(2);
- _pts->SetPoint(0, -1000 , -1000 , -1000 );
- _pts->SetPoint(1, 1000 , 1000 , 1000 );
- vtkCellArray *lines = vtkCellArray::New();
- lines->InsertNextCell(2);
- lines->InsertCellPoint(0);
- lines->InsertCellPoint(1);
- _pd = vtkPolyData::New();
- _pd->SetPoints( _pts );
- _pd->SetLines( lines );
- lines->Delete(); //do not delete lines ??
- _lineActor = vtkActor::New();
- _lineMapper = vtkPolyDataMapper::New();
- _lineMapper->SetInput(_pd);
- _lineMapper->ImmediateModeRenderingOn();
- _lineActor->SetMapper(_lineMapper);
- _lineActor->GetProperty()->BackfaceCullingOn();
- _lineActor->GetProperty()->SetDiffuseColor(0,0,1);
- _lineActor->GetProperty()->SetLineWidth(2);
- _lineActor->GetProperty()->SetOpacity(0);
- _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineActor );
-}
-
-//-------------------------------------------------------------------
-void vtkPlane2DView::RotationStart()
-{
- vtkMPRBaseData *mprbasedata = (vtkMPRBaseData*)this->GetVtkBaseData();
- vtkTransform *transform = mprbasedata->GetTransformOrientation();
- _transform1->SetMatrix( transform->GetMatrix() );
-}
-//-------------------------------------------------------------------
-void vtkPlane2DView::RotationDrag(double vx, double vy, bool ok_v, bool ok_ang)
-{
- if (ok_ang==false)
- {
- _ang =sqrt( vx*vx + vy*vy ) / 1.5;
- }
-
- if (ok_v==false){
- _vxb=-vy;
- _vyb=vx;
- }
- _transform2->Identity();
- _transform2->RotateWXYZ(_ang,0,_vxb,_vyb);
-
- vtkMPRBaseData *mprbasedata = (vtkMPRBaseData*)this->GetVtkBaseData();
- vtkTransform *transform = vtkTransform::New();
- transform->Identity();
- transform->Concatenate(_transform1);
- transform->Concatenate(_transform2);
- mprbasedata->InitTransformOrientation(transform);
- transform->Delete();
-
- // Refresh Horizontal Line
- _pts->SetPoint( 0 , (_sizeIma/2) - _vxb*2 , (_sizeIma/2) - _vyb*2 , 1 );
- _pts->SetPoint( 1 , (_sizeIma/2) + _vxb*2 , (_sizeIma/2) + _vyb*2 , 1 );
-// RefreshCircleLine();
-}
-
-//-------------------------------------------------------------------
-void vtkPlane2DView::Refresh( )
-{
- ExtractPlane();
- wxVtkBaseView::Refresh();
-}
-//-------------------------------------------------------------------
-void vtkPlane2DView::SetImgSize( int imgSize )
-{
- _sizeIma = imgSize;
-}
-//-------------------------------------------------------------------
-int vtkPlane2DView::GetImgSize()
-{
- return _sizeIma;
-}
-//-------------------------------------------------------------------
-int vtkPlane2DView::GetActualSlice() // virtual
-{
- _cx = GetVtkmprbasedata()->GetX();
- _cy = GetVtkmprbasedata()->GetY();
- _cz = GetVtkmprbasedata()->GetZ();
- return 0;
-}
-
-//-------------------------------------------------------------------
-
-bool vtkPlane2DView::GetMipVisualization()
-{
- return _mip_visualization;
-}
-
-//-------------------------------------------------------------------
-int vtkPlane2DView::GetMipWidth()
-{
- return _mip_width;
-}
-
-//-------------------------------------------------------------------
-void vtkPlane2DView::SetActualSlice(int slice) // Virtual
-{
- double dir=(double)slice/3.0;
- GetVtkmprbasedata()->SetX( _cx + (_n[0]*dir) );
- GetVtkmprbasedata()->SetY( _cy + (_n[1]*dir) );
- GetVtkmprbasedata()->SetZ( _cz + (_n[2]*dir) );
-}
-//---------------------------------------------------------------------------
-vtkInteractorStylePlane2D *vtkPlane2DView::GetInteractorstyleplane2D()
-{
- return this->_interactorstyleplane2D;
-}
-//---------------------------------------------------------------------------
-void vtkPlane2DView::SetActive(bool active)
-{
- _active = active;
-}
-
-//---------------------------------------------------------------------------
-
-void vtkPlane2DView::SetMipVisualization(bool ok)
-{
- _mip_visualization=ok;
-}
-
-//---------------------------------------------------------------------------
-
-void vtkPlane2DView::SetMipWidth(int value)
-{
- _mip_width=value;
-}
-
-//---------------------------------------------------------------------------
-void vtkPlane2DView::SetVisibleLine(bool ok)
-{
- double opacity;
- if (ok==true)
- {
- opacity=1;
- } else {
- opacity=0;
- }
- _lineActor->GetProperty()->SetOpacity(opacity);
-}
-// ----------------------------------------------------------------------------
-void vtkPlane2DView::TransfromeCoordViewWorld2(double &X, double &Y, double &Z)
-{
- double spc[3];
- GetVtkmprbasedata()->GetImageData()->GetSpacing(spc);
-
- double xx = X;
- double yy = Y;
- double zz = 0;
-
- TransfromeCoordScreenToWorld(xx,yy,zz);
-
-
- vtkTransform *transf1 = vtkTransform::New();
- transf1->Identity();
- vtkTransform *transf2 = GetVtkmprbasedata()->GetTransformOrientation();
- transf1->Concatenate(transf2->GetMatrix());
- double in[4], out[4];
- double center = GetImgSize() / 2;
- in[0] = 0;
- in[1] = xx - center;
- in[2] = yy - center;
- in[3] = 0;
-
- transf1->MultiplyPoint(in,out);
- transf1->Delete();
-
- X = out[0] + GetVtkmprbasedata()->GetX() ;
- Y = out[1] + GetVtkmprbasedata()->GetY() ;
- Z = out[2] + GetVtkmprbasedata()->GetZ() ;
-
-}
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-vtkInfoTextImageInteractorPlane2D::vtkInfoTextImageInteractorPlane2D()
-{
-}
-//-------------------------------------------------------------------
-vtkInfoTextImageInteractorPlane2D::~vtkInfoTextImageInteractorPlane2D()
-{
-}
-//-------------------------------------------------------------------
-bool vtkInfoTextImageInteractorPlane2D::OnMouseMove()
-{
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- int z = (int) (_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetVtkBaseData()->GetZ());
- double xx=X,yy=Y,zz=z;
-
-// --> dif
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView();
- vtkplane2Dview->TransfromeCoordViewWorld2(xx,yy,zz);
-
- GetVtkInfoTextImage()->PutWindowLevel();
- GetVtkInfoTextImage()->PutColorLevel();
- GetVtkInfoTextImage()->PutPosition( (int)xx , (int)yy , (int)zz );
- GetVtkInfoTextImage()->PutPixelIntensity( (int)xx , (int)yy , (int)zz );
-
- this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- return true;
-}
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-manualViewPerpPlaneContour::manualViewPerpPlaneContour()
-{
-}
-// ----------------------------------------------------------------------------
-manualViewPerpPlaneContour::~manualViewPerpPlaneContour()
-{
-}
-
-
-// ----------------------------------------------------------------------------
-manualViewPerpPlaneContour * manualViewPerpPlaneContour :: Clone()
-{
- manualViewPerpPlaneContour * clone = new manualViewPerpPlaneContour();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void manualViewPerpPlaneContour::CopyAttributesTo( manualViewPerpPlaneContour * cloneObject)
-{
- // Fathers object
- manualViewContour::CopyAttributesTo(cloneObject);
-}
-
-
-
-
-// ----------------------------------------------------------------------------
-void manualViewPerpPlaneContour::UpdateViewPoint(int id)
-{ // virtual
- double x,y,z;
- manualPoint *mp = _manContModel->GetManualPoint(id);
- x = mp->GetX();
- y = mp->GetY();
- z = mp->GetZ();
- FilterCordinateXYZ(x,y,z);
-
- _lstViewPoints[id]->SetPositionXY( x , y ,GetRange(), z );
- if ((z>=-1) && (z<=1))
- {
- _lstViewPoints[id]->GetVtkActor()->VisibilityOn();
- } else {
- _lstViewPoints[id]->GetVtkActor()->VisibilityOff();
- }
-}
-// ----------------------------------------------------------------------------
-void manualViewPerpPlaneContour::FilterCordinateXYZ (double &x, double &y, double &z)
-{
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)( this->GetWxVtkBaseView() );
- vtkMPRBaseData *vtkmprbasedata = vtkplane2Dview->GetVtkmprbasedata();
- vtkTransform *transf1 = vtkTransform::New();
- vtkTransform *transf2 = vtkmprbasedata->GetTransformOrientation();
- transf1->SetMatrix( transf2->GetMatrix() );
- transf1->Inverse();
-
- double in[4], out[4];
- double center = vtkplane2Dview->GetImgSize() / 2;
-
- in[0] = x - vtkmprbasedata->GetX();
- in[1] = y - vtkmprbasedata->GetY();
- in[2] = z - vtkmprbasedata->GetZ();
- in[3] = 0;
-
- transf1->MultiplyPoint(in,out);
- z = out[0];
- x = out[1]+center;
- y = out[2]+center;
-
- double spc[3];
- this->GetWxVtkBaseView()->GetSpacing(spc);
- x = x / spc[0];
- y = y / spc[1];
- z = z / spc[2];
-
- transf1->Delete();
-}
-
-// ----------------------------------------------------------------------------
-void manualViewPerpPlaneContour::TransfromeCoordViewWorld( double &X,double &Y,double &Z,int type )
-{
- Z = 0;
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)( this->GetWxVtkBaseView() );
- vtkplane2Dview->TransfromeCoordViewWorld2(X,Y,Z);
-}
-
-
-// ----------------------------------------------------------------------------
-void manualViewPerpPlaneContour::RefreshContour() // virtual
-{
-// manualViewContour::RefreshContour();
-
- double pp1[3];
- double pp2[3];
- double u;
-
-// JSTG 25-02-08 ----------------------------------------------------------
-// tt;
-//--------------------------------------------------------
-
- double pp[3];
- double ppB[3];
- double ppC[3];
- ppB[0] = 999999;
- double dist,distMin = 99999999;
-
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)( this->GetWxVtkBaseView() );
- double center = vtkplane2Dview->GetImgSize() / 2;
-
- int i,np,nps;
- np = GetNumberOfPoints( );
-
-//JSTG 25-02-08 ------------------------------------------
- //double t,delta;
- //nps = GetNumberOfPointsSpline();
- nps = _manContModel->GetNumberOfPointsSpline();
- //delta = ( double ) ( np ) / ( double ) ( nps-1 );
- _manContModel->UpdateSpline();
-//--------------------------------------------------------
-
- if ( np >= 2 )
- {
- for( i = 0; i < nps; i++ )
- {
-// JSTG 25-02-08 ----------------------------------------------------------
- //t = delta * (double)i ;
- //tt = delta * (double)(i+1) ;
- //_manContModel->GetSplinePoint(t ,pp1[0],pp1[1],pp1[2]);
- //_manContModel->GetSplinePoint(tt,pp2[0],pp2[1],pp2[2]);
- _manContModel->GetSpline_i_Point(i ,&pp1[0],&pp1[1],&pp1[2]);
- _manContModel->GetSpline_i_Point(i+1,&pp2[0],&pp2[1],&pp2[2]);
-//--------------------------------------------------------------------------
- FilterCordinateXYZ(pp1[0],pp1[1],pp1[2]);
- FilterCordinateXYZ(pp2[0],pp2[1],pp2[2]);
- if (pp2[2]*pp1[2]<=0)
- {
- if (pp1[2]-pp2[2]!=0) {
- u = -pp2[2] / (pp1[2]-pp2[2]);
- } else {
- u=9999999;
- }
- pp[0] = ( pp1[0]-pp2[0] )*u + pp2[0];
- pp[1] = ( pp1[1]-pp2[1] )*u + pp2[1];
- pp[2] = ( pp1[2]-pp2[2] )*u + pp2[2];
- ppC[0] = pp[0] - center;
- ppC[1] = pp[1] - center;
- ppC[2] = pp[2] ;
- dist = sqrt( ppC[0]*ppC[0] + ppC[1]*ppC[1] + ppC[2]*ppC[2] );
- if (dist<distMin)
- {
- distMin=dist;
- ppB[0] = pp[0];
- ppB[1] = pp[1];
- ppB[2] = pp[2];
- }
- }
-
- }// for
- } else {
- _pts->SetPoint(0, 0 , 0 , 0);
- _pts->SetPoint(1, 0 , 0 , 0);
- } // if
-
-//EED 27 sep 2006
- ppB[0]=ppB[0]*_spc[0];
- ppB[1]=ppB[1]*_spc[1];
-
- _pts->SetPoint( 0, ppB[0] , ppB[1]+1 , 1 );
- _pts->SetPoint( 1, ppB[0] , ppB[1]-1 , 1 );
- _pts->SetPoint( 2, ppB[0] , ppB[1] , 1 );
- _pts->SetPoint( 3, ppB[0]-1 , ppB[1] , 1 );
- _pts->SetPoint( 4, ppB[0]+1 , ppB[1] , 1 );
-
-
- for( i = 5; i < nps; i++ )
- {
- _pts->SetPoint( i, ppB[0] , ppB[1] , 1 );
- }
-
-}
-
-//---------------------------------------------------------------------------
-bool manualViewPerpPlaneContour::ifTouchContour( int x, int y, int z)
-{
- bool ok=false;
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)( this->GetWxVtkBaseView() );
- double X=x;
- double Y=y;
- double Z=z;
- vtkplane2Dview->TransfromeCoordScreenToWorld(X,Y,Z);
- double ppA[3];
- _pts->GetPoint(0, ppA);
- if (sqrt( (ppA[0]-X)*(ppA[0]-X) + (ppA[1]-Y)*(ppA[1]-Y) ) <=2)
- {
- ok = true;
- }
- return ok;
-}
-
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-vtkInteractorStyleMPRView::vtkInteractorStyleMPRView()
-{
- _stateMoveAxisX = false;
- _stateMoveAxisY = false;
- _stateMoveAxisZ = false;
-}
-//---------------------------------------------------------------------------
-vtkInteractorStyleMPRView::~vtkInteractorStyleMPRView()
-{
-}
-
-
-//---------------------------------------------------------------------------
-bool vtkInteractorStyleMPRView::OnLeftDClick () // virtual
-{
- wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
- double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- double z = 1;
- _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
- wxvtkmpr2Dview->MoveX(x,y,z);
- wxvtkmpr2Dview->MoveY(x,y,z);
- wxvtkmpr2Dview->MoveZ(x,y,z);
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- wxCommandEvent newevent2(wxEVT_COMMAND_MENU_SELECTED,12122); // Doble click
- wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent2);
-
- return true;
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorStyleMPRView::OnLeftButtonDown ()
-{
- wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
- double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- double z = 1;
- //double xx = x; // JPRx
- //double yy = y; // JPRx
- _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
-
-/*EED Borrame
- if ((_xBack==xx) && (_yBack==yy))
- {
- wxvtkmpr2Dview->MoveX(x,y,z);
- wxvtkmpr2Dview->MoveY(x,y,z);
- wxvtkmpr2Dview->MoveZ(x,y,z);
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- wxCommandEvent newevent2(wxEVT_COMMAND_MENU_SELECTED,12122); // Doble click
- wxvtkmpr2Dview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent2);
- }
-
- _xBack=xx;
- _yBack=yy;
-*/
-
- _stateMoveAxisX = wxvtkmpr2Dview->IfMouseTouchX(x,y,z);
- _stateMoveAxisY = wxvtkmpr2Dview->IfMouseTouchY(x,y,z);
- _stateMoveAxisZ = wxvtkmpr2Dview->IfMouseTouchZ(x,y,z);
-
- return true;
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorStyleMPRView::OnLeftButtonUp ()
-{
- if (_stateMoveAxisX==true)
- {
- _stateMoveAxisX=false;
- }
- if (_stateMoveAxisY==true)
- {
- _stateMoveAxisY=false;
- }
- if (_stateMoveAxisZ==true)
- {
- _stateMoveAxisZ=false;
- }
- return true;
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorStyleMPRView::OnMouseMove ()
-{
- double x = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- double y = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
-
- double z=1;
- _vtkInteractorStyleBaseView->TransformCoordinate(x,y,z);
- wxVtkMPR2DView *wxvtkmpr2Dview = (wxVtkMPR2DView*)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView());
-// wxvtkmpr2Dview->TransfromeCoordViewWorld(x,y,z);
-
- wxvtkmpr2Dview->ChangeAxisColor(x,y,z);
-
- if ((_stateMoveAxisX==true) || (_stateMoveAxisY==true) || (_stateMoveAxisZ==true) )
- {
- if (_stateMoveAxisX==true)
- {
- wxvtkmpr2Dview-> MoveX(x,y,z);
- }
- if (_stateMoveAxisY==true)
- {
- wxvtkmpr2Dview->MoveY(x,y,z);
- }
- if (_stateMoveAxisZ==true)
- {
- wxvtkmpr2Dview->MoveZ(x,y,z);
- }
-
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
- }
- return true;
-}
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-wxVtkMPR2DView::wxVtkMPR2DView( wxWindow *parent, int direction)
- :wxVtk2DBaseView(parent)
-{
- _backX = -99999;
- _backY = -99999;
- _backZ = -99999;
- _direction = direction;
- _ptsA = NULL;
- _lineAActor = NULL;
- _lineAMapper = NULL;
- _pdA = NULL;
- _ptsB = NULL;
- _lineBActor = NULL;
- _lineBMapper = NULL;
- _pdB = NULL;
-}
-
-//-------------------------------------------------------------------
-wxVtkMPR2DView::~wxVtkMPR2DView()
-{
- if (_ptsA!=NULL) { _ptsA -> Delete(); }
- if (_lineAActor!=NULL) { _lineAActor -> Delete(); }
- if (_lineAMapper!=NULL) { _lineAMapper -> Delete(); }
- if (_pdA!=NULL) { _pdA -> Delete(); }
- if (_ptsB!=NULL) { _ptsB -> Delete(); }
- if (_lineBActor!=NULL) { _lineBActor -> Delete(); }
- if (_lineBMapper!=NULL) { _lineBMapper -> Delete(); }
- if (_pdB!=NULL) { _pdB -> Delete(); }
-}
-//-------------------------------------------------------------------
-vtkMPRBaseData *wxVtkMPR2DView::GetVtkmprbasedata()
-{
- return (vtkMPRBaseData*)GetVtkBaseData();
-}
-//-------------------------------------------------------------------
-void wxVtkMPR2DView::Configure(){
- wxVtk2DBaseView::Configure();
-
- _interactorstylemprview = new vtkInteractorStyleMPRView();
- GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _interactorstylemprview );
-
- int x1,x2,y1,y2,z1,z2;
- GetVtkmprbasedata() -> GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
-
- double spc[3];
- vtkImageData* img = GetVtkmprbasedata()->GetImageData();
- if(img!=NULL){
- img->GetSpacing(spc);
- x1 = (int)(x1*spc[0]);
- y1 = (int)(y1*spc[1]);
- z1 = (int)(z1*spc[2]);
-
- x2 = (int)(x2*spc[0]);
- y2 = (int)(y2*spc[1]);
- z2 = (int)(z2*spc[2]);
-
- _visibleAxis = true;
-
- // Axe A
- _ptsA = vtkPoints::New();
- _ptsA->SetNumberOfPoints(2);
- _ptsA->SetPoint(0, -1000 , -1000 , -1000 );
- _ptsA->SetPoint(1, 1000 , 1000 , 1000 );
- vtkCellArray *linesA;
- linesA = vtkCellArray::New();
- linesA->InsertNextCell(2);
- linesA->InsertCellPoint(0);
- linesA->InsertCellPoint(1);
- _pdA = vtkPolyData::New();
- _pdA->SetPoints( _ptsA );
- _pdA->SetLines( linesA );
- linesA->Delete(); //do not delete lines ??
- _lineAActor = vtkActor::New();
- _lineAMapper = vtkPolyDataMapper::New();
- _lineAMapper->SetInput(_pdA);
- _lineAMapper->ImmediateModeRenderingOn();
- _lineAActor->SetMapper(_lineAMapper);
-// _lineAActor->GetProperty()->BackfaceCullingOn();
- _lineAActor->GetProperty()->SetDiffuseColor(1,0,0);
- _lineAActor->GetProperty()->SetLineWidth(2);
- _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
-
- // Axe B
- _ptsB = vtkPoints::New();
- _ptsB->SetNumberOfPoints(2);
- _ptsB->SetPoint(0, -1000 , -1000 , -1000 );
- _ptsB->SetPoint(1, 1000 , 1000 , 1000 );
- vtkCellArray *linesB;
- linesB = vtkCellArray::New();
- linesB->InsertNextCell(2);
- linesB->InsertCellPoint(0);
- linesB->InsertCellPoint(1);
- _pdB = vtkPolyData::New();
- _pdB->SetPoints( _ptsB );
- _pdB->SetLines( linesB );
- linesB->Delete(); //do not delete lines ??
- _lineBActor = vtkActor::New();
- _lineBMapper = vtkPolyDataMapper::New();
- _lineBMapper->SetInput(_pdB);
- _lineBMapper->ImmediateModeRenderingOn();
- _lineBActor->SetMapper(_lineBMapper);
-// _lineBActor->GetProperty()->BackfaceCullingOn();
- _lineBActor->GetProperty()->SetDiffuseColor(1,0,0);
- _lineBActor->GetProperty()->SetLineWidth(2);
- _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
-
-
- vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
-
-//EED 17Avril2009
-/*
- if (_direction==0) {
- camera->SetViewUp ( 0 , -1 , 0 );
- camera->SetPosition ( -10000,(y1+y2)/2 , (z1+z2)/2 );
- camera->SetFocalPoint ( 0 , (y1+y2)/2 , (z1+z2)/2 );
- camera->SetParallelScale( (z2-z1)/3.0 );
- }
-
- if (_direction==1) {
- camera->SetViewUp ( 0 , 0 , -1 );
- camera->SetPosition ((x1+x2)/2 , 10000 , (z1+z2)/2 );
- camera->SetFocalPoint ((x1+x2)/2 , 0 , (z1+z2)/2 );
- camera->SetParallelScale( (x2-x1)/3.0 );
- }
-
- if (_direction==2) {
- camera->SetViewUp ( 0 , -1 , 0 );
- camera->SetPosition ((x1+x2)/2 , (y1+y2)/2 , -10000);
- camera->SetFocalPoint ((x1+x2)/2 , (y1+y2)/2 , 0 );
- camera->SetParallelScale( (x2-x1)/3.0 );
- }
- */
-
- if (_direction==0) {
- camera->SetViewUp ( 0 , 1 , 0 );
- camera->SetPosition ( 10000,(y1+y2)/2 , (z1+z2)/2 );
- camera->SetFocalPoint ( 0 , (y1+y2)/2 , (z1+z2)/2 );
- camera->SetParallelScale( (z2-z1)/3.0 );
- }
-
- if (_direction==1) {
- camera->SetViewUp ( 0 , 0 , -1 );
- camera->SetPosition ((x1+x2)/2 , 10000 , (z1+z2)/2 );
- camera->SetFocalPoint ((x1+x2)/2 , 0 , (z1+z2)/2 );
- camera->SetParallelScale( (x2-x1)/3.0 );
- }
-
- if (_direction==2) {
- camera->SetViewUp ( 0 , 1 , 0 );
- camera->SetPosition ((x1+x2)/2 , (y1+y2)/2 , 10000);
- camera->SetFocalPoint ((x1+x2)/2 , (y1+y2)/2 , 0 );
- camera->SetParallelScale( (x2-x1)/3.0 );
- }
-
-
-
- }
-
-// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160);
-// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel (800);
-
-}
-
-void wxVtkMPR2DView::SetVisibleAxis(bool ok)
-{
- if (ok!=_visibleAxis)
- {
- _visibleAxis=ok;
- if (_visibleAxis==true)
- {
- _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
- _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
- }
- if (_visibleAxis==false)
- {
- _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->RemoveActor( _lineAActor );
- _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->RemoveActor( _lineBActor );
- }
-
- }
-}
-
-//-------------------------------------------------------------------
-void wxVtkMPR2DView::Refresh()
-{
- //wxVtk2DBaseView::Refresh();
-
-
- //vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2(); // JPRx
- //vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera(); // JPRx
-
-
-
- int x1,x2,y1,y2,z1,z2;
- GetVtkmprbasedata()->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
- double spc[3];
-
- vtkImageData* img = GetVtkmprbasedata()->GetImageData();
- if(img!=NULL){
- img->GetSpacing(spc);
- x1 = (int)(x1*spc[0]);
- y1 = (int)(y1*spc[1]);
- z1 = (int)(z1*spc[2]);
-
- x2 = (int)(x2*spc[0]);
- y2 = (int)(y2*spc[1]);
- z2 = (int)(z2*spc[2]);
-
- int x = (int)(GetVtkmprbasedata()->GetX());
- int y = (int)(GetVtkmprbasedata()->GetY());
- int z = (int)(GetVtkmprbasedata()->GetZ());
-
- x = (int)(x*spc[0]);
- y = (int)(y*spc[1]);
- z = (int)(z*spc[2]);
-
-
-
- if ((x!=_backX) || (y!=_backY) || (z!=_backZ)) {
-
- if (_direction==0) {
- _imageViewer2XYZ->SetXSlice( (int)(GetVtkmprbasedata()->GetX()) );
- _ptsA->SetPoint(0, -x2, y1 , z );
- _ptsA->SetPoint(1, -x2, y2 , z );
- _ptsB->SetPoint(0, -x2, y , z1);
- _ptsB->SetPoint(1, -x2, y , z2);
- }
- if (_direction==1) {
- _imageViewer2XYZ->SetYSlice( (int)(GetVtkmprbasedata()->GetY()) );
- _ptsA->SetPoint(0, x1 , y2 , z );
- _ptsA->SetPoint(1, x2 , y2 , z );
- _ptsB->SetPoint(0, x , y2 , z1);
- _ptsB->SetPoint(1, x , y2 , z2);
- }
- if (_direction==2) {
- _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) );
- _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) );
- // _ptsA->SetPoint(0, x1 , y , -z2 );
- // _ptsA->SetPoint(1, x2 , y , -z2 );
- // _ptsB->SetPoint(0, x , y1, -z2 );
- // _ptsB->SetPoint(1, x , y2, -z2 );
-
- _ptsA->SetPoint(0, x1 , y , z2 );
- _ptsA->SetPoint(1, x2 , y , z2 );
- _ptsB->SetPoint(0, x , y1, z2 );
- _ptsB->SetPoint(1, x , y2, z2 );
- }
- _backX=x;
- _backY=y;
- _backZ=z;
- }
- wxVtkBaseView::Refresh();
- }
-}
-//-------------------------------------------------------------------
-int wxVtkMPR2DView::GetActualSlice() // virtual
-{
- int result;
- if (_direction==0)
- {
- result = (int)(GetVtkmprbasedata()->GetX());
- }
- if (_direction==1)
- {
- result = (int)(GetVtkmprbasedata()->GetY());
- }
- if (_direction==2)
- {
- result = (int)(GetVtkmprbasedata()->GetZ());
- }
- return result;
-}
-//-------------------------------------------------------------------
-void wxVtkMPR2DView::SetActualSlice(int slice) // virtual
-{
- if (_direction==0)
- {
- GetVtkmprbasedata()->SetX(slice);
- }
- if (_direction==1)
- {
- GetVtkmprbasedata()->SetY(slice);
- }
- if (_direction==2)
- {
- GetVtkmprbasedata()->SetZ(slice);
- }
-}
-//-------------------------------------------------------------------
-bool wxVtkMPR2DView::IfMouseTouchX(double x, double y, double z)
-{
- double delta=5;
- bool result=false;
- if (_direction==0)
- {
- }
- if (_direction==1)
- {
- if (( x<GetVtkmprbasedata()->GetX()+delta ) && ( x>GetVtkmprbasedata()->GetX()-delta ))
- {
- result = true;
- }
- }
- if (_direction==2)
- {
- if (( x<GetVtkmprbasedata()->GetX()+delta ) && ( x>GetVtkmprbasedata()->GetX()-delta ))
- {
- result = true;
- }
- }
- return result;
-}
-//-------------------------------------------------------------------
-bool wxVtkMPR2DView::IfMouseTouchY(double x, double y, double z)
-{
- double delta=5;
- bool result=false;
- if (_direction==0)
- {
- if (( y<GetVtkmprbasedata()->GetY()+delta ) && ( y>GetVtkmprbasedata()->GetY()-delta ))
- {
- result = true;
- }
- }
- if (_direction==1)
- {
- }
- if (_direction==2)
- {
- if (( y<GetVtkmprbasedata()->GetY()+delta ) && ( y>GetVtkmprbasedata()->GetY()-delta ))
- {
- result = true;
- }
- }
- return result;
-}
-//-------------------------------------------------------------------
-bool wxVtkMPR2DView::IfMouseTouchZ(double x, double y, double z)
-{
- double delta=5;
- bool result=false;
- if (_direction==0)
- {
- if (( z<GetVtkmprbasedata()->GetZ()+delta ) && ( z>GetVtkmprbasedata()->GetZ()-delta ))
- {
- result = true;
- }
- }
- if (_direction==1)
- {
- if (( z<GetVtkmprbasedata()->GetZ()+delta ) && ( z>GetVtkmprbasedata()->GetZ()-delta ))
- {
- result = true;
- }
- }
- if (_direction==2)
- {
- }
- return result;
-}
-//-------------------------------------------------------------------
-void wxVtkMPR2DView::MoveX(double x, double y, double z)
-{
- if (_direction==0)
- {
- }
- if (_direction==1)
- {
- GetVtkmprbasedata()->SetX(x);
- }
- if (_direction==2)
- {
- GetVtkmprbasedata()->SetX(x);
- }
-}
-//-------------------------------------------------------------------
-void wxVtkMPR2DView::MoveY(double x, double y, double z)
-{
- if (_direction==0)
- {
- GetVtkmprbasedata()->SetY(y);
- }
- if (_direction==1)
- {
- }
- if (_direction==2)
- {
- GetVtkmprbasedata()->SetY(y);
- }
-}
-//-------------------------------------------------------------------
-void wxVtkMPR2DView::MoveZ(double x, double y, double z)
-{
- if (_direction==0)
- {
- GetVtkmprbasedata()->SetZ(z);
- }
- if (_direction==1)
- {
- GetVtkmprbasedata()->SetZ(z);
- }
- if (_direction==2)
- {
- }
-}
-//-------------------------------------------------------------------
-void wxVtkMPR2DView::ChangeAxisColor(double x, double y, double z)
-{
- double c1r=1,c1g=1,c1b=0;
- double c2r=1,c2g=0,c2b=0;
-
- if (_direction==0)
- {
- if (IfMouseTouchY(x,y,z)==true)
- {
- _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
- } else {
- _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
- }
- if (IfMouseTouchZ(x,y,z)==true)
- {
- _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
- } else {
- _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
- }
- }
-
- if (_direction==1)
- {
- if (IfMouseTouchX(x,y,z)==true)
- {
- _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
- } else {
- _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
- }
- if (IfMouseTouchZ(x,y,z)==true)
- {
- _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
- } else {
- _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
- }
- }
-
- if (_direction==2)
- {
- if (IfMouseTouchX(x,y,z)==true)
- {
- _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
- } else {
- _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
- }
- if (IfMouseTouchY(x,y,z)==true)
- {
- _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
- } else {
- _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
- }
- }
- Refresh();
-}
-//-------------------------------------------------------------------
-void wxVtkMPR2DView::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // virtual
-{
- wxVtkBaseView::TransfromeCoordScreenToWorld(X,Y,Z,_direction);
-
- if (_direction==0)
- {
- X = ((vtkMPRBaseData*)GetVtkBaseData())->GetX();
- }
- if (_direction==1)
- {
- Y = ((vtkMPRBaseData*)GetVtkBaseData())->GetY();
- }
- if (_direction==2)
- {
- Z = ((vtkMPRBaseData*)GetVtkBaseData())->GetZ();
- }
-}
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//void boxVolumeObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual
-// if (eventId==vtkCommand::StartInteractionEvent){
-// _renWin->SetDesiredUpdateRate(10);
-// }
-// if (eventId==vtkCommand::InteractionEvent){
-// _renWin->SetDesiredUpdateRate(0.001);
-// }
-// if (eventId==vtkCommand::EndInteractionEvent){
-// vtkPlanes *planes = vtkPlanes::New();
-// vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
-// boxwidget->GetPlanes(planes);
-// _volumeMapper->SetClippingPlanes(planes);
-// planes -> Delete();
-// }
-//}
-
-//-------------------------------------------------------------------
-//void boxVolumeObserver::SetRenWin( vtkRenderWindow *renWin ){
-// _renWin = renWin;
-//}
-//-------------------------------------------------------------------
-//void boxVolumeObserver::SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper){
-// _volumeMapper = volumeMapper;
-//}
-
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-// EED 9 fev 2007
-void boxSurfaceObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual
- vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
- boxwidget->GetPlanes(_planes);
-
- if ( _vtkVolumeRayCastMapper != NULL )
- {
- _vtkVolumeRayCastMapper->RemoveAllClippingPlanes();
-// vtkPlanes *planes = vtkPlanes::New();
-// boxwidget->GetPlanes(planes);
-// _vtkVolumeRayCastMapper->SetClippingPlanes(planes);
- _vtkVolumeRayCastMapper->SetClippingPlanes(_planes);
- }
-
-// _actor->VisibilityOn();
-
-}
-//-------------------------------------------------------------------
-void boxSurfaceObserver::SetPlanes(vtkPlanes *planes){
- _planes = planes;
-}
-//-------------------------------------------------------------------
-void boxSurfaceObserver::SetActor(vtkProp *actor){
- _actor = actor;
-}
-
-//-------------------------------------------------------------------
-void boxSurfaceObserver::SetvtkVolumeRayCastMapper(vtkVolumeRayCastMapper *vtkvolumeraycastmapper)
-{
- _vtkVolumeRayCastMapper = vtkvolumeraycastmapper;
-}
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DView *wxvtkmpr3Dview )
-: wxPanel(parent, -1)
-{
-
- wxPanel *panel = this;
- _wxvtkmpr3Dview = wxvtkmpr3Dview;
-
- /*int maxX = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionX();
- int maxY = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionY();
- int maxZ = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionZ();*/
-
- int maxX = 1;
- int maxY = 1;
- int maxZ = 1;
-
- wxCheckBox *ckBoxX = new wxCheckBox(panel,-1,_T("X "));
- _positionX = new wxSlider(panel,-1,maxX/2,0,maxX, wxDefaultPosition, wxSize(150,40), wxSL_HORIZONTAL | wxSL_LABELS);
- wxCheckBox *ckBoxY = new wxCheckBox(panel,-1,_T("Y "));
- _positionY = new wxSlider(panel,-1,maxY/2,0,maxY, wxDefaultPosition, wxSize(150,40), wxSL_HORIZONTAL | wxSL_LABELS);
- wxCheckBox *ckBoxZ = new wxCheckBox(panel,-1,_T("Z "));
- _positionZ = new wxSlider(panel,-1,maxZ/2,0,maxZ, wxDefaultPosition, wxSize(150,40), wxSL_HORIZONTAL | wxSL_LABELS);
- wxButton *btnColorTable = new wxButton (panel, -1, _T("Edit Color Table") );
-
- _ckBoxXYZ = new wxCheckBox(panel,-1,_T("XYZ "));
- _ckBoxPlane = new wxCheckBox(panel,-1,_T("Plane"));
-
- ckBoxX->SetValue(false);
- ckBoxY->SetValue(false);
- ckBoxZ->SetValue(false);
- _ckBoxXYZ->SetValue(false);
- _ckBoxPlane->SetValue(false);
-
- _positionX->SetSize(400,20);
- _positionY->SetSize(400,20);
- _positionZ->SetSize(400,20);
-
- Connect(ckBoxX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX );
- Connect(_positionX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionX );
- Connect(ckBoxY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY );
- Connect(_positionY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionY );
- Connect(ckBoxZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ );
- Connect(_positionZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionZ );
- Connect(btnColorTable->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnEditColorTable );
-
- Connect(_ckBoxXYZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisXYZ );
- Connect(_ckBoxPlane->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisiblePlane );
-
-
- wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
-// wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
-
-// wxBoxSizer *sizerH4 = new wxBoxSizer(wxHORIZONTAL);
- wxFlexGridSizer *sizerH4 = new wxFlexGridSizer(10);
- wxFlexGridSizer *sizerH5 = new wxFlexGridSizer(10);
-
-
-
-//EED 28 sep 2006
-// wxFlexGridSizer *sizerH6 = new wxFlexGridSizer(10);
-// wxFlexGridSizer *sizerH7 = new wxFlexGridSizer(10);
-
-// sizerH4->Add( ckBoxX , 1, wxALL|wxEXPAND, 0);
-// sizerH4->Add( new wxStaticText(panel, -1," ") , 1, wxALL|wxEXPAND, 0);
-// sizerH4->Add( _positionX , 1, wxALL|wxEXPAND, 0);
-
-// sizerH5->Add( ckBoxY , 1, wxALL|wxEXPAND, 0);
-// sizerH5->Add( new wxStaticText(panel, -1," ") , 1, wxALL|wxEXPAND, 0);
-// sizerH5->Add( _positionY , 1, wxALL|wxEXPAND, 0);
-
-// sizerH6->Add( ckBoxZ , 1, wxALL|wxEXPAND, 0);
-// sizerH6->Add( new wxStaticText(panel, -1," ") , 1, wxALL|wxEXPAND, 0);
-// sizerH6->Add( _positionZ , 1, wxALL|wxEXPAND, 0);
-
-// sizerH7->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0);
-// sizerH7->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0);
-
-// sizer->Add( sizerH4 , 1, wxALL|wxEXPAND, 2);
-// sizer->Add( sizerH5 , 1, wxALL|wxEXPAND, 2);
-// sizer->Add( sizerH6 , 1, wxALL|wxEXPAND, 2);
-// sizer->Add( sizerH7 , 1, wxALL|wxEXPAND, 2);
-
- sizerH4->Add( _positionX ,1,wxGROW , 0 );
- sizerH4->Add( ckBoxX ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED , 0 );
- sizerH4->Add( _positionY ,1,wxGROW , 0 );
- sizerH4->Add( ckBoxY ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED , 0 );
- sizerH4->Add( _positionZ ,1,wxGROW , 0 );
- sizerH4->Add( ckBoxZ ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED , 0 );
- sizerH4->Add( btnColorTable ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED , 0 );
-
- sizerH5->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0);
- sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0);
- sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
-// sizerH5->Add( ckBoxX , 1, wxALL|wxEXPAND, 0);
-// sizerH5->Add( ckBoxY , 1, wxALL|wxEXPAND, 0);
-// sizerH5->Add( ckBoxZ , 1, wxALL|wxEXPAND, 0);
-
- sizer->Add( sizerH4 , 1, wxALL|wxGROW, 2);
- sizer->Add( sizerH5 , 1, wxALL|wxEXPAND, 2);
-
-
- panel->SetSize(400,50);
- panel->SetAutoLayout(true);
- panel->SetSizer(sizer);
- panel->Layout();
-
- panel->SetEventHandler((wxEvtHandler*)this);
-
- //this->UpdateControlPanel();
-
-}
-void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel()
-{
-
- vtkMPRBaseData* basedata = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData();
- if(basedata != NULL){
-
- /*int maxX = basedata->GetMaxPositionX();
- int maxY = basedata->GetMaxPositionY();
- int maxZ = basedata->GetMaxPositionZ();*/
- int x0,x1,y0,y1,z0,z1;
-
- basedata->GetDimensionExtention(&x0,&x1,&y0,&y1,&z0,&z1);
- /*int maxX = x1-x0;//basedata->GetMaxPositionX();
- int maxY = y1-y0;//basedata->GetMaxPositionY();
- int maxZ = z1-z0;//basedata->GetMaxPositionZ();*/
-
-
-
- //std::cout<<"wxVtkMPR3DViewCntrlPanel::UpdateControlPanel() maxX="<<maxX<<" maxY="<<maxY<<" maxZ="<<maxZ<<std::endl;
- /*_positionX->SetRange(0,maxX);
- _positionY->SetRange(0,maxY);
- _positionZ->SetRange(0,maxZ);*/
- _positionX->SetRange(x0,x1);
- _positionY->SetRange(y0,y1);
- _positionZ->SetRange(z0,z1);
-
- _positionX->SetValue((x0+x1)/2);
- _positionY->SetValue((y0+y1)/2);
- _positionZ->SetValue((z0+z1)/2);
-
- _positionX->Update();
- _positionY->Update();
- _positionZ->Update();
- this->Update();
- }
-
-}
-//-------------------------------------------------------------------
-wxVtkMPR3DViewCntrlPanel::~wxVtkMPR3DViewCntrlPanel()
-{
-}
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::Refresh()
-{
-// wxPanel::Refresh();
- _positionX->SetValue( (int)(_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX( )) );
- _positionY->SetValue( (int)(_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY( )) );
- _positionZ->SetValue( (int)(_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ( )) );
-}
-/*
-//-------------------------------------------------------------------
-int wxVtkMPR3DViewCntrlPanel::GetIdTissue()
-{
- int idTissue=-1;
- if (_surfA->GetValue()==true)
- {
- idTissue=0;
- }
- if (_surfB->GetValue()==true)
- {
- idTissue=1;
- }
- if (_surfC->GetValue()==true)
- {
- idTissue=2;
- }
- if (_surfD->GetValue()==true)
- {
- idTissue=3;
- }
-
- return idTissue;
-}
-*/
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnEditColorTable(wxCommandEvent& event)
-{
-
- vtkColorTransferFunction *ctfun = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetvtkColorTransferFunction();
- std::vector<double> *ctfunVectorPoint = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorPoint();
- std::vector<double> *ctfunVectorRed = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorRed();
- std::vector<double> *ctfunVectorGreen = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorGreen();
- std::vector<double> *ctfunVectorBlue = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorBlue();
-
- printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfun %p\n", this, ctfun);
- printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfunVectorPoint %p\n", this, ctfunVectorPoint);
- printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfunVectorRed %p\n", this, ctfunVectorRed);
- printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfunVectorGreen %p\n", this, ctfunVectorGreen);
- printf("EED %p wxVtkMPR3DViewCntrlPanel::OnEditColorTable ctfunVectorBlue %p\n", this, ctfunVectorBlue);
-
-
- //void *p=this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer(); // JPRx
-
-
- int i=0,xi,r,g,b;
-
- vtkImageData *imagedata = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
-
- HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Color table"),imagedata,2);
-
-
- hDlg->erasePointsTransferenceFunction();
- int ctfSize=ctfunVectorRed->size();
- if(ctfSize>0)
- {
-// MACHETE OJO Eduardo
- int i=0;
- while(i<ctfSize)
- {
- double gr = (*ctfunVectorPoint)[i];
- double r = (*ctfunVectorRed)[i];
- double g = (*ctfunVectorGreen)[i];
- double b = (*ctfunVectorBlue)[i];
-
-hDlg->addColorPoint(gr,(int)(r*255),(int)(g*255),(int)(b*255));
- i++;
- }
- }
-
- //
- // when the user had changed the transference Function
- //
-
- //setting variables if the user wants to do refresh
-
- hDlg->setCTF(ctfun);
- hDlg->setMPR3Dview(_wxvtkmpr3Dview);
-
- if(hDlg->ShowModal()== wxID_OK )
- {
-
- // -- vtkColorTransferFunction --
- ctfun->RemoveAllPoints ();
- //clean colors
- ctfunVectorPoint->clear();
- ctfunVectorRed->clear();
- ctfunVectorGreen->clear();
- ctfunVectorBlue->clear();
-
- int nCTFpoints=hDlg->getSizeBarColor();
-// Machete .. Ojo Eduardo
- i=0;
- while(i<nCTFpoints)
- {
- hDlg->getDataBarColorPoint(i,xi,r,g,b);
- /*
- if (i==0)
- {
- hDlg->getDataBarColorPoint(1,xi,r,g,b);
- }
- if (i==nCTFpoints)
- {
- hDlg->getDataBarColorPoint(i-1,xi,r,g,b);
- }
- */
- ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
- ctfunVectorPoint->push_back(xi);
- ctfunVectorRed->push_back(r/255.0);
- ctfunVectorGreen->push_back(g/255.0);
- ctfunVectorBlue->push_back(b/255.0);
- i++;
-
- }
-
- }
-
- else
- {
-
- if(hDlg->getRefreshed())
- {
- // -- vtkColorTransferFunction --
- ctfun->RemoveAllPoints ();
-
- int i=0;
- int size=ctfunVectorPoint->size();
-
- for(i=0;i<size;i++)
- {
- double grey2=(*ctfunVectorPoint)[i];
- double red =(*ctfunVectorRed)[i];
- double green =(*ctfunVectorGreen)[i];
- double blue = (*ctfunVectorBlue)[i];
- ctfun->AddRGBPoint(grey2,red,green,blue);
- }
- }
-
- }
-
- hDlg->Destroy();
-}
-
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX(wxCommandEvent& event)
-{
- _wxvtkmpr3Dview->VisibleImageActor(0, event.IsChecked() );
- _wxvtkmpr3Dview->Refresh();
-
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
-
- try{
- _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- }catch(char* e){
- std::cout<<e<<std::endl;
- }
-
-}
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY(wxCommandEvent& event)
-{
- _wxvtkmpr3Dview->VisibleImageActor(1, event.IsChecked() );
- _wxvtkmpr3Dview->Refresh();
-
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-
-}
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ(wxCommandEvent& event)
-{
- _wxvtkmpr3Dview->VisibleImageActor(2, event.IsChecked() );
- _wxvtkmpr3Dview->Refresh();
-
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-}
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisXYZ(wxCommandEvent& event)
-{
- _wxvtkmpr3Dview->VisiblePointWidget(event.IsChecked());
-}
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnVisiblePlane(wxCommandEvent& event)
-{
- _wxvtkmpr3Dview->VisiblePlaneWidget(event.IsChecked());
-}
-
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnPositionX(wxScrollEvent& event)
-{
- _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX( _positionX->GetValue() );
- _wxvtkmpr3Dview->RefreshView();
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-}
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnPositionY(wxScrollEvent& event)
-{
- _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY( _positionY->GetValue() );
- _wxvtkmpr3Dview->RefreshView();
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-}
-//-------------------------------------------------------------------
-void wxVtkMPR3DViewCntrlPanel::OnPositionZ(wxScrollEvent& event)
-{
- _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ( _positionZ->GetValue() );
- _wxvtkmpr3Dview->RefreshView();
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-}
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, wxVtkClipping3DView *wxvtkclipping3Dview )
-: wxPanel(parent, -1)
-{
- wxPanel *panel = this;
- _wxvtkclipping3Dview = wxvtkclipping3Dview;
-
-//EEDx2.6
-// wxStaticText *text1 = new wxStaticText(panel, -1,_T(" "));
-// wxStaticText *text2 = new wxStaticText(panel, -1,_T(" "));
-
- _surfA = new wxRadioButton(panel,-1,_T("A"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
- _surfB = new wxRadioButton(panel,-1,_T("B"));
- _surfC = new wxRadioButton(panel,-1,_T("C"));
- _surfD = new wxRadioButton(panel,-1,_T("D"));
-
- wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Vol"));
- wxCheckBox *ckBoxSurface = new wxCheckBox(panel,-1,_T("Surface Box"));
- wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box"));
-
- _color = new wxButton(panel,-1,_T(""));
- _visible = new wxCheckBox(panel,-1,_T("Vis"));
- _opacity = new wxSlider(panel,-1,50,0,100, wxDefaultPosition, wxSize(800,40), wxSL_HORIZONTAL | wxSL_LABELS);
-
- wxStaticText *isoValueTitle = new wxStaticText(panel,-1,_T("isoValue"));
- _isoValue = new wxSlider(panel,-1,2000,110,2000, wxDefaultPosition, wxSize(800,40), wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS);
-
-
- _wireFrameRep = new wxRadioButton(panel,-1,_T("WireFrame"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
- _surfaceRep = new wxRadioButton(panel,-1,_T("Surface"));
-
-
- double range[2];
- vtkImageData *vtkimagedata = wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
- vtkimagedata->GetScalarRange( range );
- _isoValue->SetRange( (int)(range[1]*0.1) , (int)(range[1]) );
- _isoValue->SetValue( (int)(wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIsovalue(0)) );
-
-
- _isoValue->SetTickFreq(25,0);
-
- _isoValueSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT );
- _isoValueSpin->SetRange(1,8);
- _isoValueSpin->SetValue(5);
- Connect(_isoValueSpin->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin );
-
- wxButton *btnSTL = new wxButton(panel,-1,_T("Create STL File"));
- wxButton *btnSaveRaw = new wxButton(panel,-1,_T("Save Raw Volume"));
-
- wxButton *btnVolumeFunctions = new wxButton(panel,-1,_T("Read Volume Functions"));
-
-
- Connect(btnSTL->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL );
- Connect(btnSaveRaw->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume );
- Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions );
-
-
- wxButton *btnMeshVTKLoad = new wxButton(panel,-1,_T("Load Mesh"));
- Connect(btnMeshVTKLoad->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad );
-
-
-/*
- int maxX = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionX();
- int maxY = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionY();
- int maxZ = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionZ();
- wxCheckBox *ckBoxX = new wxCheckBox(panel,-1,"X");
- _positionX = new wxSlider(panel,-1,maxX/2,0,maxX, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
- wxCheckBox *ckBoxY = new wxCheckBox(panel,-1,"Y");
- _positionY = new wxSlider(panel,-1,maxY/2,0,maxY, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
- wxCheckBox *ckBoxZ = new wxCheckBox(panel,-1,"Z");
- _positionZ = new wxSlider(panel,-1,maxZ/2,0,maxZ, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
-*/
-
-// ckVolum->Enable(false);
- ckBoxSurface->SetValue(false);
- ckBoxVolume->SetValue(false);
- _color->SetSize(40,20);
- _opacity->SetSize(370,20);
-// ckBoxX->SetValue(true);
-// ckBoxY->SetValue(true);
-// ckBoxZ->SetValue(true);
- _surfA->SetValue(true);
- _wireFrameRep->SetValue(false);
- _surfaceRep->SetValue(true);
- _visible->SetValue(false);
-// _positionX->SetSize(400,20);
-// _positionY->SetSize(400,20);
-// _positionZ->SetSize(400,20);
-
- Connect(ckVolum->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleVolume );
- Connect(ckBoxVolume->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume );
-
- Connect(_surfA->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface );
- Connect(_surfB->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface );
- Connect(_surfC->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface );
- Connect(_surfD->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface );
- Connect(ckBoxSurface->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleBoxSurface );
-
- Connect(_wireFrameRep->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnRepresentationSurfaceWireFrame );
- Connect(_surfaceRep->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnRepresentationSurfaceWireFrame );
-
- Connect(_color->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnColor );
- Connect(_visible->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleSurface );
- Connect(_opacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnOpacity );
-
-//EED 27Dic2007
-// Connect(_isoValue->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValue );
- Connect(_isoValue->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValue );
-
-/*
- Connect(ckBoxX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX );
- Connect(_positionX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionX );
- Connect(ckBoxY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY );
- Connect(_positionY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionY );
- Connect(ckBoxZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ );
- Connect(_positionZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionZ );
-*/
-
- wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
- wxFlexGridSizer *sizerH0 = new wxFlexGridSizer(20);
- wxFlexGridSizer *sizerH1 = new wxFlexGridSizer(20);
- wxFlexGridSizer *sizerH2 = new wxFlexGridSizer(10);
- wxFlexGridSizer *sizerH3 = new wxFlexGridSizer(10);
- //wxFlexGridSizer *sizerH4 = new wxFlexGridSizer(10); // JPRx
- //wxFlexGridSizer *sizerH5 = new wxFlexGridSizer(10); // JPRx
- //wxFlexGridSizer *sizerH6 = new wxFlexGridSizer(10); // JPRx
-
- sizerH0->Add( ckVolum , 1, wxALL|wxEXPAND, 0);
- sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH0->Add( ckBoxVolume , 1, wxALL|wxEXPAND, 0);
- sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH0->Add( btnVolumeFunctions , 1, wxALL|wxEXPAND, 0);
- sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH0->Add( btnMeshVTKLoad , 1, wxALL|wxEXPAND, 0);
-
-
- sizerH1->Add( _surfA , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( _surfB , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( _surfC , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( _surfD , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( ckBoxSurface , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( btnSTL , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH1->Add( btnSaveRaw , 1, wxALL|wxEXPAND, 0);
-
-
-// sizerH2->Add( new wxStaticText(panel, -1,_T(" ") , 1, wxALL|wxEXPAND, 0);
- sizerH2->Add( _color , 1, wxALL|wxEXPAND, 0);
- sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH2->Add( _visible , 1, wxALL|wxEXPAND, 0);
- sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
-
-
- sizerH2->Add( _wireFrameRep , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0);
- sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
- sizerH2->Add( _surfaceRep , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0);
- sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
-
- sizerH2->Add( _opacity , 1, wxALL|wxEXPAND, 0);
-
-
- sizerH3->Add( isoValueTitle , 1, wxALL|wxEXPAND, 0);
- sizerH3->Add( _isoValueSpin , 1, wxALL|wxEXPAND, 0);
- sizerH3->Add( _isoValue , 1, wxALL|wxEXPAND, 0);
-
-/*
- sizerH4->Add( ckBoxX , 1, wxALL|wxEXPAND, 0);
- sizerH4->Add( text2 , 1, wxALL|wxEXPAND, 0);
- sizerH4->Add( _positionX , 1, wxALL|wxEXPAND, 0);
-
- sizerH5->Add( ckBoxY , 1, wxALL|wxEXPAND, 0);
- sizerH5->Add( text2 , 1, wxALL|wxEXPAND, 0);
- sizerH5->Add( _positionY , 1, wxALL|wxEXPAND, 0);
-
- sizerH6->Add( ckBoxZ , 1, wxALL|wxEXPAND, 0);
- sizerH6->Add( text2 , 1, wxALL|wxEXPAND, 0);
- sizerH6->Add( _positionZ , 1, wxALL|wxEXPAND, 0);
-*/
- sizer->Add( sizerH0 , 1, wxALL|wxEXPAND, 2);
- sizer->Add( sizerH1 , 1, wxALL|wxEXPAND, 2);
- sizer->Add( sizerH2 , 1, wxALL|wxEXPAND, 2);
- sizer->Add( sizerH3 , 1, wxALL|wxEXPAND, 2);
-// sizer->Add( sizerH4 , 1, wxALL|wxEXPAND, 2);
-// sizer->Add( sizerH5 , 1, wxALL|wxEXPAND, 2);
-// sizer->Add( sizerH6 , 1, wxALL|wxEXPAND, 2);
-
- panel->SetSize(300,60);
- panel->SetAutoLayout(true);
- panel->SetSizer(sizer);
- panel->Layout();
-
- panel->SetEventHandler((wxEvtHandler*)this);
-
-}
-//-------------------------------------------------------------------
-wxVtkClipping3DViewCntrlPanel::~wxVtkClipping3DViewCntrlPanel()
-{
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::Refresh()
-{
-// wxPanel::Refresh();
-/*
- _positionX->SetValue( _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetX( ) );
- _positionY->SetValue( _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetY( ) );
- _positionZ->SetValue( _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetZ( ) );
-*/
-}
-//-------------------------------------------------------------------
-int wxVtkClipping3DViewCntrlPanel::GetIdTissue()
-{
- int idTissue=-1;
- if (_surfA->GetValue()==true)
- {
- idTissue=0;
- }
- if (_surfB->GetValue()==true)
- {
- idTissue=1;
- }
- if (_surfC->GetValue()==true)
- {
- idTissue=2;
- }
- if (_surfD->GetValue()==true)
- {
- idTissue=3;
- }
-
- return idTissue;
-}
-/*
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnVisibleAxisX(wxCommandEvent& event)
-{
- _wxvtkclipping3Dview->VisibleImageActor(0, event.IsChecked() );
- _wxvtkclipping3Dview->Refresh();
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnVisibleAxisY(wxCommandEvent& event)
-{
- _wxvtkclipping3Dview->VisibleImageActor(1, event.IsChecked() );
- _wxvtkclipping3Dview->Refresh();
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnVisibleAxisZ(wxCommandEvent& event)
-{
- _wxvtkclipping3Dview->VisibleImageActor(2, event.IsChecked() );
- _wxvtkclipping3Dview->Refresh();
-}
-*/
-
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnSurface(wxCommandEvent& event)
-{
- int idTissue=GetIdTissue();
- if (idTissue!=-1)
- {
- // Color
- vtkActor *tmpActor;
- tmpActor = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
- double rgb[3];
- tmpActor->GetProperty()->GetColor( rgb );
- wxColour colour( (int)(rgb[0]*255) , (int)(rgb[1]*255) , (int)(rgb[2]*255) );
- _color->SetBackgroundColour(colour);
-
- // Visible
- _visible->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVisibleTissue(idTissue));
-
- // Opacity
- _opacity->SetValue( (int)(tmpActor->GetProperty()->GetOpacity()*100) );
-
- // Representation Type WireFrame / Surface
- _surfaceRep->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
- _wireFrameRep->SetValue(!_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
-
- // isoValue
- int isoValue= (int)(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIsovalue(idTissue));
- _isoValue->SetValue(isoValue);
- }
-}
-
-
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnRepresentationSurfaceWireFrame(wxCommandEvent& event)
-{
- int idTissue=GetIdTissue();
- if (idTissue!=-1)
- {
- _wxvtkclipping3Dview->SetRepSurfaceWireFrame(idTissue , _surfaceRep->GetValue() );
-
- _wxvtkclipping3Dview->Refresh();
-
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-
- }
-}
-
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnVisibleVolume(wxCommandEvent& event)
-{
- _wxvtkclipping3Dview->VisibleVolumeActor( event.IsChecked() );
- _wxvtkclipping3Dview->Refresh();
-
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnVisibleBoxSurface(wxCommandEvent& event)
-{
- _wxvtkclipping3Dview->SetVisibleBoxSurface(event.IsChecked() );
- _wxvtkclipping3Dview->Refresh();
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume(wxCommandEvent& event)
-{
- _wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() );
- _wxvtkclipping3Dview->Refresh();
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnColor(wxCommandEvent& event)
-{
- int idTissue=GetIdTissue();
- if (idTissue!=-1)
- {
-// EED 17 Janvier 2007
- wxColourDialog dlgColour(this);
-// dlgColour.ShowModal();
- if( dlgColour.ShowModal( ) == wxID_OK )
- {
- vtkActor *tmpActor;
- tmpActor = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
- float r=dlgColour.GetColourData().GetColour().Red()/255;
- float g=dlgColour.GetColourData().GetColour().Green()/255;
- float b=dlgColour.GetColourData().GetColour().Blue()/255;
- tmpActor->GetProperty()->SetColor( r , g , b );
- _color->SetBackgroundColour(dlgColour.GetColourData().GetColour());
-
- _wxvtkclipping3Dview->Refresh();
-
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- }
- }
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnVisibleSurface(wxCommandEvent& event)
-{
- int idTissue=GetIdTissue();
- if (idTissue!=-1)
- {
- _wxvtkclipping3Dview->VisibleActor(idTissue, _visible->GetValue());
-
- _wxvtkclipping3Dview->Refresh();
-
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- }
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnOpacity(wxScrollEvent& event)
-{
- int idTissue=GetIdTissue();
- if (idTissue!=-1)
- {
- vtkActor *tmpActor;
- tmpActor = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
- float opacity=_opacity->GetValue();
- tmpActor->GetProperty()->SetOpacity( opacity/100 );
-
- _wxvtkclipping3Dview->Refresh();
-
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- }
-}
-
-//----------------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin(wxScrollEvent& event)
-{
- int value = _isoValue->GetValue();
- int delta= (int)pow( 4 , _isoValueSpin->GetValue() );
- int min=value - delta/2;
- int max=value + delta/2;
- if (min<0)
- {
- min=0;
- max=delta;
- }
- _isoValue->SetRange(min,max);
-}
-
-
-//------------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnIsoValue(wxScrollEvent& event)
-{
- wxBusyCursor wait;
-
- int idTissue=GetIdTissue();
- if (idTissue!=-1)
- {
- int isoValue=_isoValue->GetValue();
- _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetIsovalue(idTissue,isoValue);
-// wxString tmpStr;
-// tmpStr.Printf("%d",isoValue);
-
- _wxvtkclipping3Dview->Refresh();
-
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- }
-
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL(wxCommandEvent& event)
-{
-
- int idTissue=GetIdTissue();
- if (idTissue==-1)
- {
- idTissue=0;
- }
-
-
- wxString dirSTL = wxGetHomeDir( ) ;
- wxFileDialog dialog( this, _T("Choose a directory..."), dirSTL , _T(""), _T("*.*"), wxSAVE );
-
- if( dialog.ShowModal( ) == wxID_OK )
- {
-
-
- // ------------------------------------------------------------------------
- // 1. GENERATE STL FILES
- // ------------------------------------------------------------------------
-// const char* fileprefix = "c:\\Creatis\\";
- std::string prefix = (const char*) (dialog.GetPath().mb_str() );
- std::string filename;
-
- // 1.1. Se hace un filtro triangular puesto que el stl writer solo recibe poligonos triangulares.
-
- vtkTriangleFilter *filtro = vtkTriangleFilter::New();
-
-
- filtro->SetInput( this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueClipper(idTissue)->GetOutput() );
- vtkPolyDataConnectivityFilter *pdcf = vtkPolyDataConnectivityFilter::New();
- pdcf->SetInput( filtro->GetOutput() );
- vtkClosePolyData *cpd = vtkClosePolyData::New();
- cpd->SetInput( pdcf->GetOutput() );
-
- // 1.2 se escribe a disco el archivo stl de la superficie interna
- cpd->Update();
- vtkSTLWriter *writer = vtkSTLWriter::New();
- writer->SetInput( cpd->GetOutput() );
- filename =prefix;
- writer->SetFileName(filename.c_str());
- writer->SetFileTypeToASCII();
- writer->Write();
- writer->Delete();
-
-
- filtro->Delete();
- cpd->Delete();
- pdcf->Delete();
- }
-
-}
-
-//EED 30 Janvier 2007
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume(wxCommandEvent& event)
-{
- wxFileDialog dialog(this, _T("Choose a file"), _T(""), _T(""), _T("*.maracas"), wxSAVE );
- if (dialog.ShowModal() == wxID_OK)
- {
- std::string directory = (const char*) (dialog.GetDirectory().mb_str() );
- std::string filename = (const char*) (dialog.GetFilename().mb_str() );
- float rescalaSlope = 1;
- float rescalaIntercept = 0;
- vtkMPRBaseData *vtkmprbasedata = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData();
- vtkImageData *vtkimagedata = vtkmprbasedata->GetImageData();
- int dim[3];
- vtkimagedata->GetDimensions(dim);
- int voi[6];
- voi[0]=0;
- voi[1]=dim[0];
- voi[2]=0;
- voi[3]=dim[1];
- voi[4]=0;
- voi[5]=dim[2];
-//EED 10 oct 2007 MaracasVisu pour bbMaracasvisu
- marRAW2Files marraw2;
- marraw2.saveVolume(directory,filename,vtkimagedata,voi,rescalaSlope,rescalaIntercept);
- }
-}
-
-//EED 22 Fevrier 2007
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
-{
-
- int /*i=0,*/ xi,yi,r,g,b; // JPRx
- vtkColorTransferFunction* ctfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetColorTransferenceFunction();
- vtkPiecewiseFunction* tfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTransferencefunction();
- std::vector<double>* gtf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetGreyValuesTransferenceFVector();
- std::vector<double>* itf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIntensityValuesTransferenceFVector();
- std::vector<double>* greyctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetGreyValueColorsOfColorTransferenceFVector();
- std::vector<double>* rctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRedColorsOfColorTransferenceFVector();
- std::vector<double>* gctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetGreenColorsOfColorTransferenceFVector();
- std::vector<double>* bctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetBlueColorsOfColorTransferenceFVector();
- vtkImageData *imagedata = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
-
-
-
- //use for update in the refresh
- /*
- vtkVolumeRayCastMapper* volumeMapper = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVolumeMapper();
- vtkVolume* newvol =this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVolumeActor();
- */
-
- /*
- MMLR BORRAME
- wxFileDialog dialog(this, _T("Choose a file"), _T("c:/Maracas_configuration"),_T(""), _T("*.MarVolConf"), wxOPEN);
- if (dialog.ShowModal() == wxID_OK)
- {
- _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions( (char *)dialog.GetPath().c_str() );
-
-
- }
- */
-
- HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata,1);
- //
- // put in a method
- //
- int tfSize=gtf->size();
- if(tfSize>0)
- {
- int i=0;
- hDlg->erasePointsTransferenceFunction();
- while(i<tfSize)
- {
- double g=(*gtf)[i];
- double in=(*itf)[i];
- hDlg->addPointToTransferenceFunction(g,in*100);
- i++;
- }
-
- }
-
- int ctfSize=rctf->size();
- if(ctfSize>0)
- {
- int i=0;
- while(i<ctfSize)
- {
- double gr=(*greyctf)[i];
- double r=(*rctf)[i];
- double g=(*gctf)[i];
- double b=(*bctf)[i];
- hDlg->addColorPoint(gr,(int)(r*255),(int)(g*255),(int)(b*255));
- i++;
- }
- }
- //setting variables if the user wants to do refresh
- hDlg->setCTF(ctfun);
- hDlg->setTF(tfun);
- hDlg->setClipping3DView(_wxvtkclipping3Dview);
- /*
- hDlg->setVolume(newvol);
- hDlg->setVolumeMapper(volumeMapper);
- */
- //
- // when the user had changed the transference Function
- //
- if(hDlg->ShowModal()== wxID_OK )
- {
- // -- vtkPiecewiseFunction --
- tfun->RemoveAllPoints();
- gtf->clear();
- itf->clear();
-
- int nTFPoints=hDlg->getSizeTransferenceFunction();
- int i=0;
- while(i<nTFPoints)
- {
- hDlg->getTransferenceFunctionPoint(i,xi,yi);
- tfun->AddPoint( xi , yi/100.0 );
- gtf->push_back(xi);
- itf->push_back(yi/100.0);
- i++;
- }
- // -- vtkColorTransferFunction --
- ctfun->RemoveAllPoints ();
- //clean colors
- rctf->clear();
- gctf->clear();
- bctf->clear();
- greyctf->clear();
-
- int nCTFpoints=hDlg->getSizeBarColor();
- i=0;
- while(i<nCTFpoints)
- {
- hDlg->getDataBarColorPoint(i,xi,r,g,b);
- ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
- rctf->push_back(r/255.0);
- gctf->push_back(g/255.0);
- bctf->push_back(b/255.0);
- greyctf->push_back(xi);
- i++;
- }
- //---------------------------------
- // Refreshing and sending the event
- //---------------------------------
- //_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions();
- _wxvtkclipping3Dview->Refresh();
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-
- /*
- volumeMapper->Update();
- newvol->Update();
- */
- }
-
- else
- {
-
- if(hDlg->getRefreshed())
- {
- int i=0,size;
- //--Transference Function----
- tfun->RemoveAllPoints();
- i=0;
- size=gtf->size();
- for(i=0;i<size;i++)
- {
- double grey1=(*gtf)[i];
- double in2=(*itf)[i];
- tfun->AddPoint( grey1 , in2 );
- }
-
- // -- vtkColorTransferFunction --
- ctfun->RemoveAllPoints ();
-
- i=0;
- size=greyctf->size();
- for(i=0;i<size;i++)
- {
- double grey2=(*greyctf)[i];
- double red =(*rctf)[i];
- double green =(*gctf)[i];
- double blue = (*bctf)[i];
- ctfun->AddRGBPoint(grey2,red,green,blue);
- }
-
- //---------------------------------
- // Refreshing and sending the event
- //---------------------------------
- //_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions();
- _wxvtkclipping3Dview->Refresh();
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-
- /*
- volumeMapper->Update();
- newvol->Update();
- */
- }
-
- }
- //destroy the dialog
- hDlg->Destroy();
-}
-
-//EED 23 Mai 2007
-//-------------------------------------------------------------------
-void wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad(wxCommandEvent& event)
-{
- wxFileDialog dialog(this, _T("Choose a file"), _T("c:/Maracas_configuration"),_T(""), _T("*.vtk"), wxOPEN);
- if (dialog.ShowModal() == wxID_OK)
- {
- _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadMeshVTK( (char *)dialog.GetPath().c_str() );
- _wxvtkclipping3Dview->Refresh();
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- }
-}
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-
-wxVtkMPR3DView::wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview )
-{
- _wxvtk3Dbaseview = wxvtk3Dbaseview;
- _vtkmpr3Ddataviewer = NULL;
- _wxvtkmpr3DviewCntrlPanel = NULL;
- _myCallback=NULL;
- _pointWidget=NULL;
- _planeWidget=NULL;
- _vtkplane=NULL;
- _probe=NULL;
- _contourMapper=NULL;
-}
-void wxVtkMPR3DView::RemoveActor(vtkActor* actor){
-
- _wxvtk3Dbaseview->GetRenderer()->RemoveActor(actor);
-
-
-}
-void wxVtkMPR3DView::ResetCamera(int* ext, double* origin,double* spc){
- if(ext == NULL){
-
- _wxvtk3Dbaseview->GetRenderer()->ResetCamera ();
- _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
- }else{
- /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0));
- double y = (spc[1])*(origin[1]+(double)ext[3]);
- double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/
- /*double x0=(spc[0])*((double)ext[0]+origin[0]);
- double x1=(spc[0])*((double)ext[1]+origin[0]);
- double y0=(spc[1])*((double)ext[2]+origin[1]);
- double y1=(spc[1])*((double)ext[3]+origin[1]);
- double z0=(spc[2])*((double)ext[4]+origin[2]);
- double z1=(spc[2])*((double)ext[5]+origin[2]);*/
- double x0=(spc[0])*((double)ext[0]);
- double x1=(spc[0])*((double)ext[1]);
- double y0=(spc[1])*((double)ext[2]);
- double y1=(spc[1])*((double)ext[3]);
- double z0=(spc[2])*((double)ext[4]);
- double z1=(spc[2])*((double)ext[5]);
-
- _wxvtk3Dbaseview->GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1);
- //_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z);
- _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
- }
-}
-void wxVtkMPR3DView::Configure(){
-
- _wxvtk3Dbaseview->Configure();
- _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel();
-
-//EED ?????? 07Mai2009
-// _wxvtk3Dbaseview->GetRenderer()->Clear();
-
-
- // Actors are added to the renderer.
- vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor();
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor );
-// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(0) ); // _saggital
-// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(1) ); // _axial
-// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(2) ); // _coronal
-
-
- // An initial camera view is created. The Dolly() method moves
- // the camera towards the FocalPoint, thereby enlarging the image.
- _wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera());
- this->ResetCamera();
-
-
- // Set a background color for the renderer and set the size of the
- // render window (expressed in pixels).
- _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.36 , 0.36 , 0.36 );
- _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400);
-
- // Note that when camera movement occurs (as it does in the Dolly()
- // method), the clipping planes often need adjusting. Clipping planes
- // consist of two planes: near and far along the view direction. The
- // near plane clips out objects in front of the plane; the far plane
- // clips out objects behind the plane. This way only what is drawn
- // between the planes is actually rendered.
- _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange();
-
-
- // vtkPointWidget
- if(_myCallback!=NULL){
- _myCallback->Delete();
-
- }
- _myCallback = vtkmyPWCallback_3DPointWidget::New();
- _myCallback->SetWxVtkMPR3DView(this);
-
- if(_pointWidget!=NULL){
- _pointWidget->Delete();
- }
- _pointWidget = vtkPointWidget::New();
- _myCallback->SetVtkPointWidget(_pointWidget);
- _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
- _pointWidget->SetInput( GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData() );
-
- _pointWidget->AllOff();
-
- _pointWidget->PlaceWidget();
-// _pointWidget->SetPosition( x,y,z );
-
-//EED01 29Mars2009
-// MACOS probleme vtk-window out of wx-window
-// _pointWidget->On();
-
- _pointWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
-
-
-// PlaneWidget
- if(_planeWidget!=NULL){
- _planeWidget->Delete();
- }
- _planeWidget = vtkPlaneWidget::New();
- _myCallback->SetVtkPlaneWidget(_planeWidget);
- _planeWidget->SetInput( GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData() );
- _planeWidget->NormalToXAxisOn();
- _planeWidget->SetResolution(50);
- _planeWidget->SetRepresentationToOutline();
- int dim[3];
- GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetDimensions(dim);
- int px=(dim[0]/2);
- int py=(dim[1]/2);
- int pz=(dim[2]/2);
- int dd=20;
- _planeWidget->PlaceWidget( px-dd , px+dd , py-dd , py+dd , pz-dd , pz+dd );
-
-
- if(_vtkplane==NULL){
- _vtkplane = vtkPolyData::New();
-
- _probe = vtkProbeFilter::New();
- _probe->SetInput(_vtkplane);
-
- _contourMapper = vtkPolyDataMapper::New();
-
- _contourMapper->SetInput( _probe->GetPolyDataOutput() );
-
- _contourPlaneActor = vtkActor::New();
- _contourPlaneActor->SetMapper(_contourMapper);
-
- _contourPlaneActor->VisibilityOff();
-
- _planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
- _planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
-
- _planeWidget->Off();
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor );
-
- }else{
-
- }
- _planeWidget->GetPolyData(_vtkplane);
-
-
- vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
- _probe->SetSource( imageData );
-
-
- _contourMapper->SetScalarRange( imageData->GetScalarRange() );
-
-
-
-
-}
-//-------------------------------------------------------------------
-wxVtkMPR3DView::~wxVtkMPR3DView()
-{
-}
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::Refresh() // virtual
-{
- _vtkmpr3Ddataviewer -> Refresh();
- if (_wxvtkmpr3DviewCntrlPanel!=NULL)
- {
- _wxvtkmpr3DviewCntrlPanel->Refresh();
- }
-
-}
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::RefreshView() // virtual
-{
- double spc[3];
- this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc);
-
- //double nx=1,ny=0,nz=0; // JPRx
- Refresh();
- double x=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetX();
- double y=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetY();
- double z=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetZ();
-
- x=x*spc[0];
- y=y*spc[1];
- z=z*spc[2];
-
- _pointWidget->SetPosition( x,y,z );
-
-
- double in[3];
- double normal[3];
- vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation();
- in[0]=1; in[1]=0; in[2]=0;
- transform->TransformPoint(in,normal);
- _planeWidget->SetNormal( normal[0],normal[1],normal[2] );
-
-
- _planeWidget->SetCenter( x,y,z );
- _planeWidget->UpdatePlacement();
- _planeWidget->GetPolyData(_vtkplane);
-}
-//-------------------------------------------------------------------
-wxPanel* wxVtkMPR3DView::CreateControlPanel(wxWindow *parent)
-{
- _wxvtkmpr3DviewCntrlPanel = new wxVtkMPR3DViewCntrlPanel(parent,this);
- return _wxvtkmpr3DviewCntrlPanel;
-}
-//-------------------------------------------------------------------
-vtkMPR3DDataViewer* wxVtkMPR3DView::GetVtkMPR3DDataViewer()
-{
- return _vtkmpr3Ddataviewer;
-}
-//-------------------------------------------------------------------
-wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() throw (char*)
-{
- if(_wxvtk3Dbaseview==NULL){
- throw "wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
- }
- return _wxvtk3Dbaseview;
-}
-//-------------------------------------------------------------------
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
- if (visible!=_vtkmpr3Ddataviewer->GetVisiblePosition(idPosition)){
- if (visible==false){
- _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
- } else {
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
- }
- _vtkmpr3Ddataviewer->SetVisiblePosition(idPosition,visible);
- }
-}
-
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::VisiblePointWidget( bool visible )
-{
- if (visible==true)
- {
- _pointWidget->On();
- } else {
- _pointWidget->Off();
- }
-}
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::VisiblePlaneWidget( bool visible )
-{
- if (visible==true)
- {
- _planeWidget->On();
- _contourPlaneActor->VisibilityOn();
-
- } else {
- _planeWidget->Off();
- _contourPlaneActor->VisibilityOff();
- }
-}
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::SetVtkMPR3DDataViewer(vtkMPR3DDataViewer *vtkmpr3Ddataviewer)
-{
- _vtkmpr3Ddataviewer = vtkmpr3Ddataviewer;
-}
-
-//-------------------------------------------------------------------
-void wxVtkMPR3DView::InitOrientationPointWidget()
-{
- this->_planeWidget->SetNormal(1,0,0);
-}
-
-
-
-
-//-------------------------------------------------------------------
-// EED 25 Janvier 2007 testLoic
-void wxVtkMPR3DView::TestLoic1()
-{
-
- int sizeIma = 128;
- double dimIma = sizeIma*2;
-
- vtkImageData *vtkimagedata = this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
-
- double spc[3];
- vtkimagedata->GetSpacing(spc);
-
- vtkimagedata->Update();
-
-
- double p[3], n[3];
- this->_planeWidget->GetOrigin(p);
- this->_planeWidget->GetNormal(n);
-
-
-
- vtkPlaneSource* pSource = vtkPlaneSource::New( );
- pSource->SetResolution( sizeIma - 1, sizeIma - 1 );
- pSource->SetOrigin( p[ 0 ], p[ 1 ], p[ 2 ] );
- pSource->SetPoint1( p[ 0 ] + dimIma - 1.0, p[ 1 ], p[ 2 ] );
- pSource->SetPoint2( p[ 0 ], p[ 1 ]+ dimIma - 1.0 , p[ 2 ] );
- pSource->Update( );
- pSource->SetCenter( p[ 0 ], p[ 1 ], p[ 2 ] );
- pSource->SetNormal( n[ 0 ], n[ 1 ], n[ 2 ] );
- pSource->Update( );
-
- vtkProbeFilter* slices = vtkProbeFilter::New();
- slices->SetInput( ( vtkDataSet* )pSource->GetOutput( ) );
- slices->SetSource( vtkimagedata );
- slices->Update( );
- pSource->Delete( );
-
- vtkStructuredPoints *stPoints = vtkStructuredPoints::New();
- stPoints -> GetPointData( )->SetScalars( slices->GetOutput()->GetPointData()->GetScalars() );
- stPoints -> SetDimensions( sizeIma, sizeIma, 1 );
- stPoints -> SetScalarType( vtkimagedata->GetScalarType() );
- stPoints -> SetScalarTypeToShort();
- stPoints -> Update();
-
- vtkImageChangeInformation *change = vtkImageChangeInformation ::New();
- change -> SetInput( stPoints );
- change -> Update(); //important
-
- double _range[2];
- vtkimagedata->GetScalarRange(_range);
- vtkWindowLevelLookupTable *_bwlookup = vtkWindowLevelLookupTable::New( );
- _bwlookup->SetHueRange( 0 , 1 );
- _bwlookup->SetNumberOfColors( (int)(_range[1] - _range[0] + 1) );
- _bwlookup->SetTableRange( _range[0] , _range[1] );
- _bwlookup->SetSaturationRange( 0 , 0 );
- _bwlookup->SetValueRange( 0 , 1 );
- _bwlookup->SetAlphaRange( 1 , 1 );
- _bwlookup->Build( );
-
- vtkLookupTable * _collookup = vtkLookupTable::New( );
- _collookup->SetNumberOfColors( 256 );
- _collookup->SetTableRange( 0 , 255 );
- _collookup->Build( );
- _collookup->SetTableValue( 0 , 1 , 0 , 0 , 1 );
- _collookup->SetTableValue(128 , 0 , 0 , 1 , 1 );
- _collookup->SetTableValue(255 , 0 , 1 , 0 , 1 );
-
-
- vtkMetaImageWriter *writer = vtkMetaImageWriter::New( );
- writer->SetInput( stPoints );
- writer->SetFileName( "C:/Users/Images/temp_EED/image.mhd" );
- writer->SetFileDimensionality( 2 );
- writer->Write( );
-
-
-
- vtkDataSetMapper *_3DSliceMapper = vtkDataSetMapper::New( );
- _3DSliceMapper->SetInput(change->GetOutput( ) );
- _3DSliceMapper->SetLookupTable( _bwlookup );
- _3DSliceMapper->SetScalarRange( _range );
- _3DSliceMapper->ImmediateModeRenderingOn( );
-
- vtkActor *_3DSliceActor = vtkActor::New( );
- _3DSliceActor->SetMapper( _3DSliceMapper );
-
- // The usual rendering stuff.
- vtkCamera *camera = vtkCamera::New();
- camera->SetPosition(1,1,1);
- camera->SetFocalPoint(0,0,0);
-
- vtkRenderer *renderer = vtkRenderer::New();
- vtkRenderWindow *renWin = vtkRenderWindow::New();
- renWin->AddRenderer(renderer);
-
- vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
- iren->SetRenderWindow(renWin);
-
- renderer->AddActor( _3DSliceActor );
- renderer->SetActiveCamera(camera);
- renderer->ResetCamera();
- renderer->SetBackground(1,1,1);
-
- renWin->SetSize(300,300);
-
- // interact with data
- renWin->Render();
- iren->Start();
-
-
-
-
-
-}
-
-//-------------------------------------------------------------------
-// EED 25 Janvier 2007 testLoic
-void wxVtkMPR3DView::TestLoic2()
-{
-/*
- vtkVectorNorm *vecMagnitude = vtkVectorNorm::New();
- vecMagnitude->SetInput(VtkMainGrid);
- vecMagnitude->NormalizeOff();
- vecMagnitude->Update();
-*/
-
- vtkPlane *slicePlane = vtkPlane::New();
- this->_planeWidget->GetPlane( slicePlane );
-
-
- vtkCutter* sliceCutter = vtkCutter::New();
- vtkImageData *vtkimagedata = this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
- sliceCutter->SetInput( vtkimagedata );
- sliceCutter->SetCutFunction( slicePlane );
-
-//EED
-// vtkLookupTable *lut = BuildHueWeightBaseMap();
-
-
- vtkPolyDataMapper *slice = vtkPolyDataMapper::New();
- slice->SetInput( sliceCutter->GetOutput() );
- double range[2];
-// EED
-// slice->Update();
- vtkimagedata->GetScalarRange(range);
-// vecMagnitude->GetOutput()->GetScalarRange( range );
-// range[1] *= 0.7; // reduce the upper range by 30%
-// slice->SetScalarRange( range );
-// slice->SetLookupTable( lut );
-
-// vtkActor *sliceActor = vtkActor::New();
-// sliceActor->SetMapper( slice );
-
- vtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New();
- contourMapper->SetInput( sliceCutter->GetOutput() );
- contourMapper->SetScalarRange( range );
- // contourMapper->SetLookupTable( lut );
-
-
- vtkActor *contourActor = vtkActor::New();
- contourActor->SetMapper( contourMapper );
-
-
-
- // The usual rendering stuff.
- vtkCamera *camera = vtkCamera::New();
- camera->SetPosition(1,1,1);
- camera->SetFocalPoint(0,0,0);
-
- vtkRenderer *renderer = vtkRenderer::New();
- vtkRenderWindow *renWin = vtkRenderWindow::New();
- renWin->AddRenderer(renderer);
-
- vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
- iren->SetRenderWindow(renWin);
-
- renderer->AddActor( contourActor );
-// renderer->AddActor(cubeActor);
- renderer->SetActiveCamera(camera);
- renderer->ResetCamera();
- renderer->SetBackground(1,1,1);
-
- renWin->SetSize(300,300);
-
- // interact with data
- renWin->Render();
- iren->Start();
-
-
-}
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-wxVtkClipping3DView::wxVtkClipping3DView(wxVtk3DBaseView* wxvtk3Dbaseview)
-{
- _wxvtk3Dbaseview = wxvtk3Dbaseview;
- _vtkclipping3Ddataviewer = NULL;
- _wxvtkclipping3DviewCntrlPanel = NULL;
-
- _boxWidgetVolume = NULL;
- _boxWidgetS1 = NULL;
-}
-
-//-------------------------------------------------------------------
-wxVtkClipping3DView::~wxVtkClipping3DView(){
- if (_boxWidgetVolume!=NULL) { _boxWidgetVolume -> Delete(); }
- if (_boxWidgetS1!=NULL) { _boxWidgetS1 -> Delete(); }
- if (_vtkclipping3Ddataviewer!=NULL) { delete _vtkclipping3Ddataviewer; }
- if (_wxvtkclipping3DviewCntrlPanel!=NULL){ delete _wxvtkclipping3DviewCntrlPanel; }
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DView::SetVisibleBoxSurface(bool visible)
-{
- if (visible==true){
- _boxWidgetS1->On();
- } else {
- _boxWidgetS1->Off();
- }
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DView::SetVisibleBoxVolume(bool visible)
-{
- if (_boxWidgetVolume!=NULL){
- if (visible==true){
- _boxWidgetVolume->On();
- } else {
- _boxWidgetVolume->Off();
- }
- }
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DView::Refresh()
-{
- _vtkclipping3Ddataviewer->Refresh();
- if (_wxvtkclipping3DviewCntrlPanel!=NULL)
- {
- _wxvtkclipping3DviewCntrlPanel->Refresh();
- }
-}
-//-------------------------------------------------------------------
-wxPanel* wxVtkClipping3DView::CreateControlPanel(wxWindow *parent)
-{
- _wxvtkclipping3DviewCntrlPanel = new wxVtkClipping3DViewCntrlPanel(parent,this);
- return _wxvtkclipping3DviewCntrlPanel;
-}
-//-------------------------------------------------------------------
-vtkClipping3DDataViewer* wxVtkClipping3DView::GetVtkClipping3DDataViewer()
-{
- return _vtkclipping3Ddataviewer;
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DView::VisibleActor(int idTissue, bool visTissue){
- if (visTissue!=_vtkclipping3Ddataviewer->GetVisibleTissue(idTissue)){
- if (visTissue==false){
- _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkclipping3Ddataviewer->GetTissueActor(idTissue) );
- } else {
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(idTissue) );
-// _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(idTissue) );
-// _actor->VisibilityOn();
- }
- _vtkclipping3Ddataviewer->SetVisibleTissue(idTissue,visTissue);
- }
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DView::SetRepSurfaceWireFrame(int idTissue , bool representationType )
-{
- vtkActor *tmpActor;
- tmpActor = GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
-
- if (representationType==false){
- tmpActor->GetProperty()->SetRepresentationToWireframe();
- } else {
- tmpActor->GetProperty()->SetRepresentationToSurface();
- }
-
- _vtkclipping3Ddataviewer->SetRepresentationType(idTissue,representationType);
-}
-
-//-------------------------------------------------------------------
-void wxVtkClipping3DView::VisibleVolumeActor( bool visVolume){
- if (visVolume!=_vtkclipping3Ddataviewer->GetVisibleVolume() ){
- if (visVolume==false){
-//EED 31/03/2008
-// _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkclipping3Ddataviewer->GetVolumeActor() );
- _wxvtk3Dbaseview->GetRenderer()->RemoveVolume( _vtkclipping3Ddataviewer->GetVolumeActor() );
- } else {
-//EED 31/03/2008
-// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetVolumeActor() );
- _wxvtk3Dbaseview->GetRenderer()->AddVolume( _vtkclipping3Ddataviewer->GetVolumeActor() );
- }
- _vtkclipping3Ddataviewer->SetVisibleVolume(visVolume);
- }
-}
-//-------------------------------------------------------------------
-wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*)
-{
- if(_wxvtk3Dbaseview==NULL){
- throw "wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
- }
- return _wxvtk3Dbaseview;
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DView::Configure(){
- _wxvtk3Dbaseview->Configure();
-
- // Actors are added to the renderer.
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetOutlineActor() );
-
- _boxWidgetS1 = vtkBoxWidget::New();
- _boxWidgetS1->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() );
- _boxWidgetS1->SetPlaceFactor(1.25);
-
-
-
- vtkStripper *stripper=_vtkclipping3Ddataviewer->GetTissueStripper(0);
- vtkPolyData *polydata= stripper->GetOutput();
-
-
- _boxWidgetS1->SetInput( polydata );
- _boxWidgetS1->PlaceWidget();
-
- int i;
- for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
- {
- _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverS(i) );
- }
-
-
-
-
-// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(0) );
-// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(3));
-
- VisibleActor(0, false );
- VisibleActor(1, false );
- VisibleActor(2, false );
- VisibleActor(3, false );
-
- _boxWidgetS1->HandlesOn ();
-
-//EED 29Mars2009
-// _boxWidgetS1->On();
-
- _boxWidgetS1->Off();
-
- _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(0) );
- _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(1) );
- _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(2) );
- _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(3) );
-
-// EED 9 fev 2007
-// box Volume
- _boxWidgetVolume = vtkBoxWidget::New();
- _boxWidgetVolume->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() );
- _boxWidgetVolume->SetPlaceFactor(1.25);
-
- _boxWidgetVolume->SetInput( this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData() );
- _boxWidgetVolume->PlaceWidget();
-
- _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverV() );
-
- _boxWidgetVolume->HandlesOn ();
-
-//EED 29Mars2009
-// _boxWidgetVolume->On();
-
- _boxWidgetVolume->Off();
-
-
-// vtkPlanes *vtkplanes=this->GetVtkClipping3DDataViewer()->GetVolumePlanes();
-// _boxWidgetVolume->GetPlanes( vtkplanes );
-
-
- // An initial camera view is created. The Dolly() method moves
- // the camera towards the FocalPoint, thereby enlarging the image.
- _wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera());
- _wxvtk3Dbaseview->GetRenderer()->ResetCamera ();
- _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
-
- // Set a background color for the renderer and set the size of the
- // render window (expressed in pixels).
- _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.36 , 0.36 , 0.36 );
- _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400);
-
- // Note that when camera movement occurs (as it does in the Dolly()
- // method), the clipping planes often need adjusting. Clipping planes
- // consist of two planes: near and far along the view direction. The
- // near plane clips out objects in front of the plane; the far plane
- // clips out objects behind the plane. This way only what is drawn
- // between the planes is actually rendered.
- _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange();
-}
-//-------------------------------------------------------------------
-void wxVtkClipping3DView::SetVtkClipping3DDataViewer(vtkClipping3DDataViewer *vtkclipping3Ddataviewer)
-{
- _vtkclipping3Ddataviewer = vtkclipping3Ddataviewer;
-}
-
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-vtkInteractorStyle3DView::vtkInteractorStyle3DView()
-{
-}
-//---------------------------------------------------------------------------
-vtkInteractorStyle3DView::~vtkInteractorStyle3DView()
-{
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorStyle3DView::OnLeftDClick()
-{
- SelectMarchibCubePoint();
- return true;
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorStyle3DView::SelectMarchibCubePoint()
-{
- bool ok=false;
- gtm::TVector< double > pO( 3 ), pF( 3 ), pp( 3 ), cp( 3 );
- gtm::TVector< double > xc( 3 );
- gtm::TVector< double > x1( 3 ), n1( 3 );
- gtm::TVector< double > x2( 3 ), n2( 3 );
-
- double pickPoint[ 3 ], cameraPos[ 3 ];
- int eventrwi[2];
- vtkPointPicker* picker = vtkPointPicker::New( );
- eventrwi[0]= _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0];
- eventrwi[1]= _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- vtkRenderer *pRenderer = _vtkInteractorStyleBaseView->GetWxVtk3DBaseView()->GetRenderer();
- picker->Pick( eventrwi[0], eventrwi[1], 0.0, pRenderer );
- pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
- picker->GetPickPosition( pickPoint );
- picker->Delete( );
-
- pp( 0 ) = pickPoint[ 0 ]; pp( 1 ) = pickPoint[ 1 ]; pp( 2 ) = pickPoint[ 2 ];
- cp( 0 ) = cameraPos[ 0 ]; cp( 1 ) = cameraPos[ 1 ]; cp( 2 ) = cameraPos[ 2 ];
-
-
-//EED 27 sep 2006 (1/2)
-// wxVtkMPR3DView *wxvtkmpr3Dview = (wxVtkMPR3DView *)_vtkInteractorStyleBaseView->GetWxVtk3DBaseView();
-// double spc[3];
-// wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetSpacing(spc);
-
-
- vtkImageData *imageData = GetWxVtkMPR3DView()->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
- int dim[3];
- double spc[3];
- imageData->GetDimensions(dim);
- imageData->GetSpacing(spc);
-
-
- vtkMarchingCubes *mcubes = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetMCubes(0);
-
-
- UtilVtk3DGeometriSelection utilVtk3DGeometriSelection;
- utilVtk3DGeometriSelection.SetDimentions(dim[0],dim[1],dim[2]);
-
- utilVtk3DGeometriSelection.SetMarchingCube(mcubes);
-
- double fac;
- fac = GTM_MAX( dim[0], dim[2] );
-
-
- if( utilVtk3DGeometriSelection.FindCubePointsFromPoints(
- pO.GetAnsiRef( ), pF.GetAnsiRef( ),
- pp.GetAnsiRef( ), cp.GetAnsiRef( ) ) )
- {
-
- if( utilVtk3DGeometriSelection.GetPointAndNormalIntersection(
- x1.GetAnsiRef( ), n1.GetAnsiRef( ),
- pO.GetAnsiRef( ), pF.GetAnsiRef( ) ) )
- {
- if( utilVtk3DGeometriSelection.GetPointAndNormalIntersection(
- x2.GetAnsiRef( ), n2.GetAnsiRef( ),
- ( x1 - n1 ).GetAnsiRef( ), ( x1 - ( n1 * fac ) ).GetAnsiRef( ) ) )
- {
- xc = ( x2 + x1 ) * 0.5;
-//EED 27 sep 2006 (2/2)
- this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX(xc(0)/spc[0]);
- this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY(xc(1)/spc[1]);
- this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ(xc(2)/spc[2]);
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- this->_wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- ok=true;
- }
- }
- }
-
-
- return ok;
-}
-//-------------------------------------------------------------------
-void vtkInteractorStyle3DView::SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview )
-{
- _wxvtkmpr3Dview = wxvtkmpr3Dview;
-}
-//-------------------------------------------------------------------
-wxVtkMPR3DView *vtkInteractorStyle3DView::GetWxVtkMPR3DView()
-{
- return _wxvtkmpr3Dview;
-}
-//-------------------------------------------------------------------
-wxVtkClipping3DView *vtkInteractorStyle3DView::GetWxVtkClipping3DView()
-{
- return _wxvtkclipping3Dview;
-}
-//-------------------------------------------------------------------
-void vtkInteractorStyle3DView::SetWxVtkClipping3DView( wxVtkClipping3DView *wxvtkclipping3Dview)
-{
- _wxvtkclipping3Dview = wxvtkclipping3Dview;
-}
-
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-void vtkmyPWCallback_3DPointWidget::Execute(vtkObject *caller, unsigned long, void*)
-{
- double n[3];
- double p[3];
- double delta = 0.000000001;
-
- vtkInteractorStyleBaseView *isbv = _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetInteractorStyleBaseView();
-
- if (caller==_pointWidget)
- {
- _pointWidget->GetPosition(p);
- }
- if (caller==_planeWidget)
- {
- _planeWidget->GetCenter(p);
- _planeWidget->GetNormal(n);
- _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetNormal(n[0],n[1],n[2]);
- }
-
- double spc[3];
- _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc);
- p[0]=p[0]/spc[0];
- p[1]=p[1]/spc[1];
- p[2]=p[2]/spc[2];
-
- // Orientation change
- if ( (fabs(n[0]-_backNormal[0])>delta) || (fabs(n[1]-_backNormal[1])>delta) || (fabs(n[2]-_backNormal[2])>delta) )
- {
- _backNormal[0] = n[0];
- _backNormal[1] = n[1];
- _backNormal[2] = n[2];
- isbv->SetParent_refresh_waiting();
- }
-
- // ----------
-
- double tx = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX();
- double ty = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY();
- double tz = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ();
-
- // Position Change
- if ( (fabs(tx-p[0])>delta) || (fabs(ty-p[1])>delta) || (fabs(tz-p[2])>delta) )
- {
- _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX( p[0] );
- _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY( p[1] );
- _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ( p[2] );
- vtkInteractorStyleBaseView *isbv = _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetInteractorStyleBaseView();
- isbv->BlockRefresh();
- isbv->vtkInteractorStyleBaseView::OnLeftButtonDown();
- isbv->SetParent_refresh_waiting();
- isbv->vtkInteractorStyleBaseView::OnMouseMove();
- isbv->UnBlockRefresh();
- }
- isbv->EvaluateToRefresh();
-}
-//-------------------------------------------------------------------
-void vtkmyPWCallback_3DPointWidget::SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview )
-{
- _wxvtkmpr3Dview=wxvtkmpr3Dview;
-}
-//-------------------------------------------------------------------
-void vtkmyPWCallback_3DPointWidget::SetVtkPointWidget( vtkPointWidget *pointWidget )
-{
- _pointWidget=pointWidget;
-}
-//-------------------------------------------------------------------
-void vtkmyPWCallback_3DPointWidget::SetVtkPlaneWidget( vtkPlaneWidget *planeWidget )
-{
- _planeWidget=planeWidget;
-}
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-wxPanelCuttingImageData::wxPanelCuttingImageData (wxWindow *parent)
-: wxPanel( parent, -1)
-{
- _imageData=NULL;
- _histogrammeVector=NULL;
- _wxvtk3Dbaseview=NULL;
- _wxvtkbaseView=NULL;
- CreateInterface();
- CreateModel();
- Create3DViewObjects();
-}
-
-//-------------------------------------------------------------------
-wxPanelCuttingImageData::~wxPanelCuttingImageData()
-{
-
-
- delete _modelCube;
- delete _modelSphere;
- delete _modelCylinder;
- _vtkcube -> Delete();
- _vtksphere -> Delete();
- _vtkcylinder -> Delete();
- _cubeMapper -> Delete();
- _sphereMapper -> Delete();
- _cylinderMapper -> Delete();
- _cubeActor -> Delete();
- _sphereActor -> Delete();
- _cylinderActor -> Delete();
-// _xyplot->RemoveAllInputs();
- _xyplot -> Delete();
- _histogrammeVector->Delete();
- _renplotter->Delete();
-
- if(_wxvtkbaseView!=NULL){
- delete _wxvtkbaseView;
- }
- //delete _vtkclipping3Ddataviewer;
-
-
- //fclose(file);
-
-}
-
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::RemoveActors()
-{
- _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
-}
-
-
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::SetWxVtk3DBaseView( wxVtk3DBaseView * wxvtk3Dbaseview )
-{
- _wxvtk3Dbaseview=wxvtk3Dbaseview;
-}
-
-//-------------------------------------------------------------------
-
-void wxPanelCuttingImageData::SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer )
-{
- this->_vtkclipping3Ddataviewer = vtkclipping3Ddataviewer;
-}
-
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::Create3DViewObjects()
-{
- // Sphere
- _vtksphere = vtkSphereSource::New();
- _vtksphere->SetThetaResolution (20);
- _vtksphere->SetPhiResolution (20);
- _sphereMapper = vtkPolyDataMapper::New();
- _sphereMapper->SetInput( _vtksphere->GetOutput() );
- _sphereActor = vtkActor::New();
- _sphereActor->SetMapper(_sphereMapper);
- _sphereActor->SetOrigin(0, 0, 0);
- _sphereActor->SetPosition(0, 0, 0);
- _sphereActor->GetProperty()->SetColor(1, 0, 0);
- _sphereActor->SetUserTransform( _modelSphere->GetVtkTransform() );
-
- // cube
- _vtkcube = vtkCubeSource::New();
- _vtkcube->SetXLength (1);
- _vtkcube->SetYLength (1);
- _vtkcube->SetZLength (1);
- _cubeMapper = vtkPolyDataMapper::New();
- _cubeMapper->SetInput( _vtkcube->GetOutput() );
- _cubeActor = vtkActor::New();
- _cubeActor->SetMapper(_cubeMapper);
- _cubeActor->SetOrigin(0, 0, 0);
- _cubeActor->SetPosition(0, 0, 0);
- _cubeActor->GetProperty()->SetColor(1, 0, 0);
- _cubeActor->SetUserTransform( _modelCube->GetVtkTransform() );
-
- // cylinder
- _vtkcylinder = vtkCylinderSource::New();
- _vtkcylinder->SetResolution(20);
- _cylinderMapper = vtkPolyDataMapper::New();
- _cylinderMapper->SetInput( _vtkcylinder->GetOutput() );
- _cylinderActor = vtkActor::New();
- _cylinderActor->SetMapper(_cylinderMapper);
- _cylinderActor->SetOrigin(0, 0, 0);
- _cylinderActor->SetPosition(0, 0, 0);
- _cylinderActor->GetProperty()->SetColor(1, 0, 0);
- _cylinderActor->SetUserTransform( _modelCylinder->GetVtkTransform() );
-
-
-}
-
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::CreateModel()
-{
- _modelCube = new figureCuttingCubeModel();
- _modelSphere = new figureCuttingSphereModel();
- _modelCylinder = new figureCuttingCylinderModel();
-
-// _modelCube->SetVtkTransform( _modelCube->GetVtkTransform() );
-// _modelSphere->SetVtkTransform( _modelSphere->GetVtkTransform() );
-// _modelCylinder->SetVtkTransform( _modelCylinder->GetVtkTransform() );
-}
-
-//-------------------------------------------------------------------
-
-void wxPanelCuttingImageData::InitHistogramme()
-{
- double rangeA[2];
- if (_imageData==NULL)
- {
- rangeA[1]=1;
- } else {
- _imageData->GetScalarRange(rangeA);
- }
- _xyplot->RemoveAllInputs();
-/*
- if ( _histogrammeVector!=NULL )
- {
- _histogrammeVector -> Delete();
- }
-*/
- _histogrammeVector = vtkImageData::New();
- _histogrammeVector -> SetDimensions ( (int)(rangeA[1]),1,1 );
- _histogrammeVector -> SetScalarTypeToUnsignedShort();
- _histogrammeVector -> AllocateScalars();
- _histogrammeVector -> Update();
-
- unsigned short *p_vol = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
- int i,size = (int) (rangeA[1]);
- for (i=0; i < size; i++)
- {
- *p_vol=0;
- p_vol++;
- }
- _xyplot->SetXRange(0, rangeA[1]);
- _xyplot->SetYRange(0, 10);
- _xyplot->AddInput( _histogrammeVector );
-}
-
-//-------------------------------------------------------------------
-wxWindow *wxPanelCuttingImageData::CreatePlotHistogrammeInterface()
-{
- _xyplot = vtkXYPlotActor::New();
- InitHistogramme();
- _xyplot->GetPositionCoordinate()->SetValue(0.00, 0.00, 0);
- _xyplot->GetPosition2Coordinate()->SetValue(1.0, 1.00, 0); //relative to Position
- _xyplot->SetXValuesToArcLength();
- _xyplot->SetNumberOfXLabels(6);
-
- _xyplot->SetTitle("Histogramme");
- _xyplot->SetXTitle("Gray level");
- _xyplot->SetYTitle("Occurrences ");
- _xyplot->GetProperty()->SetColor(1, 0, 0);
- _xyplot->GetProperty()->SetPointSize(2);
- vtkTextProperty *tprop = _xyplot->GetTitleTextProperty();
- tprop->SetColor( 1,0,1 );
- tprop->BoldOff ();
- _xyplot->SetAxisTitleTextProperty(tprop);
- _xyplot->SetAxisLabelTextProperty(tprop);
- _xyplot->PlotPointsOn();
- _xyplot->GetProperty()->SetPointSize(3);
-
- _wxvtkbaseView = new wxVtkBaseView(this);
- _wxvtkbaseView->Configure();
-
- _renplotter = vtkRenderer::New();
- vtkRenderWindow *renWin = _wxvtkbaseView->GetRenWin();
- renWin->AddRenderer( _renplotter );
- _renplotter->AddActor2D( _xyplot );
-
- return _wxvtkbaseView->GetWxVTKRenderWindowInteractor();
-}
-
-//-------------------------------------------------------------------
-
-void wxPanelCuttingImageData::CreateInterface()
-{
- SetSize(300,500);
- wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); // Principal sizer
-
- wxBoxSizer *sizerH0 = new wxBoxSizer(wxHORIZONTAL ); // type of segmentation figure
- wxBoxSizer *sizerH2 = new wxBoxSizer(wxHORIZONTAL ); // scale
- wxBoxSizer *sizerH3 = new wxBoxSizer(wxHORIZONTAL ); // rotation
- wxBoxSizer *sizerH4 = new wxBoxSizer(wxHORIZONTAL ); // intern extern
- wxBoxSizer *sizerH5 = new wxBoxSizer(wxHORIZONTAL ); // Isovalue
- wxBoxSizer *sizerH6 = new wxBoxSizer(wxHORIZONTAL ); // Buttons
- wxFlexGridSizer *sizerH7 = new wxFlexGridSizer(2 ); // Volumic information
-
-
- _typeFig = new wxChoice(this,-1);
- _opacityFig = new wxSlider(this,-1,100,0,100, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
-
- _scaleX = new wxSlider(this,-1,6,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
- _scaleY = new wxSlider(this,-1,20,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
- _scaleZ = new wxSlider(this,-1,7,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
-
- _rotationX = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
- _rotationY = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
- _rotationZ = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
-
- _volIntern = new wxRadioButton(this,-1, _T("Volume intern " ));
- _volExtern = new wxRadioButton(this,-1, _T("Volume extern " ));
-
- _histogrammeAccumulated = new wxCheckBox(this,-1,_T("Histogramme accumulated"));
-
- _isoValue = new wxSlider(this,-1, 200, 0,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
- _valueBeforeIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
- _valueAfterIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
-
- wxButton *btnExtract = new wxButton(this, -1,_T("Extract"));
-
- _infoToVo = new wxStaticText(this,-1,_T("########################"));
- _infoSuVoA = new wxStaticText(this,-1,_T("############"));
- _infoSuVo = new wxStaticText(this,-1,_T("############"));
- _infoPixLe = new wxStaticText(this,-1,_T("############"));
- _infoPixHi = new wxStaticText(this,-1,_T("############"));
-
-
-
-
- _typeFig->Append(_T("Cylindre"));
- _typeFig->Append(_T("Cube"));
- _typeFig->Append(_T("Sphere"));
- _typeFig->SetSelection(0);
- _volIntern->SetValue(true);
-
- Connect(_typeFig->GetId() , wxEVT_COMMAND_CHOICE_SELECTED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTypeFig );
-
- Connect(_opacityFig->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnOpacityFig );
- Connect(_rotationX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
- Connect(_rotationY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
- Connect(_rotationZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
- Connect(_scaleX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
- Connect(_scaleY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
- Connect(_scaleZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
- Connect(btnExtract->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnExtract );
-
-
-// wxStaticText *text=new wxStaticText(this,-1, " ");
-
- sizerH0 -> Add( new wxStaticText(this,-1, _T("Fig. Type: "),wxDefaultPosition, wxSize(50,20)) ,1,wxALL ,0);
- sizerH0 -> Add( _typeFig ,1,wxALL ,0);
- sizerH0 -> Add( _opacityFig ,1,wxALL|wxEXPAND ,0);
-
- sizerH2 -> Add( new wxStaticText(this,-1,_T("Scale : ")) ,1,wxALL ,0);
- sizerH2 -> Add( _scaleX ,1,wxALL | wxEXPAND ,0 );
- sizerH2 -> Add( _scaleY ,1,wxALL | wxEXPAND ,0 );
- sizerH2 -> Add( _scaleZ ,1,wxALL | wxEXPAND ,0 );
-
- sizerH3 -> Add( new wxStaticText(this,-1,_T("Rotation : ")) ,1,wxALL ,0);
- sizerH3 -> Add( _rotationX ,1,wxALL | wxEXPAND ,0 );
- sizerH3 -> Add( _rotationY ,1,wxALL | wxEXPAND ,0 );
- sizerH3 -> Add( _rotationZ ,1,wxALL | wxEXPAND ,0 );
-
-
- sizerH4 -> Add( new wxStaticText(this,-1,_T("Intern / Extern : ")) ,1,wxALL ,0);
- sizerH4 -> Add( _volIntern ,1,wxALL ,0);
- sizerH4 -> Add( new wxStaticText(this,-1, _T(" ")) ,1,wxALL ,0);
- sizerH4 -> Add( _volExtern ,1,wxALL ,0);
-
- sizerH5 -> Add( new wxStaticText(this,-1,_T("Isovalue ")) ,1,wxALL ,0);
- sizerH5 -> Add( _isoValue ,1,wxALL | wxEXPAND ,0 );
- sizerH5 -> Add( _valueBeforeIsoValue ,1,wxALL | wxEXPAND ,0 );
- sizerH5 -> Add( _valueAfterIsoValue ,1,wxALL | wxEXPAND ,0 );
-
- sizerH6 -> Add( new wxStaticText(this,-1, _T(" ")) ,1,wxALL ,0);
- sizerH6 -> Add( btnExtract ,1,wxALL ,0);
-
- sizerH7 -> Add( new wxStaticText(this,-1,_T("Total Volume: "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
- sizerH7 -> Add( _infoToVo , 1 , wxALL ,0);
- sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume: "), wxDefaultPosition, wxSize(200,12) ) , 1 , wxALL ,0);
- sizerH7 -> Add( _infoSuVo , 1 , wxALL ,0);
- sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume (ana.): "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
- sizerH7 -> Add( _infoSuVoA , 1 , wxALL ,0);
- sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix < isovalue: ") , wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
- sizerH7 -> Add( _infoPixLe , 1 , wxALL ,0);
- sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix > isovalue: "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
- sizerH7 -> Add( _infoPixHi , 1 , wxALL ,0);
-// sizerH7 -> SetMinSize(300, 120);
-
- // Figure type
- topsizer -> Add( sizerH0 ,1,wxALL|wxEXPAND ,0);
-
- // Scale
- topsizer -> Add( sizerH2 ,1,wxALL|wxEXPAND ,0);
-
- // Rotation
- topsizer -> Add( sizerH3 ,1,wxALL|wxEXPAND ,0);
-
- // Intern / Extern
- topsizer -> Add( sizerH4 ,1,wxALL ,0);
-
-
- // Isovalue limite
- topsizer -> Add( sizerH5 ,1,wxALL |wxEXPAND ,0);
-
- // btn Extraction
- topsizer -> Add( sizerH6 , 1 , wxALL ,0);
-
- // Histograme
- topsizer -> Add( _histogrammeAccumulated ,1, wxALL ,0);
-
- // Volumic information
- topsizer -> Add( sizerH7 , 1 , wxALL|wxEXPAND ,0);
-
-
-
-// wxBoxSizer *sizerHor = new wxBoxSizer(wxHORIZONTAL);
- wxBoxSizer *sizerHor = new wxBoxSizer(wxVERTICAL);
- sizerHor -> Add( topsizer , 1 , wxALL | wxEXPAND ,0);
-
-
- wxWindow *panelPlotHistogramme = CreatePlotHistogrammeInterface();
- sizerHor -> Add( panelPlotHistogramme , 1 , wxGROW ,0);
-
-
- this->SetAutoLayout(true);
- this->SetSizer( sizerHor );
- this->Layout();
-//EEDxx2.4
-// this->FitInside();
-}
-
-//-------------------------------------------------------------------
-
-void wxPanelCuttingImageData::OnExtract(wxCommandEvent& event)
-{
- wxBusyCursor wait;
-
- bool inside;
- bool volInt, volExt;
- int xx,yy,zz;
- unsigned short *pOrg;
- unsigned short *p_histogramme;
- int dim[3];
- double spc[3];
- long int contAfter = 0;
- long int contBefor = 0;
-
- double min=999999999;
- double max=-999999999;
-
- volExt=_volExtern->GetValue();
- volInt=_volIntern->GetValue();
- int isoValue = _isoValue->GetValue();
- int valueBeforeIsoValue = _valueBeforeIsoValue->GetValue();
- int valueAfterIsoValue = _valueAfterIsoValue ->GetValue();
-
- InitHistogramme();
- p_histogramme = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
-
- _imageData->GetDimensions(dim);
- _imageData->GetSpacing(spc);
- _actualCuttingModel->CalculeInversMatrix();
-
- for (xx=0;xx<dim[0]; xx++)
- {
- for (yy=0;yy<dim[1]; yy++)
- {
- for (zz=0;zz<dim[2];zz++)
- {
- inside=_actualCuttingModel->IfPointInside(xx,yy,zz);
- if ( ((inside==true)&&(volInt==true)) || ((!inside==true)&&(volExt==true)) )
- {
- pOrg=(unsigned short*)_imageData->GetScalarPointer (xx,yy,zz);
-
- if ((*pOrg)<isoValue)
- {
- contBefor++;
- if (valueBeforeIsoValue!=-1)
- {
- *pOrg=valueBeforeIsoValue;
- }
- } else {
- contAfter++;
- if (valueAfterIsoValue!=-1)
- {
- *pOrg=valueAfterIsoValue;
- } // if
- } // if isovalue
-
- p_histogramme[*pOrg]++;
- if (*pOrg<min) min=*pOrg;
- if (*pOrg>max) max=*pOrg;
- } // if inside
- } // for zz
- } // for yy
- } // for xx
-
-
- // Information
- wxString infoToVo;
- wxString infoSuVo;
- wxString infoSuVoA;
- wxString infoPixLe;
- wxString infoPixHi;
-
- double volumeUnit = spc[0]*spc[1]*spc[2];
- long int totalSubVolume = contBefor + contAfter;
- double contBeforPorc = 100*(double)contBefor/(double)totalSubVolume;
- double contAfterPorc = 100*(double)contAfter/(double)totalSubVolume;
- infoToVo.Printf(_T("%dx%dx%d = %d"),dim[0],dim[1],dim[2], dim[0]*dim[1]*dim[2] );
- infoSuVo.Printf(_T("%ld") , totalSubVolume);
- infoSuVoA.Printf(_T("%.2f"), _actualCuttingModel->GetTheoricVolume() );
- infoPixLe.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contBefor, contBeforPorc ,_T("%"),contBefor*volumeUnit);
- infoPixHi.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contAfter, contAfterPorc ,_T("%"),contAfter*volumeUnit);
-
- _infoToVo->SetLabel(infoToVo);
- _infoSuVo->SetLabel(infoSuVo);
- _infoSuVoA->SetLabel(infoSuVoA);
- _infoPixLe->SetLabel(infoPixLe);
- _infoPixHi->SetLabel(infoPixHi);
-
- // Histogram
- if ( _histogrammeAccumulated->GetValue()==true )
- {
- int dimHist[3];
- _histogrammeVector -> GetDimensions ( dimHist );
-
- int i,size=dimHist[0];
- for (i=1; i<=size; i++)
- {
- p_histogramme[i] = p_histogramme[i] + p_histogramme[i-1];
- }
- }
- double range[2];
- _histogrammeVector->Update();
- _histogrammeVector->GetScalarRange(range);
- _xyplot->SetYRange( 0 , range[1] );
- _xyplot->SetXRange( min , max );
-
- _vtkclipping3Ddataviewer->RefreshSurface();
- _wxvtkbaseView->Refresh();
-
-// _wxvtkbaseView->RefreshView();
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- _wxvtkbaseView->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
-}
-
-
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::OnTypeFig(wxCommandEvent& event)
-{
- _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
-
- if (_typeFig->GetSelection()==0){
- _actualCuttingModel=_modelCylinder;
- _actualActor=_cylinderActor;
- }
- if (_typeFig->GetSelection()==1){
- _actualCuttingModel=_modelCube;
- _actualActor=_cubeActor;
- }
- if (_typeFig->GetSelection()==2){
- _actualCuttingModel=_modelSphere;
- _actualActor=_sphereActor;
- }
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _actualActor );
- RefreshOpacity();
- RefreshView();
-}
-
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::RefreshOpacity()
-{
- double op= _opacityFig->GetValue()/100.0;
- _actualActor->GetProperty()->SetOpacity( op );
-}
-
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::OnOpacityFig(wxScrollEvent& event)
-{
- RefreshOpacity();
- Refresh();
-}
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::RefreshView()
-{
- SetParamsOfTransformation( );
- Refresh();
-}
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::Refresh()
-{
- _wxvtk3Dbaseview->Refresh();
-}
-
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::SetParamsOfTransformation( )
-{
- double spc[3];
- vtkImageData *vtkimagedata = _vtkmprbasedata->GetImageData();
- vtkimagedata->GetSpacing(spc);
- int px = (int) (_vtkmprbasedata->GetX() );
- int py = (int) (_vtkmprbasedata->GetY() );
- int pz = (int) (_vtkmprbasedata->GetZ() );
- int sx = (int) (_scaleX->GetValue() * spc[0] );
- int sy = (int) (_scaleY->GetValue() * spc[1] );
- int sz = (int) (_scaleZ->GetValue() * spc[2] );
- _actualCuttingModel -> SetScale ( sx , sy , sz );
- _actualCuttingModel -> SetPosition ( px , py , pz );
- _actualCuttingModel -> SetRotation ( _rotationX->GetValue() , _rotationY->GetValue() , _rotationZ->GetValue() );
- _actualCuttingModel -> SetSpacing ( spc[0] , spc[1] , spc[2] );
- _actualCuttingModel -> CalculeMatrix();
-}
-
-//-------------------------------------------------------------------
-
-void wxPanelCuttingImageData::OnTransform(wxScrollEvent& event)
-{
- RefreshView();
-}
-
-//-------------------------------------------------------------------
-void wxPanelCuttingImageData::SetVtkMPRBaseData( vtkMPRBaseData *vtkmprbasedata )
-{
- _vtkmprbasedata = vtkmprbasedata;
- _imageData = _vtkmprbasedata->GetImageData();
-}
-
-//-------------------------------------------------------------------
-
-void wxPanelCuttingImageData::Configure()
-{
- _actualCuttingModel=_modelCylinder;
- _actualActor=_cylinderActor;
- _wxvtk3Dbaseview->GetRenderer()->AddActor( _actualActor );
- SetParamsOfTransformation();
- RefreshView();
-}
-
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-/*
-BEGIN_EVENT_TABLE( wxWidgetMesure2D , wxSplitterWindow )
- EVT_MENU( 12121, wxWidgetMesure2D::OnRefreshView )
-END_EVENT_TABLE( );
-*/
-//-------------------------------------------------------------------
-
-wxWidgetMesure2D::wxWidgetMesure2D( wxWindow *parent )
-: wxSplitterWindow( parent , -1)
-{
-// EED 27 oct 2007
- this->SplitHorizontally( new wxPanel(this,-1) , new wxPanel(this,-1), 2 );
- this->SetMinimumPaneSize(50);
-}
-//-------------------------------------------------------------------
-wxWidgetMesure2D::~wxWidgetMesure2D()
-{
-}
-//-------------------------------------------------------------------
-wxWindow *wxWidgetMesure2D::CreateWin1a(wxWindow *parent) // virtual
-{
- wxPanel *panel = new wxPanel(parent,-1);
-
- _cb_messuretool = new wxCheckBox(panel,-1,_T("Active messure tool "));
- _cb_mt_visible = new wxCheckBox(panel,-1,_T("Visibles "));
- _cb_closeContour = new wxCheckBox(panel,-1,_T("Close/Open "));
- _cb_visibleText = new wxCheckBox(panel,-1,_T("Information "));
-
- _cb_mt_visible->SetValue(true);
- _cb_closeContour->SetValue(true);
- _cb_visibleText->SetValue(true);
-
- wxFlexGridSizer *sizer = new wxFlexGridSizer(4);
-
- sizer->Add(_cb_messuretool);
- sizer->Add(_cb_mt_visible);
- sizer->Add(_cb_closeContour);
- sizer->Add(_cb_visibleText);
-
- panel->SetAutoLayout(true);
- panel->SetSizer(sizer);
- panel->SetSize(400,30);
- panel->Layout();
-//EEDxx2.4
-// panel->FitInside();
-
- Connect(_cb_messuretool->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnActiveMessureTool );
- Connect(_cb_mt_visible->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnVisibleMessureTool );
- Connect(_cb_closeContour->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnCloseContour );
- Connect(_cb_visibleText->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnVisibleInformation );
-
- return panel;
-}
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D::ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview) // virtual
-{
- _wxvtk2Dbaseview = wxvtk2Dbaseview;
-
- // Contorno 1
- _manContourControl_1 = new manualContourControler();
- _mContourModel_1 = new manualContourModel();
- _mViewContour_1 = new manualViewContour();
- _mViewContour_1->SetModel( _mContourModel_1 );
- _mViewContour_1->SetWxVtkBaseView( _wxvtk2Dbaseview );
- _mViewContour_1->SetRange( 1 );
-
-// EED 3 oct 2006
-// double spc[3];
-// _wxvtk2Dbaseview->GetSpacing( spc );
-// _mViewContour_1->SetSpacing( spc );
-
-
-
- _manContourControl_1->SetZ( 1000 );
- _manContourControl_1->SetModelView( _mContourModel_1 , _mViewContour_1 );
- _wxvtk2Dbaseview->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_1 );
- _manContourControl_1->CreateNewManualContour();
- _manContourControl_1->SetActive( false );
- _mViewContour_1->RefreshContour();
-
-//EED 27 Oct 2007
-
-// this->ReplaceWindow( this->GetWindow1() , CreateWin1a(this) );
-// this->ReplaceWindow( this->GetWindow2() , _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor() );
-// CreateWin1a(this->GetWindow1() );
-
- wxBoxSizer *sizerA = new wxBoxSizer(wxHORIZONTAL);
- sizerA->Add( CreateWin1a( this->GetWindow1()) ,1, wxGROW );
- this->GetWindow1()->SetSizer(sizerA);
- this->SetAutoLayout(true);
- this->Layout();
-
- wxBoxSizer *sizerB = new wxBoxSizer(wxHORIZONTAL);
- sizerB->Add( _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor() ,1, wxGROW );
- this->GetWindow2()->SetSizer(sizerB);
- this->SetAutoLayout(true);
- this->Layout();
-
-
-// this->SplitHorizontally( CreateWin1a(this) , _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor() , 2 );
-
-
-//EEDxx2.4
-// this->FitInside();
-}
-
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D::ActiveMessureTool(bool ok)
-{
- _wxvtk2Dbaseview->GetInteractorStyleBaseView()->SetActiveAllInteractors(!ok);
- _manContourControl_1->SetActive( ok );
-}
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D::OnActiveMessureTool(wxCommandEvent& event)
-{
- ActiveMessureTool( _cb_messuretool->GetValue() );
- if ( _cb_messuretool->GetValue() == true )
- {
- _cb_mt_visible->SetValue(true);
- _mViewContour_1->SetVisible( _cb_mt_visible->GetValue() );
- _cb_closeContour->Enable(true);
- _cb_visibleText->Enable(true);
- } else{
- _cb_closeContour->Enable(false);
- _cb_visibleText->Enable(false);
- }
- _wxvtk2Dbaseview->Refresh();
- _wxvtk2Dbaseview->RefreshView();
-}
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D::OnVisibleMessureTool(wxCommandEvent& event)
-{
- _cb_messuretool->SetValue( _cb_mt_visible->GetValue() );
- if (_cb_messuretool->GetValue()==true)
- {
- _cb_closeContour->Enable(true);
- _cb_visibleText->Enable(true);
- }
- ActiveMessureTool( _cb_messuretool->GetValue() );
- _mViewContour_1->SetVisible( _cb_mt_visible->GetValue() );
- _mViewContour_1->Refresh();
- _wxvtk2Dbaseview->Refresh();
- _wxvtk2Dbaseview->RefreshView();
-}
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D::OnCloseContour(wxCommandEvent& event)
-{
- _mContourModel_1->SetCloseContour( _cb_closeContour->GetValue() );
- _mViewContour_1->Refresh();
- _wxvtk2Dbaseview->Refresh();
- _wxvtk2Dbaseview->RefreshView();
-
-}
-//-------------------------------------------------------------------
-void wxWidgetMesure2D::OnVisibleInformation(wxCommandEvent& event)
-{
- _mViewContour_1->SetShowText( _cb_visibleText->GetValue() );
- _mViewContour_1->Refresh();
- _wxvtk2Dbaseview->Refresh();
- _wxvtk2Dbaseview->RefreshView();
-}
-//-------------------------------------------------------------------
-void wxWidgetMesure2D::SetMesureScale(double mesureScale)
-{
- _mViewContour_1->SetMesureScale(mesureScale);
-}
-//-------------------------------------------------------------------
-manualContourModel* wxWidgetMesure2D::GetManualContourModel()
-{
- return _mContourModel_1;
-}
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-wxWidgetMesure2D_Plane::wxWidgetMesure2D_Plane(wxWindow *parent)
-: wxWidgetMesure2D(parent)
-{
- // Circle 1
- _ptsCircle1 = NULL;
- _circle1Actor = NULL;
- _circle1Mapper = NULL;
- _pdCircle1 = NULL;
- // Circle 2
- _ptsCircle2 = NULL;
- _circle2Actor = NULL;
- _circle2Mapper = NULL;
- _pdCircle2 = NULL;
- // line reference 1
- _ptsLineRef1 = NULL;
- _lineRef1Actor = NULL;
- _lineRef1Mapper = NULL;
- _pdLineRef1 = NULL;
- // line reference 2
- _ptsLineRef2 = NULL;
- _lineRef2Actor = NULL;
- _lineRef2Mapper = NULL;
- _pdLineRef2 = NULL;
-
-}
-
-//-------------------------------------------------------------------
-
-wxWidgetMesure2D_Plane::~wxWidgetMesure2D_Plane()
-{
- // Circle 1
- if ( _ptsCircle1 != NULL){ _ptsCircle1 -> Delete(); }
- if ( _circle1Actor != NULL){ _circle1Actor -> Delete(); }
- if ( _circle1Mapper != NULL){ _circle1Mapper -> Delete(); }
- if ( _pdCircle1 != NULL){ _pdCircle1 -> Delete(); }
- // Circle 2
- if ( _ptsCircle2 != NULL){ _ptsCircle2 -> Delete(); }
- if ( _circle2Actor != NULL){ _circle2Actor -> Delete(); }
- if ( _circle2Mapper != NULL){ _circle2Mapper -> Delete(); }
- if ( _pdCircle2 != NULL){ _pdCircle2 -> Delete(); }
- // line reference 1
- if ( _ptsLineRef1 != NULL){ _ptsLineRef1 -> Delete(); }
- if ( _lineRef1Actor != NULL){ _lineRef1Actor -> Delete(); }
- if ( _lineRef1Mapper != NULL){ _lineRef1Mapper -> Delete(); }
- if ( _pdLineRef1 != NULL){ _pdLineRef1 -> Delete(); }
- // line reference 2
- if ( _ptsLineRef2 != NULL){ _ptsLineRef2 -> Delete(); }
- if ( _lineRef2Actor != NULL){ _lineRef2Actor -> Delete(); }
- if ( _lineRef2Mapper != NULL){ _lineRef2Mapper -> Delete(); }
- if ( _pdLineRef2 != NULL){ _pdLineRef2 -> Delete(); }
-}
-
-//-------------------------------------------------------------------
-
-wxWindow *wxWidgetMesure2D_Plane::CreateWin1a(wxWindow *parent) // virtual
-{
- wxPanel *panel = new wxPanel(parent,-1);
+#include "vtkInteractorStyle3DView.h"
- _cb_circle = new wxCheckBox(panel,-1,_T("Circle "));
- _cb_line = new wxCheckBox(panel,-1,_T("Rotation Axe "));
-
-
- wxBoxSizer *sizerA = new wxBoxSizer(wxHORIZONTAL);
- sizerA->Add(_cb_circle);
- sizerA->Add(_cb_line);
-
-
- wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
- sizer->Add( sizerA );
- sizer->Add( wxWidgetMesure2D::CreateWin1a(panel) );
-
- panel->SetAutoLayout(true);
- panel->SetSizer(sizer);
- panel->SetSize(400,30);
- panel->Layout();
-//EEDxx2.4
-// panel->FitInside();
-
- Connect(_cb_line->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D_Plane::OnActiveLine );
- Connect(_cb_circle->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D_Plane::OnActiveCirlcle );
-
- return panel;
-}
-
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D_Plane::OnActiveCirlcle(wxCommandEvent& event)
-{
- SetVisibleCircle( _cb_circle->GetValue() );
- _wxvtk2Dbaseview->RefreshView();
-}
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D_Plane::SetVisibleCircle( bool ok )
-{
- double opacity;
- if (ok==true)
- {
- opacity=1;
- } else {
- opacity=0;
- }
- _lineRef1Actor->GetProperty()->SetOpacity( opacity );
- _lineRef2Actor->GetProperty()->SetOpacity( opacity );
- _circle1Actor->GetProperty()->SetOpacity( opacity );
- _circle2Actor->GetProperty()->SetOpacity( opacity );
-}
-//-------------------------------------------------------------------
-void wxWidgetMesure2D_Plane::OnActiveLine(wxCommandEvent& event)
-{
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)_wxvtk2Dbaseview;
- vtkplane2Dview->SetVisibleLine( _cb_line->GetValue() );
- _wxvtk2Dbaseview->RefreshView();
-}
-
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D_Plane::ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview) // virtual
-{
- wxWidgetMesure2D::ConfigureA(wxvtk2Dbaseview);
- CircleLine();
- ConfigureCircleLine();
- SetVisibleCircle(false);
-}
-
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D_Plane::ConfigureCircleLine()
-{
- double ang;
-
- vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)_wxvtk2Dbaseview;
- int sizeIma = vtkplane2Dview->GetImgSize();
-
- double i,maxPts=20;
- double k=(360/(maxPts-1)) * (3.1416/180);
- double x,y,r1=5,r2=10,r3=15;
- for (i=0;i<maxPts;i++)
- {
- x=cos( k*i ) ;
- y=sin( k*i ) ;
- _ptsCircle1->SetPoint( (int)i , (sizeIma/2) + x*r1 , (sizeIma/2) + y*r1 , 1 );
- _ptsCircle2->SetPoint( (int)i , (sizeIma/2) + x*r2 , (sizeIma/2) + y*r2 , 1 );
- }
-
- //
- ang=(45) * (3.1416/180);
- x=cos( ang ) ;
- y=sin( ang ) ;
- _ptsLineRef1->SetPoint( 0 , (sizeIma/2) + x*r3 , (sizeIma/2) + y*r3 , 1 );
-
- ang=(45+180) * (3.1416/180);
- x=cos( ang ) ;
- y=sin( ang ) ;
- _ptsLineRef1->SetPoint( 1 , (sizeIma/2) + x*r3 , (sizeIma/2) + y*r3 , 1 );
-
- //
- ang=(135) * (3.1416/180);
- x=cos( ang ) ;
- y=sin( ang ) ;
- _ptsLineRef2->SetPoint( 0 , (sizeIma/2) + x*r3 , (sizeIma/2) + y*r3 , 1 );
-
- ang=(135+180) * (3.1416/180);
- x=cos( ang ) ;
- y=sin( ang ) ;
- _ptsLineRef2->SetPoint( 1 , (sizeIma/2) + x*r3 , (sizeIma/2) + y*r3 , 1 );
-}
-
-
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D_Plane::CircleLine()
-{
- int i,maxPts=20;
- vtkCellArray *lines;
-
- vtkImageViewer2_XYZ *imageViewer2XYZ = _wxvtk2Dbaseview->_imageViewer2XYZ;
-
-
-// Circle 1 Horizontal
- _ptsCircle1 = vtkPoints::New();
- _ptsCircle1->SetNumberOfPoints(maxPts);
- lines = vtkCellArray::New();
- lines->InsertNextCell(maxPts);
- for (i=0;i<maxPts;i++)
- {
- lines->InsertCellPoint(i);
- _ptsCircle1->SetPoint(i, 0 , 0 , 0 );
- }
- lines->InsertCellPoint(0);
- _ptsCircle1->SetPoint(0, -1000 , -1000 , -1000 );
- _ptsCircle1->SetPoint(1, 1000 , 1000 , 1000 );
-
- _pdCircle1 = vtkPolyData::New();
- _pdCircle1->SetPoints( _ptsCircle1 );
- _pdCircle1->SetLines( lines );
- lines->Delete(); //do not delete lines ??
- _circle1Actor = vtkActor::New();
- _circle1Mapper = vtkPolyDataMapper::New();
- _circle1Mapper->SetInput(_pdCircle1);
- _circle1Mapper->ImmediateModeRenderingOn();
- _circle1Actor->SetMapper(_circle1Mapper);
- _circle1Actor->GetProperty()->BackfaceCullingOn();
- _circle1Actor->GetProperty()->SetDiffuseColor(0,0,1);
- _circle1Actor->GetProperty()->SetLineWidth(2);
- imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _circle1Actor );
-
-// Circle 2 Horizontal
- _ptsCircle2 = vtkPoints::New();
- _ptsCircle2->SetNumberOfPoints(maxPts);
- lines = vtkCellArray::New();
- lines->InsertNextCell(maxPts);
- for (i=0;i<maxPts;i++)
- {
- lines->InsertCellPoint(i);
- _ptsCircle2->SetPoint(i, 0 , 0 , 0 );
- }
- _ptsCircle2->SetPoint(0, -1000 , -1000 , -1000 );
- _ptsCircle2->SetPoint(1, 1000 , 1000 , 1000 );
-
- _pdCircle2 = vtkPolyData::New();
- _pdCircle2->SetPoints( _ptsCircle2 );
- _pdCircle2->SetLines( lines );
- lines->Delete(); //do not delete lines ??
- _circle2Actor = vtkActor::New();
- _circle2Mapper = vtkPolyDataMapper::New();
- _circle2Mapper->SetInput(_pdCircle2);
- _circle2Mapper->ImmediateModeRenderingOn();
- _circle2Actor->SetMapper(_circle2Mapper);
- _circle2Actor->GetProperty()->BackfaceCullingOn();
- _circle2Actor->GetProperty()->SetDiffuseColor(0,0,1);
- _circle2Actor->GetProperty()->SetLineWidth(2);
- imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _circle2Actor );
-
-// Line Referance 1
- _ptsLineRef1 = vtkPoints::New();
- _ptsLineRef1->SetNumberOfPoints(2);
- _ptsLineRef1->SetPoint(0, -1000 , -1000 , -1000 );
- _ptsLineRef1->SetPoint(1, 1000 , 1000 , 1000 );
- lines = vtkCellArray::New();
- lines->InsertNextCell(2);
- lines->InsertCellPoint(0);
- lines->InsertCellPoint(1);
-
- _pdLineRef1 = vtkPolyData::New();
- _pdLineRef1->SetPoints( _ptsLineRef1 );
- _pdLineRef1->SetLines( lines );
- lines->Delete(); //do not delete lines ??
- _lineRef1Actor = vtkActor::New();
- _lineRef1Mapper = vtkPolyDataMapper::New();
- _lineRef1Mapper->SetInput(_pdLineRef1);
- _lineRef1Mapper->ImmediateModeRenderingOn();
- _lineRef1Actor->SetMapper(_lineRef1Mapper);
- _lineRef1Actor->GetProperty()->BackfaceCullingOn();
- _lineRef1Actor->GetProperty()->SetDiffuseColor(0,0,1);
- _lineRef1Actor->GetProperty()->SetLineWidth(2);
- imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineRef1Actor );
-
-// Line Referance 2
- _ptsLineRef2 = vtkPoints::New();
- _ptsLineRef2->SetNumberOfPoints(2);
- _ptsLineRef2->SetPoint(0, -1000 , -1000 , -1000 );
- _ptsLineRef2->SetPoint(1, 1000 , 1000 , 1000 );
- lines = vtkCellArray::New();
- lines->InsertNextCell(2);
- lines->InsertCellPoint(0);
- lines->InsertCellPoint(1);
-
- _pdLineRef2 = vtkPolyData::New();
- _pdLineRef2->SetPoints( _ptsLineRef2 );
- _pdLineRef2->SetLines( lines );
- lines->Delete(); //do not delete lines ??
- _lineRef2Actor = vtkActor::New();
- _lineRef2Mapper = vtkPolyDataMapper::New();
- _lineRef2Mapper->SetInput(_pdLineRef2);
- _lineRef2Mapper->ImmediateModeRenderingOn();
- _lineRef2Actor->SetMapper(_lineRef2Mapper);
- _lineRef2Actor->GetProperty()->BackfaceCullingOn();
- _lineRef2Actor->GetProperty()->SetDiffuseColor(0,0,1);
- _lineRef2Actor->GetProperty()->SetLineWidth(2);
- imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineRef2Actor );
-
-
-}
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
//-------------------------------------------------------------------
-
-wxWidgetMesure2D_Plane_in_MPR::wxWidgetMesure2D_Plane_in_MPR(wxWindow *parent)
-:wxWidgetMesure2D_Plane(parent)
-{
- _vtkplane2Dview=NULL;
-}
-
-//-------------------------------------------------------------------
-
-wxWidgetMesure2D_Plane_in_MPR::~wxWidgetMesure2D_Plane_in_MPR()
-{
-}
-//-------------------------------------------------------------------
-void wxWidgetMesure2D_Plane_in_MPR::OnActiveLink(wxCommandEvent& event)
-{
- if (_vtkplane2Dview!=NULL)
- {
- _vtkplane2Dview->SetActive( _cb_link->GetValue() );
- _vtkplane2Dview->Refresh();
- _vtkplane2Dview->RefreshView();
- }
-}
-
-
-//-------------------------------------------------------------------
-void wxWidgetMesure2D_Plane_in_MPR::SetActiveLink(bool ok)
-{
- _cb_link->SetValue(ok);
- if (_vtkplane2Dview!=NULL)
- {
- _vtkplane2Dview->SetActive( _cb_link->GetValue() );
- }
-}
//-------------------------------------------------------------------
-
-void wxWidgetMesure2D_Plane_in_MPR::SetVtkPlane2DView(vtkPlane2DView *vtkplane2Dview)
-{
- _vtkplane2Dview = vtkplane2Dview;
-}
-
//-------------------------------------------------------------------
-wxWindow *wxWidgetMesure2D_Plane_in_MPR::CreateWin1a(wxWindow *parent) // virtual
-{
- wxPanel *panel = new wxPanel(parent,-1);
-
- _cb_link = new wxCheckBox(panel,-1,_T("LINK "));
- _cb_link->SetValue(true);
-
- wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
-
- sizer->Add(_cb_link);
-
- sizer->Add( wxWidgetMesure2D_Plane::CreateWin1a(panel) );
-
- panel->SetAutoLayout(true);
- panel->SetSizer(sizer);
- panel->SetSize(400,30);
- panel->Layout();
-
-//EEDxx2.4
-// panel->FitInside();
-
- Connect(_cb_link->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxWidgetMesure2D_Plane_in_MPR::OnActiveLink );
-
- return panel;
-}
-
-
//-------------------------------------------------------------------
if (_wxvtk3Dbaseview_Clipping3D_BB!=NULL)
{
- _wxvtk3Dbaseview_Clipping3D_BB->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( vtkinteractorstyle3Dview );
+ ((vtkInteractorStyleBaseView*)_wxvtk3Dbaseview_Clipping3D_BB->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( vtkinteractorstyle3Dview );
}
//EED 29Mars2009
return _vtkmpr2Dview[direction];
}
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-wxMPRWidget2::wxMPRWidget2(wxWindow* parent,marImageData *marimagedata,double voxelSize)
-: wxMPRWidget(parent,marimagedata,voxelSize)
-{
-}
-//----------------------------------------------------------------------------
-wxMPRWidget2::~wxMPRWidget2()
-{
-}
-//----------------------------------------------------------------------------
-void wxMPRWidget2::OnRefreshView(wxCommandEvent & event) // Virtual
-{
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- this->GetParent()->ProcessEvent(newevent1);
-}
-
-
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-figureCuttingModel::figureCuttingModel()
-{
- _inversModel = vtkTransform::New();
- _matrixModel = vtkTransform::New();
- _matrixVisual = vtkTransform::New();
-
- _spcX=1;
- _spcY=1;
- _spcZ=1;
-}
-//----------------------------------------------------------------------------
-figureCuttingModel::~figureCuttingModel() // virtual
-{
- _inversModel->Delete();
-}
-//----------------------------------------------------------------------------
-void figureCuttingModel::SetPosition(double x,double y, double z)
-{
- _px=x;
- _py=y;
- _pz=z;
-}
-//----------------------------------------------------------------------------
-void figureCuttingModel::SetScale(double sx,double sy, double sz)
-{
- _sx=sx;
- _sy=sy;
- _sz=sz;
-}
-//----------------------------------------------------------------------------
-void figureCuttingModel::SetRotation(double alfa,double beta, double teta)
-{
- _alfa=alfa;
- _beta=beta;
- _teta=teta;
-}
-
-//----------------------------------------------------------------------------
-void figureCuttingModel::CalculeMatrix()
-{
- _matrixModel->Identity();
- _matrixModel->Translate(_px,_py,_pz);
- _matrixModel->RotateY(_beta);
- _matrixModel->RotateX(_alfa);
- _matrixModel->RotateY(_teta);
- _matrixModel->Scale(_sx,_sy,_sz);
-
- _matrixVisual->Identity();
- _matrixVisual->Translate( _px*_spcX , _py*_spcY , _pz*_spcZ );
- _matrixVisual->RotateY(_beta);
- _matrixVisual->RotateX(_alfa);
- _matrixVisual->RotateY(_teta);
- _matrixVisual->Scale( _sx*_spcX , _sy*_spcY , _sz*_spcZ );
-
-}
-
-
-//----------------------------------------------------------------------------
-void figureCuttingModel::CalculeInversMatrix()
-{
- _inversModel->Identity ();
- _inversModel->Concatenate ( _matrixModel );
- _inversModel->Inverse();
-}
-//----------------------------------------------------------------------------
-bool figureCuttingModel::IfPointInside(double x, double y, double z) // virtual
-{
- return true;
-}
-
-//----------------------------------------------------------------------------
-vtkTransform *figureCuttingModel::GetVtkTransform()
-{
- return _matrixVisual;
-}
-
-//----------------------------------------------------------------------------
-//void figureCuttingModel::SetVtkTransform(vtkTransform *matrix)
-//{
-// _matrixModel = matrix;
-//}
-
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetTheoricVolume() // virtual
-{
- return 0;
-}
-
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetPositionX()
-{
- return _px;
-}
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetPositionY()
-{
- return _py;
-}
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetPositionZ()
-{
- return _pz;
-}
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetScaleX()
-{
- return _sx;
-}
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetScaleY()
-{
- return _sy;
-}
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetScaleZ()
-{
- return _sz;
-}
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetAngleAlfa()
-{
- return _alfa;
-}
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetAngleBeta()
-{
- return _beta;
-}
-//----------------------------------------------------------------------------
-double figureCuttingModel::GetAngleTeta()
-{
- return _teta;
-}
-//----------------------------------------------------------------------------
-char *figureCuttingModel::GetName() // virtual
-{
- return "--";
-}
-
-//----------------------------------------------------------------------------
-void figureCuttingModel::SetSpacing(double spcX,double spcY, double spcZ)
-{
- _spcX = spcX;
- _spcY = spcY;
- _spcZ = spcZ;
-}
-
-//----------------------------------------------------------------------------
-
-
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-figureCuttingSphereModel::figureCuttingSphereModel()
-{
-}
-//----------------------------------------------------------------------------
-figureCuttingSphereModel::~figureCuttingSphereModel() // virtual
-{
-}
-//----------------------------------------------------------------------------
-bool figureCuttingSphereModel::IfPointInside(double x, double y, double z) // virtual
-{
- double in[4],out[4];
- in[0]=x;
- in[1]=y;
- in[2]=z;
- in[3]=1;
- _inversModel->MultiplyPoint (in, out);
-
- bool result=false;
- if (sqrt( out[0]*out[0] + out[1]*out[1] + out[2]*out[2] )<0.5 )
- {
- result=true;
- }
- return result;
-}
-//----------------------------------------------------------------------------
-double figureCuttingSphereModel::GetTheoricVolume() // virtual
-{
- double piTMP=3.14159265;
- return (4.0/3.0) * piTMP * (_sx/2)*(_sy/2)*(_sz/2);
-}
-//----------------------------------------------------------------------------
-char *figureCuttingSphereModel::GetName() // virtual
-{
- return "Sphere";
-}
-
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-figureCuttingCubeModel::figureCuttingCubeModel()
-{
-}
-//----------------------------------------------------------------------------
-figureCuttingCubeModel::~figureCuttingCubeModel() // virtual
-{
-}
-//----------------------------------------------------------------------------
-bool figureCuttingCubeModel::IfPointInside(double x, double y, double z) // virtual
-{
- double in[4],out[4];
- in[0]=x;
- in[1]=y;
- in[2]=z;
- in[3]=1;
- _inversModel->MultiplyPoint (in, out);
-
- bool result=false;
- if ((out[0]>-0.5) && (out[0]<0.5) && (out[1]>-0.5) && (out[1]<0.5) && (out[2]>-0.5) && (out[2]<0.5) )
- {
- result=true;
- }
- return result;
-}
-//----------------------------------------------------------------------------
-double figureCuttingCubeModel::GetTheoricVolume() // virtual
-{
- return _sx * _sy * _sz;
-}
//----------------------------------------------------------------------------
-char *figureCuttingCubeModel::GetName() // virtual
-{
- return "Cube";
-}
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
-figureCuttingCylinderModel::figureCuttingCylinderModel()
-{
-}
-//----------------------------------------------------------------------------
-figureCuttingCylinderModel::~figureCuttingCylinderModel() // virtual
-{
-}
-//----------------------------------------------------------------------------
-bool figureCuttingCylinderModel::IfPointInside(double x, double y, double z) // virtual
-{
- double in[4],out[4];
- in[0]=x;
- in[1]=y;
- in[2]=z;
- in[3]=1;
- _inversModel->MultiplyPoint (in, out);
-
- bool result=false;
- if ((sqrt( out[0]*out[0] + out[2]*out[2] )<0.5 ) && (out[1]>-0.5) && (out[1]<0.5) )
- {
- result=true;
- }
- return result;
-}
//----------------------------------------------------------------------------
-double figureCuttingCylinderModel::GetTheoricVolume() // virtual
-{
- double piTMP=3.14159265;
- return piTMP*(_sx/2)*(_sz/2)*_sy;
-}
//----------------------------------------------------------------------------
-char *figureCuttingCylinderModel::GetName() // virtual
-{
- return "Cylinder";
-}
//----------------------------------------------------------------------------
Program: wxMaracas
Module: $RCSfile: wxMPRWidget.h,v $
Language: C++
- Date: $Date: 2009/05/04 15:06:42 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.10 $
Copyright: (c) 2002, 2003
License:
#include <wx/tglbtn.h>
#include <wx/splitter.h>
#include "marTypes.h"
-
-class wxMPRWidget;
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInteractorStyleSphere : public InteractorStyleMaracas
-{
-public:
- vtkInteractorStyleSphere();
- ~vtkInteractorStyleSphere();
- virtual bool OnLeftButtonUp();
- virtual bool OnLeftButtonDown();
- virtual bool OnMouseMove();
- virtual bool OnRightButtonUp();
- virtual bool OnRightButtonDown();
-
-private:
- bool _stateRotate;
- bool _stateRadio;
- int _fordwareX;
- int _fordwareY;
-
- double _radio;
-};
-
-
-
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-class idAlBeRa
-{
-public:
- int _id;
- double _radio;
- int _deltavoxel;
- idAlBeRa(int id, double radio,int deltavoxel);
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class wxSphereView : public wxVtk2DBaseView
-{
-public:
- wxSphereView( wxWindow *parent, vtkMPRBaseData *vtkmprbasedata, vtkImageData *imageData);
- ~wxSphereView();
- virtual void Configure();
- void RotationEnd();
- void RotationStart(double vx, double vy, bool ok_v, bool ok_ang);
- virtual void RefreshView();
- virtual void SetVoxel(double i, double j, int delta, double id, unsigned short gris);
- void SetDeltaVoxel(int delta);
- double GetRadio();
- void SetRadio(double radio);
- int GetIdOfImage(double radio);
- void SetXYZtoParent(double i, double j);
- void RefreshPoint();
-
-private:
- std::vector<idAlBeRa*> _lstId;
-
- int _centerX;
- int _centerY;
- int _centerZ;
- double _radio;
-
- double _ang;
- double _vxb;
- double _vyb;
-
- int _delta;
-
- vtkImageData *_imageDataOriginal;
- vtkImageData *_imageSphere;
-
- vtkMPRBaseData *_vtkmprbasedata;
- vtkInteractorStyleSphere *_vtkinteractorstylesphere;
-
- vtkTransform *_transform;
- vtkTransform *_transform1;
- vtkTransform *_transform2;
-
- void FiltreImage(int id, double radio);
- void FiltreImageB(int id, double radio, bool ok,int deltaTMP);
- void DefineImageSphere();
- void ResetlstId();
-
- void InitSphere(double points[4][3]);
- double SphereFindCenter(double P[4][3], double cc[3]);
- double determinant(double a[4][4], int n);
-
- void GetPointSphere(double p[3],double r1,double angA,double angB);
- void RotatePointOverTheSphere( double pp[3], double p[3],double cc[3]);
- void TransferePoints(double pp1[3],double pp2[3],double AngX,double AngY,vtkImageData *image);
-};
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-class vtkInteractorStylePlane2D;
-class vtkInfoTextImageInteractorPlane2D;
-
-class vtkPlane2DView : public wxVtk2DBaseView
-{
-public:
- vtkPlane2DView(wxWindow *parent);
- ~vtkPlane2DView();
- void Configure();
- void ExtractPlane();
- int GetImgSize();
- void SetImgSize( int imgSize );
-
- void RotationStart();
- void RotationDrag(double vx, double vy, bool ok_v, bool ok_ang);
-
- virtual int GetActualSlice();
- virtual void SetActualSlice(int slice);
-
- virtual void Refresh( );
-
- vtkMPRBaseData *GetVtkmprbasedata();
- vtkInteractorStylePlane2D *GetInteractorstyleplane2D();
-
- void SetActive(bool active);
- void SetVisibleLine(bool ok);
-
- void TransfromeCoordViewWorld2(double &X, double &Y, double &Z);
-
- int GetMipWidth();
- void SetMipWidth(int value);
- bool GetMipVisualization();
- void SetMipVisualization(bool ok);
-
- void ResetBack();
-
-private:
- bool _active;
- int _mip_width;
- bool _mip_visualization;
-
- double _backX;
- double _backY;
- double _backZ;
- double _backOrient[4];
-
- double _ang;
- double _vxb;
- double _vyb;
- double _n[3]; // Normal
-
- double _cx;
- double _cy;
- double _cz;
-
- int _sizeIma;
-
- vtkImageData * _imageResult;
-
- // Horizontal line
- vtkPoints *_pts;
- vtkActor *_lineActor;
- vtkPolyDataMapper *_lineMapper;
- vtkPolyData *_pd;
-
- vtkProbeFilter *_3Dslices;
- vtkPlaneSource *_pSource;
- vtkStructuredPoints *_stPoints;
- vtkImageChangeInformation *_change;
- vtkTransform *_transform1;
- vtkTransform *_transform2;
-
- vtkInteractorStylePlane2D *_interactorstyleplane2D;
-
- vtkInfoTextImage *_vtkInfoTextImage;
- vtkInfoTextImageInteractorPlane2D *_vtkInfoTextImageInteractorPlane2D;
-
-
- void SetPSource(int sizeIma);
- void HorizontalLine();
- void ResetPlane();
- void Extract_One_PlaneVTK();
- void Extract_MIP_PlaneVTK();
-
-protected:
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInfoTextImageInteractorPlane2D : public vtkInfoTextImageInteractor{
-public:
- vtkInfoTextImageInteractorPlane2D();
- ~vtkInfoTextImageInteractorPlane2D();
-
-protected:
-
- virtual bool OnMouseMove();
-
-private:
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInteractorStylePlane2D : public InteractorStyleMaracas
-{
-public:
- vtkInteractorStylePlane2D();
- ~vtkInteractorStylePlane2D();
- virtual bool OnLeftButtonDown();
- virtual bool OnLeftButtonUp();
- virtual bool OnMouseMove();
- virtual bool OnRightButtonUp();
- virtual bool OnLeftDClick();
- bool GetStateRotate();
-
-private:
- bool _stateRotate;
-
- int _fordwareX;
- int _fordwareY;
-};
-
-
-
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-
-class manualViewPerpPlaneContour : public manualViewContour
-{
-public:
- manualViewPerpPlaneContour();
- ~manualViewPerpPlaneContour();
- virtual manualViewPerpPlaneContour * Clone();
- void CopyAttributesTo( manualViewPerpPlaneContour *cloneObject );
-
- virtual void UpdateViewPoint(int id);
- virtual void RefreshContour();
- virtual void TransfromeCoordViewWorld( double &X,double &Y,double &Z,int type );
- virtual bool ifTouchContour( int x, int y, int z);
-
-protected:
-private:
- void FilterCordinateXYZ (double &x, double &y, double &z);
-};
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInteractorStyleMPRView;
-
-class creaMaracasVisu_EXPORT wxVtkMPR2DView : public wxVtk2DBaseView
-{
-public:
- wxVtkMPR2DView( wxWindow *parent, int direction );
- ~wxVtkMPR2DView();
- void Configure();
- virtual void Refresh();
- vtkMPRBaseData *GetVtkmprbasedata();
- virtual int GetActualSlice();
- virtual void SetActualSlice(int slice);
-
- bool IfMouseTouchX(double x, double y, double z);
- bool IfMouseTouchY(double x, double y, double z);
- bool IfMouseTouchZ(double x, double y, double z);
- void MoveX(double x, double y, double z);
- void MoveY(double x, double y, double z);
- void MoveZ(double x, double y, double z);
- void ChangeAxisColor(double x, double y, double z);
- virtual void TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type);
- void SetVisibleAxis(bool ok);
-
-
-private:
-
- int _backX;
- int _backY;
- int _backZ;
-
- bool _visibleAxis;
-
- int _direction;
- vtkPoints *_ptsA;
- vtkActor *_lineAActor;
- vtkPolyDataMapper *_lineAMapper;
- vtkPolyData *_pdA;
- vtkPoints *_ptsB;
- vtkActor *_lineBActor;
- vtkPolyDataMapper *_lineBMapper;
- vtkPolyData *_pdB;
-// vtkInteractorStyle2DMaracas *_interactorStyle2DMaracas;
- vtkInteractorStyleMPRView *_interactorstylemprview;
-};
-
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInteractorStyleMPRView : public InteractorStyleMaracas
-{
-public:
- vtkInteractorStyleMPRView();
- ~vtkInteractorStyleMPRView();
-
- virtual bool OnMouseMove();
- virtual bool OnLeftButtonDown();
- virtual bool OnLeftButtonUp();
- virtual bool OnLeftDClick();
-
-protected:
-/*EED Borrame
- double _xBack;
- double _yBack;
-*/
- bool _stateMoveAxisX;
- bool _stateMoveAxisY;
- bool _stateMoveAxisZ;
-};
-
-
-
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-class wxVtkMPR3DView;
-
-class wxVtkMPR3DViewCntrlPanel: public wxPanel
-{
-public:
- wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DView *wxvtkmpr3Dview);
- ~wxVtkMPR3DViewCntrlPanel();
- void OnVisibleAxisX(wxCommandEvent& event);
- void OnVisibleAxisY(wxCommandEvent& event);
- void OnVisibleAxisZ(wxCommandEvent& event);
- void OnPositionX(wxScrollEvent& event);
- void OnPositionY(wxScrollEvent& event);
- void OnPositionZ(wxScrollEvent& event);
- void OnVisibleAxisXYZ(wxCommandEvent& event);
- void OnVisiblePlane(wxCommandEvent& event);
- void OnEditColorTable(wxCommandEvent& event);
- virtual void Refresh();
- void UpdateControlPanel();
-
-private:
- wxVtkMPR3DView *_wxvtkmpr3Dview;
-
- wxSlider *_opacity;
- wxSlider *_isoValue;
- wxSlider *_isoValueSpin;
- wxStaticText *_isoValueText;
- wxRadioButton *_surfA;
- wxRadioButton *_surfB;
- wxRadioButton *_surfC;
- wxRadioButton *_surfD;
- wxCheckBox *_visible;
- wxButton *_color;
- wxSlider *_positionX;
- wxSlider *_positionY;
- wxSlider *_positionZ;
-
- wxCheckBox *_ckBoxXYZ;
- wxCheckBox *_ckBoxPlane;
-
-
-protected:
-
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-class wxVtkClipping3DView;
-
-
-
-class wxVtkClipping3DViewCntrlPanel: public wxPanel
-{
-public:
- wxVtkClipping3DViewCntrlPanel(wxWindow *parent, wxVtkClipping3DView *_wxvtkclipping3Dview);
- ~wxVtkClipping3DViewCntrlPanel();
- void OnSurface(wxCommandEvent& event);
- void OnRepresentationSurfaceWireFrame(wxCommandEvent& event);
- void OnVisibleVolume(wxCommandEvent& event);
- void OnVisibleBoxSurface(wxCommandEvent& event);
- void OnVisibleBoxVolume(wxCommandEvent& event);
- void OnColor(wxCommandEvent& event);
- void OnVisibleSurface(wxCommandEvent& event);
- void OnOpacity(wxScrollEvent& event);
- void OnIsoValue(wxScrollEvent& event);
- void OnIsoValueSpin(wxScrollEvent& event);
- virtual void Refresh();
- void OnBtnCreateFileSTL(wxCommandEvent& event);
- void OnBtnSaveRawVolume(wxCommandEvent& event);
- void OnBtnVolumeFunctions(wxCommandEvent& event);
- void OnBtnMeshVTKLoad(wxCommandEvent& event);
-
-
-private:
- wxVtkClipping3DView *_wxvtkclipping3Dview;
- wxSlider *_opacity;
- wxSlider *_isoValue;
- wxSlider *_isoValueSpin;
- wxRadioButton *_surfA;
- wxRadioButton *_surfB;
- wxRadioButton *_surfC;
- wxRadioButton *_surfD;
- wxCheckBox *_visible;
- wxButton *_color;
-
- wxRadioButton *_wireFrameRep;
- wxRadioButton *_surfaceRep;
-
- int GetIdTissue();
-protected:
-
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-class vtkmyPWCallback_3DPointWidget : public vtkCommand
-{
-public:
- static vtkmyPWCallback_3DPointWidget *New()
- { return new vtkmyPWCallback_3DPointWidget; }
- virtual void Execute(vtkObject *caller, unsigned long, void*);
- vtkmyPWCallback_3DPointWidget(){}
- void SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview );
- void SetVtkPointWidget( vtkPointWidget *pointWidget );
- void SetVtkPlaneWidget( vtkPlaneWidget *planeWidget );
-private:
-
- double _backNormal[3];
- vtkPlaneWidget *_planeWidget;
- vtkPointWidget *_pointWidget;
- wxVtkMPR3DView *_wxvtkmpr3Dview;
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class creaMaracasVisu_EXPORT wxVtkMPR3DView
-{
-public:
- wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview );
- virtual ~wxVtkMPR3DView();
- void VisibleImageActor(int idPosition, bool visible);
- void VisiblePointWidget( bool visible );
- void VisiblePlaneWidget( bool visible );
-
- void SetVisibleTissue(int idTissue, bool visible);
- bool GetVisibleTissue(int idTissue);
- virtual void Refresh();
- virtual void RefreshView();
- virtual void Configure();
- void SetVtkMPR3DDataViewer( vtkMPR3DDataViewer *vtkmpr3Ddataviewer );
- wxPanel* CreateControlPanel(wxWindow *parent);
-
- vtkMPR3DDataViewer* GetVtkMPR3DDataViewer();
- wxVtk3DBaseView* GetWxvtk3Dbaseview() throw (char*);
-
- void InitOrientationPointWidget();
-
- // EED 25 Janvier 2007 testLoic
- void TestLoic1();
- void TestLoic2();
-
- void RemoveActor(vtkActor* actor);
- void ResetCamera(int *ext=NULL, double* origin=NULL,double* spc=NULL);
-
-private:
- wxVtk3DBaseView *_wxvtk3Dbaseview;
- vtkMPR3DDataViewer *_vtkmpr3Ddataviewer;
- wxVtkMPR3DViewCntrlPanel *_wxvtkmpr3DviewCntrlPanel;
-
- // Plane Widget (3D)
- vtkPolyData *_vtkplane;
- vtkActor *_contourPlaneActor;
- vtkPlaneWidget *_planeWidget;
-
- // Point Widget (3D)
- vtkPointWidget *_pointWidget;
- vtkmyPWCallback_3DPointWidget *_myCallback;
- vtkProbeFilter *_probe;
- vtkPolyDataMapper *_contourMapper;
-
-
-
-protected:
-};
-
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class wxVtkClipping3DView
-{
-public:
- wxVtkClipping3DView( wxVtk3DBaseView* wxvtk3Dbaseview );
- virtual ~wxVtkClipping3DView();
- virtual void Refresh();
- virtual void Configure();
- void SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
- wxPanel* CreateControlPanel(wxWindow *parent);
- vtkClipping3DDataViewer* GetVtkClipping3DDataViewer();
-
- void VisibleActor(int idTissue, bool visTissue);
- void VisibleVolumeActor( bool visVolume );
- void SetVisibleBoxSurface(bool visible);
- void SetVisibleBoxVolume(bool visible);
- void SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation );
-
- wxVtk3DBaseView* GetWxvtk3Dbaseview()throw(char*);
-
-private:
- wxVtk3DBaseView *_wxvtk3Dbaseview;
- vtkClipping3DDataViewer *_vtkclipping3Ddataviewer;
- vtkBoxWidget *_boxWidgetS1;
- vtkBoxWidget *_boxWidgetVolume;
- wxVtkClipping3DViewCntrlPanel *_wxvtkclipping3DviewCntrlPanel;
-protected:
-};
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInteractorStyle3DView : public InteractorStyleMaracas
-{
-public:
- vtkInteractorStyle3DView();
- ~vtkInteractorStyle3DView();
-
- virtual bool OnLeftDClick();
- bool SelectMarchibCubePoint();
-
-
- wxVtkMPR3DView *GetWxVtkMPR3DView();
- void SetWxVtkMPR3DView( wxVtkMPR3DView *wxvtkmpr3Dview );
-
- wxVtkClipping3DView *GetWxVtkClipping3DView();
- void SetWxVtkClipping3DView( wxVtkClipping3DView *wxvtkclipping3Dview);
-
-protected:
-private:
- wxVtkMPR3DView *_wxvtkmpr3Dview;
- wxVtkClipping3DView *_wxvtkclipping3Dview;
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class figureCuttingModel
-{
-public:
- figureCuttingModel();
- virtual ~figureCuttingModel();
-
- void SetPosition(double x,double y, double z);
- double GetPositionX();
- double GetPositionY();
- double GetPositionZ();
-
- void SetScale(double sx,double sy, double sz);
- double GetScaleX();
- double GetScaleY();
- double GetScaleZ();
-
- void SetRotation(double alfa,double beta, double teta);
- double GetAngleAlfa();
- double GetAngleBeta();
- double GetAngleTeta();
-
- void SetSpacing(double spcX,double spcY, double spcZ);
-
- void CalculeMatrix();
- void CalculeInversMatrix();
- virtual bool IfPointInside(double x, double y, double z);
- vtkTransform *GetVtkTransform();
-// void SetVtkTransform(vtkTransform *matrix);
- virtual double GetTheoricVolume();
- virtual char *GetName();
-
-private:
- double _px;
- double _py;
- double _pz;
- double _alfa;
- double _beta;
- double _teta;
- double _spcX;
- double _spcY;
- double _spcZ;
-protected:
- double _sx;
- double _sy;
- double _sz;
- vtkTransform *_inversModel;
- vtkTransform *_matrixModel;
- vtkTransform *_matrixVisual;
-
-};
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-class figureCuttingSphereModel : public figureCuttingModel
-{
-public:
- figureCuttingSphereModel();
- virtual ~figureCuttingSphereModel();
- virtual bool IfPointInside(double x, double y, double z);
- virtual double GetTheoricVolume();
- virtual char *GetName();
-private:
-protected:
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class figureCuttingCubeModel : public figureCuttingModel
-{
-public:
- figureCuttingCubeModel();
- virtual ~figureCuttingCubeModel();
- virtual bool IfPointInside(double x, double y, double z);
- virtual double GetTheoricVolume();
- virtual char *GetName();
-private:
-protected:
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class figureCuttingCylinderModel : public figureCuttingModel
-{
-public:
- figureCuttingCylinderModel();
- virtual ~figureCuttingCylinderModel();
- virtual bool IfPointInside(double x, double y, double z);
- virtual double GetTheoricVolume();
- virtual char *GetName();
-private:
-protected:
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class wxPanelCuttingImageData : public wxPanel
-{
-public:
- wxPanelCuttingImageData (wxWindow *parent);
- ~wxPanelCuttingImageData ();
- void OnTransform(wxScrollEvent& event);
- void OnOpacityFig(wxScrollEvent& event);
- void OnTypeFig(wxCommandEvent& event);
- void OnExtract(wxCommandEvent& event);
- void SetVtkMPRBaseData( vtkMPRBaseData *vtkmprbasedata );
- void SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
- void SetWxVtk3DBaseView( wxVtk3DBaseView * wxvtk3Dbaseview );
-
- void SetParamsOfTransformation( );
- void Configure();
- void Refresh();
- void RefreshView();
- void RemoveActors();
-
-
-private:
- wxSlider *_opacityFig;
- wxSlider *_scaleX;
- wxSlider *_scaleY;
- wxSlider *_scaleZ;
- wxSlider *_rotationX;
- wxSlider *_rotationY;
- wxSlider *_rotationZ;
-
- wxRadioButton *_volIntern;
- wxRadioButton *_volExtern;
- wxCheckBox *_histogrammeAccumulated;
- wxSlider *_isoValue;
- wxSlider *_valueBeforeIsoValue;
- wxSlider *_valueAfterIsoValue;
- wxChoice *_typeFig;
-
- wxStaticText *_infoToVo;
- wxStaticText *_infoSuVo;
- wxStaticText *_infoSuVoA;
- wxStaticText *_infoPixLe;
- wxStaticText *_infoPixHi;
-
- // Model
- figureCuttingCylinderModel *_modelCylinder;
- figureCuttingCubeModel *_modelCube;
- figureCuttingSphereModel *_modelSphere;
- figureCuttingModel *_actualCuttingModel;
-
- // view
- vtkCubeSource *_vtkcube;
- vtkSphereSource *_vtksphere;
- vtkCylinderSource *_vtkcylinder;
- vtkPolyDataMapper *_cubeMapper;
- vtkPolyDataMapper *_sphereMapper;
- vtkPolyDataMapper *_cylinderMapper;
- vtkActor *_cubeActor;
- vtkActor *_sphereActor;
- vtkActor *_cylinderActor;
- vtkActor *_actualActor;
-
-
- vtkMPRBaseData *_vtkmprbasedata;
- wxVtk3DBaseView *_wxvtk3Dbaseview;
- vtkImageData *_imageData;
- vtkClipping3DDataViewer *_vtkclipping3Ddataviewer;
-
- vtkImageData *_histogrammeVector;
- vtkXYPlotActor *_xyplot;
- wxVtkBaseView *_wxvtkbaseView;
- vtkRenderer *_renplotter;
-
- void CreateModel();
- void CreateInterface();
- void Create3DViewObjects();
- void RefreshOpacity();
- wxWindow *CreatePlotHistogrammeInterface();
- void InitHistogramme();
-
-
-protected:
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class wxWidgetMesure2D : public wxSplitterWindow
-{
-public:
- wxWidgetMesure2D( wxWindow *parent );
- ~wxWidgetMesure2D();
-
- void OnActiveMessureTool(wxCommandEvent& event);
- void OnVisibleMessureTool(wxCommandEvent& event);
- void OnCloseContour(wxCommandEvent& event);
- void OnVisibleInformation(wxCommandEvent& event);
-
- void SetMesureScale(double mesureScale);
-
- manualContourModel* GetManualContourModel();
- virtual void ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview);
-
-protected:
- wxVtk2DBaseView *_wxvtk2Dbaseview;
- virtual wxWindow *CreateWin1a(wxWindow *parent);
-private:
- wxCheckBox *_cb_messuretool;
- wxCheckBox *_cb_mt_visible;
- wxCheckBox *_cb_closeContour;
- wxCheckBox *_cb_visibleText;
-
- manualContourControler *_manContourControl_1;
- manualContourModel *_mContourModel_1;
- manualViewContour *_mViewContour_1;
-
- void ActiveMessureTool(bool ok);
-
-// DECLARE_EVENT_TABLE();
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class wxWidgetMesure2D_Plane : public wxWidgetMesure2D
-{
-public:
- wxWidgetMesure2D_Plane(wxWindow *parent);
- ~wxWidgetMesure2D_Plane();
- void OnActiveLine(wxCommandEvent& event);
- void OnActiveCirlcle(wxCommandEvent& event);
- virtual void ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview);
- void ConfigureCircleLine();
- void CircleLine();
-
-protected:
- virtual wxWindow *CreateWin1a(wxWindow *parent);
-private:
- wxCheckBox *_cb_line;
- wxCheckBox *_cb_circle;
-
- // Circle 1
- vtkPoints *_ptsCircle1;
- vtkActor *_circle1Actor;
- vtkPolyDataMapper *_circle1Mapper;
- vtkPolyData *_pdCircle1;
- // Circle 2
- vtkPoints *_ptsCircle2;
- vtkActor *_circle2Actor;
- vtkPolyDataMapper *_circle2Mapper;
- vtkPolyData *_pdCircle2;
- // line reference 1
- vtkPoints *_ptsLineRef1;
- vtkActor *_lineRef1Actor;
- vtkPolyDataMapper *_lineRef1Mapper;
- vtkPolyData *_pdLineRef1;
- // line reference 2
- vtkPoints *_ptsLineRef2;
- vtkActor *_lineRef2Actor;
- vtkPolyDataMapper *_lineRef2Mapper;
- vtkPolyData *_pdLineRef2;
-
- void SetVisibleCircle( bool ok );
-
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-class wxWidgetMesure2D_Plane_in_MPR : public wxWidgetMesure2D_Plane
-{
-public:
- wxWidgetMesure2D_Plane_in_MPR(wxWindow *parent);
- ~wxWidgetMesure2D_Plane_in_MPR();
- void OnActiveLink(wxCommandEvent& event);
- void SetVtkPlane2DView(vtkPlane2DView *vtkplane2Dview);
- void SetActiveLink(bool ok);
-
-protected:
- virtual wxWindow *CreateWin1a(wxWindow *parent);
-private:
- wxCheckBox *_cb_link;
- vtkPlane2DView *_vtkplane2Dview;
-};
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
+#include "vtkInteractorStyleSphere.h"
+#include "idAlBeRa.h"
+
+#include "wxVtkMPR3DView.h"
+#include "wxVtkMPR2DView.h"
+#include "vtkPlane2DView.h"
+#include "wxSphereView.h"
+#include "wxVtkClipping3DView.h"
+#include "wxPanelCuttingImageData.h"
+#include "wxWidgetMesure2D_Plane_in_MPR.h"
+
+#include "wxVtk3DBaseView.h"
+
+//class wxMPRWidget;
+//class vtkInteractorStylePlane2D;
+//class vtkInfoTextImageInteractorPlane2D;
+//class vtkInteractorStyleMPRView;
+//class wxVtkMPR3DView;
+//class wxVtkClipping3DView;
class creaMaracasVisu_EXPORT wxMPRWidget : public wxPanel
{
DECLARE_EVENT_TABLE( );
};
-
-class creaMaracasVisu_EXPORT wxMPRWidget2 : public wxMPRWidget
-{
-public:
- wxMPRWidget2(wxWindow* parent,marImageData *marimagedata,double voxelSize);
- ~wxMPRWidget2();
- virtual void OnRefreshView(wxCommandEvent & event);
-private:
-protected:
-};
-
-
-
-
#endif // __WX__MPR__WIDGET__HXX__
--- /dev/null
+
+#include "wxMPRWidget2.h"
+#include "marImageData.h"
+
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+wxMPRWidget2::wxMPRWidget2(wxWindow* parent,marImageData *marimagedata,double voxelSize)
+: wxMPRWidget(parent,marimagedata,voxelSize)
+{
+}
+//----------------------------------------------------------------------------
+wxMPRWidget2::~wxMPRWidget2()
+{
+}
+//----------------------------------------------------------------------------
+void wxMPRWidget2::OnRefreshView(wxCommandEvent & event) // Virtual
+{
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ this->GetParent()->ProcessEvent(newevent1);
+}
--- /dev/null
+#ifndef WXMPRWIDGET2_H_
+#define WXMPRWIDGET2_H_
+
+#include "wxMPRWidget.h"
+
+class creaMaracasVisu_EXPORT wxMPRWidget2 : public wxMPRWidget
+{
+public:
+ wxMPRWidget2(wxWindow* parent,marImageData *marimagedata,double voxelSize);
+ ~wxMPRWidget2();
+ virtual void OnRefreshView(wxCommandEvent & event);
+private:
+protected:
+};
+
+#endif /*WXMPRWIDGET2_H_*/
Program: wxMaracas
Module: $RCSfile: wxManualTree_MPRWidget.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
#include <wx/notebook.h>
#include <wx/colordlg.h>
+#include "vtkInteractorStyle3DView.h"
//-------------------------------------------------------------------
//EED 3 oct 2006
_mViewContour_2->SetSpacing(spc);
- wxvtkbaseview->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_2 );
+ ((vtkInteractorStyleBaseView*)wxvtkbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_2 );
//
wxvtkbaseview = _MPRWidget2->GetWxVtkBaseView(0,0);
//EED 3 oct 2006
_mViewContour_0->SetSpacing(spc);
- wxvtkbaseview->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_0 );
+ ((vtkInteractorStyleBaseView*)wxvtkbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_0 );
//
wxvtkbaseview = _MPRWidget2->GetWxVtkBaseView(0,1);
//EED 3 oct 2006
_mViewContour_1->SetSpacing(spc);
- wxvtkbaseview->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_1 );
+ ((vtkInteractorStyleBaseView*)wxvtkbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_1 );
// perpendicular plane
_mViewContour_p->SetSpacing(spc);
// wxvtkbaseview->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_p );
- wxvtkbaseview->GetInteractorStyleBaseView()->InsertInteractorStyleMaracas( 0, _manContourControl_p );
+ ((vtkInteractorStyleBaseView*)wxvtkbaseview->GetInteractorStyleBaseView())->InsertInteractorStyleMaracas( 0, _manContourControl_p );
vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)wxvtkbaseview;
_manContourControl_p->SetVtkInteractorStylePlane2D( vtkplane2Dview->GetInteractorstyleplane2D() );
this->_marimageData->GetImageData()->GetDimensions( dim ); // image t=0
_mViewContour_3D->SetDimensions( dim[0],dim[1],dim[2] );
_mViewContour_3D->SetVtkMPRBaseData( _wxvtkmpr3Dview_C->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData() );
- wxvtkbaseview->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _manContourControl_3V3D );
+ ((vtkInteractorStyleBaseView*)wxvtkbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_3V3D );
//
_manContourControl_0 -> SetVtkMPRBaseData( _MPRWidget2->GetVtkMPRBaseData() );
_manContourControl_3V -> AddManualViewBaseContour( _mViewContour_0 );
_manContourControl_3V -> AddManualViewBaseContour( _mViewContour_1 );
_manContourControl_3V -> AddManualViewBaseContour( _mViewContour_p );
- _manContourControl_3V -> SetVtkInteractorStyleBaseView (wxvtkbaseview->GetInteractorStyleBaseView() );
+ _manContourControl_3V -> SetVtkInteractorStyleBaseView ((vtkInteractorStyleBaseView*)wxvtkbaseview->GetInteractorStyleBaseView() );
_manContourControl_3V3D -> SetManualContour3VControler( _manContourControl_3V );
_manContourControl_3V3D -> SetModelView( _mContourModel_2 , _mViewContour_3D );
_manContourControl_3V_p -> AddManualViewBaseContour( _mViewContour_0 );
_manContourControl_3V_p -> AddManualViewBaseContour( _mViewContour_1 );
_manContourControl_3V_p -> AddManualViewBaseContour( _mViewContour_3D );
- _manContourControl_3V_p -> SetVtkInteractorStyleBaseView (wxvtkbaseview->GetInteractorStyleBaseView() );
+ _manContourControl_3V_p -> SetVtkInteractorStyleBaseView ((vtkInteractorStyleBaseView*)wxvtkbaseview->GetInteractorStyleBaseView() );
_manContourControl_p -> SetManualContour3VControler( _manContourControl_3V_p );
_manContourControl_p -> SetModelView( _mContourModel_2 , _mViewContour_p );
vtkInteractorStyle3DView *vtkinteractorstyle3Dview = new vtkInteractorStyle3DView();
vtkinteractorstyle3Dview->SetWxVtkMPR3DView(_wxvtkmpr3Dview_C);
vtkinteractorstyle3Dview->SetWxVtkClipping3DView(_wxvtkclipping3Dview_C);
- _wxvtk3Dbaseview_Clipping3D_C->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( vtkinteractorstyle3Dview );
+ ((vtkInteractorStyleBaseView*)_wxvtk3Dbaseview_Clipping3D_C->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( vtkinteractorstyle3Dview );
ConfigureContour();
}
Program: wxMaracas
Module: $RCSfile: wxManualTree_MPRWidget.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:42 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
*/
#include "wxMPRWidget.h"
+#include "wxMPRWidget2.h"
+#include "manualViewPerpPlaneContour.h"
#include "../manualContour.h"
#include <wx/notebook.h>
+#include "wxVtk3DBaseView.h"
//------------------------------------------------------------------
//------------------------------------------------------------------
Program: wxMaracas
Module: $RCSfile: wxMaracasIRMView.cxx,v $
Language: C++
- Date: $Date: 2009/05/04 15:06:42 $
- Version: $Revision: 1.7 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.8 $
Copyright: (c) 2002, 2003
License:
// EOF - wxMaracasMPR.cxx
#include "wxMaracasIRMView.h"
+//#include "wxMaracasIRMViewPanel.h"
+#include "wxMaracasIRMViewProp3DMHD.h"
+#include "wxMaracasIRMViewProp3D.h"
#include <wx/colordlg.h>
#include <wx/bmpbuttn.h>
}
}
-/**
-** Implementation of viewProp3D
-**/
-
-wxMaracasIRMViewProp3D::wxMaracasIRMViewProp3D(wxWindow* parent,int propid)
-:wxMaracasIRMViewPanel(parent, propid){
- createControls();
-}
-
-wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D(){
- //wxMaracasIRMView::getInstance()->addRemoveActor(_propid, false);
- wxMaracasIRMView::getInstance()->deleteActor(_propid);
-}
-
-void wxMaracasIRMViewProp3D::createControls(){
-
- wxFlexGridSizer* sizerirmprop = new wxFlexGridSizer(1,1,1);
-
- wxString choices[2];
- choices[0] = wxString(_T("On"));
- choices[1] = wxString(_T("Off"));
- checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor")));
- Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onCheckBoxChange);
- checkbox->SetValue(true);
-
- sizerirmprop->Add(checkbox,wxFIXED_MINSIZE);
-
- //this->addControl(checkbox);
-
- wxBitmap bitmap(Color_xpm);
- _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));
- Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onColorChange);
- sizerirmprop->Add(_colorchoose,wxFIXED_MINSIZE);
-
- //sizercolor->Add(checkbox,wxFIXED_MINSIZE);
- //sizercolor->Add(_colorchoose,wxFIXED_MINSIZE);
- //this->addControl(sizercolor);
-
-
- wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity")));
- opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS);
- Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onOpacityRelease);
- wxFlexGridSizer* sizeropacity = new wxFlexGridSizer(1,1,1);
- sizeropacity->Add(label,wxFIXED_MINSIZE);
- sizeropacity->Add(opacity,wxFIXED_MINSIZE);
-
- sizerirmprop->Add(sizeropacity,wxFIXED_MINSIZE);
-
- //this->addControl(sizeropacity);
- this->addControl(sizerirmprop);
-
-}
-void wxMaracasIRMViewProp3D::onCheckBoxChange(wxCommandEvent& event){
- wxMaracasIRMView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
-}
-void wxMaracasIRMViewProp3D::onColorChange(wxCommandEvent& event){
- wxColourDialog* colourdiag = new wxColourDialog(this);
- if(colourdiag->ShowModal()==wxID_OK){
- wxColour colour = colourdiag->GetColourData().GetColour();
- _colorchoose->SetBackgroundColour(colour);
-
- double r = (double)(colour.Red())/255.0;
- double g = (double)(colour.Green())/255.0;
- double b = (double)(colour.Blue())/255.0;
-
- wxMaracasIRMView::getInstance()->changeColor(this->getPropId(),r,g,b);
- }
- delete colourdiag;
-}
-/*void wxMaracasIRMViewProp3D::onActionButtonPressedEliminate( wxCommandEvent& event ){
-
-}*/
-
-void wxMaracasIRMViewProp3D::onOpacityRelease(wxScrollEvent& event ){
- wxMaracasIRMView::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue());
-}
-/**
-** IRM viewProp3DMHD implementation
-**/
-wxMaracasIRMViewProp3DMHD::wxMaracasIRMViewProp3DMHD(wxWindow* parent, int propid)
-: wxMaracasIRMViewProp3D(parent, propid)
-{
-
-}
-wxMaracasIRMViewProp3DMHD::~wxMaracasIRMViewProp3DMHD(){
- //this->Show(false);
- //wxMaracasIRMView::getInstance()->addRemoveActor(_propid, false);
-}
-void wxMaracasIRMViewProp3DMHD::createControls(int maxisovalue){
-
- wxFlexGridSizer* sizer = new wxFlexGridSizer(1,1,1);
-
- wxStaticText* label = new wxStaticText(this, -1, wxString(_T("IsoValue")));
- sizer->Add(label, wxGROW);
- //this->addControl(label);
- isovalue = new wxSlider(this, -1,maxisovalue,0,maxisovalue,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS);
- sizer->Add(isovalue, wxGROW);
- //this->addControl(isovalue);
-
- this->addControl(sizer);
- Connect(isovalue->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3DMHD::onIsoValueRelease);
-}
-
-void wxMaracasIRMViewProp3DMHD::onIsoValueRelease(wxScrollEvent& event ){
-
- wxMaracasIRMView::getInstance()->changeIsoValue(this->getPropId(), isovalue->GetValue()/1.0);
-
-}
/**
**
**/
Program: wxMaracas
Module: $RCSfile: wxMaracasIRMView.h,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:42 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.4 $
Copyright: (c) 2002, 2003
License:
#include "vtkProp3D.h"
#include "wxMaracasIRMViewManager.h"
-
-class wxMaracasIRMViewPanel : public wxPanel{
-public:
- wxMaracasIRMViewPanel(wxWindow* parent, int propid)
- : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
- createPanel();
- _propid = propid;
- }
- //virtual ~wxMaracasIRMViewPanel();
- virtual void createPanel(){
- show = false;
- /*wxBoxSizer* sizerButtons = new wxBoxSizer(wxVERTICAL);
-
- wxButton* b = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
- wxDefaultValidator, wxString(_T("-")));
- Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewPanel::onActionButtonPressedHide);
- wxButton* b1 = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
- wxDefaultValidator, wxString(_T("x")));
- Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewPanel::onActionButtonPressedEliminate);
-
- sizerButtons->Add(b, wxFIXED_MINSIZE);
- sizerButtons->Add(b1, wxFIXED_MINSIZE);*/
-
- sizercontrols = new wxBoxSizer(wxVERTICAL);
-
- wxBoxSizer* sizerpanel = new wxBoxSizer(wxHORIZONTAL);
-
- //sizerpanel->Add(sizerButtons,wxGROW);
- sizerpanel->Add(sizercontrols,wxGROW);
-
- this->SetSizer(sizerpanel, true);
- this->SetAutoLayout( true );
- }
-
- /**
- ** Adds a new control to the panel (sizer, radiob, etc)
- **/
- virtual void addControl(wxWindow* win){
- if(sizercontrols!=NULL){
- sizercontrols->Add(win, wxGROW);
- }
- }
- /**
- ** Adds a new control to the panel (sizer, radiob, etc)
- **/
- virtual void addControl(wxSizer* sizer){
- if(sizercontrols!=NULL){
- sizercontrols->Add(sizer, wxGROW);
- }
- }
-
- /**
- ** Hides or show the controls in the panel
- **/
- virtual void onActionButtonPressedHide( wxCommandEvent& event ){
- wxList list = sizercontrols->GetChildren();
- int i;
- for(i=0; i<list.size();i++){
- sizercontrols->Show(i,show);
- }
- show = !show;
- sizercontrols->Layout();
- this->Layout();
- }
-
- /**
- ** The user must implement this function to remove the panel from the
- **/
- //virtual void onActionButtonPressedEliminate( wxCommandEvent& event )=0;
-
- /**
- ** The user must implement this function to add the necessary controls to the panel
- **/
- virtual void createControls( )=0;
- /**
- ** returns the id of the panel
- **/
- int getPropId(){
- return _propid;
- }
-
-private:
- wxBoxSizer* sizercontrols;
- bool show;
-protected:
- int _propid;
-
-};
-
+#include "wxMaracasIRMViewPanel.h"
-class wxMaracasIRMViewProp3D : public wxMaracasIRMViewPanel{
-public:
- wxMaracasIRMViewProp3D(wxWindow* parent, int propid);
- ~wxMaracasIRMViewProp3D();
- virtual void createControls();
- void onOpacityRelease(wxScrollEvent& event );
- void onCheckBoxChange(wxCommandEvent& event);
- void onColorChange(wxCommandEvent& event);
-
-
-private:
- wxCheckBox* checkbox;
- wxSlider* opacity;
- wxBitmapButton* _colorchoose;
-
-
-};
-
-
-
-
-class wxMaracasIRMViewProp3DMHD : public wxMaracasIRMViewProp3D{
-public:
- wxMaracasIRMViewProp3DMHD(wxWindow* parent, int propid);
- ~wxMaracasIRMViewProp3DMHD();
- void onIsoValueRelease(wxScrollEvent& event );
- void createControls(int maxisovalue);
-
-
-private:
- wxSlider* isovalue;
- int _propid;
-
-};
-
-
-
-
class ToolBar : public wxToolBar{
public:
Program: wxMaracas
Module: $RCSfile: wxMaracasIRMViewManager.cxx,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:42 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
=========================================================================*/
#include "wxMaracasIRMViewManager.h"
+#include "wxMaracasIRMViewManagerDataMhd.h"
+
/**
** Start of the manager class
**/
checkInvariant();
if(imagedata != NULL){
- wxMaracasIRMViewManagerData* data = new wxMaracasIRMViewManagerData(imagedata, dataname);
+ wxMaracasIRMViewManagerData* data = new wxMaracasIRMViewManagerDataMhd(imagedata, dataname);
prop3Dvect.push_back(data);
_renderer->AddActor(data->getProp3D());
data->setId(_idCount);
wxMaracasIRMViewManagerData* data = this->getViewData(propid);
//_renderer->RemoveActor(data->getProp3D());
- data->changeIsoValue(value);
+ ((wxMaracasIRMViewManagerDataMhd*)data)->changeIsoValue(value);
//_renderer->AddActor(data->getProp3D());
_renderer->Render();
int wxMaracasIRMViewManager::getMaxIsoValue(int propid) throw(char*){
- return this->getViewData(propid)->getMaxGreyLevel();
+ return ((wxMaracasIRMViewManagerDataMhd*)this->getViewData(propid))->getMaxGreyLevel();
}
}
-/********************************************************************************************
-** Start of data viewmanagerData
-*********************************************************************************************/
-
-wxMaracasIRMViewManagerData::wxMaracasIRMViewManagerData(vtkProp3D* prop3Dvect, std::string dataname){
-
- _prop3D = prop3Dvect;
- _dataname = dataname;
- _maxgreylevel=-1;
-
- _cubesFilter=NULL;
- _cleanFilter=NULL;
- _dataMapper=NULL;
-}
-wxMaracasIRMViewManagerData::wxMaracasIRMViewManagerData(vtkImageData* imagedata, std::string dataname){
-
- this->setVtkImageData(imagedata);
- _dataname = dataname;
-
- _maxgreylevel = getMaxLevel(imagedata);
- _prop3D=NULL;
-
- _cubesFilter = vtkMarchingCubes::New();
- _cleanFilter = vtkCleanPolyData::New();
- _dataMapper = vtkPolyDataMapper::New();
- vtkActor* dataActor = vtkActor::New();
-
- _cubesFilter->SetInput(this->_imagedata);
- _cubesFilter->ComputeGradientsOn ();
- _cubesFilter->ComputeScalarsOn ();
- _cubesFilter->SetNumberOfContours( 1 );
- _cleanFilter->SetInput ( _cubesFilter->GetOutput() );
- _dataMapper->SetInput(_cleanFilter->GetOutput());
- _dataMapper->ScalarVisibilityOff();
- _dataMapper->ImmediateModeRenderingOn();
- dataActor->SetMapper(_dataMapper);
-
- this->_prop3D = dataActor;
-
- this->changeIsoValue(this->_maxgreylevel);
-
-
-}
-/**
-** changes the isovalue in a prop3D
-**/
-void wxMaracasIRMViewManagerData::changeIsoValue(double value){
-
-
- _cubesFilter->SetValue(0,value);
- _cubesFilter->Update();
- _cleanFilter->Update();
- _dataMapper->Update();
-
-
-
-}
-int wxMaracasIRMViewManagerData::getMaxGreyLevel(){
- return _maxgreylevel;
-}
-wxMaracasIRMViewManagerData::~wxMaracasIRMViewManagerData(){
- if(_cubesFilter!=NULL){
- _cubesFilter->Delete();
- _cleanFilter->Delete();
- _dataMapper->Delete();
- }
- _prop3D->Delete();
-}
-/**
-** Adds a prop3D to the world of the application
-**/
-/**
- ** Get's the max grey level of the image
- **/
-int wxMaracasIRMViewManagerData::getMaxLevel(vtkImageData* img){
-
- int ext[6], i, j, k,max=0;
- img->GetExtent(ext);
-
- for(i = ext[0]; i < ext[1];i++){
- for(j = ext[2]; j < ext[3];j++){
- for(k = ext[4]; k < ext[5];k++){
- unsigned short* ptr = (unsigned short*)img->GetScalarPointer(i,j,k);
- int temp = (int)*ptr;
- if(temp > max){
- max = temp;
- }
- }
- }
- }
- return max;
-
-
-}
-void wxMaracasIRMViewManagerData::setVtkImageData(vtkImageData* imagedata){
- _imagedata = imagedata;
-}
-/**
-** Adds a prop3D to the world of the application
-**/
-void wxMaracasIRMViewManagerData::setProp3D(vtkProp3D* prop3D){
- _prop3D = prop3D;
-}
-/**
-** Changes the opacity in a prop3D
-**/
-void wxMaracasIRMViewManagerData::changeOpacity(int value){
- std::cout<<"chage op"<<value<<std::endl;
- vtkActor* actor = (vtkActor*)this->_prop3D;
- actor->GetProperty()->SetOpacity((double)value/100.0);
-
-
-
-}
-void wxMaracasIRMViewManagerData::changeColor(double red, double green, double blue){
- std::cout<<"chage col"<<red<<green<<blue<<std::endl;
- vtkActor* actor = (vtkActor*)this->_prop3D;
- actor->GetProperty()->SetColor(red,green,blue);
-}
-/**
-** Check if the variables are setted correctly
-**/
-void wxMaracasIRMViewManagerData::checkInvariant(){
-
-}
-/**
-** get the prop3D
-**/
-vtkProp3D* wxMaracasIRMViewManagerData::getProp3D(){
- return this->_prop3D;
-}
-/**
-** return the id from the daat
-**/
-int wxMaracasIRMViewManagerData::getId(){
- return _id;
-}
-/**
-** set data id
-**/
-void wxMaracasIRMViewManagerData::setId(int propid){
- _id = propid;
-}
-
-/**
-** Get the filanme
-**/
-std::string wxMaracasIRMViewManagerData::getDataname(){
- return _dataname;
-}
-/**
-** Set the filanme
-**/
-void wxMaracasIRMViewManagerData::setDataname(std::string dataname){
- _dataname = dataname;
-}
-
Program: wxMaracas
Module: $RCSfile: wxMaracasIRMViewManager.h,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:42 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
#include <iostream>
#include <vector>
-#include "vtkProp3D.h"
-#include "vtkRenderer.h"
-#include "vtkSTLReader.h"
-#include "vtkPolyDataMapper.h"
-#include "vtkActor.h"
-#include "vtkProperty.h"
-#include "vtkMetaImageReader.h"
-#include "vtkMarchingCubes.h"
-#include "vtkCleanPolyData.h"
-#include "vtkImageData.h"
+#include "wxMaracasIRMViewManagerData.h"
-
-
-class wxMaracasIRMViewManagerData {
-
-public:
- wxMaracasIRMViewManagerData(vtkProp3D* _prop3Dvect, std::string dataname="");
- wxMaracasIRMViewManagerData(vtkImageData* imagedata, std::string dataname="");
- ~wxMaracasIRMViewManagerData();
-
-
- /**
- ** Adds a prop3D to the world of the application
- **/
- void setVtkImageData(vtkImageData* imagedata);
- /**
- ** Adds a prop3D to the world of the application
- **/
- void setProp3D(vtkProp3D* prop3D);
- /**
- ** Changes the opacity in a prop3D
- **/
- void changeOpacity(int value);
- /**
- ** changes the isovalue in a prop3D
- **/
- void changeIsoValue(double value);
- /**
- ** Check if the variables are setted correctly
- **/
- void checkInvariant();
- /**
- ** get the prop3D
- **/
- vtkProp3D* getProp3D();
- /**
- ** return the id from the daat
- **/
- int getId();
- /**
- ** set data id
- **/
- void setId(int propid);
- /**
- ** Get the filanme
- **/
- std::string getDataname();
- /**
- ** Set the filanme
- **/
- void setDataname(std::string dataname);
- /**
- ** Returns the grey max level of the image
- **/
-
- int getMaxGreyLevel();
-
- /**
- ** creates the image
- **/
- void contourExtractor(int isovalue);
-
- /**
- ** Changes the color of the actor
- **/
- void changeColor(double red, double green, double blue);
-
-private:
- vtkProp3D* _prop3D;
- vtkImageData* _imagedata;
- int _id;
- std::string _dataname;
- int _maxgreylevel;
-
- /**
- ** to the image render
- **/
- vtkMarchingCubes* _cubesFilter;
- vtkCleanPolyData* _cleanFilter;
- vtkPolyDataMapper* _dataMapper;
-
- /**
- ** Get's the max grey level of the image
- **/
- int getMaxLevel(vtkImageData* img);
-
-
-
-};
-
class wxMaracasIRMViewManager {
public:
--- /dev/null
+
+#include "wxMaracasIRMViewManagerData.h"
+
+/********************************************************************************************
+** Start of data viewmanagerData
+*********************************************************************************************/
+
+wxMaracasIRMViewManagerData::wxMaracasIRMViewManagerData(vtkProp3D* prop3Dvect, std::string dataname){
+
+ _prop3D = prop3Dvect;
+ _dataname = dataname;
+
+}
+
+
+wxMaracasIRMViewManagerData::~wxMaracasIRMViewManagerData(){
+
+ _prop3D->Delete();
+}
+
+/**
+** Adds a prop3D to the world of the application
+**/
+void wxMaracasIRMViewManagerData::setProp3D(vtkProp3D* prop3D){
+ _prop3D = prop3D;
+}
+/**
+** Changes the opacity in a prop3D
+**/
+void wxMaracasIRMViewManagerData::changeOpacity(int value){
+ std::cout<<"chage op"<<value<<std::endl;
+ vtkActor* actor = (vtkActor*)this->_prop3D;
+ actor->GetProperty()->SetOpacity((double)value/100.0);
+
+
+
+}
+void wxMaracasIRMViewManagerData::changeColor(double red, double green, double blue){
+ std::cout<<"chage col"<<red<<green<<blue<<std::endl;
+ vtkActor* actor = (vtkActor*)this->_prop3D;
+ actor->GetProperty()->SetColor(red,green,blue);
+}
+/**
+** Check if the variables are setted correctly
+**/
+void wxMaracasIRMViewManagerData::checkInvariant(){
+
+}
+/**
+** get the prop3D
+**/
+vtkProp3D* wxMaracasIRMViewManagerData::getProp3D(){
+ return this->_prop3D;
+}
+/**
+** return the id from the daat
+**/
+int wxMaracasIRMViewManagerData::getId(){
+ return _id;
+}
+/**
+** set data id
+**/
+void wxMaracasIRMViewManagerData::setId(int propid){
+ _id = propid;
+}
+
+/**
+** Get the filanme
+**/
+std::string wxMaracasIRMViewManagerData::getDataname(){
+ return _dataname;
+}
+/**
+** Set the filanme
+**/
+void wxMaracasIRMViewManagerData::setDataname(std::string dataname){
+ _dataname = dataname;
+}
+
--- /dev/null
+#ifndef WXMARACASIRMVIEWMANAGERDATA_H_
+#define WXMARACASIRMVIEWMANAGERDATA_H_
+
+#include "vtkProp3D.h"
+#include "vtkRenderer.h"
+#include "vtkSTLReader.h"
+#include "vtkPolyDataMapper.h"
+#include "vtkActor.h"
+#include "vtkProperty.h"
+
+
+
+class wxMaracasIRMViewManagerData {
+
+public:
+ wxMaracasIRMViewManagerData(vtkProp3D* _prop3Dvect, std::string dataname="");
+ ~wxMaracasIRMViewManagerData();
+
+ /**
+ ** Adds a prop3D to the world of the application
+ **/
+ void setProp3D(vtkProp3D* prop3D);
+ /**
+ ** Changes the opacity in a prop3D
+ **/
+ void changeOpacity(int value);
+ /**
+ ** Check if the variables are setted correctly
+ **/
+ void checkInvariant();
+ /**
+ ** get the prop3D
+ **/
+ vtkProp3D* getProp3D();
+ /**
+ ** return the id from the daat
+ **/
+ int getId();
+ /**
+ ** set data id
+ **/
+ void setId(int propid);
+ /**
+ ** Get the filanme
+ **/
+ std::string getDataname();
+ /**
+ ** Set the filanme
+ **/
+ void setDataname(std::string dataname);
+
+ /**
+ ** creates the image
+ **/
+ void contourExtractor(int isovalue);
+
+ /**
+ ** Changes the color of the actor
+ **/
+ void changeColor(double red, double green, double blue);
+
+protected:
+ /**
+ * Prop 3D (data actor)
+ */
+ vtkProp3D* _prop3D;
+ /**
+ * Dataname given by the user (ex. filename)
+ **/
+ std::string _dataname;
+
+
+private:
+
+ /*
+ * id of the data
+ */
+ int _id;
+
+
+};
+
+#endif /*WXMARACASIRMVIEWMANAGERDATA_H_*/
--- /dev/null
+
+#include "wxMaracasIRMViewManagerDataMhd.h"
+
+wxMaracasIRMViewManagerDataMhd::wxMaracasIRMViewManagerDataMhd(vtkImageData* imagedata, std::string dataname)
+: wxMaracasIRMViewManagerData(NULL, dataname)
+{
+
+ this->setVtkImageData(imagedata);
+ _dataname = dataname;
+
+ _maxgreylevel = getMaxLevel(imagedata);
+ _prop3D=NULL;
+
+ _cubesFilter = vtkMarchingCubes::New();
+ _cleanFilter = vtkCleanPolyData::New();
+ _dataMapper = vtkPolyDataMapper::New();
+ vtkActor* dataActor = vtkActor::New();
+
+ _cubesFilter->SetInput(this->_imagedata);
+ _cubesFilter->ComputeGradientsOn ();
+ _cubesFilter->ComputeScalarsOn ();
+ _cubesFilter->SetNumberOfContours( 1 );
+ _cleanFilter->SetInput ( _cubesFilter->GetOutput() );
+ _dataMapper->SetInput(_cleanFilter->GetOutput());
+ _dataMapper->ScalarVisibilityOff();
+ _dataMapper->ImmediateModeRenderingOn();
+ dataActor->SetMapper(_dataMapper);
+
+ this->_prop3D = dataActor;
+
+ this->changeIsoValue(this->_maxgreylevel);
+
+
+}
+
+wxMaracasIRMViewManagerDataMhd::~wxMaracasIRMViewManagerDataMhd(){
+ _cubesFilter->Delete();
+ _cleanFilter->Delete();
+ _dataMapper->Delete();
+}
+
+
+/**
+** changes the isovalue in a prop3D
+**/
+void wxMaracasIRMViewManagerDataMhd::changeIsoValue(double value){
+
+
+ _cubesFilter->SetValue(0,value);
+ _cubesFilter->Update();
+ _cleanFilter->Update();
+ _dataMapper->Update();
+
+
+
+}
+int wxMaracasIRMViewManagerDataMhd::getMaxGreyLevel(){
+ return _maxgreylevel;
+}
+
+/**
+ ** Get's the max grey level of the image
+ **/
+int wxMaracasIRMViewManagerDataMhd::getMaxLevel(vtkImageData* img){
+
+ int ext[6], i, j, k,max=0;
+ img->GetExtent(ext);
+
+ for(i = ext[0]; i < ext[1];i++){
+ for(j = ext[2]; j < ext[3];j++){
+ for(k = ext[4]; k < ext[5];k++){
+ unsigned short* ptr = (unsigned short*)img->GetScalarPointer(i,j,k);
+ int temp = (int)*ptr;
+ if(temp > max){
+ max = temp;
+ }
+ }
+ }
+ }
+ return max;
+
+
+}
+
+/**
+** Sets the VTK image data
+**/
+
+void wxMaracasIRMViewManagerDataMhd::setVtkImageData(vtkImageData* imagedata){
+ _imagedata = imagedata;
+}
+
--- /dev/null
+#ifndef WXMARACASIRMVIEWMANAGERDATAMHD_H_
+#define WXMARACASIRMVIEWMANAGERDATAMHD_H_
+
+
+#include "wxMaracasIRMViewManagerData.h"
+
+#include "vtkMetaImageReader.h"
+#include "vtkMarchingCubes.h"
+#include "vtkCleanPolyData.h"
+#include "vtkImageData.h"
+
+class wxMaracasIRMViewManagerDataMhd : public wxMaracasIRMViewManagerData {
+
+public:
+
+ wxMaracasIRMViewManagerDataMhd(vtkImageData* imagedata, std::string dataname="");
+ ~wxMaracasIRMViewManagerDataMhd();
+
+
+ /**
+ ** Adds a prop3D to the world of the application
+ **/
+ void setVtkImageData(vtkImageData* imagedata);
+
+ /**
+ ** changes the isovalue in a prop3D
+ **/
+ void changeIsoValue(double value);
+ /**
+ ** Check if the variables are setted correctly
+ **/
+ void checkInvariant();
+
+ /**
+ ** Returns the grey max level of the image
+ **/
+
+ int getMaxGreyLevel();
+
+ /**
+ ** creates the image
+ **/
+ void contourExtractor(int isovalue);
+
+private:
+
+ vtkImageData* _imagedata;
+ int _maxgreylevel;
+
+ /**
+ ** to the image render
+ **/
+ vtkMarchingCubes* _cubesFilter;
+ vtkCleanPolyData* _cleanFilter;
+ vtkPolyDataMapper* _dataMapper;
+
+ /**
+ ** Get's the max grey level of the image
+ **/
+ int getMaxLevel(vtkImageData* img);
+
+
+
+};
+
+#endif /*WXMARACASIRMVIEWMANAGERDATAMHD_H_*/
--- /dev/null
+#ifndef WXMARACASIRMVIEWPANEL_H_
+#define WXMARACASIRMVIEWPANEL_H_
+
+#include "wx/wx.h"
+
+class wxMaracasIRMViewPanel : public wxPanel{
+public:
+ wxMaracasIRMViewPanel(wxWindow* parent, int propid)
+ : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize){
+ createPanel();
+ _propid = propid;
+ }
+ //virtual ~wxMaracasIRMViewPanel();
+ virtual void createPanel(){
+ show = false;
+ /*wxBoxSizer* sizerButtons = new wxBoxSizer(wxVERTICAL);
+
+ wxButton* b = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
+ wxDefaultValidator, wxString(_T("-")));
+ Connect(b->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewPanel::onActionButtonPressedHide);
+ wxButton* b1 = new wxButton(this, -1, wxString(_T("-")), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT,
+ wxDefaultValidator, wxString(_T("x")));
+ Connect(b1->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewPanel::onActionButtonPressedEliminate);
+
+ sizerButtons->Add(b, wxFIXED_MINSIZE);
+ sizerButtons->Add(b1, wxFIXED_MINSIZE);*/
+
+ sizercontrols = new wxBoxSizer(wxVERTICAL);
+
+ wxBoxSizer* sizerpanel = new wxBoxSizer(wxHORIZONTAL);
+
+ //sizerpanel->Add(sizerButtons,wxGROW);
+ sizerpanel->Add(sizercontrols,wxGROW);
+
+ this->SetSizer(sizerpanel, true);
+ this->SetAutoLayout( true );
+ }
+
+ /**
+ ** Adds a new control to the panel (sizer, radiob, etc)
+ **/
+ virtual void addControl(wxWindow* win){
+ if(sizercontrols!=NULL){
+ sizercontrols->Add(win, wxGROW);
+ }
+ }
+ /**
+ ** Adds a new control to the panel (sizer, radiob, etc)
+ **/
+ virtual void addControl(wxSizer* sizer){
+ if(sizercontrols!=NULL){
+ sizercontrols->Add(sizer, wxGROW);
+ }
+ }
+
+ /**
+ ** Hides or show the controls in the panel
+ **/
+ virtual void onActionButtonPressedHide( wxCommandEvent& event ){
+ wxList list = sizercontrols->GetChildren();
+ int i;
+ for(i=0; i<list.size();i++){
+ sizercontrols->Show(i,show);
+ }
+ show = !show;
+ sizercontrols->Layout();
+ this->Layout();
+ }
+
+ /**
+ ** The user must implement this function to remove the panel from the
+ **/
+ //virtual void onActionButtonPressedEliminate( wxCommandEvent& event )=0;
+
+ /**
+ ** The user must implement this function to add the necessary controls to the panel
+ **/
+ virtual void createControls( )=0;
+ /**
+ ** returns the id of the panel
+ **/
+ int getPropId(){
+ return _propid;
+ }
+
+private:
+ wxBoxSizer* sizercontrols;
+ bool show;
+protected:
+ int _propid;
+
+};
+
+#endif /*WXMARACASIRMVIEWPANEL_H_*/
--- /dev/null
+#include "wxMaracasIRMViewProp3D.h"
+
+#include <wx/colordlg.h>
+#include "wxMaracasIRMView.h"
+#include "Color.xpm"
+/**
+** Implementation of viewProp3D
+**/
+
+wxMaracasIRMViewProp3D::wxMaracasIRMViewProp3D(wxWindow* parent,int propid)
+:wxMaracasIRMViewPanel(parent, propid){
+ createControls();
+}
+
+wxMaracasIRMViewProp3D::~wxMaracasIRMViewProp3D(){
+ //wxMaracasIRMView::getInstance()->addRemoveActor(_propid, false);
+ wxMaracasIRMView::getInstance()->deleteActor(_propid);
+}
+
+void wxMaracasIRMViewProp3D::createControls(){
+
+ wxFlexGridSizer* sizerirmprop = new wxFlexGridSizer(1,1,1);
+
+ wxString choices[2];
+ choices[0] = wxString(_T("On"));
+ choices[1] = wxString(_T("Off"));
+ checkbox = new wxCheckBox(this,-1,wxString(_T("Show Actor")));
+ Connect(checkbox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onCheckBoxChange);
+ checkbox->SetValue(true);
+
+ sizerirmprop->Add(checkbox,wxFIXED_MINSIZE);
+
+ //this->addControl(checkbox);
+
+ wxBitmap bitmap(Color_xpm);
+ _colorchoose = new wxBitmapButton(this, -1, bitmap,wxDefaultPosition,wxSize(30,30));
+ Connect(_colorchoose->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onColorChange);
+ sizerirmprop->Add(_colorchoose,wxFIXED_MINSIZE);
+
+ //sizercolor->Add(checkbox,wxFIXED_MINSIZE);
+ //sizercolor->Add(_colorchoose,wxFIXED_MINSIZE);
+ //this->addControl(sizercolor);
+
+
+ wxStaticText* label = new wxStaticText(this, -1, wxString(_T("Opacity")));
+ opacity = new wxSlider(this, -1,100,0,100,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS);
+ Connect(opacity->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3D::onOpacityRelease);
+ wxFlexGridSizer* sizeropacity = new wxFlexGridSizer(1,1,1);
+ sizeropacity->Add(label,wxFIXED_MINSIZE);
+ sizeropacity->Add(opacity,wxFIXED_MINSIZE);
+
+ sizerirmprop->Add(sizeropacity,wxFIXED_MINSIZE);
+
+ //this->addControl(sizeropacity);
+ this->addControl(sizerirmprop);
+
+}
+void wxMaracasIRMViewProp3D::onCheckBoxChange(wxCommandEvent& event){
+ wxMaracasIRMView::getInstance()->addRemoveActor(this->getPropId(), checkbox->GetValue());
+}
+void wxMaracasIRMViewProp3D::onColorChange(wxCommandEvent& event){
+ wxColourDialog* colourdiag = new wxColourDialog(this);
+ if(colourdiag->ShowModal()==wxID_OK){
+ wxColour colour = colourdiag->GetColourData().GetColour();
+ _colorchoose->SetBackgroundColour(colour);
+
+ double r = (double)(colour.Red())/255.0;
+ double g = (double)(colour.Green())/255.0;
+ double b = (double)(colour.Blue())/255.0;
+
+ wxMaracasIRMView::getInstance()->changeColor(this->getPropId(),r,g,b);
+ }
+ delete colourdiag;
+}
+/*void wxMaracasIRMViewProp3D::onActionButtonPressedEliminate( wxCommandEvent& event ){
+
+}*/
+
+void wxMaracasIRMViewProp3D::onOpacityRelease(wxScrollEvent& event ){
+
+ wxMaracasIRMView::getInstance()->changeOpacity(this->getPropId(),opacity->GetValue());
+
+}
\ No newline at end of file
--- /dev/null
+#ifndef WXMARACASIRMVIEWPROP3D_H_
+#define WXMARACASIRMVIEWPROP3D_H_
+
+#include "wxMaracasIRMViewPanel.h"
+
+class wxMaracasIRMViewProp3D : public wxMaracasIRMViewPanel{
+public:
+ wxMaracasIRMViewProp3D(wxWindow* parent, int propid);
+ ~wxMaracasIRMViewProp3D();
+ virtual void createControls();
+ void onOpacityRelease(wxScrollEvent& event );
+ void onCheckBoxChange(wxCommandEvent& event);
+ void onColorChange(wxCommandEvent& event);
+
+
+private:
+ wxCheckBox* checkbox;
+ wxSlider* opacity;
+ wxBitmapButton* _colorchoose;
+
+
+};
+
+#endif /*WXMARACASIRMVIEWPROP3D_H_*/
--- /dev/null
+#include "wxMaracasIRMViewProp3DMHD.h"
+
+#include "wxMaracasIRMView.h"
+/**
+** IRM viewProp3DMHD implementation
+**/
+wxMaracasIRMViewProp3DMHD::wxMaracasIRMViewProp3DMHD(wxWindow* parent, int propid)
+: wxMaracasIRMViewProp3D(parent, propid)
+{
+
+}
+wxMaracasIRMViewProp3DMHD::~wxMaracasIRMViewProp3DMHD(){
+ //this->Show(false);
+ //wxMaracasIRMView::getInstance()->addRemoveActor(_propid, false);
+}
+void wxMaracasIRMViewProp3DMHD::createControls(int maxisovalue){
+
+ wxFlexGridSizer* sizer = new wxFlexGridSizer(1,1,1);
+
+ wxStaticText* label = new wxStaticText(this, -1, wxString(_T("IsoValue")));
+ sizer->Add(label, wxGROW);
+ //this->addControl(label);
+ isovalue = new wxSlider(this, -1,maxisovalue,0,maxisovalue,wxDefaultPosition,wxDefaultSize,wxSL_HORIZONTAL|wxSL_LABELS);
+ sizer->Add(isovalue, wxGROW);
+ //this->addControl(isovalue);
+
+ this->addControl(sizer);
+ Connect(isovalue->GetId(), wxEVT_SCROLL_CHANGED, (wxObjectEventFunction)&wxMaracasIRMViewProp3DMHD::onIsoValueRelease);
+}
+
+void wxMaracasIRMViewProp3DMHD::onIsoValueRelease(wxScrollEvent& event ){
+
+ wxMaracasIRMView::getInstance()->changeIsoValue(this->getPropId(), isovalue->GetValue()/1.0);
+
+}
\ No newline at end of file
--- /dev/null
+#ifndef WXMARACASIRMVIEWPROP3DMHD_H_
+#define WXMARACASIRMVIEWPROP3DMHD_H_
+
+#include "wxMaracasIRMViewProp3D.h"
+
+class wxMaracasIRMViewProp3DMHD : public wxMaracasIRMViewProp3D{
+public:
+ wxMaracasIRMViewProp3DMHD(wxWindow* parent, int propid);
+ ~wxMaracasIRMViewProp3DMHD();
+ void onIsoValueRelease(wxScrollEvent& event );
+ void createControls(int maxisovalue);
+
+
+private:
+ wxSlider* isovalue;
+ int _propid;
+
+};
+
+#endif /*WXMARACASIRMVIEWPROP3DMHD_H_*/
Program: wxMaracas
Module: $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:42 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.9 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: wxMaracas_N_ViewersWidget.h,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:42 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: wxMaracas_ViewerWidget.cxx,v $
Language: C++
- Date: $Date: 2009/05/07 15:35:46 $
- Version: $Revision: 1.11 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.12 $
Copyright: (c) 2002, 2003
License:
mwxvtkmpr3Dview = new wxVtkMPR3DView( mwxvtk3Dbaseview_Clipping3D );
+
vtkmpr3Ddataviewer = new vtkMPR3DDataViewer();
+
+
wxWindow *window3D = mwxvtk3Dbaseview_Clipping3D->GetWxVTKRenderWindowInteractor();
wxPanel *panelControl = new wxPanel(panelClipping3D,-1);
Program: wxMaracas
Module: $RCSfile: wxMaracas_ViewerWidget.h,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:43 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
--- /dev/null
+
+#include "wxPanelCuttingImageData.h"
+
+//-------------------------------------------------------------------
+
+#include <vtkProperty.h>
+#include <vtkTextProperty.h>
+#include <vtkProperty2D.h>
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+
+wxPanelCuttingImageData::wxPanelCuttingImageData (wxWindow *parent)
+: wxPanel( parent, -1)
+{
+ _imageData=NULL;
+ _histogrammeVector=NULL;
+ _wxvtk3Dbaseview=NULL;
+ _wxvtkbaseView=NULL;
+ CreateInterface();
+ CreateModel();
+ Create3DViewObjects();
+}
+
+//-------------------------------------------------------------------
+wxPanelCuttingImageData::~wxPanelCuttingImageData()
+{
+
+
+ delete _modelCube;
+ delete _modelSphere;
+ delete _modelCylinder;
+ _vtkcube -> Delete();
+ _vtksphere -> Delete();
+ _vtkcylinder -> Delete();
+ _cubeMapper -> Delete();
+ _sphereMapper -> Delete();
+ _cylinderMapper -> Delete();
+ _cubeActor -> Delete();
+ _sphereActor -> Delete();
+ _cylinderActor -> Delete();
+// _xyplot->RemoveAllInputs();
+ _xyplot -> Delete();
+ _histogrammeVector->Delete();
+ _renplotter->Delete();
+
+ if(_wxvtkbaseView!=NULL){
+ delete _wxvtkbaseView;
+ }
+ //delete _vtkclipping3Ddataviewer;
+
+
+ //fclose(file);
+
+}
+
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::RemoveActors()
+{
+ _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
+}
+
+
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::SetWxVtk3DBaseView( wxVtk3DBaseView * wxvtk3Dbaseview )
+{
+ _wxvtk3Dbaseview=wxvtk3Dbaseview;
+}
+
+//-------------------------------------------------------------------
+
+void wxPanelCuttingImageData::SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer )
+{
+ this->_vtkclipping3Ddataviewer = vtkclipping3Ddataviewer;
+}
+
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::Create3DViewObjects()
+{
+ // Sphere
+ _vtksphere = vtkSphereSource::New();
+ _vtksphere->SetThetaResolution (20);
+ _vtksphere->SetPhiResolution (20);
+ _sphereMapper = vtkPolyDataMapper::New();
+ _sphereMapper->SetInput( _vtksphere->GetOutput() );
+ _sphereActor = vtkActor::New();
+ _sphereActor->SetMapper(_sphereMapper);
+ _sphereActor->SetOrigin(0, 0, 0);
+ _sphereActor->SetPosition(0, 0, 0);
+ _sphereActor->GetProperty()->SetColor(1, 0, 0);
+ _sphereActor->SetUserTransform( _modelSphere->GetVtkTransform() );
+
+ // cube
+ _vtkcube = vtkCubeSource::New();
+ _vtkcube->SetXLength (1);
+ _vtkcube->SetYLength (1);
+ _vtkcube->SetZLength (1);
+ _cubeMapper = vtkPolyDataMapper::New();
+ _cubeMapper->SetInput( _vtkcube->GetOutput() );
+ _cubeActor = vtkActor::New();
+ _cubeActor->SetMapper(_cubeMapper);
+ _cubeActor->SetOrigin(0, 0, 0);
+ _cubeActor->SetPosition(0, 0, 0);
+ _cubeActor->GetProperty()->SetColor(1, 0, 0);
+ _cubeActor->SetUserTransform( _modelCube->GetVtkTransform() );
+
+ // cylinder
+ _vtkcylinder = vtkCylinderSource::New();
+ _vtkcylinder->SetResolution(20);
+ _cylinderMapper = vtkPolyDataMapper::New();
+ _cylinderMapper->SetInput( _vtkcylinder->GetOutput() );
+ _cylinderActor = vtkActor::New();
+ _cylinderActor->SetMapper(_cylinderMapper);
+ _cylinderActor->SetOrigin(0, 0, 0);
+ _cylinderActor->SetPosition(0, 0, 0);
+ _cylinderActor->GetProperty()->SetColor(1, 0, 0);
+ _cylinderActor->SetUserTransform( _modelCylinder->GetVtkTransform() );
+
+
+}
+
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::CreateModel()
+{
+ _modelCube = new figureCuttingCubeModel();
+ _modelSphere = new figureCuttingSphereModel();
+ _modelCylinder = new figureCuttingCylinderModel();
+
+// _modelCube->SetVtkTransform( _modelCube->GetVtkTransform() );
+// _modelSphere->SetVtkTransform( _modelSphere->GetVtkTransform() );
+// _modelCylinder->SetVtkTransform( _modelCylinder->GetVtkTransform() );
+}
+
+//-------------------------------------------------------------------
+
+void wxPanelCuttingImageData::InitHistogramme()
+{
+ double rangeA[2];
+ if (_imageData==NULL)
+ {
+ rangeA[1]=1;
+ } else {
+ _imageData->GetScalarRange(rangeA);
+ }
+ _xyplot->RemoveAllInputs();
+/*
+ if ( _histogrammeVector!=NULL )
+ {
+ _histogrammeVector -> Delete();
+ }
+*/
+ _histogrammeVector = vtkImageData::New();
+ _histogrammeVector -> SetDimensions ( (int)(rangeA[1]),1,1 );
+ _histogrammeVector -> SetScalarTypeToUnsignedShort();
+ _histogrammeVector -> AllocateScalars();
+ _histogrammeVector -> Update();
+
+ unsigned short *p_vol = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
+ int i,size = (int) (rangeA[1]);
+ for (i=0; i < size; i++)
+ {
+ *p_vol=0;
+ p_vol++;
+ }
+ _xyplot->SetXRange(0, rangeA[1]);
+ _xyplot->SetYRange(0, 10);
+ _xyplot->AddInput( _histogrammeVector );
+}
+
+//-------------------------------------------------------------------
+wxWindow *wxPanelCuttingImageData::CreatePlotHistogrammeInterface()
+{
+ _xyplot = vtkXYPlotActor::New();
+ InitHistogramme();
+ _xyplot->GetPositionCoordinate()->SetValue(0.00, 0.00, 0);
+ _xyplot->GetPosition2Coordinate()->SetValue(1.0, 1.00, 0); //relative to Position
+ _xyplot->SetXValuesToArcLength();
+ _xyplot->SetNumberOfXLabels(6);
+
+ _xyplot->SetTitle("Histogramme");
+ _xyplot->SetXTitle("Gray level");
+ _xyplot->SetYTitle("Occurrences ");
+ _xyplot->GetProperty()->SetColor(1, 0, 0);
+ _xyplot->GetProperty()->SetPointSize(2);
+ vtkTextProperty *tprop = _xyplot->GetTitleTextProperty();
+ tprop->SetColor( 1,0,1 );
+ tprop->BoldOff ();
+ _xyplot->SetAxisTitleTextProperty(tprop);
+ _xyplot->SetAxisLabelTextProperty(tprop);
+ _xyplot->PlotPointsOn();
+ _xyplot->GetProperty()->SetPointSize(3);
+
+ _wxvtkbaseView = new wxVtkBaseView(this);
+ _wxvtkbaseView->Configure();
+
+ _renplotter = vtkRenderer::New();
+ vtkRenderWindow *renWin = _wxvtkbaseView->GetRenWin();
+ renWin->AddRenderer( _renplotter );
+ _renplotter->AddActor2D( _xyplot );
+
+ return _wxvtkbaseView->GetWxVTKRenderWindowInteractor();
+}
+
+//-------------------------------------------------------------------
+
+void wxPanelCuttingImageData::CreateInterface()
+{
+ SetSize(300,500);
+ wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); // Principal sizer
+
+ wxBoxSizer *sizerH0 = new wxBoxSizer(wxHORIZONTAL ); // type of segmentation figure
+ wxBoxSizer *sizerH2 = new wxBoxSizer(wxHORIZONTAL ); // scale
+ wxBoxSizer *sizerH3 = new wxBoxSizer(wxHORIZONTAL ); // rotation
+ wxBoxSizer *sizerH4 = new wxBoxSizer(wxHORIZONTAL ); // intern extern
+ wxBoxSizer *sizerH5 = new wxBoxSizer(wxHORIZONTAL ); // Isovalue
+ wxBoxSizer *sizerH6 = new wxBoxSizer(wxHORIZONTAL ); // Buttons
+ wxFlexGridSizer *sizerH7 = new wxFlexGridSizer(2 ); // Volumic information
+
+
+ _typeFig = new wxChoice(this,-1);
+ _opacityFig = new wxSlider(this,-1,100,0,100, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+
+ _scaleX = new wxSlider(this,-1,6,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+ _scaleY = new wxSlider(this,-1,20,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+ _scaleZ = new wxSlider(this,-1,7,0,500 , wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+
+ _rotationX = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+ _rotationY = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+ _rotationZ = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+
+ _volIntern = new wxRadioButton(this,-1, _T("Volume intern " ));
+ _volExtern = new wxRadioButton(this,-1, _T("Volume extern " ));
+
+ _histogrammeAccumulated = new wxCheckBox(this,-1,_T("Histogramme accumulated"));
+
+ _isoValue = new wxSlider(this,-1, 200, 0,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+ _valueBeforeIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+ _valueAfterIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxSize(200,45), wxSL_HORIZONTAL | wxSL_LABELS);
+
+ wxButton *btnExtract = new wxButton(this, -1,_T("Extract"));
+
+ _infoToVo = new wxStaticText(this,-1,_T("########################"));
+ _infoSuVoA = new wxStaticText(this,-1,_T("############"));
+ _infoSuVo = new wxStaticText(this,-1,_T("############"));
+ _infoPixLe = new wxStaticText(this,-1,_T("############"));
+ _infoPixHi = new wxStaticText(this,-1,_T("############"));
+
+
+
+
+ _typeFig->Append(_T("Cylindre"));
+ _typeFig->Append(_T("Cube"));
+ _typeFig->Append(_T("Sphere"));
+ _typeFig->SetSelection(0);
+ _volIntern->SetValue(true);
+
+ Connect(_typeFig->GetId() , wxEVT_COMMAND_CHOICE_SELECTED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTypeFig );
+
+ Connect(_opacityFig->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnOpacityFig );
+ Connect(_rotationX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
+ Connect(_rotationY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
+ Connect(_rotationZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
+ Connect(_scaleX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
+ Connect(_scaleY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
+ Connect(_scaleZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
+ Connect(btnExtract->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnExtract );
+
+
+// wxStaticText *text=new wxStaticText(this,-1, " ");
+
+ sizerH0 -> Add( new wxStaticText(this,-1, _T("Fig. Type: "),wxDefaultPosition, wxSize(50,20)) ,1,wxALL ,0);
+ sizerH0 -> Add( _typeFig ,1,wxALL ,0);
+ sizerH0 -> Add( _opacityFig ,1,wxALL|wxEXPAND ,0);
+
+ sizerH2 -> Add( new wxStaticText(this,-1,_T("Scale : ")) ,1,wxALL ,0);
+ sizerH2 -> Add( _scaleX ,1,wxALL | wxEXPAND ,0 );
+ sizerH2 -> Add( _scaleY ,1,wxALL | wxEXPAND ,0 );
+ sizerH2 -> Add( _scaleZ ,1,wxALL | wxEXPAND ,0 );
+
+ sizerH3 -> Add( new wxStaticText(this,-1,_T("Rotation : ")) ,1,wxALL ,0);
+ sizerH3 -> Add( _rotationX ,1,wxALL | wxEXPAND ,0 );
+ sizerH3 -> Add( _rotationY ,1,wxALL | wxEXPAND ,0 );
+ sizerH3 -> Add( _rotationZ ,1,wxALL | wxEXPAND ,0 );
+
+
+ sizerH4 -> Add( new wxStaticText(this,-1,_T("Intern / Extern : ")) ,1,wxALL ,0);
+ sizerH4 -> Add( _volIntern ,1,wxALL ,0);
+ sizerH4 -> Add( new wxStaticText(this,-1, _T(" ")) ,1,wxALL ,0);
+ sizerH4 -> Add( _volExtern ,1,wxALL ,0);
+
+ sizerH5 -> Add( new wxStaticText(this,-1,_T("Isovalue ")) ,1,wxALL ,0);
+ sizerH5 -> Add( _isoValue ,1,wxALL | wxEXPAND ,0 );
+ sizerH5 -> Add( _valueBeforeIsoValue ,1,wxALL | wxEXPAND ,0 );
+ sizerH5 -> Add( _valueAfterIsoValue ,1,wxALL | wxEXPAND ,0 );
+
+ sizerH6 -> Add( new wxStaticText(this,-1, _T(" ")) ,1,wxALL ,0);
+ sizerH6 -> Add( btnExtract ,1,wxALL ,0);
+
+ sizerH7 -> Add( new wxStaticText(this,-1,_T("Total Volume: "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
+ sizerH7 -> Add( _infoToVo , 1 , wxALL ,0);
+ sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume: "), wxDefaultPosition, wxSize(200,12) ) , 1 , wxALL ,0);
+ sizerH7 -> Add( _infoSuVo , 1 , wxALL ,0);
+ sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume (ana.): "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
+ sizerH7 -> Add( _infoSuVoA , 1 , wxALL ,0);
+ sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix < isovalue: ") , wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
+ sizerH7 -> Add( _infoPixLe , 1 , wxALL ,0);
+ sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix > isovalue: "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
+ sizerH7 -> Add( _infoPixHi , 1 , wxALL ,0);
+// sizerH7 -> SetMinSize(300, 120);
+
+ // Figure type
+ topsizer -> Add( sizerH0 ,1,wxALL|wxEXPAND ,0);
+
+ // Scale
+ topsizer -> Add( sizerH2 ,1,wxALL|wxEXPAND ,0);
+
+ // Rotation
+ topsizer -> Add( sizerH3 ,1,wxALL|wxEXPAND ,0);
+
+ // Intern / Extern
+ topsizer -> Add( sizerH4 ,1,wxALL ,0);
+
+
+ // Isovalue limite
+ topsizer -> Add( sizerH5 ,1,wxALL |wxEXPAND ,0);
+
+ // btn Extraction
+ topsizer -> Add( sizerH6 , 1 , wxALL ,0);
+
+ // Histograme
+ topsizer -> Add( _histogrammeAccumulated ,1, wxALL ,0);
+
+ // Volumic information
+ topsizer -> Add( sizerH7 , 1 , wxALL|wxEXPAND ,0);
+
+
+
+// wxBoxSizer *sizerHor = new wxBoxSizer(wxHORIZONTAL);
+ wxBoxSizer *sizerHor = new wxBoxSizer(wxVERTICAL);
+ sizerHor -> Add( topsizer , 1 , wxALL | wxEXPAND ,0);
+
+
+ wxWindow *panelPlotHistogramme = CreatePlotHistogrammeInterface();
+ sizerHor -> Add( panelPlotHistogramme , 1 , wxGROW ,0);
+
+
+ this->SetAutoLayout(true);
+ this->SetSizer( sizerHor );
+ this->Layout();
+//EEDxx2.4
+// this->FitInside();
+}
+
+//-------------------------------------------------------------------
+
+void wxPanelCuttingImageData::OnExtract(wxCommandEvent& event)
+{
+ wxBusyCursor wait;
+
+ bool inside;
+ bool volInt, volExt;
+ int xx,yy,zz;
+ unsigned short *pOrg;
+ unsigned short *p_histogramme;
+ int dim[3];
+ double spc[3];
+ long int contAfter = 0;
+ long int contBefor = 0;
+
+ double min=999999999;
+ double max=-999999999;
+
+ volExt=_volExtern->GetValue();
+ volInt=_volIntern->GetValue();
+ int isoValue = _isoValue->GetValue();
+ int valueBeforeIsoValue = _valueBeforeIsoValue->GetValue();
+ int valueAfterIsoValue = _valueAfterIsoValue ->GetValue();
+
+ InitHistogramme();
+ p_histogramme = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
+
+ _imageData->GetDimensions(dim);
+ _imageData->GetSpacing(spc);
+ _actualCuttingModel->CalculeInversMatrix();
+
+ for (xx=0;xx<dim[0]; xx++)
+ {
+ for (yy=0;yy<dim[1]; yy++)
+ {
+ for (zz=0;zz<dim[2];zz++)
+ {
+ inside=_actualCuttingModel->IfPointInside(xx,yy,zz);
+ if ( ((inside==true)&&(volInt==true)) || ((!inside==true)&&(volExt==true)) )
+ {
+ pOrg=(unsigned short*)_imageData->GetScalarPointer (xx,yy,zz);
+
+ if ((*pOrg)<isoValue)
+ {
+ contBefor++;
+ if (valueBeforeIsoValue!=-1)
+ {
+ *pOrg=valueBeforeIsoValue;
+ }
+ } else {
+ contAfter++;
+ if (valueAfterIsoValue!=-1)
+ {
+ *pOrg=valueAfterIsoValue;
+ } // if
+ } // if isovalue
+
+ p_histogramme[*pOrg]++;
+ if (*pOrg<min) min=*pOrg;
+ if (*pOrg>max) max=*pOrg;
+ } // if inside
+ } // for zz
+ } // for yy
+ } // for xx
+
+
+ // Information
+ wxString infoToVo;
+ wxString infoSuVo;
+ wxString infoSuVoA;
+ wxString infoPixLe;
+ wxString infoPixHi;
+
+ double volumeUnit = spc[0]*spc[1]*spc[2];
+ long int totalSubVolume = contBefor + contAfter;
+ double contBeforPorc = 100*(double)contBefor/(double)totalSubVolume;
+ double contAfterPorc = 100*(double)contAfter/(double)totalSubVolume;
+ infoToVo.Printf(_T("%dx%dx%d = %d"),dim[0],dim[1],dim[2], dim[0]*dim[1]*dim[2] );
+ infoSuVo.Printf(_T("%ld") , totalSubVolume);
+ infoSuVoA.Printf(_T("%.2f"), _actualCuttingModel->GetTheoricVolume() );
+ infoPixLe.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contBefor, contBeforPorc ,_T("%"),contBefor*volumeUnit);
+ infoPixHi.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contAfter, contAfterPorc ,_T("%"),contAfter*volumeUnit);
+
+ _infoToVo->SetLabel(infoToVo);
+ _infoSuVo->SetLabel(infoSuVo);
+ _infoSuVoA->SetLabel(infoSuVoA);
+ _infoPixLe->SetLabel(infoPixLe);
+ _infoPixHi->SetLabel(infoPixHi);
+
+ // Histogram
+ if ( _histogrammeAccumulated->GetValue()==true )
+ {
+ int dimHist[3];
+ _histogrammeVector -> GetDimensions ( dimHist );
+
+ int i,size=dimHist[0];
+ for (i=1; i<=size; i++)
+ {
+ p_histogramme[i] = p_histogramme[i] + p_histogramme[i-1];
+ }
+ }
+ double range[2];
+ _histogrammeVector->Update();
+ _histogrammeVector->GetScalarRange(range);
+ _xyplot->SetYRange( 0 , range[1] );
+ _xyplot->SetXRange( min , max );
+
+ _vtkclipping3Ddataviewer->RefreshSurface();
+ _wxvtkbaseView->Refresh();
+
+// _wxvtkbaseView->RefreshView();
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkbaseView->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+}
+
+
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::OnTypeFig(wxCommandEvent& event)
+{
+ _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
+
+ if (_typeFig->GetSelection()==0){
+ _actualCuttingModel=_modelCylinder;
+ _actualActor=_cylinderActor;
+ }
+ if (_typeFig->GetSelection()==1){
+ _actualCuttingModel=_modelCube;
+ _actualActor=_cubeActor;
+ }
+ if (_typeFig->GetSelection()==2){
+ _actualCuttingModel=_modelSphere;
+ _actualActor=_sphereActor;
+ }
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _actualActor );
+ RefreshOpacity();
+ RefreshView();
+}
+
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::RefreshOpacity()
+{
+ double op= _opacityFig->GetValue()/100.0;
+ _actualActor->GetProperty()->SetOpacity( op );
+}
+
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::OnOpacityFig(wxScrollEvent& event)
+{
+ RefreshOpacity();
+ Refresh();
+}
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::RefreshView()
+{
+ SetParamsOfTransformation( );
+ Refresh();
+}
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::Refresh()
+{
+ _wxvtk3Dbaseview->Refresh();
+}
+
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::SetParamsOfTransformation( )
+{
+ double spc[3];
+ vtkImageData *vtkimagedata = _vtkmprbasedata->GetImageData();
+ vtkimagedata->GetSpacing(spc);
+ int px = (int) (_vtkmprbasedata->GetX() );
+ int py = (int) (_vtkmprbasedata->GetY() );
+ int pz = (int) (_vtkmprbasedata->GetZ() );
+ int sx = (int) (_scaleX->GetValue() * spc[0] );
+ int sy = (int) (_scaleY->GetValue() * spc[1] );
+ int sz = (int) (_scaleZ->GetValue() * spc[2] );
+ _actualCuttingModel -> SetScale ( sx , sy , sz );
+ _actualCuttingModel -> SetPosition ( px , py , pz );
+ _actualCuttingModel -> SetRotation ( _rotationX->GetValue() , _rotationY->GetValue() , _rotationZ->GetValue() );
+ _actualCuttingModel -> SetSpacing ( spc[0] , spc[1] , spc[2] );
+ _actualCuttingModel -> CalculeMatrix();
+}
+
+//-------------------------------------------------------------------
+
+void wxPanelCuttingImageData::OnTransform(wxScrollEvent& event)
+{
+ RefreshView();
+}
+
+//-------------------------------------------------------------------
+void wxPanelCuttingImageData::SetVtkMPRBaseData( vtkMPRBaseData *vtkmprbasedata )
+{
+ _vtkmprbasedata = vtkmprbasedata;
+ _imageData = _vtkmprbasedata->GetImageData();
+}
+
+//-------------------------------------------------------------------
+
+void wxPanelCuttingImageData::Configure()
+{
+ _actualCuttingModel=_modelCylinder;
+ _actualActor=_cylinderActor;
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _actualActor );
+ SetParamsOfTransformation();
+ RefreshView();
+}
+
--- /dev/null
+#ifndef WXPANELCUTTINGIMAGEDATA_H_
+#define WXPANELCUTTINGIMAGEDATA_H_
+
+#include "vtkClipping3DDataViewer.h"
+
+#include "figureCuttingCylinderModel.h"
+#include "figureCuttingCubeModel.h"
+#include "figureCuttingSphereModel.h"
+#include "figureCuttingModel.h"
+
+#include "wxVtk3DBaseView.h"
+
+#include "vtkXYPlotActor.h"
+#include "vtkCubeSource.h"
+#include "vtkCylinderSource.h"
+#include "vtkSphereSource.h"
+
+class wxPanelCuttingImageData : public wxPanel
+{
+public:
+ wxPanelCuttingImageData (wxWindow *parent);
+ ~wxPanelCuttingImageData ();
+ void OnTransform(wxScrollEvent& event);
+ void OnOpacityFig(wxScrollEvent& event);
+ void OnTypeFig(wxCommandEvent& event);
+ void OnExtract(wxCommandEvent& event);
+ void SetVtkMPRBaseData( vtkMPRBaseData *vtkmprbasedata );
+ void SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
+ void SetWxVtk3DBaseView( wxVtk3DBaseView * wxvtk3Dbaseview );
+
+ void SetParamsOfTransformation( );
+ void Configure();
+ void Refresh();
+ void RefreshView();
+ void RemoveActors();
+
+
+private:
+ wxSlider *_opacityFig;
+ wxSlider *_scaleX;
+ wxSlider *_scaleY;
+ wxSlider *_scaleZ;
+ wxSlider *_rotationX;
+ wxSlider *_rotationY;
+ wxSlider *_rotationZ;
+
+ wxRadioButton *_volIntern;
+ wxRadioButton *_volExtern;
+ wxCheckBox *_histogrammeAccumulated;
+ wxSlider *_isoValue;
+ wxSlider *_valueBeforeIsoValue;
+ wxSlider *_valueAfterIsoValue;
+ wxChoice *_typeFig;
+
+ wxStaticText *_infoToVo;
+ wxStaticText *_infoSuVo;
+ wxStaticText *_infoSuVoA;
+ wxStaticText *_infoPixLe;
+ wxStaticText *_infoPixHi;
+
+ // Model
+ figureCuttingCylinderModel *_modelCylinder;
+ figureCuttingCubeModel *_modelCube;
+ figureCuttingSphereModel *_modelSphere;
+ figureCuttingModel *_actualCuttingModel;
+
+ // view
+ vtkCubeSource *_vtkcube;
+ vtkSphereSource *_vtksphere;
+ vtkCylinderSource *_vtkcylinder;
+ vtkPolyDataMapper *_cubeMapper;
+ vtkPolyDataMapper *_sphereMapper;
+ vtkPolyDataMapper *_cylinderMapper;
+ vtkActor *_cubeActor;
+ vtkActor *_sphereActor;
+ vtkActor *_cylinderActor;
+ vtkActor *_actualActor;
+
+
+ vtkMPRBaseData *_vtkmprbasedata;
+ wxVtk3DBaseView *_wxvtk3Dbaseview;
+ vtkImageData *_imageData;
+ vtkClipping3DDataViewer *_vtkclipping3Ddataviewer;
+
+ vtkImageData *_histogrammeVector;
+ vtkXYPlotActor *_xyplot;
+ wxVtkBaseView *_wxvtkbaseView;
+ vtkRenderer *_renplotter;
+
+ void CreateModel();
+ void CreateInterface();
+ void Create3DViewObjects();
+ void RefreshOpacity();
+ wxWindow *CreatePlotHistogrammeInterface();
+ void InitHistogramme();
+
+
+protected:
+};
+
+#endif /*WXPANELCUTTINGIMAGEDATA_H_*/
#include "pPlotter/mBarRange.h"//SIL//
//#include <marInterface.h>
-#include <axisExtractor02.h>
+//#include <include/axisExtractor02.h>
#include "vtkSTLExtractor.h"
-#include "vtkJoiner.h"
+#include "include/vtkJoiner.h"
#include "marTypes.h"
--- /dev/null
+#include "wxSphereView.h"
+
+
+wxSphereView::wxSphereView( wxWindow *parent, vtkMPRBaseData *vtkmprbasedata, vtkImageData *imageData )
+: wxVtk2DBaseView(parent)
+{
+ _delta = 1;
+ _vtkmprbasedata = vtkmprbasedata;
+ _imageDataOriginal = imageData;
+
+ _imageSphere = vtkImageData::New();
+ _imageSphere->SetDimensions (150,150,500);
+ _imageSphere->SetScalarTypeToUnsignedShort();
+ _imageSphere->AllocateScalars();
+ _imageSphere->Update();
+
+
+ vtkBaseData *vtkbasedata = new vtkBaseData();
+ vtkbasedata->SetMarImageData( new marImageData(_imageSphere) );
+ this->SetVtkBaseData(vtkbasedata);
+
+ _transform = vtkTransform::New();
+ _transform1 = vtkTransform::New();
+ _transform2 = vtkTransform::New();
+ _transform ->Identity();
+ _transform1->Identity();
+ _transform2->Identity();
+
+ _radio=25;
+}
+
+//-------------------------------------------------------------------
+
+wxSphereView::~wxSphereView()
+{
+ _transform -> Delete();
+ _transform1 -> Delete();
+ _transform2 -> Delete();
+ ResetlstId();
+}
+
+//----------------------------------------------------------------------------
+
+double wxSphereView::GetRadio()
+{
+ return _radio;
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::SetRadio(double radio)
+{
+ if (radio<0)
+ {
+ radio=0;
+ }
+ _radio=radio;
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::Configure()
+{
+ wxVtk2DBaseView::Configure();
+
+ _vtkinteractorstylesphere = new vtkInteractorStyleSphere();
+ ((vtkInteractorStyleBaseView*)GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _vtkinteractorstylesphere );
+ double points[4][3];
+
+// EED purify 12/sep/2006
+ int i,j;
+ for (i=0;i<4;i++)
+ {
+ for (j=0;j<3;j++)
+ {
+ points[i][j]=0;
+ }
+ }
+
+ InitSphere(points);
+ DefineImageSphere();
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::RefreshPoint()
+{
+ double x = _vtkmprbasedata->GetX() - _centerX;
+ double y = _vtkmprbasedata->GetY() - _centerY;
+ double z = _vtkmprbasedata->GetZ() - _centerZ;
+ double alpha= atan2(x,z);
+ double beta = atan2( y , sqrt(z*z+x*x) );
+
+ alpha = alpha*180/3.1416;
+ beta = beta*180/3.1416;
+
+ _transform1->Identity();
+ _transform1->RotateY(alpha);
+ _transform1->RotateX(-beta);
+
+ _radio= sqrt(x*x + y*y +z*z);
+
+ RefreshView();
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::RefreshView()
+{
+ DefineImageSphere();
+ wxVtk2DBaseView::Refresh();
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::RotationEnd()
+{
+ _transform1->RotateWXYZ(_ang,_vxb,_vyb,0);
+ _transform2->Identity();
+ SetDeltaVoxel(1);
+ ResetlstId();
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::RotationStart(double vx, double vy, bool ok_v, bool ok_ang)
+{
+ if (ok_ang==false)
+ {
+ _ang = -sqrt( vx*vx + vy*vy ) / 1.0;
+ }
+
+ if (ok_v==false){
+ _vxb=-vy;
+ _vyb=vx;
+ }
+
+ _transform2->Identity();
+ _transform2->RotateWXYZ(_ang,_vxb,_vyb,0);
+ SetDeltaVoxel(3);
+ ResetlstId();
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::GetPointSphere(double p[3],double r1,double angA,double angB)
+{
+ double in[3],out[3];
+ in[0]=0;
+ in[1]=r1;
+ in[2]=0;
+ vtkTransform *transform = vtkTransform::New();
+ transform->Identity();
+ transform->RotateX(angB);
+ transform->RotateZ(angA);
+ transform->TransformPoint(in,out);
+ p[0]=out[0];
+ p[1]=out[1];
+ p[2]=out[2];
+ transform->Delete();
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::RotatePointOverTheSphere( double pp[3], double p[3],double cc[3])
+{
+
+ double out[3];
+ _transform->TransformPoint(p,out);
+ pp[0] = out[0] + cc[0];
+ pp[1] = out[1] + cc[1];
+ pp[2] = out[2] + cc[2];
+
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::TransferePoints(double pp1[3],double pp2[3],double AngX,double AngY,vtkImageData *image)
+{
+ double t;
+ double difX = pp2[0]-pp1[0];
+ double difY = pp2[1]-pp1[1];
+ double difZ = pp2[2]-pp1[2];
+
+ double max = 200;
+
+ int dimOrg[3];
+ int dimRes[3];
+ int z;
+ _imageDataOriginal->GetDimensions(dimOrg);
+ image->GetDimensions(dimRes);
+
+ int i;
+ double x1=pp1[0];
+ double y1=pp1[1];
+ double z1=pp1[2];
+ int xx=-1,yy=-1,zz=-1;
+
+ for (i=0;i<max;i++)
+ {
+ t = i/max;
+ xx = (int) (x1+t*difX);
+ yy = (int) (y1+t*difY);
+ zz = (int) (z1+t*difZ);
+
+ z=i;
+ if ((xx>=0) && (xx<dimOrg[0]) && (yy>=0) && (yy<dimOrg[1]) && (zz>=0) && (zz<dimOrg[2]) &&
+ (AngX>=0) && (AngX<dimRes[0]) && (AngY>=0) && (AngY<dimRes[1]) && (z>=0) && (z<dimRes[2]) )
+ {
+ unsigned short *pOrg=(unsigned short*)_imageDataOriginal->GetScalarPointer (xx,yy,zz);
+ unsigned short *pRes=(unsigned short*)image->GetScalarPointer( (int)AngX , (int)AngY , z );
+ *pRes=*pOrg;
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::ResetlstId()
+{
+ int i,size=_lstId.size();
+ for (i=size-1;i>=0;i--)
+ {
+ delete _lstId[i];
+ }
+ _lstId.clear();
+}
+
+//----------------------------------------------------------------------------
+
+int wxSphereView::GetIdOfImage(double radio)
+{
+ int id=0;
+ int dim[3];
+ _imageSphere->GetDimensions(dim);
+ int sizeMaxList = dim[2];
+ // Search in list >> alpha beta radio
+ int i,size=_lstId.size();
+ for (i=0; i<size;i++)
+ {
+ //idAlBeRa *tmp=_lstId[i]; // JPRx
+ if ((_lstId[i]->_radio==radio) && (_lstId[i]->_deltavoxel==_delta))
+ {
+ return _lstId[i]->_id;
+ }
+ }
+ if (size>sizeMaxList)
+ {
+ delete _lstId[size-1];
+ _lstId.pop_back();
+ }
+ if (size!=0){
+ id=_lstId[0]->_id+1;
+ id = id % sizeMaxList;
+ } else {
+ id = 0;
+ }
+
+ FiltreImage(id,radio);
+ _lstId.insert(_lstId.begin(),1,new idAlBeRa(id,radio,_delta) );
+
+ return id;
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::DefineImageSphere()
+{
+ int id;
+ id=GetIdOfImage( _radio );
+ GetVtkBaseData()->SetZ( id );
+}
+
+
+//----------------------------------------------------------------------------
+void wxSphereView::SetDeltaVoxel(int delta)
+{
+ _delta=delta;
+}
+
+//----------------------------------------------------------------------------
+void wxSphereView::SetVoxel(double i, double j, int delta,double id, unsigned short gris)
+{
+ int ii,jj,delta2;
+ unsigned short *pRes;
+ int dimRes[3];
+ _imageSphere->GetDimensions(dimRes);
+
+ delta2=delta-1;
+ for ( ii=(int)(i-delta2) ; ii<=(int)(i+delta2) ; ii++ )
+ {
+ for ( jj=(int)(j-delta2) ; jj<=(int)(j+delta2) ; jj++ )
+ {
+ if ( (ii>=0)&&(ii<dimRes[0]) &&
+ (jj>=0)&&(jj<dimRes[1]) )
+ {
+ pRes = (unsigned short*)_imageSphere->GetScalarPointer( ii , jj , (int)id );
+ *pRes=gris;
+ }
+ }
+ }
+
+}
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::SetXYZtoParent(double i, double j)
+{
+
+ double factor = 0.75;
+ double radio2 = _radio*_radio;
+ double pxx,pyy,d2x,d2y;
+ double cc[3],p[3],pp[3];
+ cc[0]=_centerX;
+ cc[1]=_centerY;
+ cc[2]=_centerZ;
+ double aa;
+ int dimRes[3],dimOrig[3];
+ _imageSphere->GetDimensions(dimRes);
+ d2x=dimRes[0]/2;
+ d2y=dimRes[1]/2;
+ _imageDataOriginal->GetDimensions(dimOrig);
+
+ p[0] = (i - d2x)*factor;
+ pxx=p[0]*p[0];
+ p[1] = (j - d2y)*factor;
+ pyy=p[1]*p[1];
+ aa = pxx + pyy;
+ if (radio2>aa){
+ aa=radio2-aa;
+ p[2] = sqrt(aa);
+ RotatePointOverTheSphere( pp, p,cc);
+ if ( (pp[0]>=0) && (pp[0]<dimOrig[0]) &&
+ (pp[1]>=0) && (pp[1]<dimOrig[1]) &&
+ (pp[2]>=0) && (pp[2]<dimOrig[2]) )
+ {
+ if (_vtkmprbasedata){
+ _vtkmprbasedata->SetX(pp[0]);
+ _vtkmprbasedata->SetY(pp[1]);
+ _vtkmprbasedata->SetZ(pp[2]);
+ }
+ }
+ }
+}
+
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::FiltreImageB(int id, double radio, bool ok,int deltaTMP)
+{
+ double factor = 0.75;
+ double radioB = radio/3;
+ double radio2 = radio*radio;
+ double pxx,pyy,d2x,d2y;
+ double cc[3],p[3],pp[3];
+ cc[0]=_centerX;
+ cc[1]=_centerY;
+ cc[2]=_centerZ;
+ double aa;
+ unsigned short *pOrig;
+ int dimRes[3],dimOrig[3];
+ double i,j;
+ int ext[6];
+ _imageSphere->GetExtent(ext);
+ _imageSphere->GetDimensions(dimRes);
+ //JCP 24 - 04 -09
+ //_imageSphere->SetExtent(0,dimRes[0]-1,0,dimRes[1]-1,0,dimRes[2]-1);
+ _imageSphere->SetExtent(ext);
+ //JCP 24 - 04 -09
+ d2x=dimRes[0]/2;
+ d2y=dimRes[1]/2;
+// double deltaTMP=_delta;
+ _imageDataOriginal->GetDimensions(dimOrig);
+
+ int start,end;
+ int limitA,limitB;
+ limitA = (int) ( (-radioB/factor)+d2x );
+ limitB = (int) ( (radioB/factor)+d2x );
+ if (ok==true){
+ start = limitA;
+ end = limitB;
+ } else {
+ start=0;
+ end=dimRes[0];
+ }
+
+ for ( i=start ; i<end ; i=i+deltaTMP )
+ {
+ p[0] = (i - d2x)*factor;
+ pxx=p[0]*p[0];
+ for (j=start;j<end;j=j+deltaTMP)
+ {
+ p[1] = (j - d2y)*factor;
+ pyy=p[1]*p[1];
+ aa = pxx + pyy;
+
+ if (( ((ok==false) && (!((i>limitA) && (i<limitB) && (j>limitA) && (j<limitB)))) )
+ ||
+ (ok==true))
+ {
+ if (radio2>aa){
+ aa=radio2-aa;
+ p[2] = sqrt(aa);
+ RotatePointOverTheSphere( pp, p,cc);
+ if ( (pp[0]>=0) && (pp[0]<dimOrig[0]) &&
+ (pp[1]>=0) && (pp[1]<dimOrig[1]) &&
+ (pp[2]>=0) && (pp[2]<dimOrig[2]) )
+ {
+ pOrig=(unsigned short*)_imageDataOriginal->GetScalarPointer( (int)(pp[0]) , (int)(pp[1]) , (int)(pp[2]) );
+ SetVoxel(i,j,deltaTMP,id,*pOrig);
+ } else {
+ SetVoxel(i,j,deltaTMP,id,2000);
+ }
+ } else {
+ SetVoxel(i,j,deltaTMP,id,0);
+ }
+ }
+ }
+ }
+
+ _imageSphere->Modified();
+ _imageSphere->Update();
+}
+
+
+
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::FiltreImage(int id, double radio)
+{
+
+ _transform -> Identity();
+ _transform -> Concatenate(_transform1);
+ _transform -> Concatenate(_transform2);
+
+ FiltreImageB(id,radio,false, _delta);
+ FiltreImageB(id,radio,true, 1);
+}
+
+
+//----------------------------------------------------------------------------
+
+/*
+void wxSphereView::FiltreImage(int id, double radio)
+{
+ double radio2 = radio*radio;
+ double radio2TMP= (radio/2)*(radio/2);
+ double pxx,pyy,d2x,d2y;
+ double cc[3],p[3],pp[3];
+ cc[0]=_centerX;
+ cc[1]=_centerY;
+ cc[2]=_centerZ;
+ double aa;
+ unsigned short *pOrig;
+ int dimRes[3],dimOrig[3];
+ double i,j;
+ _imageSphere->GetDimensions(dimRes);
+ _imageSphere->SetExtent(0,dimRes[0]-1,0,dimRes[1]-1,0,dimRes[2]-1);
+ d2x=dimRes[0]/2;
+ d2y=dimRes[1]/2;
+ double deltaTMP=_delta;
+ _imageDataOriginal->GetDimensions(dimOrig);
+
+ for ( i=0 ; i<dimRes[0] ; i=i+deltaTMP )
+ {
+ p[0] = (i - d2x)*0.75;
+ pxx=p[0]*p[0];
+ for (j=0;j<dimRes[1];j=j+deltaTMP)
+ {
+ p[1] = (j - d2y)*0.75;
+ pyy=p[1]*p[1];
+ aa = pxx + pyy;
+
+ if (aa>radio2TMP)
+ {
+ if (radio2>aa){
+ aa=radio2-aa;
+ p[2] = sqrt(aa);
+ RotatePointOverTheSphere( pp, p,cc);
+ if ( (pp[0]>=0) && (pp[0]<dimOrig[0]) &&
+ (pp[1]>=0) && (pp[1]<dimOrig[1]) &&
+ (pp[2]>=0) && (pp[2]<dimOrig[2]) )
+ {
+ pOrig=(unsigned short*)_imageDataOriginal->GetScalarPointer( pp[0] , pp[1] , pp[2] );
+ SetVoxel(i,j,deltaTMP,id,*pOrig);
+ } else {
+ SetVoxel(i,j,deltaTMP,id,2000);
+ }
+ } else {
+ SetVoxel(i,j,deltaTMP,id,0);
+ }
+ }
+ }
+ }
+
+
+ deltaTMP=1;
+ for ( i=0 ; i<dimRes[0] ; i=i+deltaTMP )
+ {
+ p[0] = (i - d2x)*0.75;
+ pxx=p[0]*p[0];
+ for (j=0;j<dimRes[1];j=j+deltaTMP)
+ {
+ p[1] = (j - d2y)*0.75;
+ pyy=p[1]*p[1];
+ aa = pxx + pyy;
+ if (aa<=radio2TMP)
+ {
+ if (radio2>aa){
+ aa=radio2-aa;
+ p[2] = sqrt(aa);
+ RotatePointOverTheSphere( pp, p,cc);
+ if ( (pp[0]>=0) && (pp[0]<dimOrig[0]) &&
+ (pp[1]>=0) && (pp[1]<dimOrig[1]) &&
+ (pp[2]>=0) && (pp[2]<dimOrig[2]) )
+ {
+ pOrig=(unsigned short*)_imageDataOriginal->GetScalarPointer( pp[0] , pp[1] , pp[2] );
+ SetVoxel(i,j,deltaTMP,id,*pOrig);
+ } else {
+ SetVoxel(i,j,deltaTMP,id,2000);
+ }
+ } else {
+ SetVoxel(i,j,deltaTMP,id,0);
+ }
+ }
+ }
+ }
+
+ _imageSphere->Modified();
+ _imageSphere->Update();
+}
+*/
+/*
+void wxSphereView::FiltreImage(vtkImageData *imageSphere)
+{
+ int dim[3],i,j,k;
+ imageSphere->GetDimensions(dim);
+ for (i=0;i<dim[0];i++)
+ {
+ for (j=0;j<dim[1];j++)
+ {
+ for (k=0;k<dim[2];k++)
+ {
+ unsigned short *pRes=(unsigned short*)imageSphere->GetScalarPointer (i,j,k);
+ *pRes=0;
+ }
+ }
+ }
+
+ double deltaA=90;
+ double cc[3],p1[3],p2[3],pp1[3],pp2[3];
+ cc[0]=_centerX;
+ cc[1]=_centerY;
+ cc[2]=_centerZ;
+ double r1 = _sl_radio->GetValue() - _sl_thickness->GetValue()/2;
+ double r2 = _sl_radio->GetValue() + _sl_thickness->GetValue()/2;
+ if (r1<10)
+ {
+ r1=10;
+ }
+ double alpha= _sl_alpha->GetValue();
+ double beta = _sl_beta->GetValue();
+
+ double angA,angB;
+ for (angA=-deltaA;angA<deltaA;angA++)
+ {
+ for (angB=-deltaA;angB<deltaA;angB++)
+ {
+ GetPointSphere(p1,r1,angA,angB);
+ GetPointSphere(p2,r2,angA,angB);
+ RotatePointOverTheSphere( pp1, alpha, beta, p1 ,cc );
+ RotatePointOverTheSphere( pp2, alpha, beta, p2 ,cc );
+ TransferePoints(pp1,pp2,angA+alpha+180,angB+beta+90,imageSphere);
+ }
+ }
+}
+*/
+
+
+//----------------------------------------------------------------------------
+
+void wxSphereView::InitSphere(double points[4][3])
+{
+ double cc[3];
+ double r = SphereFindCenter(points,cc); // 4-points , center
+ if (r > 0)
+ {
+ _centerX = (int)(cc[0]);
+ _centerY = (int)(cc[1]);
+ _centerZ = (int)(cc[2]);
+ } else {
+ int dim[3];
+ _imageDataOriginal->GetDimensions(dim);
+ _centerX = (int)(dim[0]/2);
+ _centerY = (int)(dim[1]/2);
+ _centerZ = (int)(dim[2]/2);
+ }
+}
+
+//----------------------------------------------------------------------------
+
+// Calculate center and radius of sphere given four points
+// http://home.att.net/~srschmitt/script_sphere_solver.html
+// source code HTML <script language=JavaScript>
+double wxSphereView::SphereFindCenter(double P[4][3], double cc[3])
+{
+ int i;
+ double r, m11, m12, m13, m14, m15;
+ double a[4][4];
+
+ for (i = 0; i < 4; i++) // find minor 11
+ {
+ a[i][0] = P[i][0];
+ a[i][1] = P[i][1];
+ a[i][2] = P[i][2];
+ a[i][3] = 1;
+ }
+ m11 = determinant( a, 4 );
+
+ for (i = 0; i < 4; i++) // find minor 12
+ {
+ a[i][0] = P[i][0]*P[i][0] + P[i][1]*P[i][1] + P[i][2]*P[i][2];
+ a[i][1] = P[i][1];
+ a[i][2] = P[i][2];
+ a[i][3] = 1;
+ }
+ m12 = determinant( a, 4 );
+
+ for (i = 0; i < 4; i++) // find minor 13
+ {
+ a[i][0] = P[i][0]*P[i][0] + P[i][1]*P[i][1] + P[i][2]*P[i][2];
+ a[i][1] = P[i][0];
+ a[i][2] = P[i][2];
+ a[i][3] = 1;
+ }
+ m13 = determinant( a, 4 );
+
+ for (i = 0; i < 4; i++) // find minor 14
+ {
+ a[i][0] = P[i][0]*P[i][0] + P[i][1]*P[i][1] + P[i][2]*P[i][2];
+ a[i][1] = P[i][0];
+ a[i][2] = P[i][1];
+ a[i][3] = 1;
+ }
+ m14 = determinant( a, 4 );
+
+
+ for (i = 0; i < 4; i++) // find minor 15
+ {
+ a[i][0] = P[i][0]*P[i][0] + P[i][1]*P[i][1] + P[i][2]*P[i][2];
+ a[i][1] = P[i][0];
+ a[i][2] = P[i][1];
+ a[i][3] = P[i][2];
+ }
+ m15 = determinant( a, 4 );
+
+ if (m11 == 0)
+ {
+ r = 0;
+ }
+ else
+ {
+ // center of sphere
+ cc[0] = 0.5*m12/m11; //cx
+ cc[1] = -0.5*m13/m11; //cy
+ cc[2] = 0.5*m14/m11; //cz
+ // Sphere radio
+ r = sqrt( cc[0]*cc[0] + cc[1]*cc[1] + cc[2]*cc[2] - m15/m11 );
+ }
+
+ return r; // the radius
+}
+//----------------------------------------------------------------------------
+
+// Recursive definition of determinate using expansion by minors.
+double wxSphereView::determinant(double a[4][4], int n)
+{
+ int i, j, j1, j2;
+ double d;
+ double m[4][4];
+
+ for (i=0;i<4;i++)
+ {
+ for (j=0;j<4;j++)
+ {
+ m[i][j]=0;
+ }
+ }
+
+ if (n == 2) // terminate recursion
+ {
+ d = a[0][0]*a[1][1] - a[1][0]*a[0][1];
+ }
+ else
+ {
+ d = 0;
+ for (j1 = 0; j1 < n; j1++ ) // do each column
+ {
+ for (i = 1; i < n; i++) // create minor
+ {
+ j2 = 0;
+ for (j = 0; j < n; j++)
+ {
+ if (j == j1) continue;
+ m[i-1][j2] = a[i][j];
+ j2++;
+ }
+ }
+
+ // sum (+/-)cofactor * minor
+ d = d + pow(-1.0, j1)*a[0][j1]*determinant( m, n-1 );
+ }
+ }
+
+ return d;
+}
+
--- /dev/null
+#ifndef WXSPHEREVIEW_H_
+#define WXSPHEREVIEW_H_
+
+#include "wxVtk2DBaseView.h"
+#include "idAlBeRa.h"
+#include "vtkInteractorStyleSphere.h"
+#include "vtkTransform.h"
+
+class wxMPRBaseData;
+
+class wxSphereView : public wxVtk2DBaseView
+{
+public:
+ wxSphereView( wxWindow *parent, vtkMPRBaseData *vtkmprbasedata, vtkImageData *imageData);
+ ~wxSphereView();
+ virtual void Configure();
+ void RotationEnd();
+ void RotationStart(double vx, double vy, bool ok_v, bool ok_ang);
+ virtual void RefreshView();
+ virtual void SetVoxel(double i, double j, int delta, double id, unsigned short gris);
+ void SetDeltaVoxel(int delta);
+ double GetRadio();
+ void SetRadio(double radio);
+ int GetIdOfImage(double radio);
+ void SetXYZtoParent(double i, double j);
+ void RefreshPoint();
+
+private:
+ std::vector<idAlBeRa*> _lstId;
+
+ int _centerX;
+ int _centerY;
+ int _centerZ;
+ double _radio;
+
+ double _ang;
+ double _vxb;
+ double _vyb;
+
+ int _delta;
+
+ vtkImageData *_imageDataOriginal;
+ vtkImageData *_imageSphere;
+
+ vtkMPRBaseData *_vtkmprbasedata;
+ vtkInteractorStyleSphere *_vtkinteractorstylesphere;
+
+ vtkTransform *_transform;
+ vtkTransform *_transform1;
+ vtkTransform *_transform2;
+
+ void FiltreImage(int id, double radio);
+ void FiltreImageB(int id, double radio, bool ok,int deltaTMP);
+ void DefineImageSphere();
+ void ResetlstId();
+
+ void InitSphere(double points[4][3]);
+ double SphereFindCenter(double P[4][3], double cc[3]);
+ double determinant(double a[4][4], int n);
+
+ void GetPointSphere(double p[3],double r1,double angA,double angB);
+ void RotatePointOverTheSphere( double pp[3], double p[3],double cc[3]);
+ void TransferePoints(double pp1[3],double pp2[3],double AngX,double AngY,vtkImageData *image);
+};
+
+#endif /*WXSPHEREVIEW_H_*/
Program: Visualization Toolkit
Module: $RCSfile: wxVTKRenderWindowInteractor.cxx,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:43 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.3 $
Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
Program: Visualization Toolkit
Module: $RCSfile: wxVTKRenderWindowInteractor.h,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:43 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/05/14 13:54:35 $
+ Version: $Revision: 1.3 $
Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
--- /dev/null
+
+#include "wxVTKRenderWindowInteractorPlus.h"
+#include "vtkInteractorStyleBaseView.h"
+
+BEGIN_EVENT_TABLE( wxVTKRenderWindowInteractorPlus, wxVTKRenderWindowInteractor )
+ EVT_LEFT_DCLICK( wxVTKRenderWindowInteractorPlus::OnLeftDClick )
+ EVT_RIGHT_DCLICK( wxVTKRenderWindowInteractorPlus::OnRightDClick )
+ EVT_MIDDLE_DCLICK( wxVTKRenderWindowInteractorPlus::OnMiddleDClick )
+ EVT_MOUSEWHEEL( wxVTKRenderWindowInteractorPlus::OnMouseWheel )
+END_EVENT_TABLE( );
+
+//-------------------------------------------------------------------
+wxVTKRenderWindowInteractorPlus::wxVTKRenderWindowInteractorPlus()
+: wxVTKRenderWindowInteractor()
+{
+}
+
+
+//-------------------------------------------------------------------
+wxVTKRenderWindowInteractorPlus::wxVTKRenderWindowInteractorPlus(wxWindow *parent, wxVtkBaseView *wxvtkbaseview)
+: wxVTKRenderWindowInteractor(parent, -1)
+{
+ _wxvtkbaseview = wxvtkbaseview;
+}
+
+//-------------------------------------------------------------------
+wxVTKRenderWindowInteractorPlus::~wxVTKRenderWindowInteractorPlus()
+{
+}
+
+//---------------------------------------------------------------------------
+wxVTKRenderWindowInteractorPlus * wxVTKRenderWindowInteractorPlus::New()
+{
+ // we don't make use of the objectfactory, because we're not registered
+ return new wxVTKRenderWindowInteractorPlus;
+}
+
+//-------------------------------------------------------------------
+void wxVTKRenderWindowInteractorPlus::OnLeftDClick( wxMouseEvent& event )
+{
+ /**
+ * JCP 14/05/09
+ wxvtkbaseview->GetInteractorStyleBaseView()->OnLeftDClick();
+ */
+ ((vtkInteractorStyleBaseView*)_wxvtkbaseview->GetInteractorStyleBaseView())->OnLeftDClick();
+}
+//-------------------------------------------------------------------
+void wxVTKRenderWindowInteractorPlus::OnRightDClick( wxMouseEvent& event )
+{
+ /**
+ * JCP 14/05/09
+ _wxvtkbaseview->GetInteractorStyleBaseView()->OnRightDClick();
+ */
+ ((vtkInteractorStyleBaseView*)_wxvtkbaseview->GetInteractorStyleBaseView())->OnRightDClick();
+}
+//-------------------------------------------------------------------
+void wxVTKRenderWindowInteractorPlus::OnMiddleDClick( wxMouseEvent& event )
+{
+ /**
+ * JCP 14/05/09
+
+ _wxvtkbaseview->GetInteractorStyleBaseView()->OnMiddleDClick();
+ */
+ ((vtkInteractorStyleBaseView*)_wxvtkbaseview->GetInteractorStyleBaseView())->OnMiddleDClick();
+}
+//-------------------------------------------------------------------
+void wxVTKRenderWindowInteractorPlus::OnMouseWheel( wxMouseEvent& event )
+{
+ /**
+ * JCP 14/05/09
+
+ _wxvtkbaseview->GetInteractorStyleBaseView()->OnMouseWheel();
+ */
+ ((vtkInteractorStyleBaseView*)_wxvtkbaseview->GetInteractorStyleBaseView())->OnMouseWheel();
+}
+
+
--- /dev/null
+#ifndef WXVTKRENDERWINDOWINTERACTORPLUS_H_
+#define WXVTKRENDERWINDOWINTERACTORPLUS_H_
+
+
+//class wxVtkBaseView;
+#include "wxVtkBaseView.h"
+#include "wxVTKRenderWindowInteractor.h"
+
+
+class creaMaracasVisu_EXPORT wxVTKRenderWindowInteractorPlus : public wxVTKRenderWindowInteractor
+{
+public:
+ wxVTKRenderWindowInteractorPlus(wxWindow *parent ,wxVtkBaseView *_wxvtkbaseview);
+ virtual ~wxVTKRenderWindowInteractorPlus();
+
+ wxVTKRenderWindowInteractorPlus();
+ void OnLeftDClick( wxMouseEvent& event );
+ void OnRightDClick( wxMouseEvent& event );
+ void OnMiddleDClick( wxMouseEvent& event );
+ void OnMouseWheel( wxMouseEvent& event );
+
+
+ // VTK
+ static wxVTKRenderWindowInteractorPlus * New();
+
+protected:
+private:
+ wxVtkBaseView *_wxvtkbaseview;
+ DECLARE_EVENT_TABLE( );
+
+
+};
+
+#endif /*WXVTKRENDERWINDOWINTERACTORPLUS_H_*/
--- /dev/null
+#include "wxVtk2DBaseView.h"
+
+#include "vtkInfoTextImage.h"
+#include "vtkInteractorStyleBaseView2D.h"
+#include "vtkInfoTextImageInteractor.h"
+
+
+wxVtk2DBaseView::wxVtk2DBaseView(wxWindow *parent)
+:wxVtkBaseView(parent)
+{
+ _imageViewer2XYZ = NULL;
+ _vtkIinfoTextImage = NULL;
+}
+
+//EED 5mai2009
+//-------------------------------------------------------------------
+wxVtk2DBaseView::~wxVtk2DBaseView()
+{
+ if (_vtkIinfoTextImage!=NULL)
+ {
+ delete _vtkIinfoTextImage;
+ }
+
+ if (_imageViewer2XYZ!=NULL)
+ {
+ delete _imageViewer2XYZ;
+ }
+}
+
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::TransformCoordinate_spacing_ViewToModel(double &X,double &Y, double &Z) // virtual
+{
+//EEDx5
+ double spc[3];
+// GetVtkBaseData()->GetImageData()->GetSpacing(spc);
+ this->_imageViewer2XYZ->GetVtkImageViewer2()->GetInput()->GetSpacing(spc);
+
+ X = X / spc[0];
+ Y = Y / spc[1];
+ Z = Z / spc[2];
+
+}
+
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::TransformCoordinate_spacing_ModelToView(double &X,double &Y, double &Z) // virtual
+{
+//EEDx5
+ double spc[3];
+// GetVtkBaseData()->GetImageData()->GetSpacing(spc);
+ this->_imageViewer2XYZ->GetVtkImageViewer2()->GetInput()->GetSpacing(spc);
+
+ X=X*spc[0];
+ Y=Y*spc[1];
+ Z=Z*spc[2];
+
+}
+
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::ResetView()
+{
+ double spx,spy,spz;
+ int x1,x2,y1,y2,z1,z2;
+ wxVtkBaseView::Configure();
+
+ wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
+ vtkImageData *imageData = GetVtkBaseData()->GetImageData();
+ imageData->UpdateInformation();
+ imageData->SetUpdateExtent( imageData->GetWholeExtent());
+ imageData->Update();
+
+ _imageViewer2XYZ->GetVtkImageViewer2()->SetInput(imageData );
+ imageData->GetSpacing (spx,spy,spz);
+ imageData->GetExtent (x1,x2,y1,y2,z1,z2);
+ _imageViewer2XYZ -> SetExtentDimension(x1,x2,y1,y2,z1,z2);
+ _imageViewer2XYZ -> GetVtkImageViewer2()->SetupInteractor ( iren );
+
+ _imageViewer2XYZ->GetVtkImageViewer2()->Render();
+ SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
+
+}
+
+
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::Configure(bool okimage)
+{
+ double spx,spy,spz;
+ int x1,x2,y1,y2,z1,z2;
+ wxVtkBaseView::Configure();
+
+// EED 17 Oct 2007
+ if (_imageViewer2XYZ==NULL)
+ {
+ _imageViewer2XYZ = new vtkImageViewer2_XYZ();
+ wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
+ _imageViewer2XYZ -> GetVtkImageViewer2()->SetupInteractor ( iren );
+ SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
+ }
+
+
+ vtkImageData *imageData = GetVtkBaseData()->GetMarImageData()->GetImageData();
+ if (imageData!=NULL){
+ imageData->UpdateInformation();
+ imageData->SetUpdateExtent( imageData->GetWholeExtent());
+ imageData->Update();
+ if (okimage==true){
+ imageData->GetSpacing (spx,spy,spz);
+ imageData->GetExtent (x1,x2,y1,y2,z1,z2);
+
+
+ _imageViewer2XYZ->GetVtkImageViewer2()->SetInput(imageData );
+ _imageViewer2XYZ->SetExtentDimension(x1,x2,y1,y2,z1,z2);
+ double range[2];
+ imageData->GetScalarRange(range);
+ if (range[1]<20000){
+ _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( (range[1]-range[0])/2 );
+ _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( (range[1]+range[0])/4 );
+ } else {
+ _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( 1000 );
+ _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( 500 );
+ }
+// EED 31 Janvier 2007
+//vtkImageActor *vtkimageactor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor ();
+//vtkimageactor->InterpolateOff ();
+//vtkLookupTable * _collookup = vtkLookupTable::New( );
+//_collookup->SetNumberOfColors( 256 );
+//_collookup->SetTableRange( 0 , 255 );
+//_collookup->Build( );
+//_collookup->SetTableValue( 0 , 1 , 0 , 0 , 1 );
+//_collookup->SetTableValue(128 , 0 , 0 , 1 , 1 );
+//_collookup->SetTableValue(255 , 0 , 1 , 0 , 1 );
+//_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel ()->SetLookupTable(_collookup );
+
+
+// EED 17 Oct 2007
+// SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
+
+
+ vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2();
+ vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera();
+
+//EED 17Avril2009
+/*
+ camera->SetViewUp ( spx*0 , -spy*1 , spz*0 );
+ camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , -spz*10000 );
+ camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
+*/
+ camera->SetViewUp ( spx*0 , spy*1 , spz*0 );
+ camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*10000 );
+ camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
+
+
+ camera->SetClippingRange( 0.01 , 1000000 );
+ camera->ComputeViewPlaneNormal();
+ camera->SetParallelScale( spx*(x2-x1)/3.0 );
+
+ // text information over the graphic window
+ _vtkIinfoTextImage = new vtkInfoTextImage();
+ _vtkIinfoTextImageInteractor = new vtkInfoTextImageInteractor();
+ _vtkIinfoTextImage->SetWxVtk2DBaseView(this);
+ _vtkIinfoTextImage->SetMarImageData( GetVtkBaseData()->GetMarImageData() );
+ _vtkIinfoTextImageInteractor->SetModelVtkInfoTextImage(_vtkIinfoTextImage);
+ _vtkIinfoTextImage->Configure();
+ ((vtkInteractorStyleBaseView*)this->GetInteractorStyleBaseView())->AddInteractorStyleMaracas(_vtkIinfoTextImageInteractor);
+ } // okimage
+ } // imageData
+
+}
+
+//-------------------------------------------------------------------
+
+int wxVtk2DBaseView::GetActualSlice() // virtual
+{
+ return (int)(_vtkbasedata->GetZ());
+}
+
+//-------------------------------------------------------------------
+void wxVtk2DBaseView::SetActualSlice(int slice) // Virtual
+{
+ _vtkbasedata->SetZ(slice);
+}
+
+//-------------------------------------------------------------------
+
+vtkBaseData *wxVtk2DBaseView::GetVtkBaseData()
+{
+ return _vtkbasedata;
+}
+
+//-------------------------------------------------------------------
+
+void wxVtk2DBaseView::SetVtkBaseData(vtkBaseData *vtkbasedata)
+{
+ _vtkbasedata=vtkbasedata;
+}
+
+//-------------------------------------------------------------------
+
+void wxVtk2DBaseView::Refresh()
+{
+ int z = (int)(GetVtkBaseData()->GetZ());
+ _imageViewer2XYZ->SetZSlice( z );
+
+ wxVtkBaseView::Refresh();
+}
+
+//-------------------------------------------------------------------
+
+void wxVtk2DBaseView::SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview)
+{
+ SetInteractorStyleBaseView(interactorstylebaseview);
+
+ wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
+ interactorstylebaseview->SetInteractor ( iren );
+ iren->SetInteractorStyle(interactorstylebaseview);
+ interactorstylebaseview->SetwxVtkBaseView(this);
+
+ vtkMaracasImageViewer2Callback * cbk = vtkMaracasImageViewer2Callback::New();
+ cbk->IV = _imageViewer2XYZ->GetVtkImageViewer2();
+ interactorstylebaseview->AddObserver( vtkCommand::WindowLevelEvent, cbk );
+ interactorstylebaseview->AddObserver( vtkCommand::StartWindowLevelEvent, cbk );
+ interactorstylebaseview->AddObserver( vtkCommand::ResetWindowLevelEvent, cbk );
+ cbk->Delete();
+}
+
+//---------------------------------------------------------------------------
+vtkRenderer* wxVtk2DBaseView::GetRenderer() // virtual
+{
+ return _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer();
+}
+//---------------------------------------------------------------------------
+vtkRenderWindow* wxVtk2DBaseView::GetRenWin() // virtual
+{
+ return _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderWindow();
+}
+
+//-------------------------------------------------------------------
+
+void wxVtk2DBaseView::GetSpacing(double spc[3]) // virtual
+{
+ vtkImageData *imageData = GetVtkBaseData()->GetImageData();
+ imageData->GetSpacing(spc);
+}
\ No newline at end of file
--- /dev/null
+#ifndef WXVTK2DBASEVIEW_H_
+#define WXVTK2DBASEVIEW_H_
+
+#include "wxVtkBaseView.h"
+#include "vtkImageViewer2_XYZ.h"
+
+//class vtkInteractorStyleBaseView;
+#include "vtkInteractorStyleBaseView.h"
+class vtkInfoTextImage;
+class vtkInfoTextImageInteractor;
+
+
+
+//------------------------------------------------------------------
+
+
+class creaMaracasVisu_EXPORT wxVtk2DBaseView: public wxVtkBaseView{
+public:
+ wxVtk2DBaseView(wxWindow *parent);
+ virtual ~wxVtk2DBaseView();
+ virtual void Configure(bool okimage=true);
+ vtkImageViewer2_XYZ* _imageViewer2XYZ;
+ vtkBaseData* GetVtkBaseData();
+ void SetVtkBaseData(vtkBaseData *vtkbasedata);
+ virtual void Refresh();
+ virtual void ResetView();
+ virtual int GetActualSlice();
+ virtual void SetActualSlice(int slice);
+ void SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview);
+
+ virtual vtkRenderer* GetRenderer();
+ virtual vtkRenderWindow* GetRenWin();
+ virtual void TransformCoordinate_spacing_ViewToModel(double &X,double &Y, double &Z);
+ virtual void TransformCoordinate_spacing_ModelToView(double &X,double &Y, double &Z);
+ virtual void GetSpacing(double spc[3]);
+
+
+private:
+ vtkBaseData *_vtkbasedata;
+
+ vtkInfoTextImage *_vtkIinfoTextImage;
+ vtkInfoTextImageInteractor *_vtkIinfoTextImageInteractor;
+
+protected:
+
+};
+
+#endif /*WXVTK2DBASEVIEW_H_*/
--- /dev/null
+#include "wxVtk3DBaseView.h"
+
+#include "vtkInteractorStyleBaseView3D.h"
+
+
+wxVtk3DBaseView::wxVtk3DBaseView(wxWindow *parent)
+:wxVtkBaseView( parent )
+{
+ _configure = false;
+ _aRenderer = NULL;
+ _renWin = NULL;
+ _aCamera = NULL;
+}
+//-------------------------------------------------------------------
+wxVtk3DBaseView::~wxVtk3DBaseView()
+{
+ if (_aCamera!=NULL) { _aCamera -> Delete(); }
+ if (_aRenderer!=NULL) { _aRenderer -> Delete(); }
+ if (_renWin!=NULL) { _renWin -> Delete(); }
+}
+//-------------------------------------------------------------------
+vtkCamera* wxVtk3DBaseView::GetCamera()
+{
+ return _aCamera;
+}
+//-------------------------------------------------------------------
+vtkRenderer* wxVtk3DBaseView::GetRenderer() // virtual
+{
+ return _aRenderer;
+}
+//-------------------------------------------------------------------
+vtkRenderWindow* wxVtk3DBaseView::GetRenWin() // virtual
+{
+ return _renWin;
+}
+//-------------------------------------------------------------------
+void wxVtk3DBaseView::Refresh()
+{
+// _renWin->Render();
+ vtkRenderWindowInteractor *vri = GetWxVTKRenderWindowInteractor();
+ vri->vtkRenderWindowInteractor::Render();
+}
+//-------------------------------------------------------------------
+void wxVtk3DBaseView::Configure()
+{
+ if (_configure==false)
+ {
+ _configure=true;
+ //wxVtkBaseView::Configure();
+ _aRenderer = vtkRenderer::New();
+ _renWin = vtkRenderWindow::New();
+ _renWin->AddRenderer(_aRenderer);
+
+
+// _renWin->SetStereoCapableWindow(1);
+// // //renderwindow->SetStereoTypeToCrystalEyes();
+// _renWin->SetStereoTypeToRedBlue();
+// _renWin->SetStereoRender(1);
+
+ GetWxVTKRenderWindowInteractor()->SetRenderWindow(_renWin);
+
+
+// EED Borrame
+// vtkInteractorStyle3DMaracas *interactorStyle3DMaracas = vtkInteractorStyle3DMaracas::New();
+ vtkInteractorStyleBaseView3D *interactorStyleBaseView3D = vtkInteractorStyleBaseView3D::New();
+
+ SetInteractorStyleBaseView( interactorStyleBaseView3D );
+ interactorStyleBaseView3D->SetInteractor ( GetWxVTKRenderWindowInteractor() );
+ GetWxVTKRenderWindowInteractor()->SetInteractorStyle( interactorStyleBaseView3D );
+ interactorStyleBaseView3D->SetwxVtkBaseView(this);
+
+
+/* EED Borrame
+ vtkInteractorStyleSwitch *iss = dynamic_cast<vtkInteractorStyleSwitch*>(_iren->GetInteractorStyle());
+ iss->SetCurrentStyleToTrackballCamera();
+*/
+
+ // It is convenient to create an initial view of the data. The
+ // FocalPoint and Position form a vector direction. Later on
+ // (ResetCamera() method) this vector is used to position the camera
+ // to look at the data in this direction.
+ _aCamera = vtkCamera::New();
+
+//EED 17Avril2009
+/*
+ _aCamera->SetViewUp (0, 0, -1);
+ _aCamera->SetPosition (0, 1, 0);
+ */
+ _aCamera->SetViewUp (0, 1, 0);
+ _aCamera->SetPosition (0, 0, 1);
+
+ _aCamera->SetFocalPoint (0, 0, 0);
+ _aCamera->ComputeViewPlaneNormal();
+
+ }
+}
+//-------------------------------------------------------------------
+//EED 27 sep 2006
+void wxVtk3DBaseView::GetSpacing(double spc[3])
+{
+ spc[0]=1;
+ spc[1]=1;
+ spc[2]=1;
+}
\ No newline at end of file
--- /dev/null
+#ifndef WXVTK3DBASEVIEW_H_
+#define WXVTK3DBASEVIEW_H_
+
+#include "wxVtkBaseView.h"
+
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+//------------------------------------------------------------------
+
+class creaMaracasVisu_EXPORT wxVtk3DBaseView: public wxVtkBaseView{
+public:
+ wxVtk3DBaseView( wxWindow *parent );
+ virtual ~wxVtk3DBaseView();
+ vtkCamera* GetCamera();
+ virtual vtkRenderer* GetRenderer();
+ virtual vtkRenderWindow* GetRenWin();
+ void Refresh();
+ void Configure();
+ virtual void GetSpacing(double spc[3]);
+
+private:
+ bool _configure;
+ vtkRenderer *_aRenderer;
+ vtkRenderWindow *_renWin;
+ vtkCamera *_aCamera;
+protected:
+};
+
+#endif /*WXVTK3DBASEVIEW_H_*/
-#include <vtkRenderer.h>
-#include <vtkRenderWindowInteractor.h>
-#include <vtkRenderWindow.h>
-#include <vtkObjectFactory.h>
-#include <vtkCamera.h>
-#include <vtkProperty.h>
-#include <vtkActor.h>
-#include <vtkInteractorStyleTrackballCamera.h>
-#include <vtkInteractorStyleSwitch.h>
-#include <vtkImageActor.h>
-#include <vtkTextProperty.h>
-#include <vtkImageMapToWindowLevelColors.h>
-#include "wxVtkBaseView.h"
-
-
-vtkStandardNewMacro(vtkInteractorStyleBaseView);
-vtkStandardNewMacro(vtkInteractorStyleBaseView2D);
-vtkStandardNewMacro(vtkInteractorStyleBaseView3D);
-
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-vtkImageViewer2_XYZ::vtkImageViewer2_XYZ()
-{
- _vtkimageviewer2= vtkImageViewer2::New();
-}
-//-------------------------------------------------------------------
-vtkImageViewer2_XYZ::~vtkImageViewer2_XYZ()
-{
- //_vtkimageviewer2->Delete();
-}
-//-------------------------------------------------------------------
-void vtkImageViewer2_XYZ::SetExtentDimension(int x1,int x2,
- int y1,int y2,
- int z1,int z2)
-{
- _x1=x1;
- _x2=x2;
- _y1=y1;
- _y2=y2;
- _z1=z1;
- _z2=z2;
-}
-//-------------------------------------------------------------------
-void vtkImageViewer2_XYZ::SetXSlice(int slice)
-{
- vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
- imageActor->SetDisplayExtent(slice, slice, _y1, _y2, _z1, _z2 );
-}
-//-------------------------------------------------------------------
-void vtkImageViewer2_XYZ::SetYSlice(int slice)
-{
- vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
- imageActor->SetDisplayExtent(_x1, _x2, slice, slice, _z1, _z2 );
-}
-//-------------------------------------------------------------------
-void vtkImageViewer2_XYZ::SetZSlice(int slice)
-{
-#if (VTK_MAJOR_VERSION >= 5)
-// _vtkimageviewer2->SetSlice( slice );
- vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
- imageActor->SetDisplayExtent(_x1, _x2, _y1, _y2, slice, slice );
-#else
- _vtkimageviewer2->SetZSlice( slice );
-#endif
-
-
-}
-//-------------------------------------------------------------------
-int vtkImageViewer2_XYZ::GetXSlice()
-{
- vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
- return imageActor->GetDisplayExtent()[0];
-}
-//-------------------------------------------------------------------
-int vtkImageViewer2_XYZ::GetYSlice()
-{
- vtkImageActor *imageActor = _vtkimageviewer2->GetImageActor();
- return imageActor->GetDisplayExtent()[2];
-}
-//-------------------------------------------------------------------
-int vtkImageViewer2_XYZ::GetZSlice()
-{
-
- int result;
-#if (VTK_MAJOR_VERSION >= 5)
- result= _vtkimageviewer2->GetSlice( );
-#else
- result= _vtkimageviewer2->GetZSlice( );
-#endif
-
-
- return result;
-}
-//-------------------------------------------------------------------
-vtkImageViewer2 *vtkImageViewer2_XYZ::GetVtkImageViewer2()
-{
- return _vtkimageviewer2;
-}
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-
-
-BEGIN_EVENT_TABLE( wxVTKRenderWindowInteractorPlus, wxVTKRenderWindowInteractor )
- EVT_LEFT_DCLICK( wxVTKRenderWindowInteractorPlus::OnLeftDClick )
- EVT_RIGHT_DCLICK( wxVTKRenderWindowInteractorPlus::OnRightDClick )
- EVT_MIDDLE_DCLICK( wxVTKRenderWindowInteractorPlus::OnMiddleDClick )
- EVT_MOUSEWHEEL( wxVTKRenderWindowInteractorPlus::OnMouseWheel )
-END_EVENT_TABLE( );
-
-//-------------------------------------------------------------------
-wxVTKRenderWindowInteractorPlus::wxVTKRenderWindowInteractorPlus()
-: wxVTKRenderWindowInteractor()
-{
-}
-
-
-//-------------------------------------------------------------------
-wxVTKRenderWindowInteractorPlus::wxVTKRenderWindowInteractorPlus(wxWindow *parent, wxVtkBaseView *wxvtkbaseview)
-: wxVTKRenderWindowInteractor(parent, -1)
-{
- _wxvtkbaseview = wxvtkbaseview;
-}
-
-//-------------------------------------------------------------------
-wxVTKRenderWindowInteractorPlus::~wxVTKRenderWindowInteractorPlus()
-{
-}
-//---------------------------------------------------------------------------
-wxVTKRenderWindowInteractorPlus * wxVTKRenderWindowInteractorPlus::New()
-{
- // we don't make use of the objectfactory, because we're not registered
- return new wxVTKRenderWindowInteractorPlus;
-}
+//#include "vtkInteractorStyleBaseView.h"
-//-------------------------------------------------------------------
-void wxVTKRenderWindowInteractorPlus::OnLeftDClick( wxMouseEvent& event )
-{
- _wxvtkbaseview->GetInteractorStyleBaseView()->OnLeftDClick();
-}
-//-------------------------------------------------------------------
-void wxVTKRenderWindowInteractorPlus::OnRightDClick( wxMouseEvent& event )
-{
- _wxvtkbaseview->GetInteractorStyleBaseView()->OnRightDClick();
-}
-//-------------------------------------------------------------------
-void wxVTKRenderWindowInteractorPlus::OnMiddleDClick( wxMouseEvent& event )
-{
- _wxvtkbaseview->GetInteractorStyleBaseView()->OnMiddleDClick();
-}
-//-------------------------------------------------------------------
-void wxVTKRenderWindowInteractorPlus::OnMouseWheel( wxMouseEvent& event )
-{
- _wxvtkbaseview->GetInteractorStyleBaseView()->OnMouseWheel();
-}
+#include "wxVtkBaseView.h"
+#include "wxVtk2DBaseView.h"
+#include "wxVTKRenderWindowInteractorPlus.h"
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
wxVtkBaseView::wxVtkBaseView()
{
_parent = NULL;
wxVtkBaseView::wxVtkBaseView(wxWindow *parent)
{
_parent = parent;
- _iren = new wxVTKRenderWindowInteractorPlus(_parent,this);
+ _iren = (wxVTKRenderWindowInteractor*)new wxVTKRenderWindowInteractorPlus(_parent,this);
// _iren->UseCaptureMouseOn();
// _iren = new wxVTKRenderWindowInteractor(_parent,-1);
_interactorStyle = NULL;
}
// EEDx5
- this->GetInteractorStyleBaseView()->GetWxVtk2DBaseView()->TransformCoordinate_spacing_ViewToModel( fP[0] , fP[1] , fP[2] );
+ //JCP 13/05/2009
+ vtkInteractorStyleBaseView* interactorstyle = (vtkInteractorStyleBaseView*)this->GetInteractorStyleBaseView();
+ wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)interactorstyle->GetWxVtk2DBaseView();
+ baseview->TransformCoordinate_spacing_ViewToModel( fP[0] , fP[1] , fP[2] );
+ //JCP 13/05/2009
if (type!=0)
{
}
//---------------------------------------------------------------------------
-
+/* JCP 14/05/09
vtkInteractorStyleBaseView* wxVtkBaseView::GetInteractorStyleBaseView()
{
return _interactorStyle;
}
+*/
+vtkInteractorStyleImage* wxVtkBaseView::GetInteractorStyleBaseView()
+{
+ return _interactorStyle;
+}
+
//---------------------------------------------------------------------------
-void wxVtkBaseView::SetInteractorStyleBaseView( vtkInteractorStyleBaseView* interactorStyle)
+void wxVtkBaseView::SetInteractorStyleBaseView( vtkInteractorStyleImage* interactorStyle)
{
_interactorStyle = interactorStyle;
}
}
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-InteractorStyleMaracas::InteractorStyleMaracas()
-{
- _active = true;
- _vtkInteractorStyleBaseView = NULL;
-}
-//---------------------------------------------------------------------------
-InteractorStyleMaracas::~InteractorStyleMaracas()
-{
-}
-
-// ----------------------------------------------------------------------------
-InteractorStyleMaracas * InteractorStyleMaracas :: Clone() // virtual
-{
- InteractorStyleMaracas * clone = new InteractorStyleMaracas();
- CopyAttributesTo(clone);
- return clone;
-}
-
-// ---------------------------------------------------------------------------
-
-void InteractorStyleMaracas::CopyAttributesTo( InteractorStyleMaracas * cloneObject)
-{
- // Fathers object
- //<FATHERCLASS>::CopyAttributesTo(cloneObject);
-
- cloneObject->SetActive( this->GetActive() );
-}
-
-
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnChar()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnMouseMove()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnLeftButtonDown()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnLeftButtonUp()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnLeftDClick()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnMiddleButtonDown()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnMiddleButtonUp()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnMiddleDClick()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnRightButtonDown()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnRightButtonUp()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnRightDClick()
-{
- return true;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::OnMouseWheel()
-{
- return true;
-}
-
-//---------------------------------------------------------------------------
-void InteractorStyleMaracas::SetVtkInteractorStyleBaseView(vtkInteractorStyleBaseView* vtkInteractorStyleBaseView)
-{
- _vtkInteractorStyleBaseView = vtkInteractorStyleBaseView;
-}
-
-//---------------------------------------------------------------------------
-void InteractorStyleMaracas::RemoveVtkInteractorStyleBaseView()
-{
- _vtkInteractorStyleBaseView = NULL;
-}
-//---------------------------------------------------------------------------
-void InteractorStyleMaracas::SetActive(bool active)
-{
- _active = active;
-}
-//---------------------------------------------------------------------------
-bool InteractorStyleMaracas::GetActive()
-{
- return _active;
-}
-
-
//-------------------------------------------------------------------
//-------------------------------------------------------------------
//-------------------------------------------------------------------
-manualInteractorWindowLevel::manualInteractorWindowLevel()
-{
- _stateWindowLevel = false;
- _backPx = 0;
- _backPy = 0;
- _backWindow = -1;
- _backLevel = -1;
-}
-
-//-------------------------------------------------------------------
-
-manualInteractorWindowLevel::~manualInteractorWindowLevel()
-{
-}
-
-//-------------------------------------------------------------------
-
-bool manualInteractorWindowLevel::OnMouseMove() // virtual
-{
-
- if (_stateWindowLevel==true)
- {
- int tmpPx,tmpPy;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition( tmpPx , tmpPy );
- int colorWin=_backWindow - 2*( _backPx - tmpPx );
- int colorLev=_backLevel + 2*( _backPy - tmpPy );
-
- if (colorWin<0)
- {
- colorWin=0;
- }
- if (colorWin>100000)
- {
- colorWin=100000;
- }
-
- if (colorLev<0)
- {
- colorLev=0;
- }
- if (colorLev>100000)
- {
- colorLev=100000;
- }
- vtkImageViewer2 *vtkimageviewer2;
- vtkimageviewer2=_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->_imageViewer2XYZ->GetVtkImageViewer2();
- vtkimageviewer2->SetColorWindow(colorWin);
- vtkimageviewer2->SetColorLevel(colorLev);
-// vtkimageviewer2->Render();
- }
- return true;
-}
-
-//-------------------------------------------------------------------
-
-bool manualInteractorWindowLevel::OnMiddleButtonDown() // virtual
-{
- if ((_vtkInteractorStyleBaseView->GetInteractor()->GetControlKey()==0) &&
- (_vtkInteractorStyleBaseView->GetInteractor()->GetShiftKey()==0) ){
-
- _stateWindowLevel = true;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition( _backPx , _backPy );
-
- _backWindow = (int)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->_imageViewer2XYZ->GetVtkImageViewer2()->GetColorWindow());
- _backLevel = (int)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->_imageViewer2XYZ->GetVtkImageViewer2()->GetColorLevel());
- }
- return true;
-}
-
-//-------------------------------------------------------------------
-
-bool manualInteractorWindowLevel::OnMiddleButtonUp() // virtual
-{
- if (_stateWindowLevel==true)
- {
- _stateWindowLevel=false;
- }
- return true;
-}
-
-
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-vtkInteractorScrollZ::vtkInteractorScrollZ()
-{
- _stateFordware=false;
-}
-//---------------------------------------------------------------------------
-vtkInteractorScrollZ::~vtkInteractorScrollZ()
-{
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorScrollZ::OnRightButtonDown()
-{
- vtkRenderWindowInteractor *interactor = _vtkInteractorStyleBaseView->GetInteractor();
- if ((interactor->GetControlKey()==0) && (interactor->GetShiftKey()==0) ){
- _stateFordware = true;
- _fordwareX = interactor->GetEventPosition()[0];
- _fordwareY = interactor->GetEventPosition()[1];
- _sliceZ = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetActualSlice();
- }
- return true;
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorScrollZ::OnRightButtonUp()
-{
- _stateFordware=false;
- return true;
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorScrollZ::OnMouseMove ()
-{
- if (_stateFordware==true){
- //int fx = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[0]; // JPRx
- int fy = _vtkInteractorStyleBaseView->GetInteractor()->GetEventPosition()[1];
- int delta = (_fordwareY - fy)/3;
- _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->SetActualSlice( _sliceZ + delta);
-
- this->_vtkInteractorStyleBaseView->SetParent_refresh_waiting();
-
- // wxCommandEvent newevent(wxEVT_COMMAND_MENU_SELECTED,12121);
- // _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent);
-
- //_wxvtk2Dbaseview->Refresh();
- }
- return true;
-}
-
-
-
-
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-vtkInteractorStyleBaseView::vtkInteractorStyleBaseView()
-{
- _refresh_waiting = false;
- _parent_refresh_waiting = false;
- _blockRefresh = false;
-}
-//---------------------------------------------------------------------------
-vtkInteractorStyleBaseView::~vtkInteractorStyleBaseView()
-{
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnMouseMove() // virtual
-{
- CallLstInteractorStyleMaracas(3);
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnLeftButtonDown() // virtual
-{
- CallLstInteractorStyleMaracas(4);
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnLeftButtonUp() // virtual
-{
- CallLstInteractorStyleMaracas(5);
-}
-
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnLeftDClick() // virtual
-{
- CallLstInteractorStyleMaracas( 11 );
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnMiddleButtonDown() // virtual
-{
- CallLstInteractorStyleMaracas(6);
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnMiddleButtonUp() // virtual
-{
- CallLstInteractorStyleMaracas(7);
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnMiddleDClick() // virtual
-{
- CallLstInteractorStyleMaracas( 13 );
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnRightButtonDown() // virtual
-{
- CallLstInteractorStyleMaracas(1);
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnRightButtonUp() // virtual
-{
- CallLstInteractorStyleMaracas(2);
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnRightDClick() // virtual
-{
- CallLstInteractorStyleMaracas( 12 );
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnMouseWheel() // virtual
-{
- CallLstInteractorStyleMaracas( 14 );
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::AddInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas)
-{
- interactorStyleMaracas->SetVtkInteractorStyleBaseView(this);
- _lstInteractorStyleMaracas.push_back(interactorStyleMaracas);
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::RemoveInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas)
-{
- interactorStyleMaracas->RemoveVtkInteractorStyleBaseView();
- int i, size = _lstInteractorStyleMaracas.size();
- std::vector< InteractorStyleMaracas* >::iterator iter = _lstInteractorStyleMaracas.begin();
- bool removed = false;
- for (i=0; !removed && i<size; i++)
- {
- if ( _lstInteractorStyleMaracas[i] == interactorStyleMaracas )
- {
- _lstInteractorStyleMaracas.erase(iter);
- removed = true;
- }
- iter++;
- }
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::InsertInteractorStyleMaracas(int pos, InteractorStyleMaracas* interactorStyleMaracas)
-{
- interactorStyleMaracas->SetVtkInteractorStyleBaseView(this);
- _lstInteractorStyleMaracas.insert(_lstInteractorStyleMaracas.begin()+pos,interactorStyleMaracas);
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas(int type)
-{
-
- InteractorStyleMaracas *intStyMar;
-
- int i,size=_lstInteractorStyleMaracas.size();
-
-//EED Borrame
-//FILE *ff = fopen("c:/temp/wxVtkBaseView_SceneManagerStadistics.txt","a+");
-//fprintf(ff,"EED vtkInteractorStyleBaseView::CallLstInteractorStyleMaracas \n" );
-//for (i=0;i<size;i++)
-//{
-//fprintf(ff," %p\n" , _lstInteractorStyleMaracas[i] );
-//}
-//fclose(ff);
-
-
-
- for (i=0;i<size;i++)
- {
- intStyMar = _lstInteractorStyleMaracas[i];
- if (intStyMar->GetActive()==true){
- if (type ==1)
- { // OnRightButtonDown
- if (intStyMar->OnRightButtonDown()==false)
- {
- i=size;
- }
- }
- if (type ==2)
- { // OnRightButtonUp
- if (intStyMar->OnRightButtonUp()==false)
- {
- i=size;
- }
- }
- if (type==3)
- { // OnMouseMouve
- if (intStyMar->OnMouseMove()==false)
- {
- i=size;
- }
- }
- if (type==4)
- { // OnLeftButtonDown
- if (intStyMar->OnLeftButtonDown()==false)
- {
- i=size;
- }
- }
- if (type==5)
- { // OnLeftButtonUp
- if (intStyMar->OnLeftButtonUp()==false)
- {
- i=size;
- }
- }
- if (type==6)
- { // OnMiddleButtonDown
- if (intStyMar->OnMiddleButtonDown()==false)
- {
- i=size;
- }
- }
- if (type==7)
- { // OnMiddleButtonUp
- if (intStyMar->OnMiddleButtonUp()==false)
- {
- i=size;
- }
- }
- if (type==10)
- { // OnMiddleButtonUp
- if (intStyMar->OnChar()==false)
- {
- i=size;
- }
- }
- if (type==11)
- { // OnLeftDClick
- if (intStyMar->OnLeftDClick()==false)
- {
- i=size;
- }
- }
- if (type==12)
- { // OnRightDClick
- if (intStyMar->OnRightDClick()==false)
- {
- i=size;
- }
- }
- if (type==13)
- { // OnMiddleDClick
- if (intStyMar-> OnMiddleDClick()==false)
- {
- i=size;
- }
- }
- if (type==14)
- { // OnMouseWheel
- if (intStyMar->OnMouseWheel()==false)
- {
- i=size;
- }
- }
- } // if active
- } // for
-
- EvaluateToRefresh();
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::OnChar() // virtual
-{
-// char a=GetInteractor()->GetKeyCode();
- CallLstInteractorStyleMaracas(10);
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::TransformCoordinate(double &X, double &Y, double &Z)
-{
- vtkImageViewer2 *imageViewer = GetWxVtk2DBaseView()->_imageViewer2XYZ->GetVtkImageViewer2();
-
- imageViewer->GetRenderer()->SetDisplayPoint((int)X, (int)Y, (int)Z);
- imageViewer->GetRenderer()->DisplayToWorld();
- double fP[4];
- imageViewer->GetRenderer()->GetWorldPoint( fP );
-
- if ( fP[3] ){
- fP[0] /= fP[3];
- fP[1] /= fP[3];
- fP[2] /= fP[3];
- }
-
-// EEDx5
- GetWxVtk2DBaseView()->TransformCoordinate_spacing_ViewToModel(fP[0],fP[1],fP[2]);
-
- X=fP[0];
- Y=fP[1];
- Z=fP[2];
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::SetwxVtkBaseView(wxVtkBaseView *wxvtkbaseview)
-{
- _wxvtkbaseview = wxvtkbaseview;
-}
-//---------------------------------------------------------------------------
-wxVtk2DBaseView* vtkInteractorStyleBaseView::GetWxVtk2DBaseView()
-{
- return (wxVtk2DBaseView*)_wxvtkbaseview;
-}
-//---------------------------------------------------------------------------
-wxVtk3DBaseView* vtkInteractorStyleBaseView::GetWxVtk3DBaseView()
-{
- return (wxVtk3DBaseView*)_wxvtkbaseview;
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::SetActiveAllInteractors(bool ok)
-{
- InteractorStyleMaracas *intStyMar;
- int i,size=_lstInteractorStyleMaracas.size();
- for (i=0;i<size;i++)
- {
- intStyMar = _lstInteractorStyleMaracas[i];
- intStyMar->SetActive(ok);
- }
-
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::SetRefresh_waiting()
-{
- _refresh_waiting=true;
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorStyleBaseView::GetRefresh_waiting()
-{
- return _refresh_waiting;
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::SetParent_refresh_waiting()
-{
- _parent_refresh_waiting=true;
-}
-//---------------------------------------------------------------------------
-bool vtkInteractorStyleBaseView::GetParent_refresh_waiting()
-{
- return _parent_refresh_waiting;
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::EvaluateToRefresh()
-{
-
- if ( _blockRefresh==false )
- {
- if ( (_refresh_waiting==true) && (_parent_refresh_waiting==false))
- {
- _refresh_waiting = false;
- this->_wxvtkbaseview->Refresh();
- }
- if (_parent_refresh_waiting==true)
- {
- _parent_refresh_waiting = false;
- wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
- this->_wxvtkbaseview->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
- }
- }
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::BlockRefresh()
-{
- _blockRefresh=true;
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView::UnBlockRefresh()
-{
- _blockRefresh=false;
-}
-
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-//---------------------------------------------------------------------------
-
-
-
-//---------------------------------------------------------------------------
-vtkInteractorStyleBaseView2D::vtkInteractorStyleBaseView2D()
-{
- _manualinteractorwindowlevel= new manualInteractorWindowLevel();
- AddInteractorStyleMaracas( _manualinteractorwindowlevel );
-
- _vtkInteractorScrollZ = new vtkInteractorScrollZ();
- AddInteractorStyleMaracas(_vtkInteractorScrollZ);
-
-}
-//---------------------------------------------------------------------------
-vtkInteractorStyleBaseView2D::~vtkInteractorStyleBaseView2D()
-{
-}
-
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView2D::OnRightButtonDown() // virtual
-{
- vtkInteractorStyleBaseView::OnRightButtonDown();
-
- if ((GetInteractor()->GetControlKey()==1) && (GetInteractor()->GetShiftKey()==0) ){
- this->vtkInteractorStyleImage::OnRightButtonDown();
- }
-
-}
-
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView2D::OnRightButtonUp() // virtual
-{
- vtkInteractorStyleBaseView::OnRightButtonUp();
- this->vtkInteractorStyleImage::OnRightButtonUp();
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView2D::OnMouseMove () // virtual
-{
- vtkInteractorStyleBaseView::OnMouseMove();
- this->vtkInteractorStyleImage::OnMouseMove();
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView2D::OnLeftButtonDown() // virtual
-{
- vtkInteractorStyleBaseView::OnLeftButtonDown();
-
- if ((GetInteractor()->GetControlKey()==0) && (GetInteractor()->GetShiftKey()==1) )
- {
- this->vtkInteractorStyleImage::OnLeftButtonDown();
- }
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView2D::OnLeftButtonUp () // virtual
-{
- vtkInteractorStyleBaseView::OnLeftButtonUp();
-
- this->vtkInteractorStyleImage::OnLeftButtonUp();
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView2D::OnMiddleButtonDown () // virtual
-{
- vtkInteractorStyleBaseView::OnMiddleButtonDown();
-
- if ((GetInteractor()->GetControlKey()==1) || (GetInteractor()->GetShiftKey()==1) )
- {
- this->vtkInteractorStyleImage::OnLeftButtonDown();
- }
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView2D::OnMiddleButtonUp () // virtual
-{
- vtkInteractorStyleBaseView::OnMiddleButtonUp();
-
- if ((GetInteractor()->GetControlKey()==1) || (GetInteractor()->GetShiftKey()==1) )
- {
- this->vtkInteractorStyleImage::OnLeftButtonUp();
- }
-}
-
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-
-//---------------------------------------------------------------------------
-vtkInteractorStyleBaseView3D::vtkInteractorStyleBaseView3D(){
-}
-//---------------------------------------------------------------------------
-vtkInteractorStyleBaseView3D::~vtkInteractorStyleBaseView3D(){
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView3D::OnRightButtonDown ()
-{
- vtkInteractorStyleBaseView::OnRightButtonDown();
-
-/*
- if (GetInteractor()->GetControlKey()==1 ){
- this->vtkInteractorStyleTrackballCamera::OnRightButtonDown();
- }
-*/
- this->FindPokedRenderer(this->Interactor->GetEventPosition()[0],
- this->Interactor->GetEventPosition()[1]);
-
- if (this->CurrentRenderer == NULL)
- {
- return;
- }
-
- if (this->Interactor->GetControlKey()) {
- this->StartDolly();
- }
-
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView3D::OnRightButtonUp ()
-{
- vtkInteractorStyleBaseView::OnRightButtonUp();
-
-/*
- if (GetInteractor()->GetControlKey()==1 ){
- this->vtkInteractorStyleTrackballCamera::OnRightButtonUp();
- }
-*/
-
-
- switch (this->State)
- {
- case VTKIS_DOLLY:
- this->EndDolly();
- break;
- }
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView3D::OnMouseMove ()
-{
- vtkInteractorStyleBaseView::OnMouseMove();
-
-// this->vtkInteractorStyleTrackballCamera::OnMouseMove();
-
- // int x = this->Interactor->GetEventPosition()[0]; // JPRx
- // int y = this->Interactor->GetEventPosition()[1]; // JPRx
-
-
- // vtkRenderWindowInteractor *rwi = this->Interactor;
-
- // int lx = rwi->GetLastEventPosition()[0]; // JPRx
- // int ly = rwi->GetLastEventPosition()[1]; // JPRx
- // int dx = rwi->GetEventPosition()[0] ; // JPRx
- // int dy = rwi->GetEventPosition()[1] ; // JPRx
-
-
- switch (this->State)
- {
- case VTKIS_ROTATE:
- // this->FindPokedRenderer(x, y);
- this->Rotate();
- // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
- break;
-
- case VTKIS_PAN:
- // this->FindPokedRenderer(x, y);
- this->Pan();
- // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
- break;
-
- case VTKIS_DOLLY:
- // this->FindPokedRenderer(x, y);
- this->Dolly();
- // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
- break;
-
- case VTKIS_SPIN:
- // this->FindPokedRenderer(x, y);
- this->Spin();
- // this->InvokeEvent(vtkCommand::InteractionEvent, NULL);
- break;
- }
-
-
-
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView3D::OnLeftButtonDown ()
-{
- vtkInteractorStyleBaseView::OnLeftButtonDown();
-/*
- if (GetInteractor()->GetControlKey()==1 ){
- this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
- } else {
- this->vtkInteractorStyleTrackballCamera::OnLeftButtonDown();
- }
-*/
-
-
- this->FindPokedRenderer(this->Interactor->GetEventPosition()[0],
- this->Interactor->GetEventPosition()[1]);
- if (this->CurrentRenderer == NULL)
- {
- return;
- }
-
- if (this->Interactor->GetControlKey()) {
- this->StartPan();
- } else {
- this->StartRotate();
- }
-
- /*
- if (this->Interactor->GetShiftKey())
- {
- if (this->Interactor->GetControlKey())
- {
- this->StartDolly();
- }
- else
- {
- this->StartPan();
- }
- }
- else
- {
- if (this->Interactor->GetControlKey())
- {
- this->StartSpin();
- }
- else
- {
- this->StartRotate();
- }
- }
-*/
-
-
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView3D::OnLeftButtonUp ()
-{
- vtkInteractorStyleBaseView::OnLeftButtonUp();
-
-/*
- if (GetInteractor()->GetControlKey()==1 ){
- this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
- } else {
- this->vtkInteractorStyleTrackballCamera::OnLeftButtonUp();
- }
-*/
- switch (this->State)
- {
-
- case VTKIS_PAN:
- this->EndPan();
- break;
-
- case VTKIS_ROTATE:
- this->EndRotate();
- break;
- }
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView3D::OnMiddleButtonDown ()
-{
- vtkInteractorStyleBaseView::OnMiddleButtonDown();
- // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
-}
-//---------------------------------------------------------------------------
-void vtkInteractorStyleBaseView3D::OnMiddleButtonUp ()
-{
- vtkInteractorStyleBaseView::OnMiddleButtonUp();
-
- // this->vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
-}
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-vtkInfoTextImage::vtkInfoTextImage()
-{
- _vtkText_WindowLevel = NULL;
- _vtkText_ColorLevel = NULL;
- _vtkText_position = NULL;
- _vtkText_pixelIntensity = NULL;
- _marimagedata = NULL;
-}
-
-//-------------------------------------------------------------------
-
-vtkInfoTextImage::~vtkInfoTextImage()
-{
-}
-
-//-------------------------------------------------------------------
-
-void vtkInfoTextImage::Configure()
-{
- _vtkText_WindowLevel = Create_Text_Label( 10 , 55 );
- _vtkText_ColorLevel = Create_Text_Label( 10 , 40 );
- _vtkText_position = Create_Text_Label( 10 , 25 );
- _vtkText_pixelIntensity = Create_Text_Label( 10 , 10 );
-}
-
-
-//-------------------------------------------------------------------
-
-void vtkInfoTextImage::SetMarImageData(marImageData *marimagedata)
-{
- _marimagedata=marimagedata;
-}
-
-//-------------------------------------------------------------------
-
-void vtkInfoTextImage::SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview)
-{
- _wxvtk2Dbaseview=wxvtk2Dbaseview;
-}
-
-//-------------------------------------------------------------------
-
-vtkTextActor *vtkInfoTextImage::Create_Text_Label(int px, int py )
-{
- // Text Window Level
- vtkTextActor *textActor = vtkTextActor::New();
- textActor->SetDisplayPosition(px, py);
- textActor->SetInput("0");
-
- // Set coordinates to match the old vtkScaledTextActor default value
- textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
- textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
-
- vtkTextProperty *tprop = textActor->GetTextProperty();
- tprop->SetFontSize(14);
- tprop->SetFontFamilyToArial();
- tprop->SetColor(1, 1, 0);
- _wxvtk2Dbaseview->GetRenderer()->AddActor2D(textActor);
-
- return textActor;
-}
-
-//-------------------------------------------------------------------
-
-void vtkInfoTextImage::PutWindowLevel()
-{
- int value = (int)( _wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->GetWindow() );
- char zTzxt[20];
- char resultText[50];
-
- strcpy(resultText,"w:");
-
-
- //ltoa ( (long)value , zTzxt , 10 );
- sprintf(zTzxt,"%d",value);
-
- strcat(resultText,zTzxt);
- _vtkText_WindowLevel -> SetInput(resultText);
-}
-
-//-------------------------------------------------------------------
-
-void vtkInfoTextImage::PutColorLevel()
-{
- int value = (int)(_wxvtk2Dbaseview->_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel()->GetLevel());
- char zTzxt[20];
- char resultText[50];
-
- strcpy(resultText,"c:");
-
-// itoa (value,zTzxt,10);
- sprintf(zTzxt,"%d",value);
-
- strcat(resultText,zTzxt);
- _vtkText_ColorLevel -> SetInput(resultText);
-}
-
-//-------------------------------------------------------------------
-
-void vtkInfoTextImage::PutPosition(int xx,int yy, int zz)
-{
-
-//EEDx7
-// double spa[3];
-// _imagedata->GetSpacing(spa);
-// xx=xx*(1/spa[0]);
-// yy=yy*(1/spa[1]);
-
-
- char zTzxt[50];
- char resultText[50];
- strcpy(resultText,"p: ");
-// itoa ((int)xx,zTzxt,10);
- sprintf(zTzxt,"%d",xx);
-
- strcat(resultText,zTzxt);
- strcat(resultText," , ");
-
-// itoa ((int)yy,zTzxt,10);
- sprintf(zTzxt,"%d",yy);
-
- strcat(resultText,zTzxt);
- strcat(resultText," , ");
-
-// itoa ((int)zz,zTzxt,10);
- sprintf(zTzxt,"%d",zz);
-
- strcat(resultText,zTzxt);
-
-
-
- int nX = _marimagedata->GetXOriginal(xx);
- int nY = _marimagedata->GetYOriginal(yy);
- int nZ = _marimagedata->GetZOriginal(zz);
-
- strcat(resultText," (");
-// ltoa ((int)nX,zTzxt,10);
- sprintf(zTzxt,"%d",nX);
-
- strcat(resultText,zTzxt);
- strcat(resultText,",");
-
-// ltoa ((int)nY,zTzxt,10);
- sprintf(zTzxt,"%d",nY);
-
- strcat(resultText,zTzxt);
- strcat(resultText,",");
-
-// ltoa ((int)nZ,zTzxt,10);
- sprintf(zTzxt,"%d",nZ);
-
- strcat(resultText,zTzxt);
- strcat(resultText,")");
-
-
-
-
- _vtkText_position -> SetInput(resultText);
-}
-
-//-------------------------------------------------------------------
-
-void vtkInfoTextImage::PutPixelIntensity(int xx, int yy, int zz)
-{
-
-//EEDx2
- bool ok=true;
-
- int dim[3];
- double spa[3];
- vtkImageData *imagedata = _marimagedata->GetImageData();
- imagedata->GetDimensions(dim);
- imagedata->GetSpacing(spa);
-
-// EEDx7
-// xx=xx*(1/spa[0]);
-// yy=yy*(1/spa[1]);
-// zz=xx*spa[2];
-
- if ( (xx<0) || (xx>=dim[0]) || (yy<0) || (yy>=dim[1]) || (zz<0) || (zz>=dim[2]) )
- {
- ok=false;
- }
-
-
- char zTzxt[20];
- char resultText[50];
- strcpy(resultText,"GL: ");
- if (ok==true)
- {
- if (imagedata->GetScalarType()==VTK_BIT)
- {
- char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- if(*pOrg==0)
- {
- sprintf(zTzxt,"%d",0);
- }
- else
- {
- sprintf(zTzxt,"%d",1);
- }
- }
-
- if (imagedata->GetScalarType()==VTK_CHAR)
- {
- char *pOrg=(char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- int tmp=*pOrg;
- sprintf(zTzxt,"%d",tmp);
- }
-
- if (imagedata->GetScalarType()==VTK_SIGNED_CHAR)
- {
- signed char *pOrg=(signed char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- int tmp=*pOrg;
- sprintf(zTzxt,"%d",tmp);
- }
-
- if (imagedata->GetScalarType()==VTK_UNSIGNED_CHAR)
- {
- unsigned char *pOrg=(unsigned char*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- int tmp=*pOrg;
- sprintf(zTzxt,"%d",tmp);
- }
-
- if (imagedata->GetScalarType()==VTK_SHORT)
- {
- short *pOrg=(short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- int tmp=*pOrg;
- sprintf(zTzxt,"%d",tmp);
- }
-
- if (imagedata->GetScalarType()==VTK_UNSIGNED_SHORT)
- {
- unsigned short *pOrg=(unsigned short*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- int tmp=*pOrg;
- sprintf(zTzxt,"%d",tmp);
- }
-
- if (imagedata->GetScalarType()==VTK_INT)
- {
- int *pOrg=(int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- sprintf(zTzxt,"%d",*pOrg);
- }
-
- if (imagedata->GetScalarType()==VTK_UNSIGNED_INT)
- {
- unsigned int *pOrg=(unsigned int*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- int tmp=*pOrg;
- sprintf(zTzxt,"%d",tmp);
- }
-
- if (imagedata->GetScalarType()==VTK_LONG)
- {
- long *pOrg=(long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- double tmp=*pOrg;
- sprintf(zTzxt,"%3.2f",tmp);
- }
-
- if (imagedata->GetScalarType()==VTK_UNSIGNED_LONG)
- {
- unsigned long *pOrg=(unsigned long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- double tmp=*pOrg;
- sprintf(zTzxt,"%3.2f",tmp);
- }
-
- if (imagedata->GetScalarType()==VTK_FLOAT)
- {
- long *pOrg=(long*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- double tmp=*pOrg;
- sprintf(zTzxt,"%3.2f",tmp);
- }
-
- if (imagedata->GetScalarType()==VTK_DOUBLE)
- {
- double *pOrg=(double*)imagedata->GetScalarPointer ((int)xx,(int)yy,(int)zz);
- // itoa (*pOrg,zTzxt,10);
- double tmp=*pOrg;
- sprintf(zTzxt,"%3.2f",tmp);
- }
- }
- else
- {
- strcpy(zTzxt,"---");
- }
- strcat(resultText,zTzxt);
- _vtkText_pixelIntensity -> SetInput(resultText);
-}
-
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-vtkInfoTextImageInteractor::vtkInfoTextImageInteractor()
-{
-}
-
-//-------------------------------------------------------------------
-vtkInfoTextImageInteractor::~vtkInfoTextImageInteractor()
-{
-}
-
-//-------------------------------------------------------------------
-
-void vtkInfoTextImageInteractor::SetModelVtkInfoTextImage(vtkInfoTextImage *vtkinfotextimage)
-{
- _vtkinfotextimage = vtkinfotextimage;
-}
-
-//-------------------------------------------------------------------
-bool vtkInfoTextImageInteractor::OnMouseMove()
-{
- int X,Y;
- wxVTKRenderWindowInteractor *wxVTKiren;
- wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor();
- wxVTKiren->GetEventPosition(X,Y);
-
- int z = (int)(_vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetVtkBaseData()->GetZ());
- double xx=X,yy=Y,zz=z;
- _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->TransfromeCoordScreenToWorld(xx,yy,zz);
-
-
- GetVtkInfoTextImage()->PutWindowLevel();
- GetVtkInfoTextImage()->PutColorLevel();
- GetVtkInfoTextImage()->PutPosition( (int)xx , (int)yy , (int)zz );
- GetVtkInfoTextImage()->PutPixelIntensity( (int)xx , (int)yy , (int)zz );
-
- this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
- return true;
-}
-
-//-------------------------------------------------------------------
-vtkInfoTextImage *vtkInfoTextImageInteractor::GetVtkInfoTextImage()
-{
- return _vtkinfotextimage;
-}
-
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-
-wxVtk2DBaseView::wxVtk2DBaseView(wxWindow *parent)
-:wxVtkBaseView(parent)
-{
- _imageViewer2XYZ = NULL;
- _vtkIinfoTextImage = NULL;
-}
-
-//EED 5mai2009
-//-------------------------------------------------------------------
-wxVtk2DBaseView::~wxVtk2DBaseView()
-{
- if (_vtkIinfoTextImage!=NULL)
- {
- delete _vtkIinfoTextImage;
- }
-
- if (_imageViewer2XYZ!=NULL)
- {
- delete _imageViewer2XYZ;
- }
-}
-
-//-------------------------------------------------------------------
-void wxVtk2DBaseView::TransformCoordinate_spacing_ViewToModel(double &X,double &Y, double &Z) // virtual
-{
-//EEDx5
- double spc[3];
-// GetVtkBaseData()->GetImageData()->GetSpacing(spc);
- this->_imageViewer2XYZ->GetVtkImageViewer2()->GetInput()->GetSpacing(spc);
-
- X = X / spc[0];
- Y = Y / spc[1];
- Z = Z / spc[2];
-
-}
-
-//-------------------------------------------------------------------
-void wxVtk2DBaseView::TransformCoordinate_spacing_ModelToView(double &X,double &Y, double &Z) // virtual
-{
-//EEDx5
- double spc[3];
-// GetVtkBaseData()->GetImageData()->GetSpacing(spc);
- this->_imageViewer2XYZ->GetVtkImageViewer2()->GetInput()->GetSpacing(spc);
-
- X=X*spc[0];
- Y=Y*spc[1];
- Z=Z*spc[2];
-
-}
-
-//-------------------------------------------------------------------
-void wxVtk2DBaseView::ResetView()
-{
- double spx,spy,spz;
- int x1,x2,y1,y2,z1,z2;
- wxVtkBaseView::Configure();
-
- wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
- vtkImageData *imageData = GetVtkBaseData()->GetImageData();
- imageData->UpdateInformation();
- imageData->SetUpdateExtent( imageData->GetWholeExtent());
- imageData->Update();
-
- _imageViewer2XYZ->GetVtkImageViewer2()->SetInput(imageData );
- imageData->GetSpacing (spx,spy,spz);
- imageData->GetExtent (x1,x2,y1,y2,z1,z2);
- _imageViewer2XYZ -> SetExtentDimension(x1,x2,y1,y2,z1,z2);
- _imageViewer2XYZ -> GetVtkImageViewer2()->SetupInteractor ( iren );
-
- _imageViewer2XYZ->GetVtkImageViewer2()->Render();
- SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
-
-}
-
-
-//-------------------------------------------------------------------
-void wxVtk2DBaseView::Configure(bool okimage)
-{
- double spx,spy,spz;
- int x1,x2,y1,y2,z1,z2;
- wxVtkBaseView::Configure();
-
-// EED 17 Oct 2007
- if (_imageViewer2XYZ==NULL)
- {
- _imageViewer2XYZ = new vtkImageViewer2_XYZ();
- wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
- _imageViewer2XYZ -> GetVtkImageViewer2()->SetupInteractor ( iren );
- SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
- }
-
-
- vtkImageData *imageData = GetVtkBaseData()->GetMarImageData()->GetImageData();
- if (imageData!=NULL){
- imageData->UpdateInformation();
- imageData->SetUpdateExtent( imageData->GetWholeExtent());
- imageData->Update();
- if (okimage==true){
- imageData->GetSpacing (spx,spy,spz);
- imageData->GetExtent (x1,x2,y1,y2,z1,z2);
-
-
- _imageViewer2XYZ->GetVtkImageViewer2()->SetInput(imageData );
- _imageViewer2XYZ->SetExtentDimension(x1,x2,y1,y2,z1,z2);
- double range[2];
- imageData->GetScalarRange(range);
- if (range[1]<20000){
- _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( (range[1]-range[0])/2 );
- _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( (range[1]+range[0])/4 );
- } else {
- _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow( 1000 );
- _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel( 500 );
- }
-// EED 31 Janvier 2007
-//vtkImageActor *vtkimageactor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor ();
-//vtkimageactor->InterpolateOff ();
-//vtkLookupTable * _collookup = vtkLookupTable::New( );
-//_collookup->SetNumberOfColors( 256 );
-//_collookup->SetTableRange( 0 , 255 );
-//_collookup->Build( );
-//_collookup->SetTableValue( 0 , 1 , 0 , 0 , 1 );
-//_collookup->SetTableValue(128 , 0 , 0 , 1 , 1 );
-//_collookup->SetTableValue(255 , 0 , 1 , 0 , 1 );
-//_imageViewer2XYZ->GetVtkImageViewer2()->GetWindowLevel ()->SetLookupTable(_collookup );
-
-
-// EED 17 Oct 2007
-// SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() );
-
-
- vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2();
- vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera();
-
-//EED 17Avril2009
-/*
- camera->SetViewUp ( spx*0 , -spy*1 , spz*0 );
- camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , -spz*10000 );
- camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
-*/
- camera->SetViewUp ( spx*0 , spy*1 , spz*0 );
- camera->SetPosition ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*10000 );
- camera->SetFocalPoint ( spx*(x1+x2)/2 , spy*(y1+y2)/2 , spz*0 );
-
-
- camera->SetClippingRange( 0.01 , 1000000 );
- camera->ComputeViewPlaneNormal();
- camera->SetParallelScale( spx*(x2-x1)/3.0 );
-
- // text information over the graphic window
- _vtkIinfoTextImage = new vtkInfoTextImage();
- _vtkIinfoTextImageInteractor = new vtkInfoTextImageInteractor();
- _vtkIinfoTextImage->SetWxVtk2DBaseView(this);
- _vtkIinfoTextImage->SetMarImageData( GetVtkBaseData()->GetMarImageData() );
- _vtkIinfoTextImageInteractor->SetModelVtkInfoTextImage(_vtkIinfoTextImage);
- _vtkIinfoTextImage->Configure();
- this->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(_vtkIinfoTextImageInteractor);
- } // okimage
- } // imageData
-
-}
-
-//-------------------------------------------------------------------
-
-int wxVtk2DBaseView::GetActualSlice() // virtual
-{
- return (int)(_vtkbasedata->GetZ());
-}
-
-//-------------------------------------------------------------------
-void wxVtk2DBaseView::SetActualSlice(int slice) // Virtual
-{
- _vtkbasedata->SetZ(slice);
-}
-
-//-------------------------------------------------------------------
-
-vtkBaseData *wxVtk2DBaseView::GetVtkBaseData()
-{
- return _vtkbasedata;
-}
-
-//-------------------------------------------------------------------
-
-void wxVtk2DBaseView::SetVtkBaseData(vtkBaseData *vtkbasedata)
-{
- _vtkbasedata=vtkbasedata;
-}
-
-//-------------------------------------------------------------------
-
-void wxVtk2DBaseView::Refresh()
-{
- int z = (int)(GetVtkBaseData()->GetZ());
- _imageViewer2XYZ->SetZSlice( z );
-
- wxVtkBaseView::Refresh();
-}
-
-//-------------------------------------------------------------------
-
-void wxVtk2DBaseView::SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview)
-{
- SetInteractorStyleBaseView(interactorstylebaseview);
-
- wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor();
- interactorstylebaseview->SetInteractor ( iren );
- iren->SetInteractorStyle(interactorstylebaseview);
- interactorstylebaseview->SetwxVtkBaseView(this);
-
- vtkMaracasImageViewer2Callback * cbk = vtkMaracasImageViewer2Callback::New();
- cbk->IV = _imageViewer2XYZ->GetVtkImageViewer2();
- interactorstylebaseview->AddObserver( vtkCommand::WindowLevelEvent, cbk );
- interactorstylebaseview->AddObserver( vtkCommand::StartWindowLevelEvent, cbk );
- interactorstylebaseview->AddObserver( vtkCommand::ResetWindowLevelEvent, cbk );
- cbk->Delete();
-}
-
-//---------------------------------------------------------------------------
-vtkRenderer* wxVtk2DBaseView::GetRenderer() // virtual
-{
- return _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer();
-}
-//---------------------------------------------------------------------------
-vtkRenderWindow* wxVtk2DBaseView::GetRenWin() // virtual
-{
- return _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderWindow();
-}
-
-//-------------------------------------------------------------------
-
-void wxVtk2DBaseView::GetSpacing(double spc[3]) // virtual
-{
- vtkImageData *imageData = GetVtkBaseData()->GetImageData();
- imageData->GetSpacing(spc);
-}
-
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-//-------------------------------------------------------------------
-
-
-
-
-wxVtk3DBaseView::wxVtk3DBaseView(wxWindow *parent)
-:wxVtkBaseView( parent )
-{
- _configure = false;
- _aRenderer = NULL;
- _renWin = NULL;
- _aCamera = NULL;
-}
-//-------------------------------------------------------------------
-wxVtk3DBaseView::~wxVtk3DBaseView()
-{
- if (_aCamera!=NULL) { _aCamera -> Delete(); }
- if (_aRenderer!=NULL) { _aRenderer -> Delete(); }
- if (_renWin!=NULL) { _renWin -> Delete(); }
-}
-//-------------------------------------------------------------------
-vtkCamera* wxVtk3DBaseView::GetCamera()
-{
- return _aCamera;
-}
-//-------------------------------------------------------------------
-vtkRenderer* wxVtk3DBaseView::GetRenderer() // virtual
-{
- return _aRenderer;
-}
-//-------------------------------------------------------------------
-vtkRenderWindow* wxVtk3DBaseView::GetRenWin() // virtual
-{
- return _renWin;
-}
-//-------------------------------------------------------------------
-void wxVtk3DBaseView::Refresh()
-{
-// _renWin->Render();
- vtkRenderWindowInteractor *vri = GetWxVTKRenderWindowInteractor();
- vri->vtkRenderWindowInteractor::Render();
-}
-//-------------------------------------------------------------------
-void wxVtk3DBaseView::Configure()
-{
- if (_configure==false)
- {
- _configure=true;
- //wxVtkBaseView::Configure();
- _aRenderer = vtkRenderer::New();
- _renWin = vtkRenderWindow::New();
- _renWin->AddRenderer(_aRenderer);
-
-
-// _renWin->SetStereoCapableWindow(1);
-// // //renderwindow->SetStereoTypeToCrystalEyes();
-// _renWin->SetStereoTypeToRedBlue();
-// _renWin->SetStereoRender(1);
-
- GetWxVTKRenderWindowInteractor()->SetRenderWindow(_renWin);
-
-
-// EED Borrame
-// vtkInteractorStyle3DMaracas *interactorStyle3DMaracas = vtkInteractorStyle3DMaracas::New();
- vtkInteractorStyleBaseView3D *interactorStyleBaseView3D = vtkInteractorStyleBaseView3D::New();
-
- SetInteractorStyleBaseView( interactorStyleBaseView3D );
- interactorStyleBaseView3D->SetInteractor ( GetWxVTKRenderWindowInteractor() );
- GetWxVTKRenderWindowInteractor()->SetInteractorStyle( interactorStyleBaseView3D );
- interactorStyleBaseView3D->SetwxVtkBaseView(this);
-
-
-/* EED Borrame
- vtkInteractorStyleSwitch *iss = dynamic_cast<vtkInteractorStyleSwitch*>(_iren->GetInteractorStyle());
- iss->SetCurrentStyleToTrackballCamera();
-*/
-
- // It is convenient to create an initial view of the data. The
- // FocalPoint and Position form a vector direction. Later on
- // (ResetCamera() method) this vector is used to position the camera
- // to look at the data in this direction.
- _aCamera = vtkCamera::New();
-
-//EED 17Avril2009
-/*
- _aCamera->SetViewUp (0, 0, -1);
- _aCamera->SetPosition (0, 1, 0);
- */
- _aCamera->SetViewUp (0, 1, 0);
- _aCamera->SetPosition (0, 0, 1);
-
- _aCamera->SetFocalPoint (0, 0, 0);
- _aCamera->ComputeViewPlaneNormal();
-
- }
-}
-//-------------------------------------------------------------------
-//EED 27 sep 2006
-void wxVtk3DBaseView::GetSpacing(double spc[3])
-{
- spc[0]=1;
- spc[1]=1;
- spc[2]=1;
-}
#include <vector>
#include "marTypes.h"
+#include "wxVTKRenderWindowInteractor.h"
+//#include "include/vtkImageViewer2_XYZ.h"
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-class creaMaracasVisu_EXPORT vtkImageViewer2_XYZ{
-public:
- vtkImageViewer2_XYZ();
- ~vtkImageViewer2_XYZ();
-
- void SetExtentDimension(int x1,int x2, int y1,int y2, int z1,int z2);
- void SetXSlice(int slice);
- void SetYSlice(int slice);
- void SetZSlice(int slice);
- int GetXSlice();
- int GetYSlice();
- int GetZSlice();
- vtkImageViewer2 *GetVtkImageViewer2();
-
-private:
- int _x1,_x2,_y1,_y2,_z1,_z2;
- vtkImageViewer2 *_vtkimageviewer2;
-protected:
-};
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class wxVtkBaseView;
-
-class creaMaracasVisu_EXPORT wxVTKRenderWindowInteractorPlus : public wxVTKRenderWindowInteractor
-{
-public:
- wxVTKRenderWindowInteractorPlus(wxWindow *parent ,wxVtkBaseView *_wxvtkbaseview);
- virtual ~wxVTKRenderWindowInteractorPlus();
-
- wxVTKRenderWindowInteractorPlus();
- void OnLeftDClick( wxMouseEvent& event );
- void OnRightDClick( wxMouseEvent& event );
- void OnMiddleDClick( wxMouseEvent& event );
- void OnMouseWheel( wxMouseEvent& event );
-
-
- // VTK
- static wxVTKRenderWindowInteractorPlus * New();
+/* JCP 14/05/09
+//#include "vtkInteractorStyleBaseView.h"
+//class vtkInteractorStyleBaseView;
+ */
-protected:
-private:
- wxVtkBaseView *_wxvtkbaseview;
- DECLARE_EVENT_TABLE( );
+#include "vtkInteractorStyleImage.h"
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-class vtkInteractorStyleBaseView;
class creaMaracasVisu_EXPORT wxVtkBaseView{
virtual vtkRenderer* GetRenderer();
virtual vtkRenderWindow* GetRenWin();
virtual void TransfromeCoordScreenToWorld(double &X, double &Y, double &Z, int type=2);
+ /* JCP 04/05/09
void SetInteractorStyleBaseView( vtkInteractorStyleBaseView* interactorStyle);
- vtkInteractorStyleBaseView* GetInteractorStyleBaseView();
+ */
+ void SetInteractorStyleBaseView( vtkInteractorStyleImage* interactorStyle);
+ /* JCP 04/05/09
+ *
+ vtkInteractorStyleBaseView* GetInteractorStyleBaseView();
+ */
+ vtkInteractorStyleImage* GetInteractorStyleBaseView();
virtual void GetSpacing(double spc[3]);
private:
wxWindow *_parent;
wxVTKRenderWindowInteractor *_iren;
- vtkInteractorStyleBaseView *_interactorStyle;
-protected:
-
-};
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInteractorStyleBaseView;
-class manualInteractorWindowLevel;
-class vtkInfoTextImage;
-class vtkInfoTextImageInteractor;
-
-//------------------------------------------------------------------
-
-
-class creaMaracasVisu_EXPORT wxVtk2DBaseView: public wxVtkBaseView{
-public:
- wxVtk2DBaseView(wxWindow *parent);
- virtual ~wxVtk2DBaseView();
- virtual void Configure(bool okimage=true);
- vtkImageViewer2_XYZ* _imageViewer2XYZ;
- vtkBaseData* GetVtkBaseData();
- void SetVtkBaseData(vtkBaseData *vtkbasedata);
- virtual void Refresh();
- virtual void ResetView();
- virtual int GetActualSlice();
- virtual void SetActualSlice(int slice);
- void SetInteractorStyleImage(vtkInteractorStyleBaseView *interactorstylebaseview);
-
- virtual vtkRenderer* GetRenderer();
- virtual vtkRenderWindow* GetRenWin();
- virtual void TransformCoordinate_spacing_ViewToModel(double &X,double &Y, double &Z);
- virtual void TransformCoordinate_spacing_ModelToView(double &X,double &Y, double &Z);
- virtual void GetSpacing(double spc[3]);
-
-
-private:
- vtkBaseData *_vtkbasedata;
-
- vtkInfoTextImage *_vtkIinfoTextImage;
- vtkInfoTextImageInteractor *_vtkIinfoTextImageInteractor;
-
+ /**
+ * JCP 04/05/09
+ * vtkInteractorStyleImage *_interactorStyle;
+ */
+ vtkInteractorStyleImage *_interactorStyle;
protected:
};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-//------------------------------------------------------------------
-
-class creaMaracasVisu_EXPORT InteractorStyleMaracas
-{
-public:
- InteractorStyleMaracas();
- virtual ~InteractorStyleMaracas();
-
- virtual InteractorStyleMaracas * Clone();
- void CopyAttributesTo( InteractorStyleMaracas *cloneObject );
-
-
- virtual bool OnChar();
- virtual bool OnMouseMove();
- virtual bool OnLeftButtonDown();
- virtual bool OnLeftButtonUp();
- virtual bool OnMiddleButtonDown();
- virtual bool OnMiddleButtonUp();
- virtual bool OnRightButtonDown();
- virtual bool OnRightButtonUp();
-
- virtual bool OnLeftDClick();
- virtual bool OnRightDClick();
- virtual bool OnMiddleDClick();
- virtual bool OnMouseWheel();
-
-
- void SetVtkInteractorStyleBaseView(vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView);
- void RemoveVtkInteractorStyleBaseView();
- void SetActive(bool active);
- bool GetActive();
-
-protected:
- vtkInteractorStyleBaseView* _vtkInteractorStyleBaseView;
-private:
- bool _active;
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-
-
-class creaMaracasVisu_EXPORT manualInteractorWindowLevel : public InteractorStyleMaracas {
-public:
- manualInteractorWindowLevel();
- virtual ~manualInteractorWindowLevel();
-protected:
-
- bool _stateWindowLevel;
- int _backPx;
- int _backPy;
- int _backWindow;
- int _backLevel;
-
- virtual bool OnMouseMove();
- virtual bool OnMiddleButtonDown();
- virtual bool OnMiddleButtonUp();
-};
-
-
//------------------------------------------------------------------
//------------------------------------------------------------------
//------------------------------------------------------------------
-class vtkInfoTextImage{
-public:
- vtkInfoTextImage();
- ~vtkInfoTextImage();
- void SetWxVtk2DBaseView(wxVtk2DBaseView *wxvtk2Dbaseview);
- void SetMarImageData(marImageData *marimagedata);
- void Configure();
- void PutPixelIntensity(int x, int y, int z);
- void PutPosition(int x, int y, int z);
- void PutColorLevel();
- void PutWindowLevel();
-protected:
-private:
-
- marImageData *_marimagedata;
- wxVtk2DBaseView *_wxvtk2Dbaseview;
- vtkTextActor *_vtkText_WindowLevel;
- vtkTextActor *_vtkText_ColorLevel;
- vtkTextActor *_vtkText_position;
- vtkTextActor *_vtkText_pixelIntensity;
-
- vtkTextActor *Create_Text_Label(int px, int py);
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInfoTextImageInteractor : public InteractorStyleMaracas{
-public:
- vtkInfoTextImageInteractor();
- virtual ~vtkInfoTextImageInteractor();
- void SetModelVtkInfoTextImage(vtkInfoTextImage *vtkinfotextimage);
- vtkInfoTextImage *GetVtkInfoTextImage();
-
-protected:
-
- virtual bool OnMouseMove();
-
-private:
- vtkInfoTextImage *_vtkinfotextimage;
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class vtkInteractorScrollZ : public InteractorStyleMaracas {
-public:
- vtkInteractorScrollZ();
- virtual ~vtkInteractorScrollZ();
-
- virtual bool OnMouseMove();
- virtual bool OnRightButtonDown();
- virtual bool OnRightButtonUp();
-
-
-
-protected:
- bool _stateFordware;
- int _fordwareX;
- int _fordwareY;
- int _sliceZ;
-
-private:
-
-};
-
-
-
-
-
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class wxVtk3DBaseView;
-
-class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView : public vtkInteractorStyleImage
-{
-public:
- vtkInteractorStyleBaseView();
- ~vtkInteractorStyleBaseView();
- static vtkInteractorStyleBaseView *New();
- virtual void OnChar();
- virtual void OnMouseMove();
- virtual void OnLeftButtonDown();
- virtual void OnLeftButtonUp();
- virtual void OnMiddleButtonDown();
- virtual void OnMiddleButtonUp();
- virtual void OnRightButtonDown();
- virtual void OnRightButtonUp();
-
- virtual void OnLeftDClick();
- virtual void OnRightDClick();
- virtual void OnMiddleDClick();
- virtual void OnMouseWheel();
-
- virtual void TransformCoordinate(double &X, double &Y, double &Z);
- void AddInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
- void RemoveInteractorStyleMaracas(InteractorStyleMaracas* interactorStyleMaracas);
- void InsertInteractorStyleMaracas(int pos, InteractorStyleMaracas* interactorStyleMaracas);
- void CallLstInteractorStyleMaracas(int type);
-
- wxVtk2DBaseView *GetWxVtk2DBaseView();
- wxVtk3DBaseView *GetWxVtk3DBaseView();
- void SetwxVtkBaseView(wxVtkBaseView *wxvtkbaseview);
- void SetActiveAllInteractors(bool ok);
-
- void SetRefresh_waiting();
- void SetParent_refresh_waiting();
-
- bool GetRefresh_waiting();
- bool GetParent_refresh_waiting();
-
-
- void EvaluateToRefresh();
- void BlockRefresh();
- void UnBlockRefresh();
-
-protected:
- std::vector< InteractorStyleMaracas* > _lstInteractorStyleMaracas;
-
-private:
- bool _blockRefresh;
- bool _refresh_waiting;
- bool _parent_refresh_waiting;
- wxVtkBaseView *_wxvtkbaseview;
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView2D : public vtkInteractorStyleBaseView{
-public:
- vtkInteractorStyleBaseView2D();
- ~vtkInteractorStyleBaseView2D();
- static vtkInteractorStyleBaseView2D *New();
- virtual void OnMouseMove();
- virtual void OnLeftButtonDown();
- virtual void OnLeftButtonUp();
- virtual void OnMiddleButtonDown();
- virtual void OnMiddleButtonUp();
- virtual void OnRightButtonDown();
- virtual void OnRightButtonUp();
-
-
-protected:
-
-private:
- manualInteractorWindowLevel *_manualinteractorwindowlevel;
- vtkInteractorScrollZ *_vtkInteractorScrollZ;
-
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class creaMaracasVisu_EXPORT vtkInteractorStyleBaseView3D : public vtkInteractorStyleBaseView {
-public:
- vtkInteractorStyleBaseView3D();
- ~vtkInteractorStyleBaseView3D();
- static vtkInteractorStyleBaseView3D *New();
-
- virtual void OnMouseMove () ;
- virtual void OnLeftButtonDown ();
- virtual void OnLeftButtonUp () ;
- virtual void OnMiddleButtonDown ();
- virtual void OnMiddleButtonUp () ;
- virtual void OnRightButtonDown () ;
- virtual void OnRightButtonUp () ;
-
-private:
-
-};
-
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-//------------------------------------------------------------------
-
-class creaMaracasVisu_EXPORT wxVtk3DBaseView: public wxVtkBaseView{
-public:
- wxVtk3DBaseView( wxWindow *parent );
- virtual ~wxVtk3DBaseView();
- vtkCamera* GetCamera();
- virtual vtkRenderer* GetRenderer();
- virtual vtkRenderWindow* GetRenWin();
- void Refresh();
- void Configure();
- virtual void GetSpacing(double spc[3]);
-
-private:
- bool _configure;
- vtkRenderer *_aRenderer;
- vtkRenderWindow *_renWin;
- vtkCamera *_aCamera;
-protected:
-};
-
#endif // __WX_VTK__BASE__VIEW__H
--- /dev/null
+#include "wxVtkClipping3DView.h"
+
+#include "wxVtkClipping3DViewCntrlPanel.h"
+
+wxVtkClipping3DView::wxVtkClipping3DView(wxVtk3DBaseView* wxvtk3Dbaseview)
+{
+ _wxvtk3Dbaseview = wxvtk3Dbaseview;
+ _vtkclipping3Ddataviewer = NULL;
+ _wxvtkclipping3DviewCntrlPanel = NULL;
+
+ _boxWidgetVolume = NULL;
+ _boxWidgetS1 = NULL;
+}
+
+//-------------------------------------------------------------------
+wxVtkClipping3DView::~wxVtkClipping3DView(){
+ if (_boxWidgetVolume!=NULL) { _boxWidgetVolume -> Delete(); }
+ if (_boxWidgetS1!=NULL) { _boxWidgetS1 -> Delete(); }
+ if (_vtkclipping3Ddataviewer!=NULL) { delete _vtkclipping3Ddataviewer; }
+ if (_wxvtkclipping3DviewCntrlPanel!=NULL){ delete _wxvtkclipping3DviewCntrlPanel; }
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DView::SetVisibleBoxSurface(bool visible)
+{
+ if (visible==true){
+ _boxWidgetS1->On();
+ } else {
+ _boxWidgetS1->Off();
+ }
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DView::SetVisibleBoxVolume(bool visible)
+{
+ if (_boxWidgetVolume!=NULL){
+ if (visible==true){
+ _boxWidgetVolume->On();
+ } else {
+ _boxWidgetVolume->Off();
+ }
+ }
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DView::Refresh()
+{
+ _vtkclipping3Ddataviewer->Refresh();
+ if (_wxvtkclipping3DviewCntrlPanel!=NULL)
+ {
+ _wxvtkclipping3DviewCntrlPanel->Refresh();
+ }
+}
+//-------------------------------------------------------------------
+wxPanel* wxVtkClipping3DView::CreateControlPanel(wxWindow *parent)
+{
+ _wxvtkclipping3DviewCntrlPanel = new wxVtkClipping3DViewCntrlPanel(parent,this);
+ return _wxvtkclipping3DviewCntrlPanel;
+}
+//-------------------------------------------------------------------
+vtkClipping3DDataViewer* wxVtkClipping3DView::GetVtkClipping3DDataViewer()
+{
+ return _vtkclipping3Ddataviewer;
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DView::VisibleActor(int idTissue, bool visTissue){
+ if (visTissue!=_vtkclipping3Ddataviewer->GetVisibleTissue(idTissue)){
+ if (visTissue==false){
+ _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkclipping3Ddataviewer->GetTissueActor(idTissue) );
+ } else {
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(idTissue) );
+// _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(idTissue) );
+// _actor->VisibilityOn();
+ }
+ _vtkclipping3Ddataviewer->SetVisibleTissue(idTissue,visTissue);
+ }
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DView::SetRepSurfaceWireFrame(int idTissue , bool representationType )
+{
+ vtkActor *tmpActor;
+ tmpActor = GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
+
+ if (representationType==false){
+ tmpActor->GetProperty()->SetRepresentationToWireframe();
+ } else {
+ tmpActor->GetProperty()->SetRepresentationToSurface();
+ }
+
+ _vtkclipping3Ddataviewer->SetRepresentationType(idTissue,representationType);
+}
+
+//-------------------------------------------------------------------
+void wxVtkClipping3DView::VisibleVolumeActor( bool visVolume){
+ if (visVolume!=_vtkclipping3Ddataviewer->GetVisibleVolume() ){
+ if (visVolume==false){
+//EED 31/03/2008
+// _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkclipping3Ddataviewer->GetVolumeActor() );
+ _wxvtk3Dbaseview->GetRenderer()->RemoveVolume( _vtkclipping3Ddataviewer->GetVolumeActor() );
+ } else {
+//EED 31/03/2008
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetVolumeActor() );
+ _wxvtk3Dbaseview->GetRenderer()->AddVolume( _vtkclipping3Ddataviewer->GetVolumeActor() );
+ }
+ _vtkclipping3Ddataviewer->SetVisibleVolume(visVolume);
+ }
+}
+//-------------------------------------------------------------------
+wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*)
+{
+ if(_wxvtk3Dbaseview==NULL){
+ throw "wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
+ }
+ return _wxvtk3Dbaseview;
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DView::Configure(){
+ _wxvtk3Dbaseview->Configure();
+
+ // Actors are added to the renderer.
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetOutlineActor() );
+
+ _boxWidgetS1 = vtkBoxWidget::New();
+ _boxWidgetS1->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() );
+ _boxWidgetS1->SetPlaceFactor(1.25);
+
+
+
+ vtkStripper *stripper=_vtkclipping3Ddataviewer->GetTissueStripper(0);
+ vtkPolyData *polydata= stripper->GetOutput();
+
+
+ _boxWidgetS1->SetInput( polydata );
+ _boxWidgetS1->PlaceWidget();
+
+ int i;
+ for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++)
+ {
+ _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverS(i) );
+ }
+
+
+
+
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(0) );
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkclipping3Ddataviewer->GetTissueActor(3));
+
+ VisibleActor(0, false );
+ VisibleActor(1, false );
+ VisibleActor(2, false );
+ VisibleActor(3, false );
+
+ _boxWidgetS1->HandlesOn ();
+
+//EED 29Mars2009
+// _boxWidgetS1->On();
+
+ _boxWidgetS1->Off();
+
+ _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(0) );
+ _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(1) );
+ _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(2) );
+ _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(3) );
+
+// EED 9 fev 2007
+// box Volume
+ _boxWidgetVolume = vtkBoxWidget::New();
+ _boxWidgetVolume->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() );
+ _boxWidgetVolume->SetPlaceFactor(1.25);
+
+ _boxWidgetVolume->SetInput( this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData() );
+ _boxWidgetVolume->PlaceWidget();
+
+ _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverV() );
+
+ _boxWidgetVolume->HandlesOn ();
+
+//EED 29Mars2009
+// _boxWidgetVolume->On();
+
+ _boxWidgetVolume->Off();
+
+
+// vtkPlanes *vtkplanes=this->GetVtkClipping3DDataViewer()->GetVolumePlanes();
+// _boxWidgetVolume->GetPlanes( vtkplanes );
+
+
+ // An initial camera view is created. The Dolly() method moves
+ // the camera towards the FocalPoint, thereby enlarging the image.
+ _wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera());
+ _wxvtk3Dbaseview->GetRenderer()->ResetCamera ();
+ _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
+
+ // Set a background color for the renderer and set the size of the
+ // render window (expressed in pixels).
+ _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.36 , 0.36 , 0.36 );
+ _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400);
+
+ // Note that when camera movement occurs (as it does in the Dolly()
+ // method), the clipping planes often need adjusting. Clipping planes
+ // consist of two planes: near and far along the view direction. The
+ // near plane clips out objects in front of the plane; the far plane
+ // clips out objects behind the plane. This way only what is drawn
+ // between the planes is actually rendered.
+ _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange();
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DView::SetVtkClipping3DDataViewer(vtkClipping3DDataViewer *vtkclipping3Ddataviewer)
+{
+ _vtkclipping3Ddataviewer = vtkclipping3Ddataviewer;
+}
--- /dev/null
+#ifndef WXVTKCLIPPING3DVIEW_H_
+#define WXVTKCLIPPING3DVIEW_H_
+
+#include "vtkClipping3DDataViewer.h"
+#include "wxVtk3DBaseView.h"
+#include "wx/wx.h"
+//#include "wxVtkClipping3DViewCntrlPanel.h"
+//class wxVtkClipping3DViewCntrlPanel;
+
+class wxVtkClipping3DView
+{
+public:
+ wxVtkClipping3DView( wxVtk3DBaseView* wxvtk3Dbaseview );
+ virtual ~wxVtkClipping3DView();
+ virtual void Refresh();
+ virtual void Configure();
+ void SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer );
+ wxPanel* CreateControlPanel(wxWindow *parent);
+ vtkClipping3DDataViewer* GetVtkClipping3DDataViewer();
+
+ void VisibleActor(int idTissue, bool visTissue);
+ void VisibleVolumeActor( bool visVolume );
+ void SetVisibleBoxSurface(bool visible);
+ void SetVisibleBoxVolume(bool visible);
+ void SetRepSurfaceWireFrame(int idTissue , bool typeRepresentation );
+
+ wxVtk3DBaseView* GetWxvtk3Dbaseview()throw(char*);
+
+private:
+ wxVtk3DBaseView *_wxvtk3Dbaseview;
+ vtkClipping3DDataViewer *_vtkclipping3Ddataviewer;
+ vtkBoxWidget *_boxWidgetS1;
+ vtkBoxWidget *_boxWidgetVolume;
+ wxPanel *_wxvtkclipping3DviewCntrlPanel;
+protected:
+};
+
+#endif /*WXVTKCLIPPING3DVIEW_H_*/
--- /dev/null
+
+#include "wxVtkClipping3DViewCntrlPanel.h"
+#include "wx/colordlg.h"
+#include "vtkTriangleFilter.h"
+#include "vtkPolyDataConnectivityFilter.h"
+#include "vtkClosePolyData.h"
+#include "vtkSTLWriter.h"
+#include "HistogramDialog.h"
+#include "marDicomBase.h"
+
+wxVtkClipping3DViewCntrlPanel::wxVtkClipping3DViewCntrlPanel(wxWindow *parent, wxVtkClipping3DView *wxvtkclipping3Dview )
+: wxPanel(parent, -1)
+{
+ wxPanel *panel = this;
+ _wxvtkclipping3Dview = wxvtkclipping3Dview;
+
+//EEDx2.6
+// wxStaticText *text1 = new wxStaticText(panel, -1,_T(" "));
+// wxStaticText *text2 = new wxStaticText(panel, -1,_T(" "));
+
+ _surfA = new wxRadioButton(panel,-1,_T("A"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+ _surfB = new wxRadioButton(panel,-1,_T("B"));
+ _surfC = new wxRadioButton(panel,-1,_T("C"));
+ _surfD = new wxRadioButton(panel,-1,_T("D"));
+
+ wxCheckBox *ckVolum = new wxCheckBox(panel,-1,_T("Vol"));
+ wxCheckBox *ckBoxSurface = new wxCheckBox(panel,-1,_T("Surface Box"));
+ wxCheckBox *ckBoxVolume = new wxCheckBox(panel,-1,_T("Volume Box"));
+
+ _color = new wxButton(panel,-1,_T(""));
+ _visible = new wxCheckBox(panel,-1,_T("Vis"));
+ _opacity = new wxSlider(panel,-1,50,0,100, wxDefaultPosition, wxSize(800,40), wxSL_HORIZONTAL | wxSL_LABELS);
+
+ wxStaticText *isoValueTitle = new wxStaticText(panel,-1,_T("isoValue"));
+ _isoValue = new wxSlider(panel,-1,2000,110,2000, wxDefaultPosition, wxSize(800,40), wxSL_HORIZONTAL | wxSL_AUTOTICKS | wxSL_LABELS);
+
+
+ _wireFrameRep = new wxRadioButton(panel,-1,_T("WireFrame"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);
+ _surfaceRep = new wxRadioButton(panel,-1,_T("Surface"));
+
+
+ double range[2];
+ vtkImageData *vtkimagedata = wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+ vtkimagedata->GetScalarRange( range );
+ _isoValue->SetRange( (int)(range[1]*0.1) , (int)(range[1]) );
+ _isoValue->SetValue( (int)(wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIsovalue(0)) );
+
+
+ _isoValue->SetTickFreq(25,0);
+
+ _isoValueSpin = new wxSlider(panel , -1,5,1,10,wxDefaultPosition , wxSize(25,45), wxSL_VERTICAL | wxSL_AUTOTICKS |wxSL_LEFT );
+ _isoValueSpin->SetRange(1,8);
+ _isoValueSpin->SetValue(5);
+ Connect(_isoValueSpin->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin );
+
+ wxButton *btnSTL = new wxButton(panel,-1,_T("Create STL File"));
+ wxButton *btnSaveRaw = new wxButton(panel,-1,_T("Save Raw Volume"));
+
+ wxButton *btnVolumeFunctions = new wxButton(panel,-1,_T("Read Volume Functions"));
+
+
+ Connect(btnSTL->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL );
+ Connect(btnSaveRaw->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume );
+ Connect(btnVolumeFunctions->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions );
+
+
+ wxButton *btnMeshVTKLoad = new wxButton(panel,-1,_T("Load Mesh"));
+ Connect(btnMeshVTKLoad->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad );
+
+
+/*
+ int maxX = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionX();
+ int maxY = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionY();
+ int maxZ = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionZ();
+ wxCheckBox *ckBoxX = new wxCheckBox(panel,-1,"X");
+ _positionX = new wxSlider(panel,-1,maxX/2,0,maxX, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
+ wxCheckBox *ckBoxY = new wxCheckBox(panel,-1,"Y");
+ _positionY = new wxSlider(panel,-1,maxY/2,0,maxY, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
+ wxCheckBox *ckBoxZ = new wxCheckBox(panel,-1,"Z");
+ _positionZ = new wxSlider(panel,-1,maxZ/2,0,maxZ, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
+*/
+
+// ckVolum->Enable(false);
+ ckBoxSurface->SetValue(false);
+ ckBoxVolume->SetValue(false);
+ _color->SetSize(40,20);
+ _opacity->SetSize(370,20);
+// ckBoxX->SetValue(true);
+// ckBoxY->SetValue(true);
+// ckBoxZ->SetValue(true);
+ _surfA->SetValue(true);
+ _wireFrameRep->SetValue(false);
+ _surfaceRep->SetValue(true);
+ _visible->SetValue(false);
+// _positionX->SetSize(400,20);
+// _positionY->SetSize(400,20);
+// _positionZ->SetSize(400,20);
+
+ Connect(ckVolum->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleVolume );
+ Connect(ckBoxVolume->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume );
+
+ Connect(_surfA->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface );
+ Connect(_surfB->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface );
+ Connect(_surfC->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface );
+ Connect(_surfD->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnSurface );
+ Connect(ckBoxSurface->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleBoxSurface );
+
+ Connect(_wireFrameRep->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnRepresentationSurfaceWireFrame );
+ Connect(_surfaceRep->GetId() , wxEVT_COMMAND_RADIOBUTTON_SELECTED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnRepresentationSurfaceWireFrame );
+
+ Connect(_color->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnColor );
+ Connect(_visible->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnVisibleSurface );
+ Connect(_opacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnOpacity );
+
+//EED 27Dic2007
+// Connect(_isoValue->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValue );
+ Connect(_isoValue->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxVtkClipping3DViewCntrlPanel::OnIsoValue );
+
+/*
+ Connect(ckBoxX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX );
+ Connect(_positionX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionX );
+ Connect(ckBoxY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY );
+ Connect(_positionY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionY );
+ Connect(ckBoxZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ );
+ Connect(_positionZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionZ );
+*/
+
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer *sizerH0 = new wxFlexGridSizer(20);
+ wxFlexGridSizer *sizerH1 = new wxFlexGridSizer(20);
+ wxFlexGridSizer *sizerH2 = new wxFlexGridSizer(10);
+ wxFlexGridSizer *sizerH3 = new wxFlexGridSizer(10);
+ //wxFlexGridSizer *sizerH4 = new wxFlexGridSizer(10); // JPRx
+ //wxFlexGridSizer *sizerH5 = new wxFlexGridSizer(10); // JPRx
+ //wxFlexGridSizer *sizerH6 = new wxFlexGridSizer(10); // JPRx
+
+ sizerH0->Add( ckVolum , 1, wxALL|wxEXPAND, 0);
+ sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH0->Add( ckBoxVolume , 1, wxALL|wxEXPAND, 0);
+ sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH0->Add( btnVolumeFunctions , 1, wxALL|wxEXPAND, 0);
+ sizerH0->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH0->Add( btnMeshVTKLoad , 1, wxALL|wxEXPAND, 0);
+
+
+ sizerH1->Add( _surfA , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( _surfB , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( _surfC , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( _surfD , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( ckBoxSurface , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( btnSTL , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH1->Add( btnSaveRaw , 1, wxALL|wxEXPAND, 0);
+
+
+// sizerH2->Add( new wxStaticText(panel, -1,_T(" ") , 1, wxALL|wxEXPAND, 0);
+ sizerH2->Add( _color , 1, wxALL|wxEXPAND, 0);
+ sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH2->Add( _visible , 1, wxALL|wxEXPAND, 0);
+ sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+
+
+ sizerH2->Add( _wireFrameRep , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0);
+ sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+ sizerH2->Add( _surfaceRep , 1,wxSHAPED | wxALIGN_CENTER_VERTICAL , 0);
+ sizerH2->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+
+ sizerH2->Add( _opacity , 1, wxALL|wxEXPAND, 0);
+
+
+ sizerH3->Add( isoValueTitle , 1, wxALL|wxEXPAND, 0);
+ sizerH3->Add( _isoValueSpin , 1, wxALL|wxEXPAND, 0);
+ sizerH3->Add( _isoValue , 1, wxALL|wxEXPAND, 0);
+
+/*
+ sizerH4->Add( ckBoxX , 1, wxALL|wxEXPAND, 0);
+ sizerH4->Add( text2 , 1, wxALL|wxEXPAND, 0);
+ sizerH4->Add( _positionX , 1, wxALL|wxEXPAND, 0);
+
+ sizerH5->Add( ckBoxY , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( text2 , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( _positionY , 1, wxALL|wxEXPAND, 0);
+
+ sizerH6->Add( ckBoxZ , 1, wxALL|wxEXPAND, 0);
+ sizerH6->Add( text2 , 1, wxALL|wxEXPAND, 0);
+ sizerH6->Add( _positionZ , 1, wxALL|wxEXPAND, 0);
+*/
+ sizer->Add( sizerH0 , 1, wxALL|wxEXPAND, 2);
+ sizer->Add( sizerH1 , 1, wxALL|wxEXPAND, 2);
+ sizer->Add( sizerH2 , 1, wxALL|wxEXPAND, 2);
+ sizer->Add( sizerH3 , 1, wxALL|wxEXPAND, 2);
+// sizer->Add( sizerH4 , 1, wxALL|wxEXPAND, 2);
+// sizer->Add( sizerH5 , 1, wxALL|wxEXPAND, 2);
+// sizer->Add( sizerH6 , 1, wxALL|wxEXPAND, 2);
+
+ panel->SetSize(300,60);
+ panel->SetAutoLayout(true);
+ panel->SetSizer(sizer);
+ panel->Layout();
+
+ panel->SetEventHandler((wxEvtHandler*)this);
+
+}
+//-------------------------------------------------------------------
+wxVtkClipping3DViewCntrlPanel::~wxVtkClipping3DViewCntrlPanel()
+{
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::Refresh()
+{
+// wxPanel::Refresh();
+/*
+ _positionX->SetValue( _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetX( ) );
+ _positionY->SetValue( _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetY( ) );
+ _positionZ->SetValue( _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetZ( ) );
+*/
+}
+//-------------------------------------------------------------------
+int wxVtkClipping3DViewCntrlPanel::GetIdTissue()
+{
+ int idTissue=-1;
+ if (_surfA->GetValue()==true)
+ {
+ idTissue=0;
+ }
+ if (_surfB->GetValue()==true)
+ {
+ idTissue=1;
+ }
+ if (_surfC->GetValue()==true)
+ {
+ idTissue=2;
+ }
+ if (_surfD->GetValue()==true)
+ {
+ idTissue=3;
+ }
+
+ return idTissue;
+}
+/*
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnVisibleAxisX(wxCommandEvent& event)
+{
+ _wxvtkclipping3Dview->VisibleImageActor(0, event.IsChecked() );
+ _wxvtkclipping3Dview->Refresh();
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnVisibleAxisY(wxCommandEvent& event)
+{
+ _wxvtkclipping3Dview->VisibleImageActor(1, event.IsChecked() );
+ _wxvtkclipping3Dview->Refresh();
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnVisibleAxisZ(wxCommandEvent& event)
+{
+ _wxvtkclipping3Dview->VisibleImageActor(2, event.IsChecked() );
+ _wxvtkclipping3Dview->Refresh();
+}
+*/
+
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnSurface(wxCommandEvent& event)
+{
+ int idTissue=GetIdTissue();
+ if (idTissue!=-1)
+ {
+ // Color
+ vtkActor *tmpActor;
+ tmpActor = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
+ double rgb[3];
+ tmpActor->GetProperty()->GetColor( rgb );
+ wxColour colour( (int)(rgb[0]*255) , (int)(rgb[1]*255) , (int)(rgb[2]*255) );
+ _color->SetBackgroundColour(colour);
+
+ // Visible
+ _visible->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVisibleTissue(idTissue));
+
+ // Opacity
+ _opacity->SetValue( (int)(tmpActor->GetProperty()->GetOpacity()*100) );
+
+ // Representation Type WireFrame / Surface
+ _surfaceRep->SetValue(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
+ _wireFrameRep->SetValue(!_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRepresentationType(idTissue));
+
+ // isoValue
+ int isoValue= (int)(_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIsovalue(idTissue));
+ _isoValue->SetValue(isoValue);
+ }
+}
+
+
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnRepresentationSurfaceWireFrame(wxCommandEvent& event)
+{
+ int idTissue=GetIdTissue();
+ if (idTissue!=-1)
+ {
+ _wxvtkclipping3Dview->SetRepSurfaceWireFrame(idTissue , _surfaceRep->GetValue() );
+
+ _wxvtkclipping3Dview->Refresh();
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+
+ }
+}
+
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnVisibleVolume(wxCommandEvent& event)
+{
+ _wxvtkclipping3Dview->VisibleVolumeActor( event.IsChecked() );
+ _wxvtkclipping3Dview->Refresh();
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnVisibleBoxSurface(wxCommandEvent& event)
+{
+ _wxvtkclipping3Dview->SetVisibleBoxSurface(event.IsChecked() );
+ _wxvtkclipping3Dview->Refresh();
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnVisibleBoxVolume(wxCommandEvent& event)
+{
+ _wxvtkclipping3Dview->SetVisibleBoxVolume(event.IsChecked() );
+ _wxvtkclipping3Dview->Refresh();
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnColor(wxCommandEvent& event)
+{
+ int idTissue=GetIdTissue();
+ if (idTissue!=-1)
+ {
+// EED 17 Janvier 2007
+ wxColourDialog dlgColour(this);
+// dlgColour.ShowModal();
+ if( dlgColour.ShowModal( ) == wxID_OK )
+ {
+ vtkActor *tmpActor;
+ tmpActor = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
+ float r=dlgColour.GetColourData().GetColour().Red()/255;
+ float g=dlgColour.GetColourData().GetColour().Green()/255;
+ float b=dlgColour.GetColourData().GetColour().Blue()/255;
+ tmpActor->GetProperty()->SetColor( r , g , b );
+ _color->SetBackgroundColour(dlgColour.GetColourData().GetColour());
+
+ _wxvtkclipping3Dview->Refresh();
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ }
+ }
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnVisibleSurface(wxCommandEvent& event)
+{
+ int idTissue=GetIdTissue();
+ if (idTissue!=-1)
+ {
+ _wxvtkclipping3Dview->VisibleActor(idTissue, _visible->GetValue());
+
+ _wxvtkclipping3Dview->Refresh();
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ }
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnOpacity(wxScrollEvent& event)
+{
+ int idTissue=GetIdTissue();
+ if (idTissue!=-1)
+ {
+ vtkActor *tmpActor;
+ tmpActor = _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueActor(idTissue);
+ float opacity=_opacity->GetValue();
+ tmpActor->GetProperty()->SetOpacity( opacity/100 );
+
+ _wxvtkclipping3Dview->Refresh();
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ }
+}
+
+//----------------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnIsoValueSpin(wxScrollEvent& event)
+{
+ int value = _isoValue->GetValue();
+ int delta= (int)pow( 4 , _isoValueSpin->GetValue() );
+ int min=value - delta/2;
+ int max=value + delta/2;
+ if (min<0)
+ {
+ min=0;
+ max=delta;
+ }
+ _isoValue->SetRange(min,max);
+}
+
+
+//------------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnIsoValue(wxScrollEvent& event)
+{
+ wxBusyCursor wait;
+
+ int idTissue=GetIdTissue();
+ if (idTissue!=-1)
+ {
+ int isoValue=_isoValue->GetValue();
+ _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->SetIsovalue(idTissue,isoValue);
+// wxString tmpStr;
+// tmpStr.Printf("%d",isoValue);
+
+ _wxvtkclipping3Dview->Refresh();
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ }
+
+}
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL(wxCommandEvent& event)
+{
+
+ int idTissue=GetIdTissue();
+ if (idTissue==-1)
+ {
+ idTissue=0;
+ }
+
+
+ wxString dirSTL = wxGetHomeDir( ) ;
+ wxFileDialog dialog( this, _T("Choose a directory..."), dirSTL , _T(""), _T("*.*"), wxSAVE );
+
+ if( dialog.ShowModal( ) == wxID_OK )
+ {
+
+
+ // ------------------------------------------------------------------------
+ // 1. GENERATE STL FILES
+ // ------------------------------------------------------------------------
+// const char* fileprefix = "c:\\Creatis\\";
+ std::string prefix = (const char*) (dialog.GetPath().mb_str() );
+ std::string filename;
+
+ // 1.1. Se hace un filtro triangular puesto que el stl writer solo recibe poligonos triangulares.
+
+ vtkTriangleFilter *filtro = vtkTriangleFilter::New();
+
+
+ filtro->SetInput( this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueClipper(idTissue)->GetOutput() );
+ vtkPolyDataConnectivityFilter *pdcf = vtkPolyDataConnectivityFilter::New();
+ pdcf->SetInput( filtro->GetOutput() );
+ vtkClosePolyData *cpd = vtkClosePolyData::New();
+ cpd->SetInput( pdcf->GetOutput() );
+
+ // 1.2 se escribe a disco el archivo stl de la superficie interna
+ cpd->Update();
+ vtkSTLWriter *writer = vtkSTLWriter::New();
+ writer->SetInput( cpd->GetOutput() );
+ filename =prefix;
+ writer->SetFileName(filename.c_str());
+ writer->SetFileTypeToASCII();
+ writer->Write();
+ writer->Delete();
+
+
+ filtro->Delete();
+ cpd->Delete();
+ pdcf->Delete();
+ }
+
+}
+
+//EED 30 Janvier 2007
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnBtnSaveRawVolume(wxCommandEvent& event)
+{
+ wxFileDialog dialog(this, _T("Choose a file"), _T(""), _T(""), _T("*.maracas"), wxSAVE );
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ std::string directory = (const char*) (dialog.GetDirectory().mb_str() );
+ std::string filename = (const char*) (dialog.GetFilename().mb_str() );
+ float rescalaSlope = 1;
+ float rescalaIntercept = 0;
+ vtkMPRBaseData *vtkmprbasedata = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData();
+ vtkImageData *vtkimagedata = vtkmprbasedata->GetImageData();
+ int dim[3];
+ vtkimagedata->GetDimensions(dim);
+ int voi[6];
+ voi[0]=0;
+ voi[1]=dim[0];
+ voi[2]=0;
+ voi[3]=dim[1];
+ voi[4]=0;
+ voi[5]=dim[2];
+//EED 10 oct 2007 MaracasVisu pour bbMaracasvisu
+ marRAW2Files marraw2;
+ marraw2.saveVolume(directory,filename,vtkimagedata,voi,rescalaSlope,rescalaIntercept);
+ }
+}
+
+//EED 22 Fevrier 2007
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnBtnVolumeFunctions(wxCommandEvent& event)
+{
+
+ int /*i=0,*/ xi,yi,r,g,b; // JPRx
+ vtkColorTransferFunction* ctfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetColorTransferenceFunction();
+ vtkPiecewiseFunction* tfun = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTransferencefunction();
+ std::vector<double>* gtf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetGreyValuesTransferenceFVector();
+ std::vector<double>* itf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetIntensityValuesTransferenceFVector();
+ std::vector<double>* greyctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetGreyValueColorsOfColorTransferenceFVector();
+ std::vector<double>* rctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetRedColorsOfColorTransferenceFVector();
+ std::vector<double>* gctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetGreenColorsOfColorTransferenceFVector();
+ std::vector<double>* bctf = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetBlueColorsOfColorTransferenceFVector();
+ vtkImageData *imagedata = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+
+ //use for update in the refresh
+ /*
+ vtkVolumeRayCastMapper* volumeMapper = this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVolumeMapper();
+ vtkVolume* newvol =this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetVolumeActor();
+ */
+
+ /*
+ MMLR BORRAME
+ wxFileDialog dialog(this, _T("Choose a file"), _T("c:/Maracas_configuration"),_T(""), _T("*.MarVolConf"), wxOPEN);
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions( (char *)dialog.GetPath().c_str() );
+
+
+ }
+ */
+
+ HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Histogram Dialog"),imagedata,1);
+ //
+ // put in a method
+ //
+ int tfSize=gtf->size();
+ if(tfSize>0)
+ {
+ int i=0;
+ hDlg->erasePointsTransferenceFunction();
+ while(i<tfSize)
+ {
+ double g=(*gtf)[i];
+ double in=(*itf)[i];
+ hDlg->addPointToTransferenceFunction(g,in*100);
+ i++;
+ }
+
+ }
+
+ int ctfSize=rctf->size();
+ if(ctfSize>0)
+ {
+ int i=0;
+ while(i<ctfSize)
+ {
+ double gr=(*greyctf)[i];
+ double r=(*rctf)[i];
+ double g=(*gctf)[i];
+ double b=(*bctf)[i];
+ hDlg->addColorPoint(gr,(int)(r*255),(int)(g*255),(int)(b*255));
+ i++;
+ }
+ }
+ //setting variables if the user wants to do refresh
+ hDlg->setCTF(ctfun);
+ hDlg->setTF(tfun);
+ hDlg->setClipping3DView(_wxvtkclipping3Dview);
+ /*
+ hDlg->setVolume(newvol);
+ hDlg->setVolumeMapper(volumeMapper);
+ */
+ //
+ // when the user had changed the transference Function
+ //
+ if(hDlg->ShowModal()== wxID_OK )
+ {
+ // -- vtkPiecewiseFunction --
+ tfun->RemoveAllPoints();
+ gtf->clear();
+ itf->clear();
+
+ int nTFPoints=hDlg->getSizeTransferenceFunction();
+ int i=0;
+ while(i<nTFPoints)
+ {
+ hDlg->getTransferenceFunctionPoint(i,xi,yi);
+ tfun->AddPoint( xi , yi/100.0 );
+ gtf->push_back(xi);
+ itf->push_back(yi/100.0);
+ i++;
+ }
+ // -- vtkColorTransferFunction --
+ ctfun->RemoveAllPoints ();
+ //clean colors
+ rctf->clear();
+ gctf->clear();
+ bctf->clear();
+ greyctf->clear();
+
+ int nCTFpoints=hDlg->getSizeBarColor();
+ i=0;
+ while(i<nCTFpoints)
+ {
+ hDlg->getDataBarColorPoint(i,xi,r,g,b);
+ ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
+ rctf->push_back(r/255.0);
+ gctf->push_back(g/255.0);
+ bctf->push_back(b/255.0);
+ greyctf->push_back(xi);
+ i++;
+ }
+ //---------------------------------
+ // Refreshing and sending the event
+ //---------------------------------
+ //_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions();
+ _wxvtkclipping3Dview->Refresh();
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+
+ /*
+ volumeMapper->Update();
+ newvol->Update();
+ */
+ }
+
+ else
+ {
+
+ if(hDlg->getRefreshed())
+ {
+ int i=0,size;
+ //--Transference Function----
+ tfun->RemoveAllPoints();
+ i=0;
+ size=gtf->size();
+ for(i=0;i<size;i++)
+ {
+ double grey1=(*gtf)[i];
+ double in2=(*itf)[i];
+ tfun->AddPoint( grey1 , in2 );
+ }
+
+ // -- vtkColorTransferFunction --
+ ctfun->RemoveAllPoints ();
+
+ i=0;
+ size=greyctf->size();
+ for(i=0;i<size;i++)
+ {
+ double grey2=(*greyctf)[i];
+ double red =(*rctf)[i];
+ double green =(*gctf)[i];
+ double blue = (*bctf)[i];
+ ctfun->AddRGBPoint(grey2,red,green,blue);
+ }
+
+ //---------------------------------
+ // Refreshing and sending the event
+ //---------------------------------
+ //_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadVolumeFunctions();
+ _wxvtkclipping3Dview->Refresh();
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+
+ /*
+ volumeMapper->Update();
+ newvol->Update();
+ */
+ }
+
+ }
+ //destroy the dialog
+ hDlg->Destroy();
+}
+
+//EED 23 Mai 2007
+//-------------------------------------------------------------------
+void wxVtkClipping3DViewCntrlPanel::OnBtnMeshVTKLoad(wxCommandEvent& event)
+{
+ wxFileDialog dialog(this, _T("Choose a file"), _T("c:/Maracas_configuration"),_T(""), _T("*.vtk"), wxOPEN);
+ if (dialog.ShowModal() == wxID_OK)
+ {
+ _wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->ReadMeshVTK( (char *)dialog.GetPath().c_str() );
+ _wxvtkclipping3Dview->Refresh();
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkclipping3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ }
+}
+
--- /dev/null
+#ifndef WXVTKCLIPPING3DVIEWCNTRLPANEL_H_
+#define WXVTKCLIPPING3DVIEWCNTRLPANEL_H_
+
+#include "wxVtkClipping3DView.h"
+#include "wx/wx.h"
+
+class wxVtkClipping3DViewCntrlPanel: public wxPanel
+{
+public:
+ wxVtkClipping3DViewCntrlPanel(wxWindow *parent, wxVtkClipping3DView *_wxvtkclipping3Dview);
+ ~wxVtkClipping3DViewCntrlPanel();
+ void OnSurface(wxCommandEvent& event);
+ void OnRepresentationSurfaceWireFrame(wxCommandEvent& event);
+ void OnVisibleVolume(wxCommandEvent& event);
+ void OnVisibleBoxSurface(wxCommandEvent& event);
+ void OnVisibleBoxVolume(wxCommandEvent& event);
+ void OnColor(wxCommandEvent& event);
+ void OnVisibleSurface(wxCommandEvent& event);
+ void OnOpacity(wxScrollEvent& event);
+ void OnIsoValue(wxScrollEvent& event);
+ void OnIsoValueSpin(wxScrollEvent& event);
+ virtual void Refresh();
+ void OnBtnCreateFileSTL(wxCommandEvent& event);
+ void OnBtnSaveRawVolume(wxCommandEvent& event);
+ void OnBtnVolumeFunctions(wxCommandEvent& event);
+ void OnBtnMeshVTKLoad(wxCommandEvent& event);
+
+
+private:
+ wxVtkClipping3DView *_wxvtkclipping3Dview;
+ wxSlider *_opacity;
+ wxSlider *_isoValue;
+ wxSlider *_isoValueSpin;
+ wxRadioButton *_surfA;
+ wxRadioButton *_surfB;
+ wxRadioButton *_surfC;
+ wxRadioButton *_surfD;
+ wxCheckBox *_visible;
+ wxButton *_color;
+
+ wxRadioButton *_wireFrameRep;
+ wxRadioButton *_surfaceRep;
+
+ int GetIdTissue();
+protected:
+
+};
+
+#endif /*WXVTKCLIPPING3DVIEWCNTRLPANEL_H_*/
--- /dev/null
+#include "wxVtkMPR2DView.h"
+
+#include "vtkInteractorStyleBaseView.h"
+
+#include "vtkCellArray.h"
+
+wxVtkMPR2DView::wxVtkMPR2DView( wxWindow *parent, int direction)
+ :wxVtk2DBaseView(parent)
+{
+ _backX = -99999;
+ _backY = -99999;
+ _backZ = -99999;
+ _direction = direction;
+ _ptsA = NULL;
+ _lineAActor = NULL;
+ _lineAMapper = NULL;
+ _pdA = NULL;
+ _ptsB = NULL;
+ _lineBActor = NULL;
+ _lineBMapper = NULL;
+ _pdB = NULL;
+}
+
+//-------------------------------------------------------------------
+wxVtkMPR2DView::~wxVtkMPR2DView()
+{
+ if (_ptsA!=NULL) { _ptsA -> Delete(); }
+ if (_lineAActor!=NULL) { _lineAActor -> Delete(); }
+ if (_lineAMapper!=NULL) { _lineAMapper -> Delete(); }
+ if (_pdA!=NULL) { _pdA -> Delete(); }
+ if (_ptsB!=NULL) { _ptsB -> Delete(); }
+ if (_lineBActor!=NULL) { _lineBActor -> Delete(); }
+ if (_lineBMapper!=NULL) { _lineBMapper -> Delete(); }
+ if (_pdB!=NULL) { _pdB -> Delete(); }
+}
+//-------------------------------------------------------------------
+vtkMPRBaseData *wxVtkMPR2DView::GetVtkmprbasedata()
+{
+ return (vtkMPRBaseData*)GetVtkBaseData();
+}
+//-------------------------------------------------------------------
+void wxVtkMPR2DView::Configure(){
+ wxVtk2DBaseView::Configure();
+
+ _interactorstylemprview = new vtkInteractorStyleMPRView();
+ ((vtkInteractorStyleBaseView*)GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _interactorstylemprview );
+
+ int x1,x2,y1,y2,z1,z2;
+ GetVtkmprbasedata() -> GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
+
+ double spc[3];
+ vtkImageData* img = GetVtkmprbasedata()->GetImageData();
+ if(img!=NULL){
+ img->GetSpacing(spc);
+ x1 = (int)(x1*spc[0]);
+ y1 = (int)(y1*spc[1]);
+ z1 = (int)(z1*spc[2]);
+
+ x2 = (int)(x2*spc[0]);
+ y2 = (int)(y2*spc[1]);
+ z2 = (int)(z2*spc[2]);
+
+ _visibleAxis = true;
+
+ // Axe A
+ _ptsA = vtkPoints::New();
+ _ptsA->SetNumberOfPoints(2);
+ _ptsA->SetPoint(0, -1000 , -1000 , -1000 );
+ _ptsA->SetPoint(1, 1000 , 1000 , 1000 );
+ vtkCellArray *linesA;
+ linesA = vtkCellArray::New();
+ linesA->InsertNextCell(2);
+ linesA->InsertCellPoint(0);
+ linesA->InsertCellPoint(1);
+ _pdA = vtkPolyData::New();
+ _pdA->SetPoints( _ptsA );
+ _pdA->SetLines( linesA );
+ linesA->Delete(); //do not delete lines ??
+ _lineAActor = vtkActor::New();
+ _lineAMapper = vtkPolyDataMapper::New();
+ _lineAMapper->SetInput(_pdA);
+ _lineAMapper->ImmediateModeRenderingOn();
+ _lineAActor->SetMapper(_lineAMapper);
+// _lineAActor->GetProperty()->BackfaceCullingOn();
+ _lineAActor->GetProperty()->SetDiffuseColor(1,0,0);
+ _lineAActor->GetProperty()->SetLineWidth(2);
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
+
+ // Axe B
+ _ptsB = vtkPoints::New();
+ _ptsB->SetNumberOfPoints(2);
+ _ptsB->SetPoint(0, -1000 , -1000 , -1000 );
+ _ptsB->SetPoint(1, 1000 , 1000 , 1000 );
+ vtkCellArray *linesB;
+ linesB = vtkCellArray::New();
+ linesB->InsertNextCell(2);
+ linesB->InsertCellPoint(0);
+ linesB->InsertCellPoint(1);
+ _pdB = vtkPolyData::New();
+ _pdB->SetPoints( _ptsB );
+ _pdB->SetLines( linesB );
+ linesB->Delete(); //do not delete lines ??
+ _lineBActor = vtkActor::New();
+ _lineBMapper = vtkPolyDataMapper::New();
+ _lineBMapper->SetInput(_pdB);
+ _lineBMapper->ImmediateModeRenderingOn();
+ _lineBActor->SetMapper(_lineBMapper);
+// _lineBActor->GetProperty()->BackfaceCullingOn();
+ _lineBActor->GetProperty()->SetDiffuseColor(1,0,0);
+ _lineBActor->GetProperty()->SetLineWidth(2);
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
+
+
+ vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
+
+//EED 17Avril2009
+/*
+ if (_direction==0) {
+ camera->SetViewUp ( 0 , -1 , 0 );
+ camera->SetPosition ( -10000,(y1+y2)/2 , (z1+z2)/2 );
+ camera->SetFocalPoint ( 0 , (y1+y2)/2 , (z1+z2)/2 );
+ camera->SetParallelScale( (z2-z1)/3.0 );
+ }
+
+ if (_direction==1) {
+ camera->SetViewUp ( 0 , 0 , -1 );
+ camera->SetPosition ((x1+x2)/2 , 10000 , (z1+z2)/2 );
+ camera->SetFocalPoint ((x1+x2)/2 , 0 , (z1+z2)/2 );
+ camera->SetParallelScale( (x2-x1)/3.0 );
+ }
+
+ if (_direction==2) {
+ camera->SetViewUp ( 0 , -1 , 0 );
+ camera->SetPosition ((x1+x2)/2 , (y1+y2)/2 , -10000);
+ camera->SetFocalPoint ((x1+x2)/2 , (y1+y2)/2 , 0 );
+ camera->SetParallelScale( (x2-x1)/3.0 );
+ }
+ */
+
+ if (_direction==0) {
+ camera->SetViewUp ( 0 , 1 , 0 );
+ camera->SetPosition ( 10000,(y1+y2)/2 , (z1+z2)/2 );
+ camera->SetFocalPoint ( 0 , (y1+y2)/2 , (z1+z2)/2 );
+ camera->SetParallelScale( (z2-z1)/3.0 );
+ }
+
+ if (_direction==1) {
+ camera->SetViewUp ( 0 , 0 , -1 );
+ camera->SetPosition ((x1+x2)/2 , 10000 , (z1+z2)/2 );
+ camera->SetFocalPoint ((x1+x2)/2 , 0 , (z1+z2)/2 );
+ camera->SetParallelScale( (x2-x1)/3.0 );
+ }
+
+ if (_direction==2) {
+ camera->SetViewUp ( 0 , 1 , 0 );
+ camera->SetPosition ((x1+x2)/2 , (y1+y2)/2 , 10000);
+ camera->SetFocalPoint ((x1+x2)/2 , (y1+y2)/2 , 0 );
+ camera->SetParallelScale( (x2-x1)/3.0 );
+ }
+
+
+
+ }
+
+// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160);
+// _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel (800);
+
+}
+
+void wxVtkMPR2DView::SetVisibleAxis(bool ok)
+{
+ if (ok!=_visibleAxis)
+ {
+ _visibleAxis=ok;
+ if (_visibleAxis==true)
+ {
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
+ }
+ if (_visibleAxis==false)
+ {
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->RemoveActor( _lineAActor );
+ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->RemoveActor( _lineBActor );
+ }
+
+ }
+}
+
+//-------------------------------------------------------------------
+void wxVtkMPR2DView::Refresh()
+{
+ //wxVtk2DBaseView::Refresh();
+
+
+ //vtkImageViewer2 *IV2=_imageViewer2XYZ->GetVtkImageViewer2(); // JPRx
+ //vtkCamera *camera = IV2->GetRenderer()->GetActiveCamera(); // JPRx
+
+
+
+ int x1,x2,y1,y2,z1,z2;
+ GetVtkmprbasedata()->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
+ double spc[3];
+
+ vtkImageData* img = GetVtkmprbasedata()->GetImageData();
+ if(img!=NULL){
+ img->GetSpacing(spc);
+ x1 = (int)(x1*spc[0]);
+ y1 = (int)(y1*spc[1]);
+ z1 = (int)(z1*spc[2]);
+
+ x2 = (int)(x2*spc[0]);
+ y2 = (int)(y2*spc[1]);
+ z2 = (int)(z2*spc[2]);
+
+ int x = (int)(GetVtkmprbasedata()->GetX());
+ int y = (int)(GetVtkmprbasedata()->GetY());
+ int z = (int)(GetVtkmprbasedata()->GetZ());
+
+ x = (int)(x*spc[0]);
+ y = (int)(y*spc[1]);
+ z = (int)(z*spc[2]);
+
+
+
+ if ((x!=_backX) || (y!=_backY) || (z!=_backZ)) {
+
+ if (_direction==0) {
+ _imageViewer2XYZ->SetXSlice( (int)(GetVtkmprbasedata()->GetX()) );
+ _ptsA->SetPoint(0, -x2, y1 , z );
+ _ptsA->SetPoint(1, -x2, y2 , z );
+ _ptsB->SetPoint(0, -x2, y , z1);
+ _ptsB->SetPoint(1, -x2, y , z2);
+ }
+ if (_direction==1) {
+ _imageViewer2XYZ->SetYSlice( (int)(GetVtkmprbasedata()->GetY()) );
+ _ptsA->SetPoint(0, x1 , y2 , z );
+ _ptsA->SetPoint(1, x2 , y2 , z );
+ _ptsB->SetPoint(0, x , y2 , z1);
+ _ptsB->SetPoint(1, x , y2 , z2);
+ }
+ if (_direction==2) {
+ _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) );
+ _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) );
+ // _ptsA->SetPoint(0, x1 , y , -z2 );
+ // _ptsA->SetPoint(1, x2 , y , -z2 );
+ // _ptsB->SetPoint(0, x , y1, -z2 );
+ // _ptsB->SetPoint(1, x , y2, -z2 );
+
+ _ptsA->SetPoint(0, x1 , y , z2 );
+ _ptsA->SetPoint(1, x2 , y , z2 );
+ _ptsB->SetPoint(0, x , y1, z2 );
+ _ptsB->SetPoint(1, x , y2, z2 );
+ }
+ _backX=x;
+ _backY=y;
+ _backZ=z;
+ }
+ wxVtkBaseView::Refresh();
+ }
+}
+//-------------------------------------------------------------------
+int wxVtkMPR2DView::GetActualSlice() // virtual
+{
+ int result;
+ if (_direction==0)
+ {
+ result = (int)(GetVtkmprbasedata()->GetX());
+ }
+ if (_direction==1)
+ {
+ result = (int)(GetVtkmprbasedata()->GetY());
+ }
+ if (_direction==2)
+ {
+ result = (int)(GetVtkmprbasedata()->GetZ());
+ }
+ return result;
+}
+//-------------------------------------------------------------------
+void wxVtkMPR2DView::SetActualSlice(int slice) // virtual
+{
+ if (_direction==0)
+ {
+ GetVtkmprbasedata()->SetX(slice);
+ }
+ if (_direction==1)
+ {
+ GetVtkmprbasedata()->SetY(slice);
+ }
+ if (_direction==2)
+ {
+ GetVtkmprbasedata()->SetZ(slice);
+ }
+}
+//-------------------------------------------------------------------
+bool wxVtkMPR2DView::IfMouseTouchX(double x, double y, double z)
+{
+ double delta=5;
+ bool result=false;
+ if (_direction==0)
+ {
+ }
+ if (_direction==1)
+ {
+ if (( x<GetVtkmprbasedata()->GetX()+delta ) && ( x>GetVtkmprbasedata()->GetX()-delta ))
+ {
+ result = true;
+ }
+ }
+ if (_direction==2)
+ {
+ if (( x<GetVtkmprbasedata()->GetX()+delta ) && ( x>GetVtkmprbasedata()->GetX()-delta ))
+ {
+ result = true;
+ }
+ }
+ return result;
+}
+//-------------------------------------------------------------------
+bool wxVtkMPR2DView::IfMouseTouchY(double x, double y, double z)
+{
+ double delta=5;
+ bool result=false;
+ if (_direction==0)
+ {
+ if (( y<GetVtkmprbasedata()->GetY()+delta ) && ( y>GetVtkmprbasedata()->GetY()-delta ))
+ {
+ result = true;
+ }
+ }
+ if (_direction==1)
+ {
+ }
+ if (_direction==2)
+ {
+ if (( y<GetVtkmprbasedata()->GetY()+delta ) && ( y>GetVtkmprbasedata()->GetY()-delta ))
+ {
+ result = true;
+ }
+ }
+ return result;
+}
+//-------------------------------------------------------------------
+bool wxVtkMPR2DView::IfMouseTouchZ(double x, double y, double z)
+{
+ double delta=5;
+ bool result=false;
+ if (_direction==0)
+ {
+ if (( z<GetVtkmprbasedata()->GetZ()+delta ) && ( z>GetVtkmprbasedata()->GetZ()-delta ))
+ {
+ result = true;
+ }
+ }
+ if (_direction==1)
+ {
+ if (( z<GetVtkmprbasedata()->GetZ()+delta ) && ( z>GetVtkmprbasedata()->GetZ()-delta ))
+ {
+ result = true;
+ }
+ }
+ if (_direction==2)
+ {
+ }
+ return result;
+}
+//-------------------------------------------------------------------
+void wxVtkMPR2DView::MoveX(double x, double y, double z)
+{
+ if (_direction==0)
+ {
+ }
+ if (_direction==1)
+ {
+ GetVtkmprbasedata()->SetX(x);
+ }
+ if (_direction==2)
+ {
+ GetVtkmprbasedata()->SetX(x);
+ }
+}
+//-------------------------------------------------------------------
+void wxVtkMPR2DView::MoveY(double x, double y, double z)
+{
+ if (_direction==0)
+ {
+ GetVtkmprbasedata()->SetY(y);
+ }
+ if (_direction==1)
+ {
+ }
+ if (_direction==2)
+ {
+ GetVtkmprbasedata()->SetY(y);
+ }
+}
+//-------------------------------------------------------------------
+void wxVtkMPR2DView::MoveZ(double x, double y, double z)
+{
+ if (_direction==0)
+ {
+ GetVtkmprbasedata()->SetZ(z);
+ }
+ if (_direction==1)
+ {
+ GetVtkmprbasedata()->SetZ(z);
+ }
+ if (_direction==2)
+ {
+ }
+}
+//-------------------------------------------------------------------
+void wxVtkMPR2DView::ChangeAxisColor(double x, double y, double z)
+{
+ double c1r=1,c1g=1,c1b=0;
+ double c2r=1,c2g=0,c2b=0;
+
+ if (_direction==0)
+ {
+ if (IfMouseTouchY(x,y,z)==true)
+ {
+ _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
+ } else {
+ _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
+ }
+ if (IfMouseTouchZ(x,y,z)==true)
+ {
+ _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
+ } else {
+ _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
+ }
+ }
+
+ if (_direction==1)
+ {
+ if (IfMouseTouchX(x,y,z)==true)
+ {
+ _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
+ } else {
+ _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
+ }
+ if (IfMouseTouchZ(x,y,z)==true)
+ {
+ _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
+ } else {
+ _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
+ }
+ }
+
+ if (_direction==2)
+ {
+ if (IfMouseTouchX(x,y,z)==true)
+ {
+ _lineBActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
+ } else {
+ _lineBActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
+ }
+ if (IfMouseTouchY(x,y,z)==true)
+ {
+ _lineAActor->GetProperty()->SetDiffuseColor(c1r,c1g,c1b);
+ } else {
+ _lineAActor->GetProperty()->SetDiffuseColor(c2r,c2g,c2b);
+ }
+ }
+ Refresh();
+}
+//-------------------------------------------------------------------
+void wxVtkMPR2DView::TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type) // virtual
+{
+ wxVtkBaseView::TransfromeCoordScreenToWorld(X,Y,Z,_direction);
+
+ if (_direction==0)
+ {
+ X = ((vtkMPRBaseData*)GetVtkBaseData())->GetX();
+ }
+ if (_direction==1)
+ {
+ Y = ((vtkMPRBaseData*)GetVtkBaseData())->GetY();
+ }
+ if (_direction==2)
+ {
+ Z = ((vtkMPRBaseData*)GetVtkBaseData())->GetZ();
+ }
+}
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//-------------------------------------------------------------------
+//void boxVolumeObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual
+// if (eventId==vtkCommand::StartInteractionEvent){
+// _renWin->SetDesiredUpdateRate(10);
+// }
+// if (eventId==vtkCommand::InteractionEvent){
+// _renWin->SetDesiredUpdateRate(0.001);
+// }
+// if (eventId==vtkCommand::EndInteractionEvent){
+// vtkPlanes *planes = vtkPlanes::New();
+// vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
+// boxwidget->GetPlanes(planes);
+// _volumeMapper->SetClippingPlanes(planes);
+// planes -> Delete();
+// }
+//}
+
+//-------------------------------------------------------------------
+//void boxVolumeObserver::SetRenWin( vtkRenderWindow *renWin ){
+// _renWin = renWin;
+//}
+//-------------------------------------------------------------------
+//void boxVolumeObserver::SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper){
+// _volumeMapper = volumeMapper;
+//}
--- /dev/null
+#ifndef WXVTKMPR2DVIEW_H_
+#define WXVTKMPR2DVIEW_H_
+
+#include "vtkInteractorStyleMPRView.h"
+
+#include "wxVtk2DBaseView.h"
+
+class creaMaracasVisu_EXPORT wxVtkMPR2DView : public wxVtk2DBaseView
+{
+public:
+ wxVtkMPR2DView( wxWindow *parent, int direction );
+ ~wxVtkMPR2DView();
+ void Configure();
+ virtual void Refresh();
+ vtkMPRBaseData *GetVtkmprbasedata();
+ virtual int GetActualSlice();
+ virtual void SetActualSlice(int slice);
+
+ bool IfMouseTouchX(double x, double y, double z);
+ bool IfMouseTouchY(double x, double y, double z);
+ bool IfMouseTouchZ(double x, double y, double z);
+ void MoveX(double x, double y, double z);
+ void MoveY(double x, double y, double z);
+ void MoveZ(double x, double y, double z);
+ void ChangeAxisColor(double x, double y, double z);
+ virtual void TransfromeCoordViewWorld(double &X, double &Y, double &Z, int type);
+ void SetVisibleAxis(bool ok);
+
+
+private:
+
+ int _backX;
+ int _backY;
+ int _backZ;
+
+ bool _visibleAxis;
+
+ int _direction;
+ vtkPoints *_ptsA;
+ vtkActor *_lineAActor;
+ vtkPolyDataMapper *_lineAMapper;
+ vtkPolyData *_pdA;
+ vtkPoints *_ptsB;
+ vtkActor *_lineBActor;
+ vtkPolyDataMapper *_lineBMapper;
+ vtkPolyData *_pdB;
+// vtkInteractorStyle2DMaracas *_interactorStyle2DMaracas;
+ vtkInteractorStyleMPRView *_interactorstylemprview;
+};
+
+
+#endif /*WXVTKMPR2DVIEW_H_*/
--- /dev/null
+#include "wxVtkMPR3DView.h"
+
+#include "vtkDataSetMapper.h"
+#include "vtkPlaneSource.h"
+#include "vtkProbeFilter.h"
+#include "vtkStructuredPoints.h"
+#include "vtkMetaImageWriter.h"
+#include "vtkDataSetMapper.h"
+#include "vtkImageChangeInformation.h"
+#include "vtkPointData.h"
+#include "vtkWindowLevelLookupTable.h"
+#include "vtkPlane.h"
+#include "vtkCutter.h"
+#include "vtkTransform.h"
+#include "vtkmyPWCallback_3DPointWidget.h"
+
+wxVtkMPR3DView::wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview )
+{
+ _wxvtk3Dbaseview = wxvtk3Dbaseview;
+ _vtkmpr3Ddataviewer = NULL;
+ _wxvtkmpr3DviewCntrlPanel = NULL;
+ //_myCallback=NULL;
+ _pointWidget=NULL;
+ _planeWidget=NULL;
+ _vtkplane=NULL;
+ _probe=NULL;
+ _contourMapper=NULL;
+}
+void wxVtkMPR3DView::RemoveActor(vtkActor* actor){
+
+ _wxvtk3Dbaseview->GetRenderer()->RemoveActor(actor);
+
+
+}
+void wxVtkMPR3DView::ResetCamera(int* ext, double* origin,double* spc){
+ if(ext == NULL){
+
+ _wxvtk3Dbaseview->GetRenderer()->ResetCamera ();
+ _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
+ }else{
+ /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0));
+ double y = (spc[1])*(origin[1]+(double)ext[3]);
+ double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/
+ /*double x0=(spc[0])*((double)ext[0]+origin[0]);
+ double x1=(spc[0])*((double)ext[1]+origin[0]);
+ double y0=(spc[1])*((double)ext[2]+origin[1]);
+ double y1=(spc[1])*((double)ext[3]+origin[1]);
+ double z0=(spc[2])*((double)ext[4]+origin[2]);
+ double z1=(spc[2])*((double)ext[5]+origin[2]);*/
+ double x0=(spc[0])*((double)ext[0]);
+ double x1=(spc[0])*((double)ext[1]);
+ double y0=(spc[1])*((double)ext[2]);
+ double y1=(spc[1])*((double)ext[3]);
+ double z0=(spc[2])*((double)ext[4]);
+ double z1=(spc[2])*((double)ext[5]);
+
+ _wxvtk3Dbaseview->GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1);
+ //_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z);
+ _wxvtk3Dbaseview->GetCamera()->Dolly(1.5);
+ }
+}
+void wxVtkMPR3DView::Configure(){
+
+
+ _wxvtk3Dbaseview->Configure();
+ _wxvtkmpr3DviewCntrlPanel->UpdateControlPanel();
+ _wxvtk3Dbaseview->GetRenderer()->Clear();
+
+ // Actors are added to the renderer.
+ vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor();
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor );
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(0) ); // _saggital
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(1) ); // _axial
+// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(2) ); // _coronal
+
+
+ // An initial camera view is created. The Dolly() method moves
+ // the camera towards the FocalPoint, thereby enlarging the image.
+ _wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera());
+ this->ResetCamera();
+
+
+ // Set a background color for the renderer and set the size of the
+ // render window (expressed in pixels).
+ _wxvtk3Dbaseview->GetRenderer()->SetBackground( 0.36 , 0.36 , 0.36 );
+ _wxvtk3Dbaseview->GetRenWin()->SetSize(400, 400);
+
+ // Note that when camera movement occurs (as it does in the Dolly()
+ // method), the clipping planes often need adjusting. Clipping planes
+ // consist of two planes: near and far along the view direction. The
+ // near plane clips out objects in front of the plane; the far plane
+ // clips out objects behind the plane. This way only what is drawn
+ // between the planes is actually rendered.
+ _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange();
+
+
+ // vtkPointWidget
+ //if(_myCallback!=NULL){
+ //_myCallback->Delete();
+
+ //}
+ vtkmyPWCallback_3DPointWidget *_myCallback = vtkmyPWCallback_3DPointWidget::New();
+ _myCallback->SetWxVtkMPR3DView(this);
+
+ if(_pointWidget!=NULL){
+ _pointWidget->Delete();
+ }
+ _pointWidget = vtkPointWidget::New();
+ _myCallback->SetVtkPointWidget(_pointWidget);
+ _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
+ _pointWidget->SetInput( GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData() );
+
+ _pointWidget->AllOff();
+
+ _pointWidget->PlaceWidget();
+// _pointWidget->SetPosition( x,y,z );
+
+//EED01 29Mars2009
+// MACOS probleme vtk-window out of wx-window
+// _pointWidget->On();
+
+ _pointWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
+
+
+// PlaneWidget
+ if(_planeWidget!=NULL){
+ _planeWidget->Delete();
+ }
+ _planeWidget = vtkPlaneWidget::New();
+ _myCallback->SetVtkPlaneWidget(_planeWidget);
+ _planeWidget->SetInput( GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData() );
+ _planeWidget->NormalToXAxisOn();
+ _planeWidget->SetResolution(50);
+ _planeWidget->SetRepresentationToOutline();
+ int dim[3];
+ GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetDimensions(dim);
+ int px=(dim[0]/2);
+ int py=(dim[1]/2);
+ int pz=(dim[2]/2);
+ int dd=20;
+ _planeWidget->PlaceWidget( px-dd , px+dd , py-dd , py+dd , pz-dd , pz+dd );
+
+
+ if(_vtkplane==NULL){
+ _vtkplane = vtkPolyData::New();
+
+ _probe = vtkProbeFilter::New();
+ _probe->SetInput(_vtkplane);
+
+ _contourMapper = vtkPolyDataMapper::New();
+
+ _contourMapper->SetInput( _probe->GetPolyDataOutput() );
+
+ _contourPlaneActor = vtkActor::New();
+ _contourPlaneActor->SetMapper(_contourMapper);
+
+ _contourPlaneActor->VisibilityOff();
+
+ _planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
+ _planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
+
+ _planeWidget->Off();
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor );
+
+ }else{
+
+ }
+ _planeWidget->GetPolyData(_vtkplane);
+
+
+ vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+ _probe->SetSource( imageData );
+
+
+ _contourMapper->SetScalarRange( imageData->GetScalarRange() );
+
+
+
+
+}
+//-------------------------------------------------------------------
+wxVtkMPR3DView::~wxVtkMPR3DView()
+{
+}
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::Refresh() // virtual
+{
+ _vtkmpr3Ddataviewer -> Refresh();
+ if (_wxvtkmpr3DviewCntrlPanel!=NULL)
+ {
+ _wxvtkmpr3DviewCntrlPanel->Refresh();
+ }
+
+}
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::RefreshView() // virtual
+{
+ double spc[3];
+ this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData()->GetSpacing(spc);
+
+ //double nx=1,ny=0,nz=0; // JPRx
+ Refresh();
+ double x=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetX();
+ double y=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetY();
+ double z=GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetZ();
+
+ x=x*spc[0];
+ y=y*spc[1];
+ z=z*spc[2];
+
+ _pointWidget->SetPosition( x,y,z );
+
+
+ double in[3];
+ double normal[3];
+ vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation();
+ in[0]=1; in[1]=0; in[2]=0;
+ transform->TransformPoint(in,normal);
+ _planeWidget->SetNormal( normal[0],normal[1],normal[2] );
+
+
+ _planeWidget->SetCenter( x,y,z );
+ _planeWidget->UpdatePlacement();
+ _planeWidget->GetPolyData(_vtkplane);
+}
+//-------------------------------------------------------------------
+wxPanel* wxVtkMPR3DView::CreateControlPanel(wxWindow *parent)
+{
+ _wxvtkmpr3DviewCntrlPanel = new wxVtkMPR3DViewCntrlPanel(parent,this);
+ return _wxvtkmpr3DviewCntrlPanel;
+}
+//-------------------------------------------------------------------
+vtkMPR3DDataViewer* wxVtkMPR3DView::GetVtkMPR3DDataViewer()
+{
+ return _vtkmpr3Ddataviewer;
+}
+//-------------------------------------------------------------------
+wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() throw (char*)
+{
+ if(_wxvtk3Dbaseview==NULL){
+ throw "wxVtk3DBaseView* wxVtkMPR3DView::GetWxvtk3Dbaseview() _wxvtk3Dbaseview=NULL";
+ }
+ return _wxvtk3Dbaseview;
+}
+//-------------------------------------------------------------------
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
+ if (visible!=_vtkmpr3Ddataviewer->GetVisiblePosition(idPosition)){
+ if (visible==false){
+ _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
+ } else {
+ _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(idPosition) );
+ }
+ _vtkmpr3Ddataviewer->SetVisiblePosition(idPosition,visible);
+ }
+}
+
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::VisiblePointWidget( bool visible )
+{
+ if (visible==true)
+ {
+ _pointWidget->On();
+ } else {
+ _pointWidget->Off();
+ }
+}
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::VisiblePlaneWidget( bool visible )
+{
+ if (visible==true)
+ {
+ _planeWidget->On();
+ _contourPlaneActor->VisibilityOn();
+
+ } else {
+ _planeWidget->Off();
+ _contourPlaneActor->VisibilityOff();
+ }
+}
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::SetVtkMPR3DDataViewer(vtkMPR3DDataViewer *vtkmpr3Ddataviewer)
+{
+ _vtkmpr3Ddataviewer = vtkmpr3Ddataviewer;
+}
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DView::InitOrientationPointWidget()
+{
+ this->_planeWidget->SetNormal(1,0,0);
+}
+
+
+
+
+//-------------------------------------------------------------------
+// EED 25 Janvier 2007 testLoic
+void wxVtkMPR3DView::TestLoic1()
+{
+
+ int sizeIma = 128;
+ double dimIma = sizeIma*2;
+
+ vtkImageData *vtkimagedata = this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+
+ double spc[3];
+ vtkimagedata->GetSpacing(spc);
+
+ vtkimagedata->Update();
+
+
+ double p[3], n[3];
+ this->_planeWidget->GetOrigin(p);
+ this->_planeWidget->GetNormal(n);
+
+
+
+ vtkPlaneSource* pSource = vtkPlaneSource::New( );
+ pSource->SetResolution( sizeIma - 1, sizeIma - 1 );
+ pSource->SetOrigin( p[ 0 ], p[ 1 ], p[ 2 ] );
+ pSource->SetPoint1( p[ 0 ] + dimIma - 1.0, p[ 1 ], p[ 2 ] );
+ pSource->SetPoint2( p[ 0 ], p[ 1 ]+ dimIma - 1.0 , p[ 2 ] );
+ pSource->Update( );
+ pSource->SetCenter( p[ 0 ], p[ 1 ], p[ 2 ] );
+ pSource->SetNormal( n[ 0 ], n[ 1 ], n[ 2 ] );
+ pSource->Update( );
+
+ vtkProbeFilter* slices = vtkProbeFilter::New();
+ slices->SetInput( ( vtkDataSet* )pSource->GetOutput( ) );
+ slices->SetSource( vtkimagedata );
+ slices->Update( );
+ pSource->Delete( );
+
+ vtkStructuredPoints *stPoints = vtkStructuredPoints::New();
+ stPoints -> GetPointData( )->SetScalars( slices->GetOutput()->GetPointData()->GetScalars() );
+ stPoints -> SetDimensions( sizeIma, sizeIma, 1 );
+ stPoints -> SetScalarType( vtkimagedata->GetScalarType() );
+ stPoints -> SetScalarTypeToShort();
+ stPoints -> Update();
+
+ vtkImageChangeInformation *change = vtkImageChangeInformation ::New();
+ change -> SetInput( stPoints );
+ change -> Update(); //important
+
+ double _range[2];
+ vtkimagedata->GetScalarRange(_range);
+ vtkWindowLevelLookupTable *_bwlookup = vtkWindowLevelLookupTable::New( );
+ _bwlookup->SetHueRange( 0 , 1 );
+ _bwlookup->SetNumberOfColors( (int)(_range[1] - _range[0] + 1) );
+ _bwlookup->SetTableRange( _range[0] , _range[1] );
+ _bwlookup->SetSaturationRange( 0 , 0 );
+ _bwlookup->SetValueRange( 0 , 1 );
+ _bwlookup->SetAlphaRange( 1 , 1 );
+ _bwlookup->Build( );
+
+ vtkLookupTable * _collookup = vtkLookupTable::New( );
+ _collookup->SetNumberOfColors( 256 );
+ _collookup->SetTableRange( 0 , 255 );
+ _collookup->Build( );
+ _collookup->SetTableValue( 0 , 1 , 0 , 0 , 1 );
+ _collookup->SetTableValue(128 , 0 , 0 , 1 , 1 );
+ _collookup->SetTableValue(255 , 0 , 1 , 0 , 1 );
+
+
+ vtkMetaImageWriter *writer = vtkMetaImageWriter::New( );
+ writer->SetInput( stPoints );
+ writer->SetFileName( "C:/Users/Images/temp_EED/image.mhd" );
+ writer->SetFileDimensionality( 2 );
+ writer->Write( );
+
+
+
+ vtkDataSetMapper *_3DSliceMapper = vtkDataSetMapper::New( );
+ _3DSliceMapper->SetInput(change->GetOutput( ) );
+ _3DSliceMapper->SetLookupTable( _bwlookup );
+ _3DSliceMapper->SetScalarRange( _range );
+ _3DSliceMapper->ImmediateModeRenderingOn( );
+
+ vtkActor *_3DSliceActor = vtkActor::New( );
+ _3DSliceActor->SetMapper( _3DSliceMapper );
+
+ // The usual rendering stuff.
+ vtkCamera *camera = vtkCamera::New();
+ camera->SetPosition(1,1,1);
+ camera->SetFocalPoint(0,0,0);
+
+ vtkRenderer *renderer = vtkRenderer::New();
+ vtkRenderWindow *renWin = vtkRenderWindow::New();
+ renWin->AddRenderer(renderer);
+
+ vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
+ iren->SetRenderWindow(renWin);
+
+ renderer->AddActor( _3DSliceActor );
+ renderer->SetActiveCamera(camera);
+ renderer->ResetCamera();
+ renderer->SetBackground(1,1,1);
+
+ renWin->SetSize(300,300);
+
+ // interact with data
+ renWin->Render();
+ iren->Start();
+
+
+
+
+
+}
+
+//-------------------------------------------------------------------
+// EED 25 Janvier 2007 testLoic
+void wxVtkMPR3DView::TestLoic2()
+{
+/*
+ vtkVectorNorm *vecMagnitude = vtkVectorNorm::New();
+ vecMagnitude->SetInput(VtkMainGrid);
+ vecMagnitude->NormalizeOff();
+ vecMagnitude->Update();
+*/
+
+ vtkPlane *slicePlane = vtkPlane::New();
+ this->_planeWidget->GetPlane( slicePlane );
+
+
+ vtkCutter* sliceCutter = vtkCutter::New();
+ vtkImageData *vtkimagedata = this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+ sliceCutter->SetInput( vtkimagedata );
+ sliceCutter->SetCutFunction( slicePlane );
+
+//EED
+// vtkLookupTable *lut = BuildHueWeightBaseMap();
+
+
+ vtkPolyDataMapper *slice = vtkPolyDataMapper::New();
+ slice->SetInput( sliceCutter->GetOutput() );
+ double range[2];
+// EED
+// slice->Update();
+ vtkimagedata->GetScalarRange(range);
+// vecMagnitude->GetOutput()->GetScalarRange( range );
+// range[1] *= 0.7; // reduce the upper range by 30%
+// slice->SetScalarRange( range );
+// slice->SetLookupTable( lut );
+
+// vtkActor *sliceActor = vtkActor::New();
+// sliceActor->SetMapper( slice );
+
+ vtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New();
+ contourMapper->SetInput( sliceCutter->GetOutput() );
+ contourMapper->SetScalarRange( range );
+ // contourMapper->SetLookupTable( lut );
+
+
+ vtkActor *contourActor = vtkActor::New();
+ contourActor->SetMapper( contourMapper );
+
+
+
+ // The usual rendering stuff.
+ vtkCamera *camera = vtkCamera::New();
+ camera->SetPosition(1,1,1);
+ camera->SetFocalPoint(0,0,0);
+
+ vtkRenderer *renderer = vtkRenderer::New();
+ vtkRenderWindow *renWin = vtkRenderWindow::New();
+ renWin->AddRenderer(renderer);
+
+ vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
+ iren->SetRenderWindow(renWin);
+
+ renderer->AddActor( contourActor );
+// renderer->AddActor(cubeActor);
+ renderer->SetActiveCamera(camera);
+ renderer->ResetCamera();
+ renderer->SetBackground(1,1,1);
+
+ renWin->SetSize(300,300);
+
+ // interact with data
+ renWin->Render();
+ iren->Start();
+
+
+}
\ No newline at end of file
--- /dev/null
+#ifndef WXVTKMPR3DVIEW_H_
+#define WXVTKMPR3DVIEW_H_
+
+#include "vtkMPR3DDataViewer.h"
+#include "wxVtkMPR3DViewCntrlPanel.h"
+#include "wxVtk3DBaseView.h"
+
+#include "vtkProbeFilter.h"
+#include "vtkPlaneWidget.h"
+
+
+//class vtkmyPWCallback_3DPointWidget;
+class wxVtkMPR3DViewCntrlPanel;
+
+class creaMaracasVisu_EXPORT wxVtkMPR3DView
+{
+public:
+ wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview );
+ virtual ~wxVtkMPR3DView();
+ void VisibleImageActor(int idPosition, bool visible);
+ void VisiblePointWidget( bool visible );
+ void VisiblePlaneWidget( bool visible );
+
+ void SetVisibleTissue(int idTissue, bool visible);
+ bool GetVisibleTissue(int idTissue);
+ virtual void Refresh();
+ virtual void RefreshView();
+ virtual void Configure();
+ void SetVtkMPR3DDataViewer( vtkMPR3DDataViewer *vtkmpr3Ddataviewer );
+ wxPanel* CreateControlPanel(wxWindow *parent);
+
+ vtkMPR3DDataViewer* GetVtkMPR3DDataViewer();
+ wxVtk3DBaseView* GetWxvtk3Dbaseview() throw (char*);
+
+ void InitOrientationPointWidget();
+
+ // EED 25 Janvier 2007 testLoic
+ void TestLoic1();
+ void TestLoic2();
+
+ void RemoveActor(vtkActor* actor);
+ void ResetCamera(int *ext=NULL, double* origin=NULL,double* spc=NULL);
+
+private:
+ wxVtk3DBaseView *_wxvtk3Dbaseview;
+ vtkMPR3DDataViewer *_vtkmpr3Ddataviewer;
+ wxVtkMPR3DViewCntrlPanel *_wxvtkmpr3DviewCntrlPanel;
+
+ // Plane Widget (3D)
+ vtkPolyData *_vtkplane;
+ vtkActor *_contourPlaneActor;
+ vtkPlaneWidget *_planeWidget;
+
+ // Point Widget (3D)
+ vtkPointWidget *_pointWidget;
+ //vtkmyPWCallback_3DPointWidget *_myCallback;
+ vtkProbeFilter *_probe;
+ vtkPolyDataMapper *_contourMapper;
+
+
+
+protected:
+};
+
+#endif /*WXVTKMPR3DVIEW_H_*/
--- /dev/null
+#include "wxVtkMPR3DViewCntrlPanel.h"
+
+#include "HistogramDialog.h"
+
+wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DView *wxvtkmpr3Dview )
+: wxPanel(parent, -1)
+{
+
+ wxPanel *panel = this;
+ _wxvtkmpr3Dview = wxvtkmpr3Dview;
+
+ /*int maxX = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionX();
+ int maxY = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionY();
+ int maxZ = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionZ();*/
+
+ int maxX = 1;
+ int maxY = 1;
+ int maxZ = 1;
+
+ wxCheckBox *ckBoxX = new wxCheckBox(panel,-1,_T("X "));
+ _positionX = new wxSlider(panel,-1,maxX/2,0,maxX, wxDefaultPosition, wxSize(150,40), wxSL_HORIZONTAL | wxSL_LABELS);
+ wxCheckBox *ckBoxY = new wxCheckBox(panel,-1,_T("Y "));
+ _positionY = new wxSlider(panel,-1,maxY/2,0,maxY, wxDefaultPosition, wxSize(150,40), wxSL_HORIZONTAL | wxSL_LABELS);
+ wxCheckBox *ckBoxZ = new wxCheckBox(panel,-1,_T("Z "));
+ _positionZ = new wxSlider(panel,-1,maxZ/2,0,maxZ, wxDefaultPosition, wxSize(150,40), wxSL_HORIZONTAL | wxSL_LABELS);
+ wxButton *btnColorTable = new wxButton (panel, -1, _T("Edit Color Table") );
+
+ _ckBoxXYZ = new wxCheckBox(panel,-1,_T("XYZ "));
+ _ckBoxPlane = new wxCheckBox(panel,-1,_T("Plane"));
+
+ ckBoxX->SetValue(false);
+ ckBoxY->SetValue(false);
+ ckBoxZ->SetValue(false);
+ _ckBoxXYZ->SetValue(false);
+ _ckBoxPlane->SetValue(false);
+
+ _positionX->SetSize(400,20);
+ _positionY->SetSize(400,20);
+ _positionZ->SetSize(400,20);
+
+ Connect(ckBoxX->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX );
+ Connect(_positionX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionX );
+ Connect(ckBoxY->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY );
+ Connect(_positionY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionY );
+ Connect(ckBoxZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ );
+ Connect(_positionZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnPositionZ );
+ Connect(btnColorTable->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnEditColorTable );
+
+ Connect(_ckBoxXYZ->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisibleAxisXYZ );
+ Connect(_ckBoxPlane->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxVtkMPR3DViewCntrlPanel::OnVisiblePlane );
+
+
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+// wxBoxSizer *sizer = new wxBoxSizer(wxVERTICAL);
+
+// wxBoxSizer *sizerH4 = new wxBoxSizer(wxHORIZONTAL);
+ wxFlexGridSizer *sizerH4 = new wxFlexGridSizer(10);
+ wxFlexGridSizer *sizerH5 = new wxFlexGridSizer(10);
+
+
+
+//EED 28 sep 2006
+// wxFlexGridSizer *sizerH6 = new wxFlexGridSizer(10);
+// wxFlexGridSizer *sizerH7 = new wxFlexGridSizer(10);
+
+// sizerH4->Add( ckBoxX , 1, wxALL|wxEXPAND, 0);
+// sizerH4->Add( new wxStaticText(panel, -1," ") , 1, wxALL|wxEXPAND, 0);
+// sizerH4->Add( _positionX , 1, wxALL|wxEXPAND, 0);
+
+// sizerH5->Add( ckBoxY , 1, wxALL|wxEXPAND, 0);
+// sizerH5->Add( new wxStaticText(panel, -1," ") , 1, wxALL|wxEXPAND, 0);
+// sizerH5->Add( _positionY , 1, wxALL|wxEXPAND, 0);
+
+// sizerH6->Add( ckBoxZ , 1, wxALL|wxEXPAND, 0);
+// sizerH6->Add( new wxStaticText(panel, -1," ") , 1, wxALL|wxEXPAND, 0);
+// sizerH6->Add( _positionZ , 1, wxALL|wxEXPAND, 0);
+
+// sizerH7->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0);
+// sizerH7->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0);
+
+// sizer->Add( sizerH4 , 1, wxALL|wxEXPAND, 2);
+// sizer->Add( sizerH5 , 1, wxALL|wxEXPAND, 2);
+// sizer->Add( sizerH6 , 1, wxALL|wxEXPAND, 2);
+// sizer->Add( sizerH7 , 1, wxALL|wxEXPAND, 2);
+
+ sizerH4->Add( _positionX ,1,wxGROW , 0 );
+ sizerH4->Add( ckBoxX ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED , 0 );
+ sizerH4->Add( _positionY ,1,wxGROW , 0 );
+ sizerH4->Add( ckBoxY ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED , 0 );
+ sizerH4->Add( _positionZ ,1,wxGROW , 0 );
+ sizerH4->Add( ckBoxZ ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED , 0 );
+ sizerH4->Add( btnColorTable ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED , 0 );
+
+ sizerH5->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0);
+ sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0);
+// sizerH5->Add( ckBoxX , 1, wxALL|wxEXPAND, 0);
+// sizerH5->Add( ckBoxY , 1, wxALL|wxEXPAND, 0);
+// sizerH5->Add( ckBoxZ , 1, wxALL|wxEXPAND, 0);
+
+ sizer->Add( sizerH4 , 1, wxALL|wxGROW, 2);
+ sizer->Add( sizerH5 , 1, wxALL|wxEXPAND, 2);
+
+
+ panel->SetSize(400,50);
+ panel->SetAutoLayout(true);
+ panel->SetSizer(sizer);
+ panel->Layout();
+
+ panel->SetEventHandler((wxEvtHandler*)this);
+
+ //this->UpdateControlPanel();
+
+}
+void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel()
+{
+
+ vtkMPRBaseData* basedata = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData();
+ if(basedata != NULL){
+
+ /*int maxX = basedata->GetMaxPositionX();
+ int maxY = basedata->GetMaxPositionY();
+ int maxZ = basedata->GetMaxPositionZ();*/
+ int x0,x1,y0,y1,z0,z1;
+
+ basedata->GetDimensionExtention(&x0,&x1,&y0,&y1,&z0,&z1);
+ /*int maxX = x1-x0;//basedata->GetMaxPositionX();
+ int maxY = y1-y0;//basedata->GetMaxPositionY();
+ int maxZ = z1-z0;//basedata->GetMaxPositionZ();*/
+
+
+
+ //std::cout<<"wxVtkMPR3DViewCntrlPanel::UpdateControlPanel() maxX="<<maxX<<" maxY="<<maxY<<" maxZ="<<maxZ<<std::endl;
+ /*_positionX->SetRange(0,maxX);
+ _positionY->SetRange(0,maxY);
+ _positionZ->SetRange(0,maxZ);*/
+ _positionX->SetRange(x0,x1);
+ _positionY->SetRange(y0,y1);
+ _positionZ->SetRange(z0,z1);
+
+ _positionX->SetValue((x0+x1)/2);
+ _positionY->SetValue((y0+y1)/2);
+ _positionZ->SetValue((z0+z1)/2);
+
+ _positionX->Update();
+ _positionY->Update();
+ _positionZ->Update();
+ this->Update();
+ }
+
+}
+//-------------------------------------------------------------------
+wxVtkMPR3DViewCntrlPanel::~wxVtkMPR3DViewCntrlPanel()
+{
+}
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::Refresh()
+{
+// wxPanel::Refresh();
+ _positionX->SetValue( (int)(_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetX( )) );
+ _positionY->SetValue( (int)(_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetY( )) );
+ _positionZ->SetValue( (int)(_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetZ( )) );
+}
+/*
+//-------------------------------------------------------------------
+int wxVtkMPR3DViewCntrlPanel::GetIdTissue()
+{
+ int idTissue=-1;
+ if (_surfA->GetValue()==true)
+ {
+ idTissue=0;
+ }
+ if (_surfB->GetValue()==true)
+ {
+ idTissue=1;
+ }
+ if (_surfC->GetValue()==true)
+ {
+ idTissue=2;
+ }
+ if (_surfD->GetValue()==true)
+ {
+ idTissue=3;
+ }
+
+ return idTissue;
+}
+*/
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnEditColorTable(wxCommandEvent& event)
+{
+
+ vtkColorTransferFunction *ctfun = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetvtkColorTransferFunction();
+ std::vector<double> *ctfunVectorPoint = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorPoint();
+ std::vector<double> *ctfunVectorRed = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorRed();
+ std::vector<double> *ctfunVectorGreen = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorGreen();
+ std::vector<double> *ctfunVectorBlue = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetctFunVectorBlue();
+
+ //void *p=this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer(); // JPRx
+
+
+ int i=0,xi,r,g,b;
+
+ vtkImageData *imagedata = this->_wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData();
+
+ HistogramDialog* hDlg=new HistogramDialog(NULL,_T("Color table"),imagedata,2);
+
+
+ hDlg->erasePointsTransferenceFunction();
+ int ctfSize=ctfunVectorRed->size();
+ if(ctfSize>0)
+ {
+// MACHETE OJO Eduardo
+ int i=0;
+ while(i<ctfSize)
+ {
+ double gr = (*ctfunVectorPoint)[i];
+ double r = (*ctfunVectorRed)[i];
+ double g = (*ctfunVectorGreen)[i];
+ double b = (*ctfunVectorBlue)[i];
+
+hDlg->addColorPoint(gr,(int)(r*255),(int)(g*255),(int)(b*255));
+ i++;
+ }
+ }
+
+ //
+ // when the user had changed the transference Function
+ //
+
+ //setting variables if the user wants to do refresh
+
+ hDlg->setCTF(ctfun);
+ hDlg->setMPR3Dview(_wxvtkmpr3Dview);
+
+ if(hDlg->ShowModal()== wxID_OK )
+ {
+
+ // -- vtkColorTransferFunction --
+ ctfun->RemoveAllPoints ();
+ //clean colors
+ ctfunVectorPoint->clear();
+ ctfunVectorRed->clear();
+ ctfunVectorGreen->clear();
+ ctfunVectorBlue->clear();
+
+ int nCTFpoints=hDlg->getSizeBarColor();
+// Machete .. Ojo Eduardo
+ i=0;
+ while(i<nCTFpoints)
+ {
+ hDlg->getDataBarColorPoint(i,xi,r,g,b);
+ /*
+ if (i==0)
+ {
+ hDlg->getDataBarColorPoint(1,xi,r,g,b);
+ }
+ if (i==nCTFpoints)
+ {
+ hDlg->getDataBarColorPoint(i-1,xi,r,g,b);
+ }
+ */
+ ctfun->AddRGBPoint(xi,r/255.0,g/255.0,b/255.0 );
+ ctfunVectorPoint->push_back(xi);
+ ctfunVectorRed->push_back(r/255.0);
+ ctfunVectorGreen->push_back(g/255.0);
+ ctfunVectorBlue->push_back(b/255.0);
+ i++;
+
+ }
+
+ }
+
+ else
+ {
+
+ if(hDlg->getRefreshed())
+ {
+ // -- vtkColorTransferFunction --
+ ctfun->RemoveAllPoints ();
+
+ int i=0;
+ int size=ctfunVectorPoint->size();
+
+ for(i=0;i<size;i++)
+ {
+ double grey2=(*ctfunVectorPoint)[i];
+ double red =(*ctfunVectorRed)[i];
+ double green =(*ctfunVectorGreen)[i];
+ double blue = (*ctfunVectorBlue)[i];
+ ctfun->AddRGBPoint(grey2,red,green,blue);
+ }
+ }
+
+ }
+
+ hDlg->Destroy();
+}
+
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisX(wxCommandEvent& event)
+{
+ _wxvtkmpr3Dview->VisibleImageActor(0, event.IsChecked() );
+ _wxvtkmpr3Dview->Refresh();
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+
+ try{
+ _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+ }catch(char* e){
+ std::cout<<e<<std::endl;
+ }
+
+}
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisY(wxCommandEvent& event)
+{
+ _wxvtkmpr3Dview->VisibleImageActor(1, event.IsChecked() );
+ _wxvtkmpr3Dview->Refresh();
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+
+}
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisZ(wxCommandEvent& event)
+{
+ _wxvtkmpr3Dview->VisibleImageActor(2, event.IsChecked() );
+ _wxvtkmpr3Dview->Refresh();
+
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+}
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnVisibleAxisXYZ(wxCommandEvent& event)
+{
+ _wxvtkmpr3Dview->VisiblePointWidget(event.IsChecked());
+}
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnVisiblePlane(wxCommandEvent& event)
+{
+ _wxvtkmpr3Dview->VisiblePlaneWidget(event.IsChecked());
+}
+
+
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnPositionX(wxScrollEvent& event)
+{
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetX( _positionX->GetValue() );
+ _wxvtkmpr3Dview->RefreshView();
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+}
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnPositionY(wxScrollEvent& event)
+{
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetY( _positionY->GetValue() );
+ _wxvtkmpr3Dview->RefreshView();
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+}
+//-------------------------------------------------------------------
+void wxVtkMPR3DViewCntrlPanel::OnPositionZ(wxScrollEvent& event)
+{
+ _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetZ( _positionZ->GetValue() );
+ _wxvtkmpr3Dview->RefreshView();
+ wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
+ _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
+}
--- /dev/null
+#ifndef WXVTKMPR3DVIEWCNTRLPANEL_H_
+#define WXVTKMPR3DVIEWCNTRLPANEL_H_
+
+#include "wxVtkMPR3DView.h"
+
+#include "wx/wx.h"
+
+class wxVtkMPR3DView;
+
+class wxVtkMPR3DViewCntrlPanel: public wxPanel
+{
+public:
+ wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DView *wxvtkmpr3Dview);
+ ~wxVtkMPR3DViewCntrlPanel();
+ void OnVisibleAxisX(wxCommandEvent& event);
+ void OnVisibleAxisY(wxCommandEvent& event);
+ void OnVisibleAxisZ(wxCommandEvent& event);
+ void OnPositionX(wxScrollEvent& event);
+ void OnPositionY(wxScrollEvent& event);
+ void OnPositionZ(wxScrollEvent& event);
+ void OnVisibleAxisXYZ(wxCommandEvent& event);
+ void OnVisiblePlane(wxCommandEvent& event);
+ void OnEditColorTable(wxCommandEvent& event);
+ virtual void Refresh();
+ void UpdateControlPanel();
+
+private:
+ wxVtkMPR3DView *_wxvtkmpr3Dview;
+
+ wxSlider *_opacity;
+ wxSlider *_isoValue;
+ wxSlider *_isoValueSpin;
+ wxStaticText *_isoValueText;
+ wxRadioButton *_surfA;
+ wxRadioButton *_surfB;
+ wxRadioButton *_surfC;
+ wxRadioButton *_surfD;
+ wxCheckBox *_visible;
+ wxButton *_color;
+ wxSlider *_positionX;
+ wxSlider *_positionY;
+ wxSlider *_positionZ;
+
+ wxCheckBox *_ckBoxXYZ;
+ wxCheckBox *_ckBoxPlane;
+
+
+protected:
+
+};
+
+#endif /*WXVTKMPR3DVIEWCNTRLPANEL_H_*/
--- /dev/null
+#include "wxWidgetMesure2D.h"
+
+
+/*
+BEGIN_EVENT_TABLE( wxWidgetMesure2D , wxSplitterWindow )
+ EVT_MENU( 12121, wxWidgetMesure2D::OnRefreshView )
+END_EVENT_TABLE( );
+*/
+//-------------------------------------------------------------------
+
+wxWidgetMesure2D::wxWidgetMesure2D( wxWindow *parent )
+: wxSplitterWindow( parent , -1)
+{
+// EED 27 oct 2007
+ this->SplitHorizontally( new wxPanel(this,-1) , new wxPanel(this,-1), 2 );
+ this->SetMinimumPaneSize(50);
+}
+//-------------------------------------------------------------------
+wxWidgetMesure2D::~wxWidgetMesure2D()
+{
+}
+//-------------------------------------------------------------------
+wxWindow *wxWidgetMesure2D::CreateWin1a(wxWindow *parent) // virtual
+{
+ wxPanel *panel = new wxPanel(parent,-1);
+
+ _cb_messuretool = new wxCheckBox(panel,-1,_T("Active messure tool "));
+ _cb_mt_visible = new wxCheckBox(panel,-1,_T("Visibles "));
+ _cb_closeContour = new wxCheckBox(panel,-1,_T("Close/Open "));
+ _cb_visibleText = new wxCheckBox(panel,-1,_T("Information "));
+
+ _cb_mt_visible->SetValue(true);
+ _cb_closeContour->SetValue(true);
+ _cb_visibleText->SetValue(true);
+
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(4);
+
+ sizer->Add(_cb_messuretool);
+ sizer->Add(_cb_mt_visible);
+ sizer->Add(_cb_closeContour);
+ sizer->Add(_cb_visibleText);
+
+ panel->SetAutoLayout(true);
+ panel->SetSizer(sizer);
+ panel->SetSize(400,30);
+ panel->Layout();
+//EEDxx2.4
+// panel->FitInside();
+
+ Connect(_cb_messuretool->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnActiveMessureTool );
+ Connect(_cb_mt_visible->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnVisibleMessureTool );
+ Connect(_cb_closeContour->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnCloseContour );
+ Connect(_cb_visibleText->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnVisibleInformation );
+
+ return panel;
+}
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D::ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview) // virtual
+{
+ _wxvtk2Dbaseview = wxvtk2Dbaseview;
+
+ // Contorno 1
+ _manContourControl_1 = new manualContourControler();
+ _mContourModel_1 = new manualContourModel();
+ _mViewContour_1 = new manualViewContour();
+ _mViewContour_1->SetModel( _mContourModel_1 );
+ _mViewContour_1->SetWxVtkBaseView( _wxvtk2Dbaseview );
+ _mViewContour_1->SetRange( 1 );
+
+// EED 3 oct 2006
+// double spc[3];
+// _wxvtk2Dbaseview->GetSpacing( spc );
+// _mViewContour_1->SetSpacing( spc );
+
+
+
+ _manContourControl_1->SetZ( 1000 );
+ _manContourControl_1->SetModelView( _mContourModel_1 , _mViewContour_1 );
+ ((vtkInteractorStyleBaseView*)_wxvtk2Dbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_1 );
+ _manContourControl_1->CreateNewManualContour();
+ _manContourControl_1->SetActive( false );
+ _mViewContour_1->RefreshContour();
+
+//EED 27 Oct 2007
+
+// this->ReplaceWindow( this->GetWindow1() , CreateWin1a(this) );
+// this->ReplaceWindow( this->GetWindow2() , _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor() );
+// CreateWin1a(this->GetWindow1() );
+
+ wxBoxSizer *sizerA = new wxBoxSizer(wxHORIZONTAL);
+ sizerA->Add( CreateWin1a( this->GetWindow1()) ,1, wxGROW );
+ this->GetWindow1()->SetSizer(sizerA);
+ this->SetAutoLayout(true);
+ this->Layout();
+
+ wxBoxSizer *sizerB = new wxBoxSizer(wxHORIZONTAL);
+ sizerB->Add( _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor() ,1, wxGROW );
+ this->GetWindow2()->SetSizer(sizerB);
+ this->SetAutoLayout(true);
+ this->Layout();
+
+
+// this->SplitHorizontally( CreateWin1a(this) , _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor() , 2 );
+
+
+//EEDxx2.4
+// this->FitInside();
+}
+
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D::ActiveMessureTool(bool ok)
+{
+ ((vtkInteractorStyleBaseView*)_wxvtk2Dbaseview->GetInteractorStyleBaseView())->SetActiveAllInteractors(!ok);
+ _manContourControl_1->SetActive( ok );
+}
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D::OnActiveMessureTool(wxCommandEvent& event)
+{
+ ActiveMessureTool( _cb_messuretool->GetValue() );
+ if ( _cb_messuretool->GetValue() == true )
+ {
+ _cb_mt_visible->SetValue(true);
+ _mViewContour_1->SetVisible( _cb_mt_visible->GetValue() );
+ _cb_closeContour->Enable(true);
+ _cb_visibleText->Enable(true);
+ } else{
+ _cb_closeContour->Enable(false);
+ _cb_visibleText->Enable(false);
+ }
+ _wxvtk2Dbaseview->Refresh();
+ _wxvtk2Dbaseview->RefreshView();
+}
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D::OnVisibleMessureTool(wxCommandEvent& event)
+{
+ _cb_messuretool->SetValue( _cb_mt_visible->GetValue() );
+ if (_cb_messuretool->GetValue()==true)
+ {
+ _cb_closeContour->Enable(true);
+ _cb_visibleText->Enable(true);
+ }
+ ActiveMessureTool( _cb_messuretool->GetValue() );
+ _mViewContour_1->SetVisible( _cb_mt_visible->GetValue() );
+ _mViewContour_1->Refresh();
+ _wxvtk2Dbaseview->Refresh();
+ _wxvtk2Dbaseview->RefreshView();
+}
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D::OnCloseContour(wxCommandEvent& event)
+{
+ _mContourModel_1->SetCloseContour( _cb_closeContour->GetValue() );
+ _mViewContour_1->Refresh();
+ _wxvtk2Dbaseview->Refresh();
+ _wxvtk2Dbaseview->RefreshView();
+
+}
+//-------------------------------------------------------------------
+void wxWidgetMesure2D::OnVisibleInformation(wxCommandEvent& event)
+{
+ _mViewContour_1->SetShowText( _cb_visibleText->GetValue() );
+ _mViewContour_1->Refresh();
+ _wxvtk2Dbaseview->Refresh();
+ _wxvtk2Dbaseview->RefreshView();
+}
+//-------------------------------------------------------------------
+void wxWidgetMesure2D::SetMesureScale(double mesureScale)
+{
+ _mViewContour_1->SetMesureScale(mesureScale);
+}
+//-------------------------------------------------------------------
+manualContourModel* wxWidgetMesure2D::GetManualContourModel()
+{
+ return _mContourModel_1;
+}
--- /dev/null
+#ifndef WXWIDGETMESURE2D_H_
+#define WXWIDGETMESURE2D_H_
+
+#include <wx/splitter.h>
+#include <wx/checkbox.h>
+#include "manualContour.h"
+#include "wxVtk2DBaseView.h"
+
+class wxWidgetMesure2D : public wxSplitterWindow
+{
+public:
+ wxWidgetMesure2D( wxWindow *parent );
+ ~wxWidgetMesure2D();
+
+ void OnActiveMessureTool(wxCommandEvent& event);
+ void OnVisibleMessureTool(wxCommandEvent& event);
+ void OnCloseContour(wxCommandEvent& event);
+ void OnVisibleInformation(wxCommandEvent& event);
+
+ void SetMesureScale(double mesureScale);
+
+ manualContourModel* GetManualContourModel();
+ virtual void ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview);
+
+protected:
+ wxVtk2DBaseView *_wxvtk2Dbaseview;
+ virtual wxWindow *CreateWin1a(wxWindow *parent);
+private:
+ wxCheckBox *_cb_messuretool;
+ wxCheckBox *_cb_mt_visible;
+ wxCheckBox *_cb_closeContour;
+ wxCheckBox *_cb_visibleText;
+
+ manualContourControler *_manContourControl_1;
+ manualContourModel *_mContourModel_1;
+ manualViewContour *_mViewContour_1;
+
+ void ActiveMessureTool(bool ok);
+
+// DECLARE_EVENT_TABLE();
+};
+
+
+#endif /*WXWIDGETMESURE2D_H_*/
--- /dev/null
+#include "wxWidgetMesure2D_Plane.h"
+
+#include "vtkPlane2DView.h"
+
+wxWidgetMesure2D_Plane::wxWidgetMesure2D_Plane(wxWindow *parent)
+: wxWidgetMesure2D(parent)
+{
+ // Circle 1
+ _ptsCircle1 = NULL;
+ _circle1Actor = NULL;
+ _circle1Mapper = NULL;
+ _pdCircle1 = NULL;
+ // Circle 2
+ _ptsCircle2 = NULL;
+ _circle2Actor = NULL;
+ _circle2Mapper = NULL;
+ _pdCircle2 = NULL;
+ // line reference 1
+ _ptsLineRef1 = NULL;
+ _lineRef1Actor = NULL;
+ _lineRef1Mapper = NULL;
+ _pdLineRef1 = NULL;
+ // line reference 2
+ _ptsLineRef2 = NULL;
+ _lineRef2Actor = NULL;
+ _lineRef2Mapper = NULL;
+ _pdLineRef2 = NULL;
+
+}
+
+//-------------------------------------------------------------------
+
+wxWidgetMesure2D_Plane::~wxWidgetMesure2D_Plane()
+{
+ // Circle 1
+ if ( _ptsCircle1 != NULL){ _ptsCircle1 -> Delete(); }
+ if ( _circle1Actor != NULL){ _circle1Actor -> Delete(); }
+ if ( _circle1Mapper != NULL){ _circle1Mapper -> Delete(); }
+ if ( _pdCircle1 != NULL){ _pdCircle1 -> Delete(); }
+ // Circle 2
+ if ( _ptsCircle2 != NULL){ _ptsCircle2 -> Delete(); }
+ if ( _circle2Actor != NULL){ _circle2Actor -> Delete(); }
+ if ( _circle2Mapper != NULL){ _circle2Mapper -> Delete(); }
+ if ( _pdCircle2 != NULL){ _pdCircle2 -> Delete(); }
+ // line reference 1
+ if ( _ptsLineRef1 != NULL){ _ptsLineRef1 -> Delete(); }
+ if ( _lineRef1Actor != NULL){ _lineRef1Actor -> Delete(); }
+ if ( _lineRef1Mapper != NULL){ _lineRef1Mapper -> Delete(); }
+ if ( _pdLineRef1 != NULL){ _pdLineRef1 -> Delete(); }
+ // line reference 2
+ if ( _ptsLineRef2 != NULL){ _ptsLineRef2 -> Delete(); }
+ if ( _lineRef2Actor != NULL){ _lineRef2Actor -> Delete(); }
+ if ( _lineRef2Mapper != NULL){ _lineRef2Mapper -> Delete(); }
+ if ( _pdLineRef2 != NULL){ _pdLineRef2 -> Delete(); }
+}
+
+//-------------------------------------------------------------------
+
+wxWindow *wxWidgetMesure2D_Plane::CreateWin1a(wxWindow *parent) // virtual
+{
+ wxPanel *panel = new wxPanel(parent,-1);
+
+ _cb_circle = new wxCheckBox(panel,-1,_T("Circle "));
+ _cb_line = new wxCheckBox(panel,-1,_T("Rotation Axe "));
+
+
+ wxBoxSizer *sizerA = new wxBoxSizer(wxHORIZONTAL);
+ sizerA->Add(_cb_circle);
+ sizerA->Add(_cb_line);
+
+
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+ sizer->Add( sizerA );
+ sizer->Add( wxWidgetMesure2D::CreateWin1a(panel) );
+
+ panel->SetAutoLayout(true);
+ panel->SetSizer(sizer);
+ panel->SetSize(400,30);
+ panel->Layout();
+//EEDxx2.4
+// panel->FitInside();
+
+ Connect(_cb_line->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D_Plane::OnActiveLine );
+ Connect(_cb_circle->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D_Plane::OnActiveCirlcle );
+
+ return panel;
+}
+
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D_Plane::OnActiveCirlcle(wxCommandEvent& event)
+{
+ SetVisibleCircle( _cb_circle->GetValue() );
+ _wxvtk2Dbaseview->RefreshView();
+}
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D_Plane::SetVisibleCircle( bool ok )
+{
+ double opacity;
+ if (ok==true)
+ {
+ opacity=1;
+ } else {
+ opacity=0;
+ }
+ _lineRef1Actor->GetProperty()->SetOpacity( opacity );
+ _lineRef2Actor->GetProperty()->SetOpacity( opacity );
+ _circle1Actor->GetProperty()->SetOpacity( opacity );
+ _circle2Actor->GetProperty()->SetOpacity( opacity );
+}
+//-------------------------------------------------------------------
+void wxWidgetMesure2D_Plane::OnActiveLine(wxCommandEvent& event)
+{
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)_wxvtk2Dbaseview;
+ vtkplane2Dview->SetVisibleLine( _cb_line->GetValue() );
+ _wxvtk2Dbaseview->RefreshView();
+}
+
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D_Plane::ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview) // virtual
+{
+ wxWidgetMesure2D::ConfigureA(wxvtk2Dbaseview);
+ CircleLine();
+ ConfigureCircleLine();
+ SetVisibleCircle(false);
+}
+
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D_Plane::ConfigureCircleLine()
+{
+ double ang;
+
+ vtkPlane2DView *vtkplane2Dview = (vtkPlane2DView*)_wxvtk2Dbaseview;
+ int sizeIma = vtkplane2Dview->GetImgSize();
+
+ double i,maxPts=20;
+ double k=(360/(maxPts-1)) * (3.1416/180);
+ double x,y,r1=5,r2=10,r3=15;
+ for (i=0;i<maxPts;i++)
+ {
+ x=cos( k*i ) ;
+ y=sin( k*i ) ;
+ _ptsCircle1->SetPoint( (int)i , (sizeIma/2) + x*r1 , (sizeIma/2) + y*r1 , 1 );
+ _ptsCircle2->SetPoint( (int)i , (sizeIma/2) + x*r2 , (sizeIma/2) + y*r2 , 1 );
+ }
+
+ //
+ ang=(45) * (3.1416/180);
+ x=cos( ang ) ;
+ y=sin( ang ) ;
+ _ptsLineRef1->SetPoint( 0 , (sizeIma/2) + x*r3 , (sizeIma/2) + y*r3 , 1 );
+
+ ang=(45+180) * (3.1416/180);
+ x=cos( ang ) ;
+ y=sin( ang ) ;
+ _ptsLineRef1->SetPoint( 1 , (sizeIma/2) + x*r3 , (sizeIma/2) + y*r3 , 1 );
+
+ //
+ ang=(135) * (3.1416/180);
+ x=cos( ang ) ;
+ y=sin( ang ) ;
+ _ptsLineRef2->SetPoint( 0 , (sizeIma/2) + x*r3 , (sizeIma/2) + y*r3 , 1 );
+
+ ang=(135+180) * (3.1416/180);
+ x=cos( ang ) ;
+ y=sin( ang ) ;
+ _ptsLineRef2->SetPoint( 1 , (sizeIma/2) + x*r3 , (sizeIma/2) + y*r3 , 1 );
+}
+
+
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D_Plane::CircleLine()
+{
+ int i,maxPts=20;
+ vtkCellArray *lines;
+
+ vtkImageViewer2_XYZ *imageViewer2XYZ = _wxvtk2Dbaseview->_imageViewer2XYZ;
+
+
+// Circle 1 Horizontal
+ _ptsCircle1 = vtkPoints::New();
+ _ptsCircle1->SetNumberOfPoints(maxPts);
+ lines = vtkCellArray::New();
+ lines->InsertNextCell(maxPts);
+ for (i=0;i<maxPts;i++)
+ {
+ lines->InsertCellPoint(i);
+ _ptsCircle1->SetPoint(i, 0 , 0 , 0 );
+ }
+ lines->InsertCellPoint(0);
+ _ptsCircle1->SetPoint(0, -1000 , -1000 , -1000 );
+ _ptsCircle1->SetPoint(1, 1000 , 1000 , 1000 );
+
+ _pdCircle1 = vtkPolyData::New();
+ _pdCircle1->SetPoints( _ptsCircle1 );
+ _pdCircle1->SetLines( lines );
+ lines->Delete(); //do not delete lines ??
+ _circle1Actor = vtkActor::New();
+ _circle1Mapper = vtkPolyDataMapper::New();
+ _circle1Mapper->SetInput(_pdCircle1);
+ _circle1Mapper->ImmediateModeRenderingOn();
+ _circle1Actor->SetMapper(_circle1Mapper);
+ _circle1Actor->GetProperty()->BackfaceCullingOn();
+ _circle1Actor->GetProperty()->SetDiffuseColor(0,0,1);
+ _circle1Actor->GetProperty()->SetLineWidth(2);
+ imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _circle1Actor );
+
+// Circle 2 Horizontal
+ _ptsCircle2 = vtkPoints::New();
+ _ptsCircle2->SetNumberOfPoints(maxPts);
+ lines = vtkCellArray::New();
+ lines->InsertNextCell(maxPts);
+ for (i=0;i<maxPts;i++)
+ {
+ lines->InsertCellPoint(i);
+ _ptsCircle2->SetPoint(i, 0 , 0 , 0 );
+ }
+ _ptsCircle2->SetPoint(0, -1000 , -1000 , -1000 );
+ _ptsCircle2->SetPoint(1, 1000 , 1000 , 1000 );
+
+ _pdCircle2 = vtkPolyData::New();
+ _pdCircle2->SetPoints( _ptsCircle2 );
+ _pdCircle2->SetLines( lines );
+ lines->Delete(); //do not delete lines ??
+ _circle2Actor = vtkActor::New();
+ _circle2Mapper = vtkPolyDataMapper::New();
+ _circle2Mapper->SetInput(_pdCircle2);
+ _circle2Mapper->ImmediateModeRenderingOn();
+ _circle2Actor->SetMapper(_circle2Mapper);
+ _circle2Actor->GetProperty()->BackfaceCullingOn();
+ _circle2Actor->GetProperty()->SetDiffuseColor(0,0,1);
+ _circle2Actor->GetProperty()->SetLineWidth(2);
+ imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _circle2Actor );
+
+// Line Referance 1
+ _ptsLineRef1 = vtkPoints::New();
+ _ptsLineRef1->SetNumberOfPoints(2);
+ _ptsLineRef1->SetPoint(0, -1000 , -1000 , -1000 );
+ _ptsLineRef1->SetPoint(1, 1000 , 1000 , 1000 );
+ lines = vtkCellArray::New();
+ lines->InsertNextCell(2);
+ lines->InsertCellPoint(0);
+ lines->InsertCellPoint(1);
+
+ _pdLineRef1 = vtkPolyData::New();
+ _pdLineRef1->SetPoints( _ptsLineRef1 );
+ _pdLineRef1->SetLines( lines );
+ lines->Delete(); //do not delete lines ??
+ _lineRef1Actor = vtkActor::New();
+ _lineRef1Mapper = vtkPolyDataMapper::New();
+ _lineRef1Mapper->SetInput(_pdLineRef1);
+ _lineRef1Mapper->ImmediateModeRenderingOn();
+ _lineRef1Actor->SetMapper(_lineRef1Mapper);
+ _lineRef1Actor->GetProperty()->BackfaceCullingOn();
+ _lineRef1Actor->GetProperty()->SetDiffuseColor(0,0,1);
+ _lineRef1Actor->GetProperty()->SetLineWidth(2);
+ imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineRef1Actor );
+
+// Line Referance 2
+ _ptsLineRef2 = vtkPoints::New();
+ _ptsLineRef2->SetNumberOfPoints(2);
+ _ptsLineRef2->SetPoint(0, -1000 , -1000 , -1000 );
+ _ptsLineRef2->SetPoint(1, 1000 , 1000 , 1000 );
+ lines = vtkCellArray::New();
+ lines->InsertNextCell(2);
+ lines->InsertCellPoint(0);
+ lines->InsertCellPoint(1);
+
+ _pdLineRef2 = vtkPolyData::New();
+ _pdLineRef2->SetPoints( _ptsLineRef2 );
+ _pdLineRef2->SetLines( lines );
+ lines->Delete(); //do not delete lines ??
+ _lineRef2Actor = vtkActor::New();
+ _lineRef2Mapper = vtkPolyDataMapper::New();
+ _lineRef2Mapper->SetInput(_pdLineRef2);
+ _lineRef2Mapper->ImmediateModeRenderingOn();
+ _lineRef2Actor->SetMapper(_lineRef2Mapper);
+ _lineRef2Actor->GetProperty()->BackfaceCullingOn();
+ _lineRef2Actor->GetProperty()->SetDiffuseColor(0,0,1);
+ _lineRef2Actor->GetProperty()->SetLineWidth(2);
+ imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineRef2Actor );
+
+
+}
+
--- /dev/null
+#ifndef WXWIDGETMESURE2D_PLANE_H_
+#define WXWIDGETMESURE2D_PLANE_H_
+
+#include "wxWidgetMesure2D.h"
+
+class wxWidgetMesure2D_Plane : public wxWidgetMesure2D
+{
+public:
+ wxWidgetMesure2D_Plane(wxWindow *parent);
+ ~wxWidgetMesure2D_Plane();
+ void OnActiveLine(wxCommandEvent& event);
+ void OnActiveCirlcle(wxCommandEvent& event);
+ virtual void ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview);
+ void ConfigureCircleLine();
+ void CircleLine();
+
+protected:
+ virtual wxWindow *CreateWin1a(wxWindow *parent);
+private:
+ wxCheckBox *_cb_line;
+ wxCheckBox *_cb_circle;
+
+ // Circle 1
+ vtkPoints *_ptsCircle1;
+ vtkActor *_circle1Actor;
+ vtkPolyDataMapper *_circle1Mapper;
+ vtkPolyData *_pdCircle1;
+ // Circle 2
+ vtkPoints *_ptsCircle2;
+ vtkActor *_circle2Actor;
+ vtkPolyDataMapper *_circle2Mapper;
+ vtkPolyData *_pdCircle2;
+ // line reference 1
+ vtkPoints *_ptsLineRef1;
+ vtkActor *_lineRef1Actor;
+ vtkPolyDataMapper *_lineRef1Mapper;
+ vtkPolyData *_pdLineRef1;
+ // line reference 2
+ vtkPoints *_ptsLineRef2;
+ vtkActor *_lineRef2Actor;
+ vtkPolyDataMapper *_lineRef2Mapper;
+ vtkPolyData *_pdLineRef2;
+
+ void SetVisibleCircle( bool ok );
+
+};
+
+#endif /*WXWIDGETMESURE2D_PLANE_H_*/
--- /dev/null
+#include "wxWidgetMesure2D_Plane_in_MPR.h"
+
+wxWidgetMesure2D_Plane_in_MPR::wxWidgetMesure2D_Plane_in_MPR(wxWindow *parent)
+:wxWidgetMesure2D_Plane(parent)
+{
+ _vtkplane2Dview=NULL;
+}
+
+//-------------------------------------------------------------------
+
+wxWidgetMesure2D_Plane_in_MPR::~wxWidgetMesure2D_Plane_in_MPR()
+{
+}
+//-------------------------------------------------------------------
+void wxWidgetMesure2D_Plane_in_MPR::OnActiveLink(wxCommandEvent& event)
+{
+ if (_vtkplane2Dview!=NULL)
+ {
+ _vtkplane2Dview->SetActive( _cb_link->GetValue() );
+ _vtkplane2Dview->Refresh();
+ _vtkplane2Dview->RefreshView();
+ }
+}
+
+
+//-------------------------------------------------------------------
+void wxWidgetMesure2D_Plane_in_MPR::SetActiveLink(bool ok)
+{
+ _cb_link->SetValue(ok);
+ if (_vtkplane2Dview!=NULL)
+ {
+ _vtkplane2Dview->SetActive( _cb_link->GetValue() );
+ }
+}
+//-------------------------------------------------------------------
+
+void wxWidgetMesure2D_Plane_in_MPR::SetVtkPlane2DView(vtkPlane2DView *vtkplane2Dview)
+{
+ _vtkplane2Dview = vtkplane2Dview;
+}
+
+//-------------------------------------------------------------------
+
+wxWindow *wxWidgetMesure2D_Plane_in_MPR::CreateWin1a(wxWindow *parent) // virtual
+{
+ wxPanel *panel = new wxPanel(parent,-1);
+
+ _cb_link = new wxCheckBox(panel,-1,_T("LINK "));
+ _cb_link->SetValue(true);
+
+ wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
+
+ sizer->Add(_cb_link);
+
+ sizer->Add( wxWidgetMesure2D_Plane::CreateWin1a(panel) );
+
+ panel->SetAutoLayout(true);
+ panel->SetSizer(sizer);
+ panel->SetSize(400,30);
+ panel->Layout();
+
+//EEDxx2.4
+// panel->FitInside();
+
+ Connect(_cb_link->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxWidgetMesure2D_Plane_in_MPR::OnActiveLink );
+
+ return panel;
+}
+
--- /dev/null
+#ifndef WXWIDGETMESURE2D_PLANE_IN_MPR_H_
+#define WXWIDGETMESURE2D_PLANE_IN_MPR_H_
+
+#include "wxWidgetMesure2D_Plane.h"
+#include "vtkPlane2DView.h"
+
+class wxWidgetMesure2D_Plane_in_MPR : public wxWidgetMesure2D_Plane
+{
+public:
+ wxWidgetMesure2D_Plane_in_MPR(wxWindow *parent);
+ ~wxWidgetMesure2D_Plane_in_MPR();
+ void OnActiveLink(wxCommandEvent& event);
+ void SetVtkPlane2DView(vtkPlane2DView *vtkplane2Dview);
+ void SetActiveLink(bool ok);
+
+protected:
+ virtual wxWindow *CreateWin1a(wxWindow *parent);
+private:
+ wxCheckBox *_cb_link;
+ vtkPlane2DView *_vtkplane2Dview;
+};
+
+
+#endif /*WXWIDGETMESURE2D_PLANE_IN_MPR_H_*/
Program: wxMaracas
Module: $RCSfile: wxMaracasMPR.cxx,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:45 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/05/14 13:54:31 $
+ Version: $Revision: 1.4 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: wxMaracasMPR.h,v $
Language: C++
- Date: $Date: 2009/05/04 07:35:45 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2009/05/14 13:54:31 $
+ Version: $Revision: 1.6 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: wxMaracas_ManualTree_MPR.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:31 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: wxMaracas_ManualTree_MPR.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:11 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:31 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
--- /dev/null
+# This directory should only be build if wxWindows and VTK can be found
+
+SET(MaracasKernel_SRCS
+curve.cxx
+curve.hxx
+volume.cxx
+volume.hxx
+marVector.cpp
+marVector.h
+marMatrix.cpp
+marMatrix.h
+marMathConst.h
+marTypes.h
+marAxis.cpp
+marAxis.h
+marContour.cpp
+marContour.h
+marKVolume.cpp
+marKVolume.h
+marDynData.cpp
+marDynData.h
+marExperiment.cpp
+marExperiment.h
+marInterface.cpp
+marInterface.h
+marObject.cpp
+marObject.h
+marParameters.cpp
+marParameters.h
+marDicomBase.cpp
+marDicomBase.h
+axisExtractor.cxx
+axisExtractor.h
+axisExtractor02.cxx
+axisExtractor02.h
+carotidaBifurcacion.cxx
+carotidaBifurcacion.h
+marAxisCT.cpp
+marAxisCT.h
+marInterfaceCT.cpp
+marInterfaceCT.h
+marExperimentCT.cpp
+marExperimentCT.h
+marAxisContours.cpp
+marAxisContours.h
+marContourVO.cpp
+marContourVO.h
+marIsocontour.cpp
+marIsocontour.h
+marPoint.cpp
+marPoint.h
+marLine.cpp
+marLine.h
+vtkDijkstraImageData.cxx
+vtkDijkstraImageData.h
+vtkOtsuImageData.cxx
+vtkOtsuImageData.h
+vtkOtsuSphereSource.cxx
+vtkOtsuSphereSource.h
+itkFM3D.h
+itkFM3D.cxx
+itkVTKImageToImageFilter.h
+itkVTKImageToImageFilter.txx
+itkImageToVTKImageFilter.h
+itkImageToVTKImageFilter.txx
+vtkJoiner.cxx
+vtkJoiner.h
+vtkSTLExtractor.cpp
+vtkSTLExtractor.h
+marUtils.h
+marUtils.cpp
+marImageData.cpp
+marImageData.h
+)
+
+ADD_LIBRARY(MaracasKernel ${MaracasKernel_SRCS})
+IF(CYGWIN)
+TARGET_LINK_LIBRARIES(MaracasKernel
+ MaracasAlgorithm
+ MaracasSnakeContour
+ ${GDCM_LIBRARIES}
+ ${WXWIDGETS_LIBRARIES}
+ ${MARACAS_ITK_LIBRARIES}
+)
+ELSE(CYGWIN)
+TARGET_LINK_LIBRARIES(MaracasKernel
+ MaracasAlgorithm
+ MaracasSnakeContour
+ ${GDCM_LIBRARIES}
+ ${WXWIDGETS_LIBRARIES}
+ vtkCommon vtkGraphics vtkImaging
+ ${MARACAS_ITK_LIBRARIES}
+)
+ENDIF(CYGWIN)
+#SET_TARGET_PROPERTIES(MaracasKernel PROPERTIES LINK_FLAGS "/nodefaultlib:msvcrt")
+
Program: wxMaracas
Module: $RCSfile: curve.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: curve.hxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: gslobj.hxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkImageToVTKImageFilter.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright (c) 2002 Insight Consortium. All rights reserved.
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkVTKImageToImageFilter.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright (c) 2002 Insight Consortium. All rights reserved.
Program: wxMaracas
Module: $RCSfile: marAxis.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marAxis.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marAxisCT.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marAxisContours.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marAxisContours.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marContourVO.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marContourVO.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marExperiment.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marExperiment.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marExperimentCT.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marExperimentCT.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marInterface.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:07 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marInterface.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marInterfaceCT.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marInterfaceCT.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marIsocontour.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marIsocontour.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marKVolume.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marKVolume.h,v $
Language: C++
- Date: $Date: 2009/03/24 10:49:23 $
- Version: $Revision: 1.2 $
+ Date: $Date: 2009/05/14 13:55:08 $
+ Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: marPoint.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:56 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marPoint.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:56 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marSimpleDicom.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:56 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: marSimpleDicom.h,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:56 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: matrix.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:56 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: wxMaracas
Module: $RCSfile: vector.cxx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:56 $
+ Date: $Date: 2009/05/14 13:55:08 $
Version: $Revision: 1.1 $
Copyright: (c) 2002, 2003
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkImageToVTKImageFilter.txx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.2 $
Copyright (c) 2002 Insight Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: itkVTKImageToImageFilter.txx,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:54 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.2 $
Copyright (c) 2002 Insight Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
Program: wxMaracas
Module: $RCSfile: marDynData.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: marDynData.h,v $
Language: C++
- Date: $Date: 2009/01/15 11:09:47 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.4 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: marObject.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:55 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: marObject.h,v $
Language: C++
- Date: $Date: 2009/01/15 11:09:47 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: marParameters.cpp,v $
Language: C++
- Date: $Date: 2008/10/31 16:32:56 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.2 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: marParameters.h,v $
Language: C++
- Date: $Date: 2009/01/15 11:09:47 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.4 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: marTypes.h,v $
Language: C++
- Date: $Date: 2009/01/15 11:09:47 $
- Version: $Revision: 1.6 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.7 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: volume.cxx,v $
Language: C++
- Date: $Date: 2009/01/26 11:22:49 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License:
Program: wxMaracas
Module: $RCSfile: volume.hxx,v $
Language: C++
- Date: $Date: 2009/01/26 11:22:49 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2009/05/14 13:54:43 $
+ Version: $Revision: 1.5 $
Copyright: (c) 2002, 2003
License: