ITK  4.8.0
Insight Segmentation and Registration Toolkit
QuickView.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef QuickView_h
19 #define QuickView_h
20 
21 #include <vector>
22 #include <algorithm>
23 #include <string>
24 
25 #include <itkImage.h>
26 #include <itkRGBPixel.h>
27 #include <itkIntTypes.h>
28 
29 #include "ITKVtkGlueExport.h"
30 
35 class ITKVtkGlue_EXPORT ImageInfo
36 {
37 public:
39 
40  ImageInfo(ImageType *image, std::string description="")
41  {
42  m_Image = image;
43  m_Description = description;
44  }
45 
47  std::string m_Description;
48 };
49 
54 class ITKVtkGlue_EXPORT RGBImageInfo
55 {
56 public:
58  RGBImageInfo(ImageType *image, std::string description="")
59  {
60  m_Image = image;
61  m_Description = description;
62  }
63 
65  std::string m_Description;
66 };
67 
107 class ITKVtkGlue_EXPORT QuickView
108 {
109 public:
111  {
112  m_ShareCamera = true;
113  m_Interpolate = true;
114  m_Counter = 0;
115  m_Snapshot = false;
116  m_SnapshotPath = "";
117  m_SnapshotPrefix = "snapshot_";
118  m_SnapshotExtension = "png";
119  }
121  template<typename TImage> void AddImage(
122  TImage *,
123  bool FlipVertical=true,
124  std::string Description="");
125 
127  template<typename TImage> void AddRGBImage(
128  TImage *,
129  bool FlipVertical=true,
130  std::string Description="");
131 
135  void Visualize(bool interact=true);
136 
137 
140  {
141  m_ShareCamera = false;
142  }
143 
146  {
147  m_ShareCamera = true;
148  }
149 
152  {
153  m_Interpolate = false;
154  }
155 
158  {
159  m_Interpolate = true;
160  }
161 
163  void SnapshotOn()
164  {
165  m_Snapshot = true;
166  }
167 
169  void SnapshotOff()
170  {
171  m_Snapshot = false;
172  }
173 
174  void SetSnapshotPath( const std::string& iPath )
175  {
176  m_SnapshotPath = iPath;
177  }
178 
179  void SetSnapshotPrefix( const std::string& iPrefix )
180  {
181  m_SnapshotPrefix = iPrefix;
182  }
183 
185  void SetSnapshotExtension( const std::string& iExtension )
186  {
187  m_SnapshotExtension = iExtension;
188  std::transform(
189  m_SnapshotExtension.begin(),
190  m_SnapshotExtension.end(),
191  m_SnapshotExtension.begin(),
192  ::tolower );
193  }
195 
196 private:
197  std::vector<ImageInfo> Images; // Container for images
198  std::vector<RGBImageInfo> RGBImages; // Container for rgb images
200  std::string m_SnapshotPath;
201  std::string m_SnapshotPrefix;
202  std::string m_SnapshotExtension;
206 };
207 
208 #endif
std::string m_SnapshotPrefix
Definition: QuickView.h:201
void InterpolateOff()
Definition: QuickView.h:151
std::vector< RGBImageInfo > RGBImages
Definition: QuickView.h:198
ImageInfo(ImageType *image, std::string description="")
Definition: QuickView.h:40
void SnapshotOff()
Definition: QuickView.h:169
void SetSnapshotPath(const std::string &iPath)
Definition: QuickView.h:174
std::vector< ImageInfo > Images
Definition: QuickView.h:197
A container for an rgb image and its descriptiom.
Definition: QuickView.h:54
std::string m_Description
Definition: QuickView.h:65
bool m_Snapshot
Definition: QuickView.h:204
bool m_Interpolate
Definition: QuickView.h:205
ImageType::Pointer m_Image
Definition: QuickView.h:46
std::string m_SnapshotExtension
Definition: QuickView.h:202
std::string m_SnapshotPath
Definition: QuickView.h:200
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
itk::Image< itk::RGBPixel< unsigned char >, 2 > ImageType
Definition: QuickView.h:57
void SetSnapshotPrefix(const std::string &iPrefix)
Definition: QuickView.h:179
bool m_ShareCamera
Definition: QuickView.h:203
void InterpolateOn()
Definition: QuickView.h:157
ImageType::Pointer m_Image
Definition: QuickView.h:64
itk::Image< unsigned char, 2 > ImageType
Definition: QuickView.h:38
void ShareCameraOff()
Definition: QuickView.h:139
RGBImageInfo(ImageType *image, std::string description="")
Definition: QuickView.h:58
void ShareCameraOn()
Definition: QuickView.h:145
std::string m_Description
Definition: QuickView.h:47
void SetSnapshotExtension(const std::string &iExtension)
Definition: QuickView.h:185
A container for an image and its descriptiom.
Definition: QuickView.h:35
Templated n-dimensional image class.
Definition: itkImage.h:75
void SnapshotOn()
Definition: QuickView.h:163
A convenient class to render itk images with vtk.
Definition: QuickView.h:107
itk::IdentifierType m_Counter
Definition: QuickView.h:199