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 
61 #include "vtkImagingCoreModule.h" // For export macro
63 
64 // interpolation mode constants
65 #define VTK_RESLICE_NEAREST VTK_NEAREST_INTERPOLATION
66 #define VTK_RESLICE_LINEAR VTK_LINEAR_INTERPOLATION
67 #define VTK_RESLICE_CUBIC VTK_CUBIC_INTERPOLATION
68 
69 class vtkImageData;
71 class vtkMatrix4x4;
73 class vtkScalarsToColors;
75 
77 {
78 public:
79  static vtkImageReslice *New();
81 
82  virtual void PrintSelf(ostream& os, vtkIndent indent);
83 
85 
97  virtual void SetResliceAxes(vtkMatrix4x4*);
98  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
100 
102 
106  void SetResliceAxesDirectionCosines(double x0, double x1, double x2,
107  double y0, double y1, double y2,
108  double z0, double z1, double z2);
109  void SetResliceAxesDirectionCosines(const double x[3],
110  const double y[3],
111  const double z[3]) {
112  this->SetResliceAxesDirectionCosines(x[0], x[1], x[2],
113  y[0], y[1], y[2],
114  z[0], z[1], z[2]); };
115  void SetResliceAxesDirectionCosines(const double xyz[9]) {
116  this->SetResliceAxesDirectionCosines(xyz[0], xyz[1], xyz[2],
117  xyz[3], xyz[4], xyz[5],
118  xyz[6], xyz[7], xyz[8]); };
119  void GetResliceAxesDirectionCosines(double x[3], double y[3], double z[3]);
120  void GetResliceAxesDirectionCosines(double xyz[9]) {
121  this->GetResliceAxesDirectionCosines(&xyz[0], &xyz[3], &xyz[6]); };
123  this->GetResliceAxesDirectionCosines(this->ResliceAxesDirectionCosines);
124  return this->ResliceAxesDirectionCosines; };
126 
128 
131  void SetResliceAxesOrigin(double x, double y, double z);
132  void SetResliceAxesOrigin(const double xyz[3]) {
133  this->SetResliceAxesOrigin(xyz[0], xyz[1], xyz[2]); };
134  void GetResliceAxesOrigin(double xyz[3]);
136  this->GetResliceAxesOrigin(this->ResliceAxesOrigin);
137  return this->ResliceAxesOrigin; };
139 
141 
148  virtual void SetResliceTransform(vtkAbstractTransform*);
149  vtkGetObjectMacro(ResliceTransform, vtkAbstractTransform);
151 
153 
159  virtual void SetInformationInput(vtkImageData*);
160  vtkGetObjectMacro(InformationInput, vtkImageData);
162 
164 
168  vtkSetMacro(TransformInputSampling, int);
169  vtkBooleanMacro(TransformInputSampling, int);
170  vtkGetMacro(TransformInputSampling, int);
172 
174 
177  vtkSetMacro(AutoCropOutput, int);
178  vtkBooleanMacro(AutoCropOutput, int);
179  vtkGetMacro(AutoCropOutput, int);
181 
183 
184  vtkSetMacro(Wrap, int);
185  vtkGetMacro(Wrap, int);
186  vtkBooleanMacro(Wrap, int);
188 
190 
192  vtkSetMacro(Mirror, int);
193  vtkGetMacro(Mirror, int);
194  vtkBooleanMacro(Mirror, int);
196 
198 
205  vtkSetMacro(Border, int);
206  vtkGetMacro(Border, int);
207  vtkBooleanMacro(Border, int);
209 
211 
212  vtkSetClampMacro(InterpolationMode, int,
214  vtkGetMacro(InterpolationMode, int);
216  this->SetInterpolationMode(VTK_RESLICE_NEAREST); };
218  this->SetInterpolationMode(VTK_RESLICE_LINEAR); };
220  this->SetInterpolationMode(VTK_RESLICE_CUBIC); };
221  virtual const char *GetInterpolationModeAsString();
223 
225 
227  virtual void SetInterpolator(vtkAbstractImageInterpolator *sampler);
228  virtual vtkAbstractImageInterpolator *GetInterpolator();
230 
232 
236  vtkSetClampMacro(SlabMode, int, VTK_IMAGE_SLAB_MIN, VTK_IMAGE_SLAB_SUM);
237  vtkGetMacro(SlabMode, int);
239  this->SetSlabMode(VTK_IMAGE_SLAB_MIN); };
241  this->SetSlabMode(VTK_IMAGE_SLAB_MAX); };
243  this->SetSlabMode(VTK_IMAGE_SLAB_MEAN); };
245  this->SetSlabMode(VTK_IMAGE_SLAB_SUM); };
246  virtual const char *GetSlabModeAsString();
248 
250 
251  vtkSetMacro(SlabNumberOfSlices, int);
252  vtkGetMacro(SlabNumberOfSlices, int);
254 
256 
259  vtkSetMacro(SlabTrapezoidIntegration, int);
260  vtkBooleanMacro(SlabTrapezoidIntegration, int);
261  vtkGetMacro(SlabTrapezoidIntegration, int);
263 
265 
272  vtkSetMacro(SlabSliceSpacingFraction, double);
273  vtkGetMacro(SlabSliceSpacingFraction, double);
275 
277 
279  vtkSetMacro(Optimization, int);
280  vtkGetMacro(Optimization, int);
281  vtkBooleanMacro(Optimization, int);
283 
285 
290  vtkSetMacro(ScalarShift, double);
291  vtkGetMacro(ScalarShift, double);
293 
295 
300  vtkSetMacro(ScalarScale, double);
301  vtkGetMacro(ScalarScale, double)
303 
305 
313  vtkSetMacro(OutputScalarType, int);
314  vtkGetMacro(OutputScalarType, int);
316 
318 
319  vtkSetVector4Macro(BackgroundColor, double);
320  vtkGetVector4Macro(BackgroundColor, double);
322 
324 
325  void SetBackgroundLevel(double v) { this->SetBackgroundColor(v,v,v,v); };
326  double GetBackgroundLevel() { return this->GetBackgroundColor()[0]; };
328 
330 
332  virtual void SetOutputSpacing(double x, double y, double z);
333  virtual void SetOutputSpacing(const double a[3]) {
334  this->SetOutputSpacing(a[0], a[1], a[2]); };
335  vtkGetVector3Macro(OutputSpacing, double);
336  void SetOutputSpacingToDefault();
338 
340 
342  virtual void SetOutputOrigin(double x, double y, double z);
343  virtual void SetOutputOrigin(const double a[3]) {
344  this->SetOutputOrigin(a[0], a[1], a[2]); };
345  vtkGetVector3Macro(OutputOrigin, double);
346  void SetOutputOriginToDefault();
348 
350 
352  virtual void SetOutputExtent(int a, int b, int c, int d, int e, int f);
353  virtual void SetOutputExtent(const int a[6]) {
354  this->SetOutputExtent(a[0], a[1], a[2], a[3], a[4], a[5]); };
355  vtkGetVector6Macro(OutputExtent, int);
356  void SetOutputExtentToDefault();
358 
360 
366  vtkSetMacro(OutputDimensionality, int);
367  vtkGetMacro(OutputDimensionality, int);
369 
372  unsigned long int GetMTime();
373 
375  virtual void ReportReferences(vtkGarbageCollector*);
376 
378 
383  void SetInterpolate(int t) {
384  if (t && !this->GetInterpolate()) {
385  this->SetInterpolationModeToLinear(); }
386  else if (!t && this->GetInterpolate()) {
387  this->SetInterpolationModeToNearestNeighbor(); } };
388  void InterpolateOn() {
389  this->SetInterpolate(1); };
390  void InterpolateOff() {
391  this->SetInterpolate(0); };
393  return (this->GetInterpolationMode() != VTK_RESLICE_NEAREST); };
395 
397 
400  void SetStencilData(vtkImageStencilData *stencil);
401  vtkImageStencilData *GetStencil();
403 
405 
407  vtkSetMacro(GenerateStencilOutput, int);
408  vtkGetMacro(GenerateStencilOutput, int);
409  vtkBooleanMacro(GenerateStencilOutput, int);
411 
413 
415  return this->GetOutputPort(1); }
416  vtkImageStencilData *GetStencilOutput();
417  void SetStencilOutput(vtkImageStencilData *stencil);
419 
420 protected:
421  vtkImageReslice();
422  ~vtkImageReslice();
423 
425  double ResliceAxesDirectionCosines[9];
426  double ResliceAxesOrigin[3];
430  int Wrap;
431  int Mirror;
432  int Border;
435  int SlabMode;
439  double ScalarShift;
440  double ScalarScale;
441  double BackgroundColor[4];
442  double OutputOrigin[3];
443  double OutputSpacing[3];
444  int OutputExtent[6];
455 
458 
462 
465  virtual int ConvertScalarInfo(int &scalarType, int &numComponents);
466 
468 
474  virtual void ConvertScalars(void *inPtr, void *outPtr,
475  int inputType, int inputNumComponents,
476  int count, int idX, int idY, int idZ,
477  int threadId);
479 
480  void ConvertScalarsBase(void *inPtr, void *outPtr,
481  int inputType, int inputNumComponents,
482  int count, int idX, int idY, int idZ, int threadId) {
483  this->ConvertScalars(inPtr, outPtr, inputType, inputNumComponents,
484  count, idX, idY, idZ, threadId); }
485 
486  void GetAutoCroppedOutputBounds(vtkInformation *inInfo, double bounds[6]);
487  virtual void AllocateOutputData(vtkImageData *output, vtkInformation *outInfo, int *uExtent);
495  virtual void ThreadedRequestData(vtkInformation *request,
496  vtkInformationVector **inputVector,
497  vtkInformationVector *outputVector,
498  vtkImageData ***inData,
499  vtkImageData **outData, int ext[6], int id);
502 
503  vtkMatrix4x4 *GetIndexMatrix(vtkInformation *inInfo,
504  vtkInformation *outInfo);
506  return this->OptimizedTransform; };
507 
508 private:
509  vtkImageReslice(const vtkImageReslice&); // Not implemented.
510  void operator=(const vtkImageReslice&); // Not implemented.
511 };
512 
513 #endif
double * GetResliceAxesDirectionCosines()
interpolate data values from images
#define VTK_IMAGE_SLAB_MAX
#define VTK_RESLICE_NEAREST
vtkAlgorithmOutput * GetOutputPort()
Definition: vtkAlgorithm.h:373
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
#define VTK_IMAGE_SLAB_MIN
vtkAbstractTransform * GetOptimizedTransform()
#define VTK_RESLICE_CUBIC
Store vtkAlgorithm input/output information.
vtkMatrix4x4 * IndexMatrix
#define VTK_IMAGE_SLAB_SUM
#define VTK_IMAGE_SLAB_MEAN
void SetInterpolationModeToLinear()
void SetInterpolationModeToCubic()
vtkAlgorithmOutput * GetStencilOutputPort()
double * GetResliceAxesOrigin()
#define VTK_RESLICE_LINEAR
Detect and break reference loops.
void PrintSelf(ostream &os, vtkIndent indent)
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Proxy object to connect input/output ports.
virtual void AllocateOutputData(vtkImageData *out, vtkInformation *outInfo, int *uExtent)
Superclass for mapping scalar values to colors.
virtual void ReportReferences(vtkGarbageCollector *)
Generic filter that has one input..
virtual unsigned long GetMTime()
a simple class to control print indentation
Definition: vtkIndent.h:38
efficient description of an image stencil
void ConvertScalarsBase(void *inPtr, void *outPtr, int inputType, int inputNumComponents, int count, int idX, int idY, int idZ, int threadId)
vtkAbstractTransform * OptimizedTransform
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
superclass for all geometric transformations
virtual int FillOutputPortInformation(int port, vtkInformation *info)
#define VTKIMAGINGCORE_EXPORT
virtual int FillInputPortInformation(int port, vtkInformation *info)
virtual void ThreadedRequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector, vtkImageData ***inData, vtkImageData **outData, int extent[6], int threadId)
double GetBackgroundLevel()
virtual void SetOutputExtent(const int a[6])
vtkImageData * InformationInput
Reslices a volume along a new set of axes.
void SetResliceAxesDirectionCosines(const double x[3], const double y[3], const double z[3])
void SetInterpolate(int t)
vtkMatrix4x4 * ResliceAxes
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void GetResliceAxesDirectionCosines(double xyz[9])
void SetResliceAxesDirectionCosines(const double xyz[9])
virtual void SetOutputSpacing(const double a[3])
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
general representation of visualization data
Definition: vtkDataObject.h:64
void SetInterpolationModeToNearestNeighbor()
vtkAbstractImageInterpolator * Interpolator
virtual void SetOutputOrigin(const double a[3])
vtkAbstractTransform * ResliceTransform
double SlabSliceSpacingFraction
void SetResliceAxesOrigin(const double xyz[3])