vtkSlicerMRMLSaveDataWidget.h

Go to the documentation of this file.
00001 /*=auto=========================================================================
00002 
00003   Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
00004 
00005   See Doc/copyright/copyright.txt
00006   or http://www.slicer.org/copyright/copyright.txt for details.
00007 
00008   Program:   3D Slicer
00009   Module:    $RCSfile: vtkSlicerNodeSelectorWidget.h,v $
00010   Date:      $Date: 2010-07-16 12:30:00 -0400 (Fri, 16 Jul 2010) $
00011   Version:   $Revision: 14197 $
00012 
00013 =========================================================================auto=*/
00014 
00021 //
00022 
00023 
00024 #ifndef __vtkSlicerMRMLSaveDataWidget_h
00025 #define __vtkSlicerMRMLSaveDataWidget_h
00026 
00027 #include "vtkSlicerWidget.h"
00028 
00029 #include "vtkMRMLScene.h"
00030 #include "vtkMRMLNode.h"
00031 
00032 class vtkKWDialog;
00033 class vtkKWLoadSaveDialog;
00034 class vtkKWEntryWithLabel;
00035 class vtkKWLoadSaveButtonWithLabel;
00036 class vtkKWCheckButton;
00037 class vtkKWMultiColumnListWithScrollbars;
00038 class vtkKWPushButton;
00039 class vtkMRMLStorageNode;
00040 class vtkStringArray;
00041 class vtkSlicerSaveDataWidgetIcons;
00042 
00043 class VTK_SLICER_BASE_GUI_EXPORT vtkSlicerMRMLSaveDataWidget : public vtkSlicerWidget
00044 {
00045   
00046 public:
00047   static vtkSlicerMRMLSaveDataWidget* New();
00048   vtkTypeRevisionMacro(vtkSlicerMRMLSaveDataWidget,vtkSlicerWidget);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050   
00053   virtual void ProcessWidgetEvents ( vtkObject *caller, unsigned long event, void *callData );
00054   
00057   virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, void *callData );
00058   
00061   virtual void AddWidgetObservers ( );
00062   virtual void RemoveWidgetObservers ( );
00063 
00066   vtkGetStringMacro(DataDirectoryName);
00067   vtkSetStringMacro(DataDirectoryName);
00068   
00071   vtkGetStringMacro(Version);
00072   vtkSetStringMacro(Version);
00073 
00077   int UpdateFromMRML();
00078 
00081   void Invoke();
00082   
00083     //BTX
00084   enum
00085     {
00086       DataSavedEvent = 69010,
00087     };
00088 //ETX
00089 
00090 
00091 protected:
00092   vtkSlicerMRMLSaveDataWidget();
00093   virtual ~vtkSlicerMRMLSaveDataWidget();
00094 
00097   virtual void CreateWidget();
00098   
00102   int SaveScene(int sceneRow);
00103 
00107   int SaveData(vtkIntArray* arrayRows);
00108 
00112   int SaveModifiedData();
00113 
00117   int SaveMarkedData();
00118 
00119   void UpdateDataDirectory();
00120 
00121   int CheckUniqueFilenames(vtkIntArray* arrayRows);
00122 
00125   void SetupSaveDataListWidget();
00126 
00131   void SetFileNameRelatedCells(
00132     int row, const char* filename, vtkStringArray* supportedFileFormats);
00133   void SetFileNameAndDirectoryCells(int row, const char* filename);
00134 
00138   void SetFileNameRelatedCellsEnabled(int row, int enable);
00139 
00144   void InitRowForNonSupportedFormat(
00145     int row, const char* filename, vtkStringArray* supportedFileFormats);
00146   
00149   void SetFirstAvailableFormat(int row);
00150 
00154   int IsRowFileFormatSet(int row);
00155 
00159   const char* GetFileFormatWithExtension(
00160     const char* fileext, vtkStringArray* supportedFileFormats);
00161 
00164   const char* GetRowCurrentFileExtension(int row);
00165   
00168   void UpdateRowFileNameWithExtension(int row);
00169   void UpdateRowFileFormatWithName(int row);
00170   
00173   const char* GetRowFileFormatWithExtension(int row, const char* extension);
00174 
00178   void SetDataDirectoryRelatedCells(
00179     int row, const char* dirname);
00180 
00183   void SetRowMarkedForSave(int row, int marked, int doUpdate=1);
00184 
00187   void SetRowModified(int row, int modified);
00188 
00191   void SetAllRowsSelected(int selected);
00192 
00195   int IsRowModified( int row);
00196 
00201   virtual void UpdateDataTableCell(int row, int col);
00202 
00206   virtual void AddNodeId(const char* strID, int row);
00207   virtual void AddStorageNodeId(const char* strID, int row);
00208 
00216   virtual void UpdateEnableState();
00217 
00220   virtual void UpdateNodeDataDirectory(int row);
00221 
00224   virtual void DisableRowForSaving(int row, const char* filename);
00225 
00228   virtual void AddMRMLSceneRow();
00229   
00232   virtual int IsSceneRow(int row);
00233 
00236   virtual int GetSceneRowIndex();
00237   
00240   virtual void SaveSceneWithData(int sceneRow);
00241 
00242   virtual void SetSnapshotsRootDirectory();
00243 
00244   //BTX
00247   enum
00248     {
00249     Save_Column = 0,
00250     NodeName_Column, 
00251     Type_Column, 
00252     Status_Column,
00253     Format_Column,
00254     FileName_Column,
00255     FileDirectory_Column,
00256     Hidden_NodeID_Column,
00257     Hidden_StorageNodeID_Column,
00258     Hidden_FileName_Column 
00259     };
00260 
00263   std::string GetRowFullFileName(int row);
00264   //ETX
00265 
00266 private:
00267   
00268   char *DataDirectoryName;
00269   
00270   char *Version;
00271 
00272   //BTX
00273   std::vector<std::string> Nodes;
00274   std::vector<std::string> StorageNodes;
00275   //ETX
00276   
00277   vtkKWDialog *SaveDialog;
00278 
00279   vtkSlicerSaveDataWidgetIcons* GUIIcons;
00280 
00281   vtkKWLoadSaveButtonWithLabel *ChangeAllSelectedDirButton;
00282 
00285   vtkKWPushButton *SelectAllButton;
00286   vtkKWPushButton *SelectNoneButton;
00287   vtkKWPushButton *SelectModifiedDataButton;
00288   vtkKWPushButton *SelectSceneAndModifiedDataButton;
00289   
00290   vtkKWPushButton *OkButton;
00291   vtkKWPushButton *CancelButton;
00292   
00293   vtkKWMultiColumnListWithScrollbars *MultiColumnList;
00294 
00295 
00296   bool IsProcessing;
00297   
00298   vtkSlicerMRMLSaveDataWidget(const vtkSlicerMRMLSaveDataWidget&); 
00299   void operator=(const vtkSlicerMRMLSaveDataWidget&); 
00300 };
00301 
00302 #endif
00303 
00304 
00305 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1