ITK  4.13.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  m_NumberOfColumns = 4;
120  m_ViewPortSize = 300;
121  }
123  template<typename TImage> void AddImage(
124  TImage *,
125  bool FlipVertical=true,
126  std::string Description="");
127 
129  template<typename TImage> void AddRGBImage(
130  TImage *,
131  bool FlipVertical=true,
132  std::string Description="");
133 
137  void Visualize(bool interact=true);
138 
139 
142  {
143  m_ShareCamera = false;
144  }
145 
148  {
149  m_ShareCamera = true;
150  }
151 
154  {
155  m_Interpolate = false;
156  }
157 
160  {
161  m_Interpolate = true;
162  }
163 
165  void SnapshotOn()
166  {
167  m_Snapshot = true;
168  }
169 
171  void SnapshotOff()
172  {
173  m_Snapshot = false;
174  }
175 
176  void SetSnapshotPath( const std::string& iPath )
177  {
178  m_SnapshotPath = iPath;
179  }
180 
181  void SetSnapshotPrefix( const std::string& iPrefix )
182  {
183  m_SnapshotPrefix = iPrefix;
184  }
185 
187  void SetSnapshotExtension( const std::string& iExtension )
188  {
189  m_SnapshotExtension = iExtension;
190  std::transform(
191  m_SnapshotExtension.begin(),
192  m_SnapshotExtension.end(),
193  m_SnapshotExtension.begin(),
194  ::tolower );
195  }
197 
199  void SetNumberOfColumns (const unsigned int columns)
200  {
201  m_NumberOfColumns = columns;
202  }
203 
205  void SetViewPortSize (const unsigned int size)
206  {
207  m_ViewPortSize = size;
208  }
209 
210 private:
211  std::vector<ImageInfo> Images; // Container for images
212  std::vector<RGBImageInfo> RGBImages; // Container for rgb images
214  std::string m_SnapshotPath;
215  std::string m_SnapshotPrefix;
216  std::string m_SnapshotExtension;
220  unsigned int m_NumberOfColumns;
221  unsigned int m_ViewPortSize;
222 };
223 
224 #endif
std::string m_SnapshotPrefix
Definition: QuickView.h:215
void InterpolateOff()
Definition: QuickView.h:153
std::vector< RGBImageInfo > RGBImages
Definition: QuickView.h:212
ImageInfo(ImageType *image, std::string description="")
Definition: QuickView.h:40
void SnapshotOff()
Definition: QuickView.h:171
void SetSnapshotPath(const std::string &iPath)
Definition: QuickView.h:176
std::vector< ImageInfo > Images
Definition: QuickView.h:211
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:218
bool m_Interpolate
Definition: QuickView.h:219
ImageType::Pointer m_Image
Definition: QuickView.h:46
void SetNumberOfColumns(const unsigned int columns)
Definition: QuickView.h:199
std::string m_SnapshotExtension
Definition: QuickView.h:216
std::string m_SnapshotPath
Definition: QuickView.h:214
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:181
void SetViewPortSize(const unsigned int size)
Definition: QuickView.h:205
bool m_ShareCamera
Definition: QuickView.h:217
unsigned int m_ViewPortSize
Definition: QuickView.h:221
void InterpolateOn()
Definition: QuickView.h:159
ImageType::Pointer m_Image
Definition: QuickView.h:64
itk::Image< unsigned char, 2 > ImageType
Definition: QuickView.h:38
void ShareCameraOff()
Definition: QuickView.h:141
RGBImageInfo(ImageType *image, std::string description="")
Definition: QuickView.h:58
void ShareCameraOn()
Definition: QuickView.h:147
std::string m_Description
Definition: QuickView.h:47
unsigned int m_NumberOfColumns
Definition: QuickView.h:220
void SetSnapshotExtension(const std::string &iExtension)
Definition: QuickView.h:187
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:165
A convenient class to render itk images with vtk.
Definition: QuickView.h:107
itk::IdentifierType m_Counter
Definition: QuickView.h:213