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 VTK_NEAREST_INTERPOLATION
65 #define VTK_RESLICE_LINEAR VTK_LINEAR_INTERPOLATION
66 #define VTK_RESLICE_CUBIC VTK_CUBIC_INTERPOLATION
67 
68 class vtkImageData;
70 class vtkMatrix4x4;
72 class vtkScalarsToColors;
74 
76 {
77 public:
78  static vtkImageReslice *New();
80 
81  virtual void PrintSelf(ostream& os, vtkIndent indent);
82 
84 
96  virtual void SetResliceAxes(vtkMatrix4x4*);
97  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
99 
101 
105  void SetResliceAxesDirectionCosines(double x0, double x1, double x2,
106  double y0, double y1, double y2,
107  double z0, double z1, double z2);
108  void SetResliceAxesDirectionCosines(const double x[3],
109  const double y[3],
110  const double z[3]) {
111  this->SetResliceAxesDirectionCosines(x[0], x[1], x[2],
112  y[0], y[1], y[2],
113  z[0], z[1], z[2]); };
114  void SetResliceAxesDirectionCosines(const double xyz[9]) {
115  this->SetResliceAxesDirectionCosines(xyz[0], xyz[1], xyz[2],
116  xyz[3], xyz[4], xyz[5],
117  xyz[6], xyz[7], xyz[8]); };
118  void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3]);
119  void GetResliceAxesDirectionCosines(double xyz[9]) {
120  this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]); };
122  this->GetResliceAxesDirectionCosines(this->ResliceAxesDirectionCosines);
123  return this->ResliceAxesDirectionCosines; };
125 
127 
130  void SetResliceAxesOrigin(double x, double y, double z);
131  void SetResliceAxesOrigin(const double xyz[3]) {
132  this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]); };
133  void GetResliceAxesOrigin(double xyz[3]);
135  this->GetResliceAxesOrigin(this->ResliceAxesOrigin);
136  return this->ResliceAxesOrigin; };
138 
140 
147  virtual void SetResliceTransform(vtkAbstractTransform*);
148  vtkGetObjectMacro(ResliceTransform, vtkAbstractTransform);
150 
152 
158  virtual void SetInformationInput(vtkImageData*);
159  vtkGetObjectMacro(InformationInput, vtkImageData);
161 
163 
167  vtkSetMacro(TransformInputSampling, int);
168  vtkBooleanMacro(TransformInputSampling, int);
169  vtkGetMacro(TransformInputSampling, int);
171 
173 
176  vtkSetMacro(AutoCropOutput, int);
177  vtkBooleanMacro(AutoCropOutput, int);
178  vtkGetMacro(AutoCropOutput, int);
180 
182 
183  vtkSetMacro(Wrap, int);
184  vtkGetMacro(Wrap, int);
185  vtkBooleanMacro(Wrap, int);
187 
189 
191  vtkSetMacro(Mirror, int);
192  vtkGetMacro(Mirror, int);
193  vtkBooleanMacro(Mirror, int);
195 
197 
204  vtkSetMacro(Border, int);
205  vtkGetMacro(Border, int);
206  vtkBooleanMacro(Border, int);
208 
210 
211  vtkSetClampMacro(InterpolationMode, int,
213  vtkGetMacro(InterpolationMode, int);
215  this->SetInterpolationMode(VTK_RESLICE_NEAREST); };
217  this->SetInterpolationMode(VTK_RESLICE_LINEAR); };
219  this->SetInterpolationMode(VTK_RESLICE_CUBIC); };
220  virtual const char *GetInterpolationModeAsString();
222 
224 
226  virtual void SetInterpolator(vtkAbstractImageInterpolator *sampler);
227  virtual vtkAbstractImageInterpolator *GetInterpolator();
229 
231 
232  vtkSetClampMacro(SlabMode, int, VTK_IMAGE_SLAB_MIN, VTK_IMAGE_SLAB_SUM);
233  vtkGetMacro(SlabMode, int);
235  this->SetSlabMode(VTK_IMAGE_SLAB_MIN); };
237  this->SetSlabMode(VTK_IMAGE_SLAB_MAX); };
239  this->SetSlabMode(VTK_IMAGE_SLAB_MEAN); };
241  this->SetSlabMode(VTK_IMAGE_SLAB_SUM); };
242  virtual const char *GetSlabModeAsString();
244 
246 
247  vtkSetMacro(SlabNumberOfSlices, int);
248  vtkGetMacro(SlabNumberOfSlices, int);
250 
252 
255  vtkSetMacro(SlabTrapezoidIntegration, int);
256  vtkBooleanMacro(SlabTrapezoidIntegration, int);
257  vtkGetMacro(SlabTrapezoidIntegration, int);
259 
261 
263  vtkSetMacro(Optimization, int);
264  vtkGetMacro(Optimization, int);
265  vtkBooleanMacro(Optimization, int);
267 
269 
270  vtkSetVector4Macro(BackgroundColor, double);
271  vtkGetVector4Macro(BackgroundColor, double);
273 
275 
276  void SetBackgroundLevel(double v) { this->SetBackgroundColor(v,v,v,v); };
277  double GetBackgroundLevel() { return this->GetBackgroundColor()[0]; };
279 
281 
283  virtual void SetOutputSpacing(double x, double y, double z);
284  virtual void SetOutputSpacing(const double a[3]) {
285  this->SetOutputSpacing(a[0], a[1], a[2]); };
286  vtkGetVector3Macro(OutputSpacing, double);
287  void SetOutputSpacingToDefault();
289 
291 
293  virtual void SetOutputOrigin(double x, double y, double z);
294  virtual void SetOutputOrigin(const double a[3]) {
295  this->SetOutputOrigin(a[0], a[1], a[2]); };
296  vtkGetVector3Macro(OutputOrigin, double);
297  void SetOutputOriginToDefault();
299 
301 
303  virtual void SetOutputExtent(int a, int b, int c, int d, int e, int f);
304  virtual void SetOutputExtent(const int a[6]) {
305  this->SetOutputExtent(a[0], a[1], a[2], a[3], a[4], a[5]); };
306  vtkGetVector6Macro(OutputExtent, int);
307  void SetOutputExtentToDefault();
309 
311 
317  vtkSetMacro(OutputDimensionality, int);
318  vtkGetMacro(OutputDimensionality, int);
320 
323  unsigned long int GetMTime();
324 
326  virtual void ReportReferences(vtkGarbageCollector*);
327 
329 
334  void SetInterpolate(int t) {
335  if (t && !this->GetInterpolate()) {
336  this->SetInterpolationModeToLinear(); }
337  else if (!t && this->GetInterpolate()) {
338  this->SetInterpolationModeToNearestNeighbor(); } };
339  void InterpolateOn() {
340  this->SetInterpolate(1); };
341  void InterpolateOff() {
342  this->SetInterpolate(0); };
344  return (this->GetInterpolationMode() != VTK_RESLICE_NEAREST); };
346 
348 
351  void SetStencil(vtkImageStencilData *stencil);
352  vtkImageStencilData *GetStencil();
354 
356 
358  vtkSetMacro(GenerateStencilOutput, int);
359  vtkGetMacro(GenerateStencilOutput, int);
360  vtkBooleanMacro(GenerateStencilOutput, int);
362 
364 
366  return this->GetOutputPort(1); }
367  vtkImageStencilData *GetStencilOutput();
368  void SetStencilOutput(vtkImageStencilData *stencil);
370 
371 protected:
372  vtkImageReslice();
373  ~vtkImageReslice();
374 
376  double ResliceAxesDirectionCosines[9];
377  double ResliceAxesOrigin[3];
381  int Wrap;
382  int Mirror;
383  int Border;
386  int SlabMode;
389  double BackgroundColor[4];
390  double OutputOrigin[3];
391  double OutputSpacing[3];
392  int OutputExtent[6];
403 
406 
410 
413  virtual int ConvertScalarInfo(int &scalarType, int &numComponents);
414 
416 
422  virtual void ConvertScalars(void *inPtr, void *outPtr,
423  int inputType, int inputNumComponents,
424  int count, int idX, int idY, int idZ,
425  int threadId);
427 
428  void ConvertScalarsBase(void *inPtr, void *outPtr,
429  int inputType, int inputNumComponents,
430  int count, int idX, int idY, int idZ, int threadId) {
431  this->ConvertScalars(inPtr, outPtr, inputType, inputNumComponents,
432  count, idX, idY, idZ, threadId); }
433 
434  void GetAutoCroppedOutputBounds(vtkInformation *inInfo, double bounds[6]);
435  virtual void AllocateOutputData(vtkImageData *output, int *uExtent);
443  virtual void ThreadedRequestData(vtkInformation *request,
444  vtkInformationVector **inputVector,
445  vtkInformationVector *outputVector,
446  vtkImageData ***inData,
447  vtkImageData **outData, int ext[6], int id);
450 
451  vtkMatrix4x4 *GetIndexMatrix(vtkInformation *inInfo,
452  vtkInformation *outInfo);
454  return this->OptimizedTransform; };
455 
456 private:
457  vtkImageReslice(const vtkImageReslice&); // Not implemented.
458  void operator=(const vtkImageReslice&); // Not implemented.
459 };
460 
461 #endif