Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLStreamingVolumeNode.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3 Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
4 Queen's University, Kingston, ON, Canada. All Rights Reserved.
5 
6 See COPYRIGHT.txt
7 or http://www.slicer.org/copyright/copyright.txt for details.
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 
15 This file was originally developed by Kyle Sunderland, PerkLab, Queen's University
16 and was supported through CANARIE's Research Software Program, and Cancer
17 Care Ontario.
18 
19 ==============================================================================*/
20 
21 #ifndef __vtkMRMLStreamingVolumeNode_h
22 #define __vtkMRMLStreamingVolumeNode_h
23 
24 // MRML includes
25 #include "vtkMRML.h"
26 #include "vtkMRMLNode.h"
27 #include "vtkMRMLStorageNode.h"
31 
32 // vtkAddon includes
33 #include "vtkStreamingVolumeCodec.h"
34 
35 // VTK includes
36 #include <vtkImageData.h>
37 #include <vtkObject.h>
38 #include <vtkStdString.h>
39 #include <vtkUnsignedCharArray.h>
40 
46 {
47 public:
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
52  vtkMRMLNode* CreateNodeInstance() override;
53 
54  void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) override;
55 
57  void ReadXMLAttributes(const char** atts) override;
58 
60  void WriteXML(ostream& of, int indent) override;
61 
65 
67  const char* GetNodeTagName() override
68  {return "StreamingVolume";}
69 
72  void SetAndObserveImageData(vtkImageData* imageData) override;
73  vtkImageData* GetImageData() override;
74  vtkAlgorithmOutput* GetImageDataConnection() override;
75 
78  void SetAndObserveFrame(vtkStreamingVolumeFrame* frame);
79 
81  vtkStreamingVolumeFrame* GetFrame(){return this->Frame.GetPointer();};
82 
85  virtual bool EncodeImageData(bool forceKeyFrame = false);
86 
89  virtual bool DecodeFrame();
90 
93  virtual bool IsKeyFrame();
94 
97  static void FrameModifiedCallback(vtkObject *caller, unsigned long eid, void* clientData, void* callData);
98  enum
99  {
100  FrameModifiedEvent = 18002
101  };
102 
104  vtkSetMacro(Codec, vtkStreamingVolumeCodec*);
105  vtkStreamingVolumeCodec* GetCodec();
106 
109  vtkGetMacro(CodecFourCC, std::string);
110  vtkSetMacro(CodecFourCC, std::string);
111 
114  void SetCodecParameterString(std::string parameterString);
115  std::string GetCodecParameterString();
116 
117 protected:
119  ~vtkMRMLStreamingVolumeNode() override;
122 
124  void AllocateImageForFrame(vtkImageData* imageData);
125 
127  bool HasExternalImageObserver();
128 
129 protected:
130  vtkSmartPointer<vtkStreamingVolumeCodec> Codec;
131  std::string CodecFourCC;
132  vtkSmartPointer<vtkStreamingVolumeFrame> Frame;
133  bool FrameDecoded{false};
134  bool FrameDecodingInProgress{false};
135  vtkSmartPointer<vtkCallbackCommand> FrameModifiedCallbackCommand;
136 
137 };
138 
139 #endif
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
vtkSmartPointer< vtkCallbackCommand > FrameModifiedCallbackCommand
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
vtkMRMLCopyContentMacro(vtkMRMLTensorVolumeNode)
virtual vtkAlgorithmOutput * GetImageDataConnection()
Return the input image data pipeline.
void WriteXML(ostream &of, int indent) override
Write this node&#39;s information to a MRML file in XML format.
MRML node for representing a single compressed video frame that can be decoded to an image representa...
void ReadXMLAttributes(const char **atts) override
Set node attributes
void operator=(const vtkMRMLVectorVolumeNode &)
vtkSmartPointer< vtkStreamingVolumeCodec > Codec
static vtkMRMLVectorVolumeNode * New()
MRML node for representing a vector volume (image stack).
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
vtkSmartPointer< vtkStreamingVolumeFrame > Frame
virtual void SetAndObserveImageData(vtkImageData *ImageData)
vtkStreamingVolumeFrame * GetFrame()
Returns a pointer to the current frame.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
virtual vtkImageData * GetImageData()
void PrintSelf(ostream &os, vtkIndent indent) override