ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
QuickView.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 <cctype>
24#include <string>
25
26#include <itkImage.h>
27#include <itkRGBPixel.h>
28#include <itkIntTypes.h>
29
30#include "ITKVtkGlueExport.h"
31
37class ITKVtkGlue_EXPORT ImageInfo
38{
39public:
41
42 ImageInfo(ImageType * image, std::string description = "")
43 {
44 m_Image = image;
45 m_Description = description;
46 }
47
49 std::string m_Description;
50};
51
57class ITKVtkGlue_EXPORT RGBImageInfo
58{
59public:
61 RGBImageInfo(ImageType * image, std::string description = "")
62 {
63 m_Image = image;
64 m_Description = description;
65 }
66
68 std::string m_Description;
69};
70
111class ITKVtkGlue_EXPORT QuickView
112{
113public:
115 {
116 m_ShareCamera = true;
117 m_Interpolate = true;
118 m_Counter = 0;
119 m_Snapshot = false;
120 m_SnapshotPath = "";
121 m_SnapshotPrefix = "snapshot_";
122 m_SnapshotExtension = "png";
124 m_ViewPortSize = 300;
125 }
126
127 template <typename TImage>
128 void
129 AddImage(TImage *, bool FlipVertical = true, std::string Description = "");
130
132 template <typename TImage>
133 void
134 AddRGBImage(TImage *, bool FlipVertical = true, std::string Description = "");
135
139 void
140 Visualize(bool interact = true);
141
142
144 void
146 {
147 m_ShareCamera = false;
148 }
149
151 void
153 {
154 m_ShareCamera = true;
155 }
156
158 void
160 {
161 m_Interpolate = false;
162 }
163
165 void
167 {
168 m_Interpolate = true;
169 }
170
172 void
174 {
175 m_Snapshot = true;
176 }
177
179 void
181 {
182 m_Snapshot = false;
183 }
184
185 void
186 SetSnapshotPath(const std::string & iPath)
187 {
188 m_SnapshotPath = iPath;
189 }
190
191 void
192 SetSnapshotPrefix(const std::string & iPrefix)
193 {
194 m_SnapshotPrefix = iPrefix;
195 }
196
198 void
199 SetSnapshotExtension(const std::string & iExtension)
200 {
201 m_SnapshotExtension = iExtension;
202 std::transform(m_SnapshotExtension.begin(),
204 m_SnapshotExtension.begin(),
205 [](unsigned char c) { return static_cast<char>(std::tolower(c)); });
206 }
207
209 void
210 SetNumberOfColumns(const unsigned int columns)
211 {
212 m_NumberOfColumns = columns;
213 }
214
216 void
217 SetViewPortSize(const unsigned int size)
218 {
219 m_ViewPortSize = size;
220 }
221
222private:
223 std::vector<ImageInfo> Images; // Container for images
224 std::vector<RGBImageInfo> RGBImages; // Container for rgb images
226 std::string m_SnapshotPath;
227 std::string m_SnapshotPrefix;
232 unsigned int m_NumberOfColumns;
233 unsigned int m_ViewPortSize;
234};
235
236#endif
std::string m_Description
Definition QuickView.h:49
ImageInfo(ImageType *image, std::string description="")
Definition QuickView.h:42
ImageType::Pointer m_Image
Definition QuickView.h:48
itk::Image< unsigned char, 2 > ImageType
Definition QuickView.h:40
std::vector< RGBImageInfo > RGBImages
Definition QuickView.h:224
void InterpolateOff()
Definition QuickView.h:159
void SetNumberOfColumns(const unsigned int columns)
Definition QuickView.h:210
void AddImage(TImage *, bool FlipVertical=true, std::string Description="")
std::string m_SnapshotExtension
Definition QuickView.h:228
std::string m_SnapshotPrefix
Definition QuickView.h:227
void SnapshotOn()
Definition QuickView.h:173
bool m_ShareCamera
Definition QuickView.h:229
unsigned int m_ViewPortSize
Definition QuickView.h:233
void SetViewPortSize(const unsigned int size)
Definition QuickView.h:217
bool m_Interpolate
Definition QuickView.h:231
std::string m_SnapshotPath
Definition QuickView.h:226
bool m_Snapshot
Definition QuickView.h:230
void ShareCameraOn()
Definition QuickView.h:152
void Visualize(bool interact=true)
itk::IdentifierType m_Counter
Definition QuickView.h:225
std::vector< ImageInfo > Images
Definition QuickView.h:223
void SetSnapshotExtension(const std::string &iExtension)
Definition QuickView.h:199
void InterpolateOn()
Definition QuickView.h:166
void SetSnapshotPath(const std::string &iPath)
Definition QuickView.h:186
void SetSnapshotPrefix(const std::string &iPrefix)
Definition QuickView.h:192
void AddRGBImage(TImage *, bool FlipVertical=true, std::string Description="")
void ShareCameraOff()
Definition QuickView.h:145
unsigned int m_NumberOfColumns
Definition QuickView.h:232
void SnapshotOff()
Definition QuickView.h:180
RGBImageInfo(ImageType *image, std::string description="")
Definition QuickView.h:61
std::string m_Description
Definition QuickView.h:68
ImageType::Pointer m_Image
Definition QuickView.h:67
itk::Image< itk::RGBPixel< unsigned char >, 2 > ImageType
Definition QuickView.h:60
Templated n-dimensional image class.
Definition itkImage.h:89
SmartPointer< Self > Pointer
Definition itkImage.h:96
SizeValueType IdentifierType
Definition itkIntTypes.h:90