#ifndef __DefOrgViewerWithKW_h #define __DefOrgViewerWithKW_h /*#define CRTDBG_MAP_ALLOC #include #include */ #define _CRT_SECURE_NO_DEPRECATE 1 #include "vtkKWObject.h" #include "itkImage.h" #include "itkImageFileReader.h" #include "vtkImageImport.h" #include "itkVTKImageExport.h" #include "vtkDefOrgViewerWithKWState.h" #include "DefOrgViewerAdapterBase.h" #include "DefOrgViewerAdapterBaseTemplated.h"//debug class vtkKWPushButton; class vtkKWCheckButton; class vtkKWVolumePropertyWidget; class vtkKWRenderWidget; class vtkImageViewer2; class vtkVolume; class vtkKWScale; class vtkKWWindowLevelPresetSelector; class vtkKWFrameWithLabel; class vtkKWWindow; class vtkActor; class vtkXMLImageDataReader; class vtkKWLoadSaveButton; class vtkKWSurfaceMaterialPropertyWidget; class vtkKWHSVColorSelector; class vtkActorCollection; class vtkKWScaleWithEntry; class vtkKWTextWithScrollbars; class vtkBoxWidget; class vtkMultiThreader; using namespace mial; /*!Core viewer class for handling UI interfaces*/ class vtkDefOrgViewerWithKW : public vtkKWObject { public: static vtkDefOrgViewerWithKW* New(); vtkTypeRevisionMacro(vtkDefOrgViewerWithKW,vtkKWObject); //entry point int Run(int argc, char *argv[]); void InitializeState(vtkKWWindow* win); // Description: // Callbacks /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SetSliceFromScaleCallback(double value); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SetSliceCallback(int slice); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual int GetSliceCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual int GetSliceMinCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual int GetSliceMaxCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SetSliceOrientationToXYCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SetSliceOrientationToXZCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SetSliceOrientationToYZCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void WindowLevelPresetApplyCallback(int id); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void WindowLevelPresetAddCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void WindowLevelPresetUpdateCallback(int id); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void WindowLevelPresetHasChangedCallback(int id); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void LoadImageDialogCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void LoadScheduleDialogCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void LoadMeshDialogCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void LoadDefOrgDialogCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void InitOrganismButtonCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SimulateOrganismButtonCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use. Call run on the organism synchronously.*/ virtual void StepOrganismButtonCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use. Call run on the organism asynchronously */ virtual void StepOrganism(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SendOrganismMessageCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void UpdateOrganismTextOutputCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void GenerateDefOrgDialogCallback(); /*!Internal callback. It is public for TCL wrapping. Do not use. Helper method. Also see SimulateOrganismButtonCallback*/ virtual void StopSimulation(); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SetVolumeRenderingCallback(int id); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SetVolumeRenderingControlBoxCallback(char * val); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void SetSOColorCallback(double h, double s, double v); virtual void LayerComboCallback(int id, const char* choice); /*!Internal callback. It is public for TCL wrapping. Do not use*/ virtual void ForcePrimaryRender(); /*!Internal callback. It is public for TCL wrapping. Do not use. Hack for animation widget to record deformation instead*/ virtual int NoOp(); //internal use /*!Internal callback. It is public for TCL wrapping. Do not use Hack for animation widget to record deformation instead*/ virtual void NoOp2(int i); //internal use DefOrgViewerAdapterBase* GetCurrDefOrg(){ return this->m_currState->theDefOrg; } bool m_updateOrganismResults; protected: vtkDefOrgViewerWithKW():m_currThreadID(0),m_updateOrganismResults(false),WindowLevelPresetSelector(0),SliceScale(0),m_currState(0),RenderWidget(0) {}; void SetupImageViewerPipeline(); void UpdateImageViewers(bool flushAll=false); //UI void CreateImageDataFrame(int imagePageCookie, vtkKWWindow* win); void CreateVolumeRenderingFrame(int volumeRenderingPageCookie, vtkKWWindow* win); void CreateOrganismDataFrame(int organismPageCookie, vtkKWWindow* win); void CreateSpatialObjectFrame(int polyPageCookie, vtkKWWindow *win); void AddActorsFromSOViewers(bool flushAll=false); void RemoveActorsFromSOViewers(bool flushAll=false); void SetScenesToSOViewers(bool flushAll=false); void RenderSOViewers(bool flushAll=false); //vtkImageViewer2 *ImageViewer; vtkKWScale *SliceScale; vtkKWWindowLevelPresetSelector *WindowLevelPresetSelector; vtkKWRenderWidget *RenderWidget; vtkKWLoadSaveButton *LoadImageButton; vtkKWLoadSaveButton *LoadScheduleButton; vtkKWLoadSaveButton *LoadMeshButton; vtkKWLoadSaveButton *LoadDefOrgButton; vtkKWPushButton *InitOrganismButton; vtkKWPushButton *SimulateOrganismButton; vtkKWPushButton *StepOrganismButton; vtkKWPushButton *SendOrganismMessageButton; vtkKWTextWithScrollbars *OrganismOutputTextbox; vtkKWTextWithScrollbars *OrganismInputTextbox; vtkKWVolumePropertyWidget *VRVolumePropertyWidget; vtkVolume **RenderVolume; vtkKWSurfaceMaterialPropertyWidget* SOMatieralPropertyWidget; vtkKWHSVColorSelector *SOColorWidget; vtkKWWindow *MainWindow; vtkKWTopLevel **viewerWindows; vtkKWFrameWithLabel *OrganismTextIOFrame; vtkBoxWidget *MeshBoxWidget; vtkKWCheckButton *VolumeRenderingCheckButton; int *VolumeRenderToggles; vtkMultiThreader *m_threader; int m_currThreadID; bool m_organismRunning; virtual void UpdateSliceScale(); //Destructor ~vtkDefOrgViewerWithKW() { delete [] RenderVolume; delete [] viewerWindows; delete [] VolumeRenderToggles; }; private: vtkDefOrgViewerWithKW(const vtkDefOrgViewerWithKW&); // Not implemented. void operator=(const vtkDefOrgViewerWithKW&); // Not implemented. vtkDefOrgViewerWithKWState* m_currState; int OutputImageOffset; //To keep track of which window is being edited void SetCurrDefOrg(DefOrgViewerAdapterBase* defOrg){ this->m_currState->theDefOrg = defOrg; } }; #endif