ITK  4.6.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<typename TImage> void AddImage(
119  TImage *,
120  bool FlipVertical=true,
121  std::string Description="");
122 
124  template<typename 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
std::string m_SnapshotPrefix
Definition: QuickView.h:186
void AddRGBImage(TImage *, bool FlipVertical=true, std::string Description="")
std::vector< RGBImageInfo > RGBImages
Definition: QuickView.h:183
ImageInfo(ImageType *image, std::string description="")
Definition: QuickView.h:38
void SnapshotOff()
Definition: QuickView.h:154
void SetSnapshotPath(const std::string &iPath)
Definition: QuickView.h:159
std::vector< ImageInfo > Images
Definition: QuickView.h:182
A container for an rgb image and its descriptiom.
Definition: QuickView.h:52
std::string m_Description
Definition: QuickView.h:63
bool m_Snapshot
Definition: QuickView.h:189
ImageType::Pointer m_Image
Definition: QuickView.h:44
void Visualize(bool interact=true)
std::string m_SnapshotExtension
Definition: QuickView.h:187
std::string m_SnapshotPath
Definition: QuickView.h:185
SizeValueType IdentifierType
Definition: itkIntTypes.h:147
itk::Image< itk::RGBPixel< unsigned char >, 2 > ImageType
Definition: QuickView.h:55
void SetSnapshotPrefix(const std::string &iPrefix)
Definition: QuickView.h:164
bool m_ShareCamera
Definition: QuickView.h:188
void AddImage(TImage *, bool FlipVertical=true, std::string Description="")
ImageType::Pointer m_Image
Definition: QuickView.h:62
itk::Image< unsigned char, 2 > ImageType
Definition: QuickView.h:36
void ShareCameraOff()
Definition: QuickView.h:136
RGBImageInfo(ImageType *image, std::string description="")
Definition: QuickView.h:56
void ShareCameraOn()
Definition: QuickView.h:142
std::string m_Description
Definition: QuickView.h:45
void SetSnapshotExtension(const std::string &iExtension)
Definition: QuickView.h:170
A container for an image and its descriptiom.
Definition: QuickView.h:33
Templated n-dimensional image class.
Definition: itkImage.h:75
void SnapshotOn()
Definition: QuickView.h:148
A convenient class to render itk images with vtk.
Definition: QuickView.h:105
itk::IdentifierType m_Counter
Definition: QuickView.h:184