ITK  4.4.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 
33 class ImageInfo
34 {
35 public:
37 
38  ImageInfo(ImageType *image, std::string description="")
39  {
40  m_Image = image;
41  m_Description = description;
42  }
43 
45  std::string m_Description;
46 };
47 
53 {
54 public:
56  RGBImageInfo(ImageType *image, std::string description="")
57  {
58  m_Image = image;
59  m_Description = description;
60  }
61 
63  std::string m_Description;
64 };
65 
106 {
107 public:
109  {
110  m_ShareCamera = true;
111  m_Counter = 0;
112  m_Snapshot = false;
113  m_SnapshotPath = "";
114  m_SnapshotPrefix = "snapshot_";
115  m_SnapshotExtension = "png";
116  }
118  template<class TImage> void AddImage(
119  TImage *,
120  bool FlipVertical=true,
121  std::string Description="");
122 
124  template<class TImage> void AddRGBImage(
125  TImage *,
126  bool FlipVertical=true,
127  std::string Description="");
128 
132  void Visualize(bool interact=true);
133 
134 
137  {
138  m_ShareCamera = false;
139  }
140 
143  {
144  m_ShareCamera = true;
145  }
146 
148  void SnapshotOn()
149  {
150  m_Snapshot = true;
151  }
152 
154  void SnapshotOff()
155  {
156  m_Snapshot = false;
157  }
158 
159  void SetSnapshotPath( const std::string& iPath )
160  {
161  m_SnapshotPath = iPath;
162  }
163 
164  void SetSnapshotPrefix( const std::string& iPrefix )
165  {
166  m_SnapshotPrefix = iPrefix;
167  }
168 
170  void SetSnapshotExtension( const std::string& iExtension )
171  {
172  m_SnapshotExtension = iExtension;
173  std::transform(
174  m_SnapshotExtension.begin(),
175  m_SnapshotExtension.end(),
176  m_SnapshotExtension.begin(),
177  ::tolower );
178  }
180 
181 private:
182  std::vector<ImageInfo> Images; // Container for images
183  std::vector<RGBImageInfo> RGBImages; // Container for rgb images
185  std::string m_SnapshotPath;
186  std::string m_SnapshotPrefix;
187  std::string m_SnapshotExtension;
190 };
191 
192 #endif
193