VTK
vtkImageReslice.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageReslice.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
57 #ifndef __vtkImageReslice_h
58 #define __vtkImageReslice_h
59 
60 
62 
63 // interpolation mode constants
64 #define VTK_RESLICE_NEAREST 0
65 #define VTK_RESLICE_LINEAR 1
66 #define VTK_RESLICE_RESERVED_2 2
67 #define VTK_RESLICE_CUBIC 3
68 
69 class vtkImageData;
71 class vtkMatrix4x4;
73 
75 {
76 public:
77  static vtkImageReslice *New();
79 
80  virtual void PrintSelf(ostream& os, vtkIndent indent);
81 
83 
95  virtual void SetResliceAxes(vtkMatrix4x4*);
96  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
98 
100 
104  void SetResliceAxesDirectionCosines(double x0, double x1, double x2,
105  double y0, double y1, double y2,
106  double z0, double z1, double z2);
107  void SetResliceAxesDirectionCosines(const double x[3],
108  const double y[3],
109  const double z[3]) {
110  this->SetResliceAxesDirectionCosines(x[0], x[1], x[2],
111  y[0], y[1], y[2],
112  z[0], z[1], z[2]); };
113  void SetResliceAxesDirectionCosines(const double xyz[9]) {
114  this->SetResliceAxesDirectionCosines(xyz[0], xyz[1], xyz[2],
115  xyz[3], xyz[4], xyz[5],
116  xyz[6], xyz[7], xyz[8]); };
117  void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3]);
118  void GetResliceAxesDirectionCosines(double xyz[9]) {
119  this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]); };
121  this->GetResliceAxesDirectionCosines(this->ResliceAxesDirectionCosines);
122  return this->ResliceAxesDirectionCosines; };
124 
126 
129  void SetResliceAxesOrigin(double x, double y, double z);
130  void SetResliceAxesOrigin(const double xyz[3]) {
131  this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]); };
132  void GetResliceAxesOrigin(double xyz[3]);
134  this->GetResliceAxesOrigin(this->ResliceAxesOrigin);
135  return this->ResliceAxesOrigin; };
137 
139 
146  virtual void SetResliceTransform(vtkAbstractTransform*);
147  vtkGetObjectMacro(ResliceTransform, vtkAbstractTransform);
149 
151 
157  virtual void SetInformationInput(vtkImageData*);
158  vtkGetObjectMacro(InformationInput, vtkImageData);
160 
162 
166  vtkSetMacro(TransformInputSampling, int);
167  vtkBooleanMacro(TransformInputSampling, int);
168  vtkGetMacro(TransformInputSampling, int);
170 
172 
175  vtkSetMacro(AutoCropOutput, int);
176  vtkBooleanMacro(AutoCropOutput, int);
177  vtkGetMacro(AutoCropOutput, int);
179 
181 
182  vtkSetMacro(Wrap, int);
183  vtkGetMacro(Wrap, int);
184  vtkBooleanMacro(Wrap, int);
186 
188 
190  vtkSetMacro(Mirror, int);
191  vtkGetMacro(Mirror, int);
192  vtkBooleanMacro(Mirror, int);
194 
196 
203  vtkSetMacro(Border, int);
204  vtkGetMacro(Border, int);
205  vtkBooleanMacro(Border, int);
207 
209 
210  vtkSetClampMacro(InterpolationMode, int,
212  vtkGetMacro(InterpolationMode, int);
214  this->SetInterpolationMode(VTK_RESLICE_NEAREST); };
216  this->SetInterpolationMode(VTK_RESLICE_LINEAR); };
218  this->SetInterpolationMode(VTK_RESLICE_CUBIC); };
219  virtual const char *GetInterpolationModeAsString();
221 
223 
225  vtkSetMacro(Optimization, int);
226  vtkGetMacro(Optimization, int);
227  vtkBooleanMacro(Optimization, int);
229 
231 
232  vtkSetVector4Macro(BackgroundColor, double);
233  vtkGetVector4Macro(BackgroundColor, double);
235 
237 
238  void SetBackgroundLevel(double v) { this->SetBackgroundColor(v,v,v,v); };
239  double GetBackgroundLevel() { return this->GetBackgroundColor()[0]; };
241 
243 
245  virtual void SetOutputSpacing(double x, double y, double z);
246  virtual void SetOutputSpacing(const double a[3]) {
247  this->SetOutputSpacing(a[0], a[1], a[2]); };
248  vtkGetVector3Macro(OutputSpacing, double);
249  void SetOutputSpacingToDefault();
251 
253 
255  virtual void SetOutputOrigin(double x, double y, double z);
256  virtual void SetOutputOrigin(const double a[3]) {
257  this->SetOutputOrigin(a[0], a[1], a[2]); };
258  vtkGetVector3Macro(OutputOrigin, double);
259  void SetOutputOriginToDefault();
261 
263 
265  virtual void SetOutputExtent(int a, int b, int c, int d, int e, int f);
266  virtual void SetOutputExtent(const int a[6]) {
267  this->SetOutputExtent(a[0], a[1], a[2], a[3], a[4], a[5]); };
268  vtkGetVector6Macro(OutputExtent, int);
269  void SetOutputExtentToDefault();
271 
273 
279  vtkSetMacro(OutputDimensionality, int);
280  vtkGetMacro(OutputDimensionality, int);
282 
285  unsigned long int GetMTime();
286 
288  virtual void ReportReferences(vtkGarbageCollector*);
289 
291 
296  void SetInterpolate(int t) {
297  if (t && !this->GetInterpolate()) {
298  this->SetInterpolationModeToLinear(); }
299  else if (!t && this->GetInterpolate()) {
300  this->SetInterpolationModeToNearestNeighbor(); } };
301  void InterpolateOn() {
302  this->SetInterpolate(1); };
303  void InterpolateOff() {
304  this->SetInterpolate(0); };
306  return (this->GetInterpolationMode() != VTK_RESLICE_NEAREST); };
308 
310 
313  void SetStencil(vtkImageStencilData *stencil);
314  vtkImageStencilData *GetStencil();
316 
317 protected:
318  vtkImageReslice();
319  ~vtkImageReslice();
320 
322  double ResliceAxesDirectionCosines[9];
323  double ResliceAxesOrigin[3];
326  int Wrap;
327  int Mirror;
328  int Border;
331  double BackgroundColor[4];
332  double OutputOrigin[3];
333  double OutputSpacing[3];
334  int OutputExtent[6];
342 
345 
346  void GetAutoCroppedOutputBounds(vtkInformation *inInfo, double bounds[6]);
351  virtual void ThreadedRequestData(vtkInformation *request,
352  vtkInformationVector **inputVector,
353  vtkInformationVector *outputVector,
354  vtkImageData ***inData,
355  vtkImageData **outData, int ext[6], int id);
357 
358  vtkMatrix4x4 *GetIndexMatrix(vtkInformation *inInfo,
359  vtkInformation *outInfo);
361  return this->OptimizedTransform; };
362 
363 private:
364  vtkImageReslice(const vtkImageReslice&); // Not implemented.
365  void operator=(const vtkImageReslice&); // Not implemented.
366 };
367 
368 #endif