Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLSliceLogic.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Program: 3D Slicer
9  Module: $RCSfile: vtkMRMLSliceLogic.h,v $
10  Date: $Date$
11  Version: $Revision: 18866
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkMRMLSliceLogic_h
16 #define __vtkMRMLSliceLogic_h
17 
18 // MRMLLogic includes
19 #include "vtkMRMLAbstractLogic.h"
20 
21 // STD includes
22 #include <vector>
23 
24 class vtkMRMLDisplayNode;
27 class vtkMRMLModelNode;
30 class vtkMRMLSliceNode;
31 class vtkMRMLVolumeNode;
32 
33 class vtkAlgorithmOutput;
34 class vtkCollection;
35 class vtkImageBlend;
36 class vtkTransform;
37 class vtkImageData;
38 class vtkImageReslice;
39 class vtkPolyDataCollection;
40 class vtkTransform;
41 
54 class VTK_MRML_LOGIC_EXPORT vtkMRMLSliceLogic : public vtkMRMLAbstractLogic
55 {
56 public:
58  static vtkMRMLSliceLogic *New();
60  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
61 
64  void Initialize(vtkMRMLSliceNode* newSliceNode);
65  bool IsInitialized();
66 
68  vtkSetStringMacro(Name);
69  vtkGetStringMacro(Name);
70 
73  vtkGetObjectMacro (SliceNode, vtkMRMLSliceNode);
74  void SetSliceNode (vtkMRMLSliceNode * newSliceNode);
75 
78  vtkGetObjectMacro (SliceCompositeNode, vtkMRMLSliceCompositeNode);
79  void SetSliceCompositeNode (vtkMRMLSliceCompositeNode *SliceCompositeNode);
80 
84  vtkGetObjectMacro (BackgroundLayer, vtkMRMLSliceLayerLogic);
85  void SetBackgroundLayer (vtkMRMLSliceLayerLogic *BackgroundLayer);
86 
90  vtkGetObjectMacro (ForegroundLayer, vtkMRMLSliceLayerLogic);
91  void SetForegroundLayer (vtkMRMLSliceLayerLogic *ForegroundLayer);
92 
96  vtkGetObjectMacro (LabelLayer, vtkMRMLSliceLayerLogic);
97  void SetLabelLayer (vtkMRMLSliceLayerLogic *LabelLayer);
98 
101  void SetBackgroundWindowLevel(double window, double level);
102 
105  void GetBackgroundWindowLevelAndRange(double& window, double& level,
106  double& rangeLow, double& rangeHigh);
107 
110  void SetForegroundWindowLevel(double window, double level);
111 
114  void GetForegroundWindowLevelAndRange(double& window, double& level,
115  double& rangeLow, double& rangeHigh);
118  vtkGetObjectMacro(SliceModelNode, vtkMRMLModelNode);
119 
122  vtkGetObjectMacro(SliceModelDisplayNode, vtkMRMLModelDisplayNode);
123 
126  vtkGetObjectMacro(SliceModelTransformNode, vtkMRMLLinearTransformNode);
127 
131  vtkGetObjectMacro(Blend, vtkImageBlend);
132  vtkGetObjectMacro(BlendUVW, vtkImageBlend);
133 
136  vtkGetObjectMacro(ActiveSliceTransform, vtkTransform);
137 
140  vtkGetObjectMacro(PolyDataCollection, vtkPolyDataCollection);
141 
144  vtkGetObjectMacro(LookupTableCollection, vtkCollection);
145 
149  vtkGetObjectMacro(ExtractModelTexture, vtkImageReslice);
150 
154  vtkAlgorithmOutput *GetImageDataConnection();
155 
158  void UpdatePipeline();
159 
161  void UpdateImageData();
162 
165  virtual bool EnterMRMLCallback()const;
166 
169  void UpdateSliceNode();
170 
173  void UpdateSliceNodeFromLayout();
174 
177  void UpdateSliceCompositeNode();
178 
182  vtkMRMLVolumeNode *GetLayerVolumeNode(int layer);
183 
186  static void GetVolumeRASBox(vtkMRMLVolumeNode *volumeNode, double rasDimensions[3], double rasCenter[3]);
187 
190  void GetVolumeSliceDimensions(vtkMRMLVolumeNode *volumeNode, double sliceDimensions[3], double sliceCenter[3]);
191 
196  double *GetVolumeSliceSpacing(vtkMRMLVolumeNode *volumeNode);
197 
202  void GetVolumeSliceBounds(vtkMRMLVolumeNode *volumeNode, double sliceBounds[6]);
203 
206  void FitSliceToVolume(vtkMRMLVolumeNode *volumeNode, int width, int height);
207 
210  void GetBackgroundRASBox(double rasDimensions[3], double rasCenter[3]);
211 
214  void GetBackgroundSliceDimensions(double sliceDimensions[3], double sliceCenter[3]);
215 
220  double *GetBackgroundSliceSpacing();
221 
226  void GetBackgroundSliceBounds(double sliceBounds[6]);
227 
230  void FitSliceToBackground(int width, int height);
231 
235  void FitSliceToAll(int width = -1, int height = -1);
236 
239  void FitFOVToBackground(double fov);
240 
246  void ResizeSliceNode(double newWidth, double newHeight);
247 
253  double *GetLowestVolumeSliceSpacing();
254 
260  void GetLowestVolumeSliceBounds(double sliceBounds[6]);
261 
264  double GetSliceOffset();
265  void SetSliceOffset(double offset);
266 
269  void GetSliceBounds(double sliceBounds[6]);
270 
273  void SetSliceExtentsToSliceNode();
274 
278  void StartSliceNodeInteraction(unsigned int parameters);
279 
281  void EndSliceNodeInteraction();
282 
286  void StartSliceCompositeNodeInteraction(unsigned int parameters);
287 
289  void EndSliceCompositeNodeInteraction();
290 
292  void StartSliceOffsetInteraction();
293 
295  void EndSliceOffsetInteraction();
296 
300  void SnapSliceOffsetToIJK();
301 
302  static const int SLICE_INDEX_ROTATED;
303  static const int SLICE_INDEX_OUT_OF_VOLUME;
304  static const int SLICE_INDEX_NO_VOLUME;
305 
311  int GetSliceIndexFromOffset(double sliceOffset, vtkMRMLVolumeNode *volumeNode);
312 
321  int GetSliceIndexFromOffset(double sliceOffset);
322 
325  void CreateSliceModel();
326  void DeleteSliceModel();
327 
330  std::vector< vtkMRMLDisplayNode*> GetPolyDataDisplayNodes();
332  static vtkMRMLSliceCompositeNode* GetSliceCompositeNode(vtkMRMLSliceNode* node);
334  static vtkMRMLSliceNode* GetSliceNode(vtkMRMLSliceCompositeNode* node);
335 
339  static const std::string SLICE_MODEL_NODE_NAME_SUFFIX;
340 
344  static bool IsSliceModelNode(vtkMRMLNode *mrmlNode);
349  static bool IsSliceModelDisplayNode(vtkMRMLDisplayNode *mrmlDisplayNode);
350 
351 protected:
352 
354  virtual ~vtkMRMLSliceLogic();
355 
356  virtual void SetMRMLSceneInternal(vtkMRMLScene * newScene) VTK_OVERRIDE;
357 
360  virtual void ProcessMRMLLogicsEvents(vtkObject * caller,
361  unsigned long event,
362  void * callData) VTK_OVERRIDE;
364 
365  virtual void OnMRMLSceneNodeAdded(vtkMRMLNode* node) VTK_OVERRIDE;
366  virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode* node) VTK_OVERRIDE;
367  virtual void UpdateFromMRMLScene() VTK_OVERRIDE;
368  virtual void OnMRMLSceneStartClose() VTK_OVERRIDE;
369  virtual void OnMRMLSceneEndImport() VTK_OVERRIDE;
370  virtual void OnMRMLSceneEndRestore() VTK_OVERRIDE;
371 
372  void UpdateSliceNodes();
373  void SetupCrosshairNode();
374 
375  virtual void OnMRMLNodeModified(vtkMRMLNode* node) VTK_OVERRIDE;
376  static vtkMRMLSliceCompositeNode* GetSliceCompositeNode(vtkMRMLScene* scene,
377  const char* layoutName);
378  static vtkMRMLSliceNode* GetSliceNode(vtkMRMLScene* scene,
379  const char* layoutName);
380 
383  void SetWindowLevel(double window, double level, int layer);
384 
385  bool AddingSliceModelNodes;
386  bool Initialized;
387 
388  char * Name;
389  vtkMRMLSliceNode * SliceNode;
390  vtkMRMLSliceCompositeNode * SliceCompositeNode;
391  vtkMRMLSliceLayerLogic * BackgroundLayer;
392  vtkMRMLSliceLayerLogic * ForegroundLayer;
394 
395 
396  vtkImageBlend * Blend;
397  vtkImageBlend * BlendUVW;
398  vtkImageReslice * ExtractModelTexture;
399  vtkAlgorithmOutput * ImageDataConnection;
400  vtkTransform * ActiveSliceTransform;
401 
402  vtkPolyDataCollection * PolyDataCollection;
403  vtkCollection * LookupTableCollection;
404 
405  vtkMRMLModelNode * SliceModelNode;
406  vtkMRMLModelDisplayNode * SliceModelDisplayNode;
407  vtkMRMLLinearTransformNode * SliceModelTransformNode;
408  double SliceSpacing[3];
409 
410 private:
411 
413  void operator=(const vtkMRMLSliceLogic&);
414 
415 };
416 
417 #endif
static const int SLICE_INDEX_ROTATED
Superclass for MRML logic classes.
static const int SLICE_INDEX_OUT_OF_VOLUME
MRML node to represent a display property of 3D surface model.
MRML node to represent a 3D surface model.
static const int SLICE_INDEX_NO_VOLUME
MRML node for storing a slice through RAS space.
MRML node for storing a slice through RAS space.
virtual void ProcessMRMLLogicsEvents(vtkObject *caller, unsigned long event, void *callData)
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
MRML node for representing a linear transformation.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
virtual void OnMRMLSceneNodeAdded(vtkMRMLNode *)
static const std::string SLICE_MODEL_NODE_NAME_SUFFIX
virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode *)
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
MRML node for representing a volume (image stack).
Abstract class that contains graphical display properties for displayable nodes.
virtual void UpdateFromMRMLScene()
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
static vtkMRMLAbstractLogic * New()
Slicer logic class for slice manipulation.