vtkSlicerVolumesLogic.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: vtkSlicerVolumesLogic.h,v $
00010   Date:      $Date: 2006/01/08 04:48:05 $
00011   Version:   $Revision: 1.45 $
00012 
00013 =========================================================================auto=*/
00014 
00015 // .NAME vtkSlicerVolumesLogic - slicer logic class for volumes manipulation
00016 // .SECTION Description
00017 // This class manages the logic associated with reading, saving,
00018 // and changing propertied of the volumes
00019 
00020 
00021 #ifndef __vtkSlicerVolumesLogic_h
00022 #define __vtkSlicerVolumesLogic_h
00023 
00024 // Slicer includes
00025 #include "vtkSlicerModuleLogic.h"
00026 
00027 // MRML includes
00028 #include "vtkMRML.h"
00029 #include "vtkMRMLVolumeNode.h"
00030 
00031 // STL includes
00032 #include <stdlib.h>
00033 
00034 #include "vtkSlicerVolumesModuleLogicExport.h"
00035 
00036 class vtkMRMLScalarVolumeNode;
00037 class vtkMRMLScalarVolumeDisplayNode;
00038 class vtkMRMLVolumeHeaderlessStorageNode;
00039 class vtkStringArray;
00040 
00041 class VTK_SLICER_VOLUMES_MODULE_LOGIC_EXPORT vtkSlicerVolumesLogic :
00042   public vtkSlicerModuleLogic
00043 {
00044   public:
00045   
00046   // The Usual vtk class functions
00047   static vtkSlicerVolumesLogic *New();
00048   vtkTypeRevisionMacro(vtkSlicerVolumesLogic,vtkSlicerModuleLogic);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00051   // Description:
00052   // The currently active mrml volume node 
00053   vtkGetObjectMacro (ActiveVolumeNode, vtkMRMLVolumeNode);
00054   void SetActiveVolumeNode (vtkMRMLVolumeNode *ActiveVolumeNode);
00055 
00056   // Description:
00057   // Sub type of loading an archetype volume that is known to be a scalar
00058   vtkMRMLScalarVolumeNode* AddArchetypeScalarVolume (const char *filename, const char* volname, int loadingOptions);
00059 
00060   vtkMRMLScalarVolumeNode* AddArchetypeScalarVolume (const char *filename, const char* volname) 
00061     {
00062     return this->AddArchetypeScalarVolume( filename, volname, 0);
00063     };
00064 
00065   // Description:
00066   // Overloaded function of AddArchetypeVolume to provide more 
00067   // loading options, where variable loadingOptions is bit-coded as following:
00068   // bit 0: label map
00069   // bit 1: centered
00070   // bit 2: loading single file
00071   // higher bits are reserved for future use
00072   vtkMRMLVolumeNode* AddArchetypeVolume (const char* filename, const char* volname, int loadingOptions) 
00073     {
00074     return (this->AddArchetypeVolume( filename, volname, loadingOptions, NULL));
00075     };
00076   vtkMRMLVolumeNode* AddArchetypeVolume (const char* filename, const char* volname, int loadingOptions, vtkStringArray *fileList);
00077   vtkMRMLVolumeNode* AddArchetypeVolume (const char *filename, const char* volname) 
00078     {
00079     return this->AddArchetypeVolume( filename, volname, 0, NULL);
00080     };
00081 
00082   // Description:
00083   // Create new mrml node and associated storage node.
00084   // Read image data from a specified file
00085   // vtkMRMLVolumeNode* AddArchetypeVolume (const char* filename, int centerImage, int labelMap, const char* volname);
00086 
00087   // Description:
00088   // Overloaded function of AddHeaderVolume to provide more 
00089   // loading options, where variable loadingOptions is bit-coded as following:
00090   // bit 0: label map
00091   // bit 1: centered
00092   // bit 2: loading signal file
00093   // higher bits are reserved for future use
00094   vtkMRMLVolumeNode* AddHeaderVolume (const char* filename, const char* volname, 
00095                                       vtkMRMLVolumeHeaderlessStorageNode *headerStorage,
00096                                       int loadingOptions);
00097 
00098   // Description:
00099   // Create new mrml node and associated storage node.
00100   // Read image data from a specified file
00101   // vtkMRMLVolumeNode* AddHeaderVolume (const char* filename, int centerImage, int labelMap, const char* volname, 
00102   //                                    vtkMRMLVolumeHeaderlessStorageNode *headerStorage);
00103 
00104   // Description:
00105   // Write volume's image data to a specified file
00106   int SaveArchetypeVolume (const char* filename, vtkMRMLVolumeNode *volumeNode);
00107 
00108   // Description:
00109   // Create a label map volume to match the given volume node and add it to
00110   // the scene
00111   vtkMRMLScalarVolumeNode *CreateLabelVolume (vtkMRMLScene *scene, vtkMRMLVolumeNode *volumeNode, const char *name);
00112 
00113   // Description:
00114   // Create a deep copy of a volume and add it to the scene
00115   vtkMRMLScalarVolumeNode *CloneVolume (vtkMRMLScene *scene, 
00116                                         vtkMRMLVolumeNode *volumeNode, 
00117                                         const char *name);
00118 
00119   // Description:
00120   // Update MRML events
00121   virtual void ProcessMRMLEvents ( vtkObject * /*caller*/, 
00122                                   unsigned long /*event*/, 
00123                                   void * /*callData*/ );    
00124   // Description:
00125   // Update logic events
00126   virtual void ProcessLogicEvents ( vtkObject * /*caller*/, 
00127                                   unsigned long /*event*/, 
00128                                   void * /*callData*/ );  
00129   //BTX
00130   using vtkSlicerLogic::ProcessLogicEvents; 
00131   //ETX
00132   
00133   // Description:
00134   // Computes matrix we need to register
00135   // V1Node to V2Node given the
00136   // "register.dat" matrix from tkregister2 (FreeSurfer)
00137   void TranslateFreeSurferRegistrationMatrixIntoSlicerRASToRASMatrix( vtkMRMLVolumeNode *V1Node,
00138                              vtkMRMLVolumeNode *V2Node,
00139                              vtkMatrix4x4 *FSRegistrationMatrix,
00140                              vtkMatrix4x4 *ResultsMatrix);
00141   // Description:
00142   // Convenience method to compute
00143   // a volume's Vox2RAS-tkreg Matrix
00144   void ComputeTkRegVox2RASMatrix ( vtkMRMLVolumeNode *VNode,
00145                                    vtkMatrix4x4 *M );
00146 
00147 protected:
00148   vtkSlicerVolumesLogic();
00149   virtual ~vtkSlicerVolumesLogic();
00150   vtkSlicerVolumesLogic(const vtkSlicerVolumesLogic&);
00151   void operator=(const vtkSlicerVolumesLogic&);
00152 
00153   // Description:
00154   // Examine the file name to see if the extension is one of the supported
00155   // freesurfer volume formats. Used to assign the proper colour node to label
00156   // maps.
00157   int IsFreeSurferVolume (const char* filename);
00158   
00159   // Description:
00160   //
00161   vtkMRMLVolumeNode *ActiveVolumeNode;
00162 };
00163 
00164 #endif
00165 

Generated on 6 Apr 2011 for Slicer3 by  doxygen 1.6.1