Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkStreamingVolumeCodec.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 __vtkStreamingVolumeCodec_h
22 #define __vtkStreamingVolumeCodec_h
23 
24 // vtkAddon includes
25 #include "vtkAddon.h"
26 #include "vtkAddonSetGet.h"
28 
29 // VTK includes
30 #include <vtkImageData.h>
31 #include <vtkObject.h>
32 #include <vtkUnsignedCharArray.h>
33 
34 // STD includes
35 #include <map>
36 
37 #ifndef vtkCodecNewMacro
38 #define vtkCodecNewMacro(newClass) \
39 vtkStandardNewMacro(newClass); \
40 vtkStreamingVolumeCodec* newClass::CreateCodecInstance() \
41 { \
42 return newClass::New(); \
43 }
44 #endif
45 
47 class VTK_ADDON_EXPORT vtkStreamingVolumeCodec : public vtkObject
48 {
49 public:
50  vtkTypeMacro(vtkStreamingVolumeCodec, vtkObject);
51  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
52 
55  virtual std::string GetFourCC() = 0;
56 
58  // This can be overridden using vtkCodecNewMacro(className);
59  virtual vtkStreamingVolumeCodec* CreateCodecInstance() = 0;
60 
66  virtual bool DecodeFrame(vtkStreamingVolumeFrame* frame, vtkImageData* outputImageData);
67 
73  virtual bool EncodeImageData(vtkImageData* inputImageData, vtkStreamingVolumeFrame* outputStreamingFrame, bool forceKeyFrame=false);
74 
78  virtual void SetParametersFromString(std::string parameterString);
79 
83  virtual std::string GetParametersAsString();
84 
85  enum
86  {
87  ParameterModifiedEvent = 18003
88  };
89 
91  vtkGetStdVectorMacro(AvailiableParameterNames, std::vector<std::string>);
92 
96  virtual std::string GetParameterDescription(std::string parameterName) = 0;
97 
102  virtual bool SetParameter(std::string parameterName, std::string parameterValue);
103 
108  virtual bool GetParameter(std::string parameterName, std::string& parameterValue);
109 
112  virtual void SetParameters(std::map<std::string, std::string> parameters);
113 
115  std::vector<std::string> GetParameterPresetNames() const;
116 
120  std::string GetParameterPresetValue(const std::string& presetName) const;
121 
125  std::string GetParameterPresetName(const std::string& presetValue) const;
126 
128  int GetNumberOfParameterPresets() const { return this->ParameterPresets.size(); };
129 
131  {
134  std::string Name;
137  std::string Value;
138  };
139  // Get a list of all supported parameter presets for the codec
140  vtkGetStdVectorMacro(ParameterPresets, const std::vector<ParameterPreset>);
141 
146  virtual bool SetParametersFromPresetValue(const std::string& presetValue);
147 
151  vtkGetMacro(DefaultParameterPresetValue, std::string);
152 
153 protected:
154 
159  virtual bool UpdateParameterInternal(std::string parameterName, std::string parameterValue) = 0;
160 
167  virtual bool DecodeFrameInternal(vtkStreamingVolumeFrame* inputFrame, vtkImageData* outputImageData, bool saveDecodedImage = true) = 0;
168 
175  virtual bool EncodeImageDataInternal(vtkImageData* inputImageData, vtkStreamingVolumeFrame* outputFrame, bool forceKeyFrame) = 0;
176 
177 protected:
180 
181 private:
183  void operator=(const vtkStreamingVolumeCodec&);
184 
185 protected:
186  std::vector<std::string> AvailiableParameterNames;
187  vtkSmartPointer<vtkStreamingVolumeFrame> LastDecodedFrame;
188  std::map<std::string, std::string> Parameters;
189  std::vector<ParameterPreset> ParameterPresets;
191 };
192 
193 #endif
std::vector< ParameterPreset > ParameterPresets
VTK object containing a single compressed frame.
#define vtkGetStdVectorMacro(name, type)
VTK object for representing a volume compression codec (normally a video compression codec) ...
std::map< std::string, std::string > Parameters
vtkSmartPointer< vtkStreamingVolumeFrame > LastDecodedFrame
std::vector< std::string > AvailiableParameterNames
int GetNumberOfParameterPresets() const
Get the number of parameter presets.